问:
WSO2 Identity Server - dashboard timeout
I have a recent installation of wso2 Identity Server 5.7.0 with a Citrix Netscaler load balancer as a front end. Single Sign On is working well, but the Dashboard eventually times out and I get

"HTTP Status 500 - Internal Server Error."

Nothing is recorded in the log until the timeout is reached and then I receive

"java.net.SocketTimeoutException: connect timed out"

Not sure where to look next.

Screen shot of resulting UI message

Log Trace:

```==> wso2carbon.log <==
[2020-02-17 06:49:18,146]  WARN -  Could not lock System prefs. Unix error code 0. {java.util.prefs.FileSystemPreferences}
[2020-02-17 06:49:18,146]  WARN -  Couldn't flush system prefs: java.util.prefs.BackingStoreException: Couldn't get file lock. {java.util.prefs.FileSystemPreferences}
[2020-02-17 06:49:48,145]  WARN -  Could not lock System prefs. Unix error code 0. {java.util.prefs.FileSystemPreferences}
[2020-02-17 06:49:48,145]  WARN -  Couldn't flush system prefs: java.util.prefs.BackingStoreException: Couldn't get file lock. {java.util.prefs.FileSystemPreferences}
[2020-02-17 06:50:12,072]  INFO -  Unable to sendViaPost to url[https://xxxxxxxxxxxxx/services/SAML2SSOAuthenticationService] {org.apache.axis2.transport.http.HTTPSender}
java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:607)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
        at org.opensaml.ws.soap.client.http.TLSProtocolSocketFactory.createSocket(TLSProtocolSocketFactory.java:193)
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:704)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
        at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:81)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:459)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:286)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:554)
        at org.jaggeryjs.modules.ws.WSRequestHostObject.jsFunction_send(WSRequestHostObject.java:379)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
        at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_call_1(/dashboard/controllers/wsUtil.jag:27)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnXML_3(/dashboard/controllers/wsUtil.jag:67)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnJSON_4(/dashboard/controllers/wsUtil.jag:82)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1._c_login_1(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag:17)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1.call(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.dashboard.c6._c_script_0(/dashboard//acs.jag:67)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.jaggeryjs.rhino.dashboard.c6.exec(/dashboard//acs.jag)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)
        at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:743)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
        at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:126)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:695)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:80)
        at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:100)
        at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:65)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
        at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
        at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
        at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
        at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1734)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
[2020-02-17 06:50:12,076] ERROR -  org.mozilla.javascript.WrappedException: Wrapped org.jaggeryjs.scriptengine.exceptions.ScriptException: connect timed out (/dashboard/controllers/wsUtil.jag#27)
        at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)
        at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_call_1(/dashboard/controllers/wsUtil.jag:27)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnXML_3(/dashboard/controllers/wsUtil.jag:67)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnJSON_4(/dashboard/controllers/wsUtil.jag:82)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1._c_login_1(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag:17)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1.call(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.dashboard.c6._c_script_0(/dashboard//acs.jag:67)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.jaggeryjs.rhino.dashboard.c6.exec(/dashboard//acs.jag)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)
        at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:743)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
        at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:126)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:695)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:80)
        at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:100)
        at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:65)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
        at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
        at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
        at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
        at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1734)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.jaggeryjs.scriptengine.exceptions.ScriptException: connect timed out
        at org.jaggeryjs.modules.ws.WSRequestHostObject.jsFunction_send(WSRequestHostObject.java:404)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
        ... 70 more
Caused by: org.apache.axis2.AxisFault: connect timed out
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:203)
        at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:81)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:459)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:286)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:554)
        at org.jaggeryjs.modules.ws.WSRequestHostObject.jsFunction_send(WSRequestHostObject.java:379)
        ... 75 more
Caused by: java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:607)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
        at org.opensaml.ws.soap.client.http.TLSProtocolSocketFactory.createSocket(TLSProtocolSocketFactory.java:193)
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:704)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
        ... 84 more
 {JAGGERY.acs:jag}
[2020-02-17 06:50:12,077] ERROR -  org.mozilla.javascript.JavaScriptException: JavaException: org.jaggeryjs.scriptengine.exceptions.ScriptException: connect timed out (/dashboard/controllers/wsUtil.jag#76) {org.jaggeryjs.jaggery.core.manager.WebAppManager}
org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.JavaScriptException: JavaException: org.jaggeryjs.scriptengine.exceptions.ScriptException: connect timed out (/dashboard/controllers/wsUtil.jag#76)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:571)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)
        at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:743)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
        at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:126)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:695)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:80)
        at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:100)
        at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:65)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
        at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
        at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
        at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
        at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1734)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.mozilla.javascript.JavaScriptException: JavaException: org.jaggeryjs.scriptengine.exceptions.ScriptException: connect timed out (/dashboard/controllers/wsUtil.jag#76)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnXML_3(/dashboard/controllers/wsUtil.jag:76)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnJSON_4(/dashboard/controllers/wsUtil.jag:82)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1._c_login_1(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag:17)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1.call(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.dashboard.c6._c_script_0(/dashboard//acs.jag:67)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.jaggeryjs.rhino.dashboard.c6.exec(/dashboard//acs.jag)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
        ... 49 more

==> http_access_2020-02-17.log <==
10.91.0.12 - - [17/Feb/2020:06:50:12 -0600] "POST /dashboard/acs HTTP/1.1" 500 786 "https://xxxxxxxxxxxxx/samlsso" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0"

==> localhost_access_log2020-02-17.log <==
Mon 2/17/2020 @ 06:50:12.81 AM CST 10.91.0.12 (-) > 10.91.0.2:443 "POST /dashboard/acs HTTP/1.1" - 60086 500 786 http-nio-9443-exec-34 "https://xxxxxxxxxxxxx/samlsso" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" - - -
```

答: Problem is related to the wso2is server residing behind a load balancer and a firewall block. The wso2is server (private IP) is making a call to it's public name (public IP), but needed a firewall rule allowance to do so. Once a rule was added, the dashboard works successfully.</p>

Body:
I have a recent installation of wso2 Identity Server 5.7.0 with a Citrix Netscaler load balancer as a front end. Single Sign On is working well, but the Dashboard eventually times out and I get

"HTTP Status 500 - Internal Server Error."

Nothing is recorded in the log until the timeout is reached and then I receive

"java.net.SocketTimeoutException: connect timed out"

Not sure where to look next.

Screen shot of resulting UI message

Log Trace:

==> wso2carbon.log <==
[2020-02-17 06:49:18,146]  WARN -  Could not lock System prefs. Unix error code 0. {java.util.prefs.FileSystemPreferences}
[2020-02-17 06:49:18,146]  WARN -  Couldn't flush system prefs: java.util.prefs.BackingStoreException: Couldn't get file lock. {java.util.prefs.FileSystemPreferences}
[2020-02-17 06:49:48,145]  WARN -  Could not lock System prefs. Unix error code 0. {java.util.prefs.FileSystemPreferences}
[2020-02-17 06:49:48,145]  WARN -  Couldn't flush system prefs: java.util.prefs.BackingStoreException: Couldn't get file lock. {java.util.prefs.FileSystemPreferences}
[2020-02-17 06:50:12,072]  INFO -  Unable to sendViaPost to url[https://xxxxxxxxxxxxx/services/SAML2SSOAuthenticationService] {org.apache.axis2.transport.http.HTTPSender}
java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:607)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
        at org.opensaml.ws.soap.client.http.TLSProtocolSocketFactory.createSocket(TLSProtocolSocketFactory.java:193)
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:704)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
        at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:81)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:459)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:286)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:554)
        at org.jaggeryjs.modules.ws.WSRequestHostObject.jsFunction_send(WSRequestHostObject.java:379)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
        at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_call_1(/dashboard/controllers/wsUtil.jag:27)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnXML_3(/dashboard/controllers/wsUtil.jag:67)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnJSON_4(/dashboard/controllers/wsUtil.jag:82)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1._c_login_1(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag:17)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1.call(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.dashboard.c6._c_script_0(/dashboard//acs.jag:67)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.jaggeryjs.rhino.dashboard.c6.exec(/dashboard//acs.jag)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)
        at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:743)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
        at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:126)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:695)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:80)
        at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:100)
        at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:65)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
        at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
        at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
        at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
        at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1734)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
[2020-02-17 06:50:12,076] ERROR -  org.mozilla.javascript.WrappedException: Wrapped org.jaggeryjs.scriptengine.exceptions.ScriptException: connect timed out (/dashboard/controllers/wsUtil.jag#27)
        at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)
        at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_call_1(/dashboard/controllers/wsUtil.jag:27)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnXML_3(/dashboard/controllers/wsUtil.jag:67)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnJSON_4(/dashboard/controllers/wsUtil.jag:82)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1._c_login_1(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag:17)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1.call(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.dashboard.c6._c_script_0(/dashboard//acs.jag:67)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.jaggeryjs.rhino.dashboard.c6.exec(/dashboard//acs.jag)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)
        at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:743)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
        at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:126)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:695)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:80)
        at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:100)
        at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:65)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
        at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
        at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
        at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
        at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1734)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.jaggeryjs.scriptengine.exceptions.ScriptException: connect timed out
        at org.jaggeryjs.modules.ws.WSRequestHostObject.jsFunction_send(WSRequestHostObject.java:404)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
        ... 70 more
Caused by: org.apache.axis2.AxisFault: connect timed out
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:203)
        at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:81)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:459)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:286)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:554)
        at org.jaggeryjs.modules.ws.WSRequestHostObject.jsFunction_send(WSRequestHostObject.java:379)
        ... 75 more
Caused by: java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:607)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
        at org.opensaml.ws.soap.client.http.TLSProtocolSocketFactory.createSocket(TLSProtocolSocketFactory.java:193)
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:704)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
        ... 84 more
 {JAGGERY.acs:jag}
[2020-02-17 06:50:12,077] ERROR -  org.mozilla.javascript.JavaScriptException: JavaException: org.jaggeryjs.scriptengine.exceptions.ScriptException: connect timed out (/dashboard/controllers/wsUtil.jag#76) {org.jaggeryjs.jaggery.core.manager.WebAppManager}
org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.JavaScriptException: JavaException: org.jaggeryjs.scriptengine.exceptions.ScriptException: connect timed out (/dashboard/controllers/wsUtil.jag#76)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:571)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)
        at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:743)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
        at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:126)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:695)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:80)
        at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:100)
        at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:65)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
        at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
        at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
        at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
        at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1734)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.mozilla.javascript.JavaScriptException: JavaException: org.jaggeryjs.scriptengine.exceptions.ScriptException: connect timed out (/dashboard/controllers/wsUtil.jag#76)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnXML_3(/dashboard/controllers/wsUtil.jag:76)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.c0._c_callWSReturnJSON_4(/dashboard/controllers/wsUtil.jag:82)
        at org.jaggeryjs.rhino.dashboard.controllers.c0.call(/dashboard/controllers/wsUtil.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1._c_login_1(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag:17)
        at org.jaggeryjs.rhino.dashboard.controllers.login_logout.c1.call(/dashboard/controllers/login-logout/SAML2SSOAuthenticationClient.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.dashboard.c6._c_script_0(/dashboard//acs.jag:67)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
        at org.jaggeryjs.rhino.dashboard.c6.call(/dashboard//acs.jag)
        at org.jaggeryjs.rhino.dashboard.c6.exec(/dashboard//acs.jag)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
        ... 49 more

==> http_access_2020-02-17.log <==
10.91.0.12 - - [17/Feb/2020:06:50:12 -0600] "POST /dashboard/acs HTTP/1.1" 500 786 "https://xxxxxxxxxxxxx/samlsso" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0"

==> localhost_access_log2020-02-17.log <==
Mon 2/17/2020 @ 06:50:12.81 AM CST 10.91.0.12 (-) > 10.91.0.2:443 "POST /dashboard/acs HTTP/1.1" - 60086 500 786 http-nio-9443-exec-34 "https://xxxxxxxxxxxxx/samlsso" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" - - -


来源: stackexchange

问:
Await Task.Delay(x) changing UI or completing instantly
I am trying to change the image of a PictureBox for a few seconds and then change it back whilst keeping the UI thread unblocked and the UI responsive.

I was previously using Threading.Thread.Sleep(x) to show the new image and then change it back but that stops any user input to the application for the entire length of the sleep.

I then found out about creating a Wait on a Task that is completed Asynchronously and after reading up on it, put together the below:

Private Async Sub PictureBox_Click(sender As Object, e As EventArgs) Handles PictureBox.Click
    saveList(listName)

    PictureBox.Image = My.Resources.Temp_Image
    Await Task.Delay(5000)
    PictureBox.Image = My.Resources.Normal_Image
End Sub
```

<p>The problem is, it appears that the task completes almost instantly rather than waiting the 5 seconds as expected. After breaking and debugging the code, it seems to change the image correctly to "Temp_Image" and as soon as it hits the <code>Await Task.Delay(5000)</code> line, it changes the image back to the "Normal_Image" instantly.</p>

<p>Is there a better way to complete these "animations" on the UI thread without blocking it, or am I using this <code>Async Task.Delay()</code> incorrectly?</p>

<p><strong>EDIT:</strong> Ah, I've stumbled across the issue. The MouseUp and MouseLeave Events are firing and cancelling the visual change (presumably as this is asynchronous, so it returns to processing tasks/events) - is there a way to disable these events when waiting on an Async task?</p>

<pre class="lang-vb prettyprint-override"><code>    Private Sub PictureBox_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox.MouseLeave
        PictureBox.Image = My.Resources.Normal_Image
    End Sub
    Private Sub PictureBox_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox.MouseUp
        PictureBox.Image = My.Resources.Normal_Image
    End Sub
</code>```

答:
You should use a flag to signal not to change the image while waiting

Private flag As Boolean = False

Private Async Sub PictureBox_Click(sender As Object, e As EventArgs) Handles PictureBox.Click
    flag = True
    PictureBox.Image = My.Resources.Temp_Image
    Await Task.Delay(1000)
    PictureBox.Image = My.Resources.Normal_Image
    flag = False
End Sub

Private Sub PictureBox_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox.MouseLeave
    If Not flag Then PictureBox.Image = My.Resources.Normal_Image
End Sub
```

The mouse must remain in the PictureBox for the entirety of the click. I mean the mouse down and up. So if you press, move away, then release, only the MouseLeave event will occur. You may consider using MouseDown or MouseUp, depending on your desired behavior, or leave it as-is if this is acceptable.

ContentLicense: CC BY-SA 4.0

Body:
I am trying to change the image of a PictureBox for a few seconds and then change it back whilst keeping the UI thread unblocked and the UI responsive.

I was previously using Threading.Thread.Sleep(x) to show the new image and then change it back but that stops any user input to the application for the entire length of the sleep.

I then found out about creating a Wait on a Task that is completed Asynchronously and after reading up on it, put together the below:

Private Async Sub PictureBox_Click(sender As Object, e As EventArgs) Handles PictureBox.Click
    saveList(listName)

    PictureBox.Image = My.Resources.Temp_Image
    Await Task.Delay(5000)
    PictureBox.Image = My.Resources.Normal_Image
End Sub

The problem is, it appears that the task completes almost instantly rather than waiting the 5 seconds as expected. After breaking and debugging the code, it seems to change the image correctly to "Temp_Image" and as soon as it hits the Await Task.Delay(5000) line, it changes the image back to the "Normal_Image" instantly.

Is there a better way to complete these "animations" on the UI thread without blocking it, or am I using this Async Task.Delay() incorrectly?

EDIT: Ah, I've stumbled across the issue. The MouseUp and MouseLeave Events are firing and cancelling the visual change (presumably as this is asynchronous, so it returns to processing tasks/events) - is there a way to disable these events when waiting on an Async task?

    Private Sub PictureBox_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox.MouseLeave
        PictureBox.Image = My.Resources.Normal_Image
    End Sub
    Private Sub PictureBox_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox.MouseUp
        PictureBox.Image = My.Resources.Normal_Image
    End Sub

Body:
You should use a flag to signal not to change the image while waiting

Private flag As Boolean = False

Private Async Sub PictureBox_Click(sender As Object, e As EventArgs) Handles PictureBox.Click
    flag = True
    PictureBox.Image = My.Resources.Temp_Image
    Await Task.Delay(1000)
    PictureBox.Image = My.Resources.Normal_Image
    flag = False
End Sub

Private Sub PictureBox_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox.MouseLeave
    If Not flag Then PictureBox.Image = My.Resources.Normal_Image
End Sub

The mouse must remain in the PictureBox for the entirety of the click. I mean the mouse down and up. So if you press, move away, then release, only the MouseLeave event will occur. You may consider using MouseDown or MouseUp, depending on your desired behavior, or leave it as-is if this is acceptable.


问:
How to describe math formula by using xsd?
i"m trying to validate if an xml element is a multiply of 5 by using xsd. does any 1 have an idea how to do it ?

Thanks,

Itay

答:
I'm pretty sure you can't use general formula for validation. But in your specific case you can use a pattern match to match multiples of 5 </p>

```<code><xs:element name="myelement">
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]*[05]{1}"></xs:pattern>
    </xs:restriction>
  </xs:simpleType>
</xs:element>
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I'm pretty sure you can't use general formula for validation. But in your specific case you can use a pattern match to match multiples of 5

<xs:element name="myelement">
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]*[05]{1}"></xs:pattern>
    </xs:restriction>
  </xs:simpleType>
</xs:element>


问:
Regexp to search for phrase containing other phrase and don't mark anything other
Similar topics appear here quite frequently but even analyzing them i still can't figure the proper regexp to do my task. I have an XML file with some sections. I need to remove text sections which contain given attributes and leave the everything else.

The example text section:

```<code><Text FontFamily="Open Sans" FontSize="19" FontStyle="Normal"
    FontWeight="Normal" HorizontalAlign="Left" Left="803.0"
    Name="Back" Stroke="#CCCCCC" TextDecoration="None"
    Top="126.0" Visibility="Hidden">
... More content here ...
</Text>
</code>```

I need to find and remove only the ones containing Name="Back". There are different Name attributes in other text sections or there are sections without Name at all (not named). Sections are multilined.

The simplest regexp is:

```<code>(?s)<Text (.*?)Name="Back"(.*?)</Text>
</code>```

and also an improper one. If Name="Back" appears then regexp marks the proper part. But if this special phrase is not there, then it starts from
<Text> then marks many other text or not text sections until it finds
</Text> followed by Name="Back" which can be at end of file. So it marks almost the whole file, many texts and not text sections.

There is no point in showing my other regexp trials I tried to create based on other people's regexp solutions. The final regexp marks nothing or marks too much.

I will be grateful for help.

By the way, how do I escape < here? < plus Text won't appear in text, only in the code segment.

答:
You're close, try this:

```<code>(?s)<Text[^>]*? Name="Back".*?>.*?<\/Text>
</code>```

See the demo at https://regex101.com/r/Dmyq59/1

^ I know it's not Notepad++ but they're both PCRE

If you paste your regex into my regex101 example then it will visualize the problem for you which is Text (.*?)Name="Back" because (.*?) will continue capturing EVERYTHING until it reaches a tag which does contain Name="Back"

You should strongly consider installing the XPatherizerNPP plugin so that you can use XPath. The equivalent XPath would have been //text[@name='Back']

Body:
Similar topics appear here quite frequently but even analyzing them i still can't figure the proper regexp to do my task. I have an XML file with some sections. I need to remove text sections which contain given attributes and leave the everything else.

The example text section:

<Text FontFamily="Open Sans" FontSize="19" FontStyle="Normal"
    FontWeight="Normal" HorizontalAlign="Left" Left="803.0"
    Name="Back" Stroke="#CCCCCC" TextDecoration="None"
    Top="126.0" Visibility="Hidden">
... More content here ...
</Text>

I need to find and remove only the ones containing Name="Back". There are different Name attributes in other text sections or there are sections without Name at all (not named). Sections are multilined.

The simplest regexp is:

(?s)<Text (.*?)Name="Back"(.*?)</Text>

and also an improper one. If Name="Back" appears then regexp marks the proper part. But if this special phrase is not there, then it starts from
<Text> then marks many other text or not text sections until it finds
</Text> followed by Name="Back" which can be at end of file. So it marks almost the whole file, many texts and not text sections.

There is no point in showing my other regexp trials I tried to create based on other people's regexp solutions. The final regexp marks nothing or marks too much.

I will be grateful for help.

By the way, how do I escape < here? < plus Text won't appear in text, only in the code segment.

Body:
You're close, try this:

(?s)<Text[^>]*? Name="Back".*?>.*?<\/Text>

See the demo at https://regex101.com/r/Dmyq59/1

^ I know it's not Notepad++ but they're both PCRE

If you paste your regex into my regex101 example then it will visualize the problem for you which is Text (.*?)Name="Back" because (.*?) will continue capturing EVERYTHING until it reaches a tag which does contain Name="Back"

You should strongly consider installing the XPatherizerNPP plugin so that you can use XPath. The equivalent XPath would have been //text[@name='Back']


问:
Not able to use MAVEN command
I don't know what's the problem but I am not able to use a maven for my projects.

This is the output of the command that means all the setup for maven is done properly but dont know why performing tasks is leading to a BUILD FAILURE.

mvn.cmd

mvn clean

答: You are in your main user folder vipul. The clean command is project specific, you need to be in the project path, a project which is configured for maven (has pom.xml file)

Title: Not able to use MAVEN command


答: The error says you don't have a pom.xml file, which means you're running the command in the wrong directory or you haven't got the project set up. This quick Maven overview guide will help you set up a project if you haven't already.

Title: Not able to use MAVEN command

Body:
I don't know what's the problem but I am not able to use a maven for my projects.

This is the output of the command that means all the setup for maven is done properly but dont know why performing tasks is leading to a BUILD FAILURE.

mvn.cmd

mvn clean


问:
Insert data into databricks delta table with past timestamp
I am exploring DataBricks Delta table and its time travel / temporal feature. I have some events data that happened in the past. I am trying to insert them into delta table and be able to time travel using the timestamp in the data and not the actual insert time.

I have a date/time column in my event. I renamed it to "timestamp" but it still didn't work.

My csv data looks like this: (Data shows 5 updates that happened to a single case with id=1000)

```<code>account_id,id,case_id,case_status,owner,department,priority,created_at,timestamp
2114809,1000,ABC-121,1,200,300,1,2020-01-01T08:00:00.000000-07:00,2020-01-01T08:00:00.000000-07:00
2114809,1000,ABC-121,2,200,300,3,2020-01-01T08:00:00.000000-07:00,2020-01-01T09:00:00.000000-07:00
2114809,1000,ABC-121,3,200,300,3,2020-01-01T08:00:00.000000-07:00,2020-01-03T13:00:00.000000-07:00
2114809,1000,ABC-121,3,201,300,3,2020-01-01T08:00:00.000000-07:00,2020-01-12T14:00:00.000000-07:00
2114809,1000,ABC-121,4,201,300,3,2020-01-01T08:00:00.000000-07:00,2020-01-13T10:00:00.000000-07:00
</code>```

I used these commands to create the delta table:

```<code>DROP TABLE IF EXISTS cases;
DROP TABLE IF EXISTS temp_cases;

CREATE TABLE temp_cases
USING csv
OPTIONS (path "/FileStore/tables/cases/test_cases.csv", header "true", inferSchema "true");

CREATE TABLE cases
USING delta
AS SELECT * FROM temp_cases;

DROP TABLE IF EXISTS temp_cases;
</code>```

I have 2 questions:

How can I do a data migration into delta table and still keep the timestamp from the data and not the inserted timestamp to perform time travel?

How can I specify a primary key or a composite primary key when creating a delta table.

答:
There might be a minor misunderstanding of the use case of time travel. Time Travel is a feature for giving users access to the different versions/snapshots of the Delta table. You cannot specify a timestamp attribute as a time travel index of sorts.

Each operation (merge, insert, delete, etc) on the Delta table creates a new version of the table with associated timestamp and metadata of that change. You can then time travel to the different versions of your data.

Here is a link to some helpful documentation.

https://docs.delta.io/latest/delta-batch.html#query-an-older-snapshot-of-a-table-time-travel

For the second question

How can I specify a primary key or a composite primary key when creating a delta table.

Primary keys are not a metadata component within a Delta Table. There is no definition within Delta Lake known as a primary key outside of Merge operations. The only time a unique key is required is during the runtime of a Merge operation.

Some more helpful documentation. Make not of the important note block in this section

https://docs.delta.io/latest/delta-update.html#upsert-into-a-table-using-merge

Body:
I am exploring DataBricks Delta table and its time travel / temporal feature. I have some events data that happened in the past. I am trying to insert them into delta table and be able to time travel using the timestamp in the data and not the actual insert time.

I have a date/time column in my event. I renamed it to "timestamp" but it still didn't work.

My csv data looks like this: (Data shows 5 updates that happened to a single case with id=1000)

account_id,id,case_id,case_status,owner,department,priority,created_at,timestamp
2114809,1000,ABC-121,1,200,300,1,2020-01-01T08:00:00.000000-07:00,2020-01-01T08:00:00.000000-07:00
2114809,1000,ABC-121,2,200,300,3,2020-01-01T08:00:00.000000-07:00,2020-01-01T09:00:00.000000-07:00
2114809,1000,ABC-121,3,200,300,3,2020-01-01T08:00:00.000000-07:00,2020-01-03T13:00:00.000000-07:00
2114809,1000,ABC-121,3,201,300,3,2020-01-01T08:00:00.000000-07:00,2020-01-12T14:00:00.000000-07:00
2114809,1000,ABC-121,4,201,300,3,2020-01-01T08:00:00.000000-07:00,2020-01-13T10:00:00.000000-07:00

I used these commands to create the delta table:

DROP TABLE IF EXISTS cases;
DROP TABLE IF EXISTS temp_cases;

CREATE TABLE temp_cases
USING csv
OPTIONS (path "/FileStore/tables/cases/test_cases.csv", header "true", inferSchema "true");

CREATE TABLE cases
USING delta
AS SELECT * FROM temp_cases;

DROP TABLE IF EXISTS temp_cases;

I have 2 questions:

How can I do a data migration into delta table and still keep the timestamp from the data and not the inserted timestamp to perform time travel?

How can I specify a primary key or a composite primary key when creating a delta table.


问:
Mount vfat image win linux using C
I'm trying to mount a vfat disk image from DOS, using .C

```<code>if( mount( "/mypath/disk.img", "/mypath/img/", "vfat", MS_DIRSYNC | MS_SYNCHRONOUS, "utf8" ) ) {
  printf( "Error mount %s errno=%d %s\n", dst.c_str(), errno, strerror( errno ) );
}
</code>```

I get all the times the error "Block device required". Should i add some parameter or flag?

Note:I can mount from the bash the same file in the same target without any error.

UPDATE:
I had some good result using the function to mount an ISO. When I run the program, it remains stacked on the call ioctl(loop_device_fd, LOOP_CLR_FD, 0);. When I exit from the program (ctrl-c), the image is mounted. Is  LOOP_CLR_FD necessary to complete all the steps? In additional,it is mounted in read only and seems not possible to change it in read/write.

```<code>const auto loop_control = std::fopen( "/dev/loop-control", "r" );
const auto loop_control_fd = fileno(loop_control);
const auto devnr = ioctl(loop_control_fd, LOOP_CTL_GET_FREE);
std::stringstream loopname;
loopname << "/dev/loop" << devnr;
const auto loop_device_name = loopname.str();
const auto loop_device = std::fopen(loop_device_name.c_str(), "r");
const auto loop_device_fd = fileno(loop_device);
const auto image = std::fopen( dst.c_str(), "r" );
const auto image_fd = fileno(image);
//Associate the loop device with the open file whose file descriptor is passed as the (third) ioctl(2) argument.
ioctl(loop_device_fd, LOOP_SET_FD, image_fd);
const auto result = mount(loop_device_name.c_str(), dst_path_img.c_str(), "vfat", MS_RDONLY, NULL);
if( result ) {
printf( "Error mount %s errno=%d %s\n", dst.c_str(), errno, strerror( errno ) );
return;
}
ioctl(loop_device_fd, LOOP_CLR_FD, 0);
</code>```

答:
As the disk image is not really a device, it cannot be directly mounted.
What you are trying to do, is to mount via a loop device.
Command line equivalent is: mount /mypath/disk.img /mypath/img -t vfat -o loop

I'm not sure, but try whether adding the "loop, utf8" as your last parameter would fix the problem.

Title: Mount vfat image win linux using C

Body:
I'm trying to mount a vfat disk image from DOS, using .C

if( mount( "/mypath/disk.img", "/mypath/img/", "vfat", MS_DIRSYNC | MS_SYNCHRONOUS, "utf8" ) ) {
  printf( "Error mount %s errno=%d %s\n", dst.c_str(), errno, strerror( errno ) );
}

I get all the times the error "Block device required". Should i add some parameter or flag?

Note:I can mount from the bash the same file in the same target without any error.

UPDATE:
I had some good result using the function to mount an ISO. When I run the program, it remains stacked on the call ioctl(loop_device_fd, LOOP_CLR_FD, 0);. When I exit from the program (ctrl-c), the image is mounted. Is  LOOP_CLR_FD necessary to complete all the steps? In additional,it is mounted in read only and seems not possible to change it in read/write.

const auto loop_control = std::fopen( "/dev/loop-control", "r" );
const auto loop_control_fd = fileno(loop_control);
const auto devnr = ioctl(loop_control_fd, LOOP_CTL_GET_FREE);
std::stringstream loopname;
loopname << "/dev/loop" << devnr;
const auto loop_device_name = loopname.str();
const auto loop_device = std::fopen(loop_device_name.c_str(), "r");
const auto loop_device_fd = fileno(loop_device);
const auto image = std::fopen( dst.c_str(), "r" );
const auto image_fd = fileno(image);
//Associate the loop device with the open file whose file descriptor is passed as the (third) ioctl(2) argument.
ioctl(loop_device_fd, LOOP_SET_FD, image_fd);
const auto result = mount(loop_device_name.c_str(), dst_path_img.c_str(), "vfat", MS_RDONLY, NULL);
if( result ) {
printf( "Error mount %s errno=%d %s\n", dst.c_str(), errno, strerror( errno ) );
return;
}
ioctl(loop_device_fd, LOOP_CLR_FD, 0);


问:
PHP: How to get referrer URL?
I have a page (index.php) where customers can send me emails. Now I want to see from what website that visitor is coming from.

How can I get the Referrer URL with PHP? I tried with
$_SERVER['HTTP_REFERER'] but it's empty all the time. What variable do I need to consider?

Here is what my $_SERVER contains; I put some ---- CENSORED ---- for privacy concerns, there are actually real values.

```<code>array(31) {
  ["DOCUMENT_ROOT"]=>
  string(33) "/home/anything/public_html/design"
  ["GATEWAY_INTERFACE"]=>
  string(7) "CGI/1.1"
  ["HTTP_ACCEPT"]=>
  string(129) "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1"
  ["HTTP_ACCEPT_ENCODING"]=>
  string(13) "gzip, deflate"
  ["HTTP_ACCEPT_LANGUAGE"]=>
  string(14) "en-US,en;q=0.9"
  ["HTTP_CACHE_CONTROL"]=>
  string(8) "no-cache"
  ["HTTP_CONNECTION"]=>
  string(10) "Keep-Alive"
  ["HTTP_COOKIE"]=>
  string(189) "__utma=76630272.1468291432.1367655794.1367669576.1367674157.3; __utmb=76630272.1.10.1367674157; __utmc=76630272; __utmz=76630272.1367655794.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)"
  ["HTTP_HOST"]=>
  string(25) " ---- CENSORED ---- "
  ["HTTP_USER_AGENT"]=>
  string(57) "Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.15"
  ["PATH"]=>
  string(13) "/bin:/usr/bin"
  ["QUERY_STRING"]=>
  string(0) ""
  ["REDIRECT_STATUS"]=>
  string(3) "200"
  ["REMOTE_ADDR"]=>
  string(10) "5.15.68.79"
  ["REMOTE_PORT"]=>
  string(5) "57897"
  ["REQUEST_METHOD"]=>
  string(3) "GET"
  ["REQUEST_URI"]=>
  string(12) "/referer.php"
  ["SCRIPT_FILENAME"]=>
  string(45) "/home/anything/public_html/design/referer.php"
  ["SCRIPT_NAME"]=>
  string(12) "/referer.php"
  ["SERVER_ADDR"]=>
  string(13) " ---- CENSORED ---- "
  ["SERVER_ADMIN"]=>
  string(35) " ---- CENSORED ---- "
  ["SERVER_NAME"]=>
  string(25) " ---- CENSORED ---- "
  ["SERVER_PORT"]=>
  string(2) "80"
  ["SERVER_PROTOCOL"]=>
  string(8) "HTTP/1.1"
  ["SERVER_SIGNATURE"]=>
  string(189) "
Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at ---- CENSORED ---- Port 80

"
  ["SERVER_SOFTWARE"]=>
  string(125) "Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635"
  ["UNIQUE_ID"]=>
  string(24) "UYUNcUPeiDsAABkR2eYAAAAj"
  ["PHP_SELF"]=>
  string(12) "/referer.php"
  ["REQUEST_TIME"]=>
  int(1367674225)
  ["argv"]=>
  array(0) {
  }
  ["argc"]=>
  int(0)
}
</code>```

答:
```<code>$_SERVER['HTTP_REFERER'];
</code>```

But if you run a file (that contains the above code) by directly hitting the URL in the browser then you get the following error.

Notice: Undefined index: HTTP_REFERER

Title: PHP: How to get referrer URL?

Body:
I have a page (index.php) where customers can send me emails. Now I want to see from what website that visitor is coming from.

How can I get the Referrer URL with PHP? I tried with
$_SERVER['HTTP_REFERER'] but it's empty all the time. What variable do I need to consider?

Here is what my $_SERVER contains; I put some ---- CENSORED ---- for privacy concerns, there are actually real values.

array(31) {
  ["DOCUMENT_ROOT"]=>
  string(33) "/home/anything/public_html/design"
  ["GATEWAY_INTERFACE"]=>
  string(7) "CGI/1.1"
  ["HTTP_ACCEPT"]=>
  string(129) "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1"
  ["HTTP_ACCEPT_ENCODING"]=>
  string(13) "gzip, deflate"
  ["HTTP_ACCEPT_LANGUAGE"]=>
  string(14) "en-US,en;q=0.9"
  ["HTTP_CACHE_CONTROL"]=>
  string(8) "no-cache"
  ["HTTP_CONNECTION"]=>
  string(10) "Keep-Alive"
  ["HTTP_COOKIE"]=>
  string(189) "__utma=76630272.1468291432.1367655794.1367669576.1367674157.3; __utmb=76630272.1.10.1367674157; __utmc=76630272; __utmz=76630272.1367655794.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)"
  ["HTTP_HOST"]=>
  string(25) " ---- CENSORED ---- "
  ["HTTP_USER_AGENT"]=>
  string(57) "Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.15"
  ["PATH"]=>
  string(13) "/bin:/usr/bin"
  ["QUERY_STRING"]=>
  string(0) ""
  ["REDIRECT_STATUS"]=>
  string(3) "200"
  ["REMOTE_ADDR"]=>
  string(10) "5.15.68.79"
  ["REMOTE_PORT"]=>
  string(5) "57897"
  ["REQUEST_METHOD"]=>
  string(3) "GET"
  ["REQUEST_URI"]=>
  string(12) "/referer.php"
  ["SCRIPT_FILENAME"]=>
  string(45) "/home/anything/public_html/design/referer.php"
  ["SCRIPT_NAME"]=>
  string(12) "/referer.php"
  ["SERVER_ADDR"]=>
  string(13) " ---- CENSORED ---- "
  ["SERVER_ADMIN"]=>
  string(35) " ---- CENSORED ---- "
  ["SERVER_NAME"]=>
  string(25) " ---- CENSORED ---- "
  ["SERVER_PORT"]=>
  string(2) "80"
  ["SERVER_PROTOCOL"]=>
  string(8) "HTTP/1.1"
  ["SERVER_SIGNATURE"]=>
  string(189) "
Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at ---- CENSORED ---- Port 80

"
  ["SERVER_SOFTWARE"]=>
  string(125) "Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635"
  ["UNIQUE_ID"]=>
  string(24) "UYUNcUPeiDsAABkR2eYAAAAj"
  ["PHP_SELF"]=>
  string(12) "/referer.php"
  ["REQUEST_TIME"]=>
  int(1367674225)
  ["argv"]=>
  array(0) {
  }
  ["argc"]=>
  int(0)
}

Body:
$_SERVER['HTTP_REFERER'];

But if you run a file (that contains the above code) by directly hitting the URL in the browser then you get the following error.

Notice: Undefined index: HTTP_REFERER


问:
Using Primary Key / ID Field as an identifier in a URL
What are the pros and cons of using your databases primary key as a URL identifier?  As an example, http://localhost/post/view/13 - 13 being my primary key for my posts table.

Some sites like reddit use what I assume is a unique id that is not the primary key but still unique to help identify the link:

```http://www.reddit.com/r/funny/comments/7ynin/the_mystery_of_irelands_worst_driver/```

You can change the last part of the URL to whatever you want as long as the /7ynin/ is the same.

Digg seems to use a slug of the links title to id a link:

```http://digg.com/space/Liquid_Water_Recently_Seen_on_Mars```

While if i recall correctly a default WordPress install uses index.php?p=# as their id until fancy urls are enabled.

I can see why for SEO's sake you would want to have the most informative url possible but I am just trying to see if using the primary key is a security risk or simply just bad form.

答:
You always want to present the user with a nice URL-not some nasty auto-generated ID.  But I dont think you should make said "friendly url" the primary key.  You should still use a "classic" auto-incremented, numeric PK and have a second column that is a unique "friendly url".  Why?

All the comment tables, ratings
tables, whatever tables that have a
relationship with your content table
can use the numeric primary key.
This means smaller indexes and lower
memory use.

Somebody will want to
change the friendly url.  If you've
got a numeric primary key, you don't
have to update any of your dependent
tables (or have the DB do it via a
cascading update).

In the future,
you can abstract out the URL bits
into another table.  Said table can
then store "legacy" URL mappings
that issue redirects to the primary
"real" URL map.  Then when the user
wants to change the friendly URL,
you don't have to break the all the
inbound legacy URL's.  Couldn't do
this if your primary key was the
"friendly URL".

I'd still be inclined to use the numeric primary key in all my AJAX goo (for example, a post_new_comment() javascript function would take the primary key, not some friendly URL).  The only time I'd use the friendly URL is in any user-facing URL structure.

As for security?  If your content is access controlled, you are gonna have to check access no matter if it is the primary key or some friendly URL.

If you allow ways to get to the content via the primary key, people might try plugging in random ID's.  If your requirement for not only limited access to content, but the denial said content exists, it is a matter of the phrasing of your errors.  It is the same as with login failures--you dont say "username not found" you say "bad username or password".  Plugging in random values to find content is gonna be a problem for any approach you take, it is just that with numeric keys there is way fewer values to try.

Bottom line:  Friendly URL's?  Hell yeah.  Using them as the primary key?  Hell no.

OwnerDisplayName: anonymous

ContentLicense: CC BY-SA 2.5

Body:
What are the pros and cons of using your databases primary key as a URL identifier?  As an example, http://localhost/post/view/13 - 13 being my primary key for my posts table.

Some sites like reddit use what I assume is a unique id that is not the primary key but still unique to help identify the link:

http://www.reddit.com/r/funny/comments/7ynin/the_mystery_of_irelands_worst_driver/

You can change the last part of the URL to whatever you want as long as the /7ynin/ is the same.

Digg seems to use a slug of the links title to id a link:

http://digg.com/space/Liquid_Water_Recently_Seen_on_Mars

While if i recall correctly a default WordPress install uses index.php?p=# as their id until fancy urls are enabled.

I can see why for SEO's sake you would want to have the most informative url possible but I am just trying to see if using the primary key is a security risk or simply just bad form.

OwnerDisplayName: Cory R. King

LastEditorDisplayName: Cory R. King


问:
How to assert an actual value against 2 or more expected values?
I'm testing a method to see if it returns the correct string. This string is made up of a lot of lines whose order might change, thus usually giving 2 possible combinations. That order is not important for my application.

However, because the order of the lines might change, writing just an Assert statement will not work, since sometimes it will pass the test, and sometimes it will fail the test.

So, is it possible to write a test that will assert an actual string value against 2 or more expected string values and see if it is equal to any of them?

答:
You can use Hamcrest for this:

```<code>assertThat(testString, anyOf(
    containsString("My first string"),
    containsString("My other string")));
</code>```

(I see Joachim just answered very similarly (+1)... i'll add this as another example.)

Body:
You can use Hamcrest for this:

assertThat(testString, anyOf(
    containsString("My first string"),
    containsString("My other string")));

(I see Joachim just answered very similarly (+1)... i'll add this as another example.)


问:
Pass a null date to a crystal report parameter using SetParameterValue
I have a situation where I have a crystal report where I pass in a start and end date via rdoc.SetParameterValue this works fine, except that, I do not want it to show a date if I pass nothing for the date variable, I just want it to be blank

To an attempt to do so i have written

```<code>    if (DateStart != defaultDate)
    {
        rdoc.SetParameterValue("DStart", DateStart);
    }else
    {
        rdoc.SetParameterValue("DStart", "");
    }
</code>```

Which gives me the error The types of the parameter field and parameter field current values are not compatible of course, this makes sense because I am trying to set a date to a string variable.
However, I am unable to think of a solution, nor do I see any solution in the Parameter's menu.

Appreciate it if I be given some assistance to solve this.

Regards

答:
You may change the parameter type to string and pass the date as string:

```<code>DateStart.ToString()
</code>```

I don't like this solution, but it works. Usually i just require the date.

Body:
I have a situation where I have a crystal report where I pass in a start and end date via rdoc.SetParameterValue this works fine, except that, I do not want it to show a date if I pass nothing for the date variable, I just want it to be blank

To an attempt to do so i have written

    if (DateStart != defaultDate)
    {
        rdoc.SetParameterValue("DStart", DateStart);
    }else
    {
        rdoc.SetParameterValue("DStart", "");
    }

Which gives me the error The types of the parameter field and parameter field current values are not compatible of course, this makes sense because I am trying to set a date to a string variable.
However, I am unable to think of a solution, nor do I see any solution in the Parameter's menu.

Appreciate it if I be given some assistance to solve this.

Regards

Body:
You may change the parameter type to string and pass the date as string:

DateStart.ToString()

I don't like this solution, but it works. Usually i just require the date.


问:
How to output only random xx% of query output records in Redshift?
Is there a way to output only a percentage of the total number of output records in Redshift, when you don't know the number of records returned?

Let's say the output of the query will be 1000 records. You just want to select randomly 60% of it... So that will be 600 records in this case.

If I knew that the output is always 1000, then I would use LIMIT 600. But I don't know how many records will be returned, and I want it to be variable..

Any ideas?

PS: Tried to use LIMIT (0.6*COUNT(*)) and it didn't work.. The error was that "LIMIT doesn't take a variable"

答:
If you don't need an exact number of records but about 60%, then I would recommend:

```<code>where random() <= 0.6
</code>```

If you do need an exact number, then:

```<code>select t.*
from (select t.*,
             row_number() over (order by random()) as seqnum,
             count(*) over () as cnt
      from t
     ) t
where seqnum <= 0.6 * cnt;
</code>```

Body:
If you don't need an exact number of records but about 60%, then I would recommend:

where random() <= 0.6

If you do need an exact number, then:

select t.*
from (select t.*,
             row_number() over (order by random()) as seqnum,
             count(*) over () as cnt
      from t
     ) t
where seqnum <= 0.6 * cnt;


问:
C, dynamic array, segmentation fault
I wanted to allocate memory and scanf array in one function, but it gives segmentation fault (core dumped) error. Thank you for help.</p>

```<code>#include <stdio.h>
#include <stdlib.h>

void scanf_array (int **array_pp, int size);

int main ()
{
  int *array_p, size;
  scanf ("%d", &size);
  scanf_array (&array_p, size);
  for (int i = 0; i < size; i++)
  {
    printf ("%d", array_p[i]);
  }
  return 0;
}

void scanf_array (int **array_pp, int size)
{
  *array_pp = (int *)malloc (size * sizeof (int));
  for (int i = 0; i < size; i++)
  {
  scanf ("%d", array_pp[i]);
  }
}
</code>```

答:
The problem is the following line:

scanf ("%d", array_pp[i]);

The expression array_pp[i] would be correct if array_pp was a pointer to the first element of an array. However, it is a pointer to a single variable of type int *. Since a single variable is equivalent to an array of size 1, the only permissible index that is not out of bounds would be array_pp[0]. However, for single variables, it is common to write *array_pp instead, even if it accomplishes exactly the same thing as array_pp[0]. This is because indexing is generally only used with "proper" arrays, i.e. arrays with at least 2 elements.

The expression *array_pp (or array_pp[0] if you prefer) gives you access to the variable

int *array_p

from the function main. Since that pointer now points to the first element of a dynamically allocated array of type int, you can use the indexes 0 to size on that pointer. So you could write either

(*array_pp)[i]

or

array_pp[0][i]

in your loop, where i is a value between 0 and size.

As stated before, even if both expressions accomplish exactly the same thing, it is better to write (*array_pp)[i] instead of array_pp[0][i].

However, the function scanf() requires the address of the array element to write to. So the line should be changed to the following:

scanf ("%d", &(*array_pp)[i]);

Title: C, dynamic array, segmentation fault

Body:
I wanted to allocate memory and scanf array in one function, but it gives segmentation fault (core dumped) error. Thank you for help.

#include <stdio.h>
#include <stdlib.h>

void scanf_array (int **array_pp, int size);

int main ()
{
  int *array_p, size;
  scanf ("%d", &size);
  scanf_array (&array_p, size);
  for (int i = 0; i < size; i++)
  {
    printf ("%d", array_p[i]);
  }
  return 0;
}

void scanf_array (int **array_pp, int size)
{
  *array_pp = (int *)malloc (size * sizeof (int));
  for (int i = 0; i < size; i++)
  {
  scanf ("%d", array_pp[i]);
  }
}


问:
BigQuery - DELETE statement to remove duplicates Group by Id
I am trying to use DELETE to remove duplicate records from my BigQuery table.

I found multiple solutions to the above question but most of them use CREATE, REPLACE or SELECT.

The closest solution using DELETE I found was:

BigQuery - DELETE statement to remove duplicates

BigQuery Standard SQL: Delete Duplicates from Table

I have a follow up questions on the below solution:

```<code>#standardSQL
DELETE FROM `yourproject.yourdataset.duplicates`
WHERE STRUCT(id, loadTime) NOT IN (
    SELECT AS STRUCT id, MAX(loadTime) loadTime
    FROM `yourproject.yourdataset.duplicates` where id= '123'
    GROUP BY id)
</code>```

This statement deletes all the records from the table which does not satisfy the NOT IN condition. For example, if my table looks like below:

```<code>Id      Loadtime
123        5
123        4
456        2
321        1
</code>```

The query above deletes all records except for the first row.
How can I modify the query so that it deletes only the 2nd row i.e. it only deletes group by id?

The final output should be:

```<code> Id      Loadtime
 123        5
 456        2
 321        1
</code>```

答:
Below should work as per your expectation   </p>

```<code>#standardSQL
DELETE FROM `yourproject.yourdataset.duplicates`
WHERE STRUCT(id, loadTime) NOT IN (
SELECT AS STRUCT id, MAX(loadTime) loadTime
FROM `yourproject.yourdataset.duplicates`
GROUP BY id)
</code>```

<p>so, in your sample - it will delete ONLY second row      </p>

```<code>Id  Loadtime
123 4
</code>```

Body:
I am trying to use DELETE to remove duplicate records from my BigQuery table.

I found multiple solutions to the above question but most of them use CREATE, REPLACE or SELECT.

The closest solution using DELETE I found was:

BigQuery - DELETE statement to remove duplicates

BigQuery Standard SQL: Delete Duplicates from Table

I have a follow up questions on the below solution:

#standardSQL
DELETE FROM `yourproject.yourdataset.duplicates`
WHERE STRUCT(id, loadTime) NOT IN (
    SELECT AS STRUCT id, MAX(loadTime) loadTime
    FROM `yourproject.yourdataset.duplicates` where id= '123'
    GROUP BY id)

This statement deletes all the records from the table which does not satisfy the NOT IN condition. For example, if my table looks like below:

Id      Loadtime
123        5
123        4
456        2
321        1

The query above deletes all records except for the first row.
How can I modify the query so that it deletes only the 2nd row i.e. it only deletes group by id?

The final output should be:

 Id      Loadtime
 123        5
 456        2
 321        1

Body:
Below should work as per your expectation

#standardSQL
DELETE FROM `yourproject.yourdataset.duplicates`
WHERE STRUCT(id, loadTime) NOT IN (
SELECT AS STRUCT id, MAX(loadTime) loadTime
FROM `yourproject.yourdataset.duplicates`
GROUP BY id)

so, in your sample - it will delete ONLY second row

Id  Loadtime
123 4


问:
How to hit a web page programmatically and silently?
I would like to know how can I hit a web page programmatically and silently using C/C++?

I tried ShellExecute (shellapi.h), don't know how to make use of it?

答:
Use the HTTP protocol directly

netcat

curl

wget

HTTP Client Services

On linuxen there are perl implemented CLI commands (GET, PUT, POST), in short: pick one from a vast array; you platform will have tools too.

Simplistic example:

```<code>type request.http | netcat mywebserver:80
</code>```

Where request.http could be as simple as

```<code>GET /
</code>```

(mind the trailing empty lines, which SO helpfully hides)

Body:
Use the HTTP protocol directly

netcat

curl

wget

HTTP Client Services

On linuxen there are perl implemented CLI commands (GET, PUT, POST), in short: pick one from a vast array; you platform will have tools too.

Simplistic example:

type request.http | netcat mywebserver:80

Where request.http could be as simple as

GET /

(mind the trailing empty lines, which SO helpfully hides)


问:
Coral Edge TPU, Can use it for training?
I bought a Coral Edge TPU for my Raspberry Pi
to use TensorFlow Lite.

On provider's homepage, They said it's only for inferencing
and just limited transfer learning.

There example use it their own framework.
Is Tensorflow-core library support this device?

Colar Edge TPU designed for inferencing.
There is no FP32 or FP16 operation units.
And provider's library also don't have it.
So it's impossible what i want to do.

and Tensorflow-core library also do not support this device.

答:
The EdgeTPU can only be used for tflite models that are compiled using the edgetpu_compiler. The job of the compiler is to map the model to the tpu, otherwise all operations will be executes on the CPU by default. The EdgeTPU, then, will not work with tensorflow core models because it hasn't been compiled.
In order for you model(s) to pass the compiler, it will have to meets all requirements lists here. </p>