问:
JBoss Remote Client Credentials client credentials dumped
I have a Java EE application that runs fine on JBoss4.0.3, but we need to port it to JBoss 6.
(There are security issues against 4.0.x) [This application runs on a LAN away from the internet, but security issues have to be addressed.]

The application uses EJBs and a Java client.

The client used to log in using a LoginContext, now uses a LoginContext and a SecurityClient. These are held client side in a singleton that does respond to JAAS callbacks.

After the a period of successful calls the client credentials are gone. (Snipped to make the log small enough for SO)

I Have seen the connection to the server re-connected in other log files, and there are no security credentials immediately afterwards. I suspect this problem might be some sort of timeout.

```<code>Tue May 17 14:31:35 EST 2011: Successfully set the login.config resource property
TRACE - Security domain: null
TRACE - Enabling restore-login-identity mode
TRACE - Begin login
TRACE - Obtained login: Foo_user, credential.class: [C
TRACE - End login
TRACE - commit, subject=Subject:

DEBUG - Using ThreadLocal: false
TRACE - Security domain: null
TRACE - Enabling restore-login-identity mode
TRACE - Begin login
TRACE - Obtained login: Foo_user, credential.class: [C
TRACE - End login
TRACE - commit, subject=Subject:

Tue May 17 14:31:40 EST 2011: User: Foo_user credentials established.
DEBUG - createSocket, hostAddr: localhost/127.0.0.1, port: 1099, localAddr: null, localPort: 0, timeout: 0
DEBUG - Remoting version: 2.5.3 (Flounder)
DEBUG - Client[17459938:a001p-17x5i6-gnscippf-1-gnscipq9-3].connect(null)
TRACE - Client[17459938:a001p-17x5i6-gnscippf-1-gnscipq9-3]: metadata = null
TRACE - Mapping properties for bean: SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446]
TRACE - Property editor found for: marshaller, editor: java.beans.PropertyDescriptor@c4909136, setter: public void org.jboss.remoting.MicroRemoteClientInvoker.setMarshaller(org.jboss.remoting.marshal.Marshaller)
TRACE - Failed to find property editor for: marshaller
TRACE - Failed to write property
java.lang.NullPointerException
    at org.jboss.util.propertyeditor.PropertyEditors.mapJavaBeanProperties(PropertyEditors.java:377)
    at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.mapJavaBeanProperties(MicroSocketClientInvoker.java:1359)
    at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.setup(MicroSocketClientInvoker.java:533)
    at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.<init>(MicroSocketClientInvoker.java:292)
    at org.jboss.remoting.transport.socket.SocketClientInvoker.<init>(SocketClientInvoker.java:78)
    at org.jboss.remoting.transport.socket.TransportClientFactory.createClientInvoker(TransportClientFactory.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.remoting.InvokerRegistry.loadClientInvoker(InvokerRegistry.java:460)
    at org.jboss.remoting.InvokerRegistry.createClientInvoker(InvokerRegistry.java:359)
    at org.jboss.remoting.Client$4.run(Client.java:651)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.jboss.remoting.Client.connect(Client.java:647)
    at org.jboss.remoting.Client.connect(Client.java:595)
    at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.init(UnifiedInvokerProxy.java:98)
    at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.readExternal(UnifiedInvokerProxy.java:252)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at java.util.HashMap.readObject(HashMap.java:1030)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:158)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
    at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:771)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at au.com.FooCorp.util.servicelocator.ServiceLocator.getEnterpriseObject(ServiceLocator.java:118)
    at au.com.FooCorp.Foo.appclient.main.FrontControllerManager.createController(FrontControllerManager.java:75)
    at au.com.FooCorp.Foo.appclient.main.FrontControllerManager.getRealController(FrontControllerManager.java:164)
    at au.com.FooCorp.Foo.appclient.Launcher.run(Launcher.java:382)
    at au.com.FooCorp.Foo.appclient.Launcher.main(Launcher.java:417)
DEBUG - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] setting enableTcpNodelay to true
DEBUG - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] constructed
DEBUG - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] setting enableTcpNodelay to true
DEBUG - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] connecting
DEBUG - Creating semaphore with size 50
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] added new pool ([]) as ServerAddress[127.0.0.1:4446, enableTcpNodelay timeout 1800000 ms, maxPoolSize=50]
DEBUG - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] connected
TRACE - Client[17459938:a001p-17x5i6-gnscippf-1-gnscipq9-3] enableLease: false
DEBUG - Client[17459938:a001p-17x5i6-gnscippf-1-gnscipq9-3] connected to InvokerLocator [socket://127.0.0.1:4446/?dataType=invocation&enableTcpNodelay=true&marshaller=org.jboss.invocation.unified.marshall.InvocationMarshaller&unmarshaller=org.jboss.invocation.unified.marshall.InvocationUnMarshaller]
DEBUG - Client[17459938:a001p-17x5i6-gnscippf-1-gnscipq9-3] is connected
Tue May 17 14:31:40 EST 2011: createController(): created HOME for front controller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446](1) invoking InvocationRequest[3bc257, INVOKER, org.jboss.invocation.Invocation@153f67e]
TRACE - Could not find marshaller for data type 'invocation'.  Object in collection is null
TRACE - Could not look up marshaller by data type ('invocation').  Will try to load dynamically.
TRACE - Found marshaller by loading locally.
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] retryCount: 0
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] obtained semaphore: 49
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] creating socket
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] created socket: Socket[addr=/127.0.0.1,port=4446,localport=1898]
TRACE - constructing org.jboss.remoting.transport.socket.ClientSocketWrapper instance for Socket[addr=/127.0.0.1,port=4446,localport=1898], using timeout 1800000
TRACE - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] setting timeout to 1800000
TRACE - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] getting output stream from Socket[addr=/127.0.0.1,port=4446,localport=1898], org.jboss.invocation.unified.marshall.InvocationMarshaller@16dadf9
TRACE - Creating ObjectOutputStream
TRACE - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] getting input stream from Socket[addr=/127.0.0.1,port=4446,localport=1898], org.jboss.invocation.unified.marshall.InvocationUnMarshaller@1b8d6f7
TRACE - Creating ObjectInputStreamWithClassLoader
TRACE - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] setting timeout to 1800000
TRACE - reset timeout: 1800000
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] got socketWrapper: ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446]got outputStream: org.jboss.remoting.serialization.impl.java.ClearableObjectOutputStream@1bf3d87
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing version
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing version 22 on output stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] wrote version
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing invocation to marshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] done writing invocation to marshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] reading version from input stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] read version 22 from input stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] reading response from unmarshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] returned ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] to pool
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] released semaphore: 50
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] received response InvocationResponse[9be79a, java.rmi.MarshalledObject@2bf70148]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] received InvocationResponse so going to return response's return value of java.rmi.MarshalledObject@2bf70148
DEBUG - Client[26980954:a001p-17x5i6-gnscippf-1-gnsciq4g-5].connect(null)
TRACE - Client[26980954:a001p-17x5i6-gnscippf-1-gnsciq4g-5]: metadata = null
TRACE - Found and returning cached client invoker (SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446])
TRACE - Client[26980954:a001p-17x5i6-gnscippf-1-gnsciq4g-5] enableLease: false
DEBUG - Client[26980954:a001p-17x5i6-gnscippf-1-gnsciq4g-5] connected to InvokerLocator [socket://127.0.0.1:4446/?dataType=invocation&enableTcpNodelay=true&marshaller=org.jboss.invocation.unified.marshall.InvocationMarshaller&unmarshaller=org.jboss.invocation.unified.marshall.InvocationUnMarshaller]
DEBUG - Client[26980954:a001p-17x5i6-gnscippf-1-gnsciq4g-5] is connected
proxy created
Tue May 17 14:31:41 EST 2011: createController(): FrontController EJB has been created
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446](1) invoking InvocationRequest[100ebec, INVOKER, org.jboss.invocation.Invocation@180f96c]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] retryCount: 0
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] obtained semaphore: 49
TRACE - checking open connection
</code>```

Snippage here... successful calls occur to server.

```<code>TRACE - checking open connection
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] reusing pooled connection: ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] got socketWrapper: ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446]got outputStream: org.jboss.remoting.serialization.impl.java.ClearableObjectOutputStream@1bf3d87
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing version
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing version 22 on output stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] wrote version
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing invocation to marshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] done writing invocation to marshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] reading version from input stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] read version 22 from input stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] reading response from unmarshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] returned ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] to pool
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] released semaphore: 50
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] received response InvocationResponse[bef361, java.rmi.AccessException: SecurityException; nested exception is:
    java.lang.SecurityException: Authentication exception, principal=null]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] received a server-side exception as response to the invocation: java.rmi.AccessException: SecurityException; nested exception is:
    java.lang.SecurityException: Authentication exception, principal=null
java.rmi.AccessException: SecurityException; nested exception is:
    java.lang.SecurityException: Authentication exception, principal=null
    at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:388)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
    at org.jboss.ejb.Container.invoke(Container.java:1072)
    at sun.reflect.GeneratedMethodAccessor294.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670)
    at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)
    at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:898)
    at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791)
    at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744)
    at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:586)
    at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)
Caused by: java.lang.SecurityException: Authentication exception, principal=null
    at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityContext(SecurityInterceptor.java:322)
    at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:243)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
    at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:140)
    at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
    at org.jboss.ejb.Container.invoke(Container.java:1072)
    at sun.reflect.GeneratedMethodAccessor294.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670)
    at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)
    at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:898)
    at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791)
    at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744)
    at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:586)
    at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)
    at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:216)
    at org.jboss.remoting.Client.invoke(Client.java:1961)
    at org.jboss.remoting.Client.invoke(Client.java:804)
    at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.invoke(UnifiedInvokerProxy.java:184)
    at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
    at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
    at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
    at org.jboss.proxy.ejb.SecurityContextInterceptor.invoke(SecurityContextInterceptor.java:64)
    at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68)
    at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
    at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
    at $Proxy1.getCommandCharacteristics(Unknown Source)
    at au.com.FooCorp.Foo.appclient.main.SwingProxifier.invoke(SwingProxifier.java:107)
    at $Proxy1.registerNewLicence(Unknown Source)
    at au.com.FooCorp.Foo.appclient.Launcher.notifyLicenseEvent(Launcher.java:126)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog.registerAction(LicenseRegDialog.java:213)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog.access$0(LicenseRegDialog.java:185)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog$1.actionPerformed(LicenseRegDialog.java:118)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6134)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.awt.Component.processEvent(Component.java:5899)
    at java.awt.Container.processEvent(Container.java:2023)
    at java.awt.Component.dispatchEventImpl(Component.java:4501)
    at java.awt.Container.dispatchEventImpl(Container.java:2081)
    at java.awt.Component.dispatchEvent(Component.java:4331)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
    at java.awt.Container.dispatchEventImpl(Container.java:2067)
    at java.awt.Window.dispatchEventImpl(Window.java:2458)
    at java.awt.Component.dispatchEvent(Component.java:4331)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
    at java.awt.Dialog$1.run(Dialog.java:1047)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
au.com.FooCorp.Foo.server.licence.LicenceException: SecurityException; nested exception is:
    java.lang.SecurityException: Authentication exception, principal=null
    at au.com.FooCorp.Foo.appclient.Launcher.notifyLicenseEvent(Launcher.java:129)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog.registerAction(LicenseRegDialog.java:213)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog.access$0(LicenseRegDialog.java:185)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog$1.actionPerformed(LicenseRegDialog.java:118)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6134)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.awt.Component.processEvent(Component.java:5899)
    at java.awt.Container.processEvent(Container.java:2023)
    at java.awt.Component.dispatchEventImpl(Component.java:4501)
    at java.awt.Container.dispatchEventImpl(Container.java:2081)
    at java.awt.Component.dispatchEvent(Component.java:4331)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
    at java.awt.Container.dispatchEventImpl(Container.java:2067)
    at java.awt.Window.dispatchEventImpl(Window.java:2458)
    at java.awt.Component.dispatchEvent(Component.java:4331)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
    at java.awt.Dialog$1.run(Dialog.java:1047)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
</code>```

答:
Short answer: Client Side Security associations are thread local in JBoss AS 5 or higher.

Well it turns out to be a new thing in JBoss 5.x and later.

JBoss Forum

My poor multi threaded client's security association isn't by default shared across threads.
This change to the auth.cofig file fixes it.

And I can revert my application code to "plain old" JAAS login without using JBoss APIs.

auth.config file

```<code>foo-application {
       // jBoss LoginModule
       org.jboss.security.ClientLoginModule required
    multi-threaded=false;
};
</code>```

Body:
I have a Java EE application that runs fine on JBoss4.0.3, but we need to port it to JBoss 6.
(There are security issues against 4.0.x) [This application runs on a LAN away from the internet, but security issues have to be addressed.]

The application uses EJBs and a Java client.

The client used to log in using a LoginContext, now uses a LoginContext and a SecurityClient. These are held client side in a singleton that does respond to JAAS callbacks.

After the a period of successful calls the client credentials are gone. (Snipped to make the log small enough for SO)

I Have seen the connection to the server re-connected in other log files, and there are no security credentials immediately afterwards. I suspect this problem might be some sort of timeout.

Tue May 17 14:31:35 EST 2011: Successfully set the login.config resource property
TRACE - Security domain: null
TRACE - Enabling restore-login-identity mode
TRACE - Begin login
TRACE - Obtained login: Foo_user, credential.class: [C
TRACE - End login
TRACE - commit, subject=Subject:

DEBUG - Using ThreadLocal: false
TRACE - Security domain: null
TRACE - Enabling restore-login-identity mode
TRACE - Begin login
TRACE - Obtained login: Foo_user, credential.class: [C
TRACE - End login
TRACE - commit, subject=Subject:

Tue May 17 14:31:40 EST 2011: User: Foo_user credentials established.
DEBUG - createSocket, hostAddr: localhost/127.0.0.1, port: 1099, localAddr: null, localPort: 0, timeout: 0
DEBUG - Remoting version: 2.5.3 (Flounder)
DEBUG - Client[17459938:a001p-17x5i6-gnscippf-1-gnscipq9-3].connect(null)
TRACE - Client[17459938:a001p-17x5i6-gnscippf-1-gnscipq9-3]: metadata = null
TRACE - Mapping properties for bean: SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446]
TRACE - Property editor found for: marshaller, editor: java.beans.PropertyDescriptor@c4909136, setter: public void org.jboss.remoting.MicroRemoteClientInvoker.setMarshaller(org.jboss.remoting.marshal.Marshaller)
TRACE - Failed to find property editor for: marshaller
TRACE - Failed to write property
java.lang.NullPointerException
    at org.jboss.util.propertyeditor.PropertyEditors.mapJavaBeanProperties(PropertyEditors.java:377)
    at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.mapJavaBeanProperties(MicroSocketClientInvoker.java:1359)
    at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.setup(MicroSocketClientInvoker.java:533)
    at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.<init>(MicroSocketClientInvoker.java:292)
    at org.jboss.remoting.transport.socket.SocketClientInvoker.<init>(SocketClientInvoker.java:78)
    at org.jboss.remoting.transport.socket.TransportClientFactory.createClientInvoker(TransportClientFactory.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.remoting.InvokerRegistry.loadClientInvoker(InvokerRegistry.java:460)
    at org.jboss.remoting.InvokerRegistry.createClientInvoker(InvokerRegistry.java:359)
    at org.jboss.remoting.Client$4.run(Client.java:651)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.jboss.remoting.Client.connect(Client.java:647)
    at org.jboss.remoting.Client.connect(Client.java:595)
    at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.init(UnifiedInvokerProxy.java:98)
    at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.readExternal(UnifiedInvokerProxy.java:252)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at java.util.HashMap.readObject(HashMap.java:1030)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:158)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
    at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:771)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at au.com.FooCorp.util.servicelocator.ServiceLocator.getEnterpriseObject(ServiceLocator.java:118)
    at au.com.FooCorp.Foo.appclient.main.FrontControllerManager.createController(FrontControllerManager.java:75)
    at au.com.FooCorp.Foo.appclient.main.FrontControllerManager.getRealController(FrontControllerManager.java:164)
    at au.com.FooCorp.Foo.appclient.Launcher.run(Launcher.java:382)
    at au.com.FooCorp.Foo.appclient.Launcher.main(Launcher.java:417)
DEBUG - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] setting enableTcpNodelay to true
DEBUG - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] constructed
DEBUG - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] setting enableTcpNodelay to true
DEBUG - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] connecting
DEBUG - Creating semaphore with size 50
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] added new pool ([]) as ServerAddress[127.0.0.1:4446, enableTcpNodelay timeout 1800000 ms, maxPoolSize=50]
DEBUG - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] connected
TRACE - Client[17459938:a001p-17x5i6-gnscippf-1-gnscipq9-3] enableLease: false
DEBUG - Client[17459938:a001p-17x5i6-gnscippf-1-gnscipq9-3] connected to InvokerLocator [socket://127.0.0.1:4446/?dataType=invocation&enableTcpNodelay=true&marshaller=org.jboss.invocation.unified.marshall.InvocationMarshaller&unmarshaller=org.jboss.invocation.unified.marshall.InvocationUnMarshaller]
DEBUG - Client[17459938:a001p-17x5i6-gnscippf-1-gnscipq9-3] is connected
Tue May 17 14:31:40 EST 2011: createController(): created HOME for front controller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446](1) invoking InvocationRequest[3bc257, INVOKER, org.jboss.invocation.Invocation@153f67e]
TRACE - Could not find marshaller for data type 'invocation'.  Object in collection is null
TRACE - Could not look up marshaller by data type ('invocation').  Will try to load dynamically.
TRACE - Found marshaller by loading locally.
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] retryCount: 0
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] obtained semaphore: 49
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] creating socket
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] created socket: Socket[addr=/127.0.0.1,port=4446,localport=1898]
TRACE - constructing org.jboss.remoting.transport.socket.ClientSocketWrapper instance for Socket[addr=/127.0.0.1,port=4446,localport=1898], using timeout 1800000
TRACE - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] setting timeout to 1800000
TRACE - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] getting output stream from Socket[addr=/127.0.0.1,port=4446,localport=1898], org.jboss.invocation.unified.marshall.InvocationMarshaller@16dadf9
TRACE - Creating ObjectOutputStream
TRACE - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] getting input stream from Socket[addr=/127.0.0.1,port=4446,localport=1898], org.jboss.invocation.unified.marshall.InvocationUnMarshaller@1b8d6f7
TRACE - Creating ObjectInputStreamWithClassLoader
TRACE - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] setting timeout to 1800000
TRACE - reset timeout: 1800000
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] got socketWrapper: ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446]got outputStream: org.jboss.remoting.serialization.impl.java.ClearableObjectOutputStream@1bf3d87
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing version
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing version 22 on output stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] wrote version
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing invocation to marshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] done writing invocation to marshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] reading version from input stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] read version 22 from input stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] reading response from unmarshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] returned ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] to pool
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] released semaphore: 50
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] received response InvocationResponse[9be79a, java.rmi.MarshalledObject@2bf70148]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] received InvocationResponse so going to return response's return value of java.rmi.MarshalledObject@2bf70148
DEBUG - Client[26980954:a001p-17x5i6-gnscippf-1-gnsciq4g-5].connect(null)
TRACE - Client[26980954:a001p-17x5i6-gnscippf-1-gnsciq4g-5]: metadata = null
TRACE - Found and returning cached client invoker (SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446])
TRACE - Client[26980954:a001p-17x5i6-gnscippf-1-gnsciq4g-5] enableLease: false
DEBUG - Client[26980954:a001p-17x5i6-gnscippf-1-gnsciq4g-5] connected to InvokerLocator [socket://127.0.0.1:4446/?dataType=invocation&enableTcpNodelay=true&marshaller=org.jboss.invocation.unified.marshall.InvocationMarshaller&unmarshaller=org.jboss.invocation.unified.marshall.InvocationUnMarshaller]
DEBUG - Client[26980954:a001p-17x5i6-gnscippf-1-gnsciq4g-5] is connected
proxy created
Tue May 17 14:31:41 EST 2011: createController(): FrontController EJB has been created
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446](1) invoking InvocationRequest[100ebec, INVOKER, org.jboss.invocation.Invocation@180f96c]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] retryCount: 0
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] obtained semaphore: 49
TRACE - checking open connection

Snippage here... successful calls occur to server.

TRACE - checking open connection
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] reusing pooled connection: ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] got socketWrapper: ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446]got outputStream: org.jboss.remoting.serialization.impl.java.ClearableObjectOutputStream@1bf3d87
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing version
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing version 22 on output stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] wrote version
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] writing invocation to marshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] done writing invocation to marshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] reading version from input stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] read version 22 from input stream
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] reading response from unmarshaller
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] returned ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4446,localport=1898].949f69] to pool
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] released semaphore: 50
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] received response InvocationResponse[bef361, java.rmi.AccessException: SecurityException; nested exception is:
    java.lang.SecurityException: Authentication exception, principal=null]
TRACE - SocketClientInvoker[1bb60c3, socket://127.0.0.1:4446] received a server-side exception as response to the invocation: java.rmi.AccessException: SecurityException; nested exception is:
    java.lang.SecurityException: Authentication exception, principal=null
java.rmi.AccessException: SecurityException; nested exception is:
    java.lang.SecurityException: Authentication exception, principal=null
    at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:388)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
    at org.jboss.ejb.Container.invoke(Container.java:1072)
    at sun.reflect.GeneratedMethodAccessor294.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670)
    at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)
    at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:898)
    at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791)
    at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744)
    at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:586)
    at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)
Caused by: java.lang.SecurityException: Authentication exception, principal=null
    at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityContext(SecurityInterceptor.java:322)
    at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:243)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
    at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:140)
    at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
    at org.jboss.ejb.Container.invoke(Container.java:1072)
    at sun.reflect.GeneratedMethodAccessor294.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670)
    at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)
    at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:898)
    at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791)
    at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744)
    at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:586)
    at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)
    at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:216)
    at org.jboss.remoting.Client.invoke(Client.java:1961)
    at org.jboss.remoting.Client.invoke(Client.java:804)
    at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.invoke(UnifiedInvokerProxy.java:184)
    at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
    at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
    at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
    at org.jboss.proxy.ejb.SecurityContextInterceptor.invoke(SecurityContextInterceptor.java:64)
    at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68)
    at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
    at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
    at $Proxy1.getCommandCharacteristics(Unknown Source)
    at au.com.FooCorp.Foo.appclient.main.SwingProxifier.invoke(SwingProxifier.java:107)
    at $Proxy1.registerNewLicence(Unknown Source)
    at au.com.FooCorp.Foo.appclient.Launcher.notifyLicenseEvent(Launcher.java:126)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog.registerAction(LicenseRegDialog.java:213)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog.access$0(LicenseRegDialog.java:185)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog$1.actionPerformed(LicenseRegDialog.java:118)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6134)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.awt.Component.processEvent(Component.java:5899)
    at java.awt.Container.processEvent(Container.java:2023)
    at java.awt.Component.dispatchEventImpl(Component.java:4501)
    at java.awt.Container.dispatchEventImpl(Container.java:2081)
    at java.awt.Component.dispatchEvent(Component.java:4331)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
    at java.awt.Container.dispatchEventImpl(Container.java:2067)
    at java.awt.Window.dispatchEventImpl(Window.java:2458)
    at java.awt.Component.dispatchEvent(Component.java:4331)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
    at java.awt.Dialog$1.run(Dialog.java:1047)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
au.com.FooCorp.Foo.server.licence.LicenceException: SecurityException; nested exception is:
    java.lang.SecurityException: Authentication exception, principal=null
    at au.com.FooCorp.Foo.appclient.Launcher.notifyLicenseEvent(Launcher.java:129)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog.registerAction(LicenseRegDialog.java:213)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog.access$0(LicenseRegDialog.java:185)
    at au.com.FooCorp.Foo.appclient.admin.license.LicenseRegDialog$1.actionPerformed(LicenseRegDialog.java:118)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6134)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.awt.Component.processEvent(Component.java:5899)
    at java.awt.Container.processEvent(Container.java:2023)
    at java.awt.Component.dispatchEventImpl(Component.java:4501)
    at java.awt.Container.dispatchEventImpl(Container.java:2081)
    at java.awt.Component.dispatchEvent(Component.java:4331)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
    at java.awt.Container.dispatchEventImpl(Container.java:2067)
    at java.awt.Window.dispatchEventImpl(Window.java:2458)
    at java.awt.Component.dispatchEvent(Component.java:4331)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
    at java.awt.Dialog$1.run(Dialog.java:1047)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Body:
Short answer: Client Side Security associations are thread local in JBoss AS 5 or higher.

Well it turns out to be a new thing in JBoss 5.x and later.

JBoss Forum

My poor multi threaded client's security association isn't by default shared across threads.
This change to the auth.cofig file fixes it.

And I can revert my application code to "plain old" JAAS login without using JBoss APIs.

auth.config file

foo-application {
       // jBoss LoginModule
       org.jboss.security.ClientLoginModule required
    multi-threaded=false;
};


来源: stackexchange

问:
Does PHP cURL extension in version 7.4.2 support cURL with HTTP/3
Can I curl a website that supports HTTP/3, with curl, using HTTP/3 instead of HTTP/2, HTTP/1.1 or HTTP/1.0. Is this possible? If so, how to do this?</p>

答:
Yes it is indeed possible to get going but you need tweaks and manual hands-on to make it work:

Make sure your PHP uses a libcurl built to support HTTP/3

Provide the necessary HTTP3 symbol for your PHP program, perhaps like the example below (as CURL/PHP itself doesn't know about HTTP/3 yet)

Make sure that the QUIC/h3 libraries you build curl to use support the same HTTP/3 draft version as the test server you intend to try out

HTTP/3 and QUIC are not done yet, expect rough edges and glitches. Enable verbose and keep attention to details

Happy http3ing!

```<code>if (!defined('CURL_HTTP_VERSION_3')) {
  define('CURL_HTTP_VERSION_3', 30);
}

$ch = curl_init("https://cloudflare-quic.com/");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_3);
curl_exec($ch);
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Yes it is indeed possible to get going but you need tweaks and manual hands-on to make it work:

Make sure your PHP uses a libcurl built to support HTTP/3

Provide the necessary HTTP3 symbol for your PHP program, perhaps like the example below (as CURL/PHP itself doesn't know about HTTP/3 yet)

Make sure that the QUIC/h3 libraries you build curl to use support the same HTTP/3 draft version as the test server you intend to try out

HTTP/3 and QUIC are not done yet, expect rough edges and glitches. Enable verbose and keep attention to details

Happy http3ing!

if (!defined('CURL_HTTP_VERSION_3')) {
  define('CURL_HTTP_VERSION_3', 30);
}

$ch = curl_init("https://cloudflare-quic.com/");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_3);
curl_exec($ch);


问:
How to implement a CMSampleBuffer for MLkit facial detection?
Basically, I'm trying to create a simple real-time facial recognition IOS app that streams the users face and tells them whether their eyes are closed. I'm following the google tutorial here - https://firebase.google.com/docs/ml-kit/ios/detect-faces.
I'm on step 2 (Run the Face Detector) and I'm trying to create a visionImage using the CMSampleBufferRef. I'm basically just copying the code and when I do, there is no reference to "sampleBuffer" as shown in the tutorial. I don't know what to do as I really don't understand the CMSampleBuffer stuff. </p>

答:
ML Kit has a Quickstart app showing how to do that.  Here is the code:

https://github.com/firebase/quickstart-ios/tree/master/mlvision


问:
Change button color in AlertDialog
How can I change the color of the button(s) in an AlertDialog in Android?

答:
Here is the perfect solution that worked for me:</p>
```<code>AlertDialog.Builder alertDialogBuilder
                        = new AlertDialog.Builder(DashboardActivity.this);
alertDialogBuilder.setTitle("");
alertDialogBuilder.setMessage("Are you sure you want to Logout?");

alertDialogBuilder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialogInterface, int i) {
        preferenceManager.logout();
        Intent intent = new Intent(DashboardActivity.this,
                                LoginActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                                | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);
    }
});

alertDialogBuilder.setNegativeButton("Cancel", null);

AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();

Button btnOk = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
Button btnCancel = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);

if (btnOk != null && btnCancel != null) {
    btnOk.setTextColor(getResources().getColor(R.color.colorGreenButton));
    btnCancel.setTextColor(getResources().getColor(R.color.colorGreenButton));
} else {
    Log.i(TAG, "LogOut: Buttons of Dialog are null");
}
</code>```

ContentLicense: CC BY-SA 3.0

Title: Change button color in AlertDialog

Body:
Here is the perfect solution that worked for me:

AlertDialog.Builder alertDialogBuilder
                        = new AlertDialog.Builder(DashboardActivity.this);
alertDialogBuilder.setTitle("");
alertDialogBuilder.setMessage("Are you sure you want to Logout?");

alertDialogBuilder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialogInterface, int i) {
        preferenceManager.logout();
        Intent intent = new Intent(DashboardActivity.this,
                                LoginActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                                | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);
    }
});

alertDialogBuilder.setNegativeButton("Cancel", null);

AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();

Button btnOk = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
Button btnCancel = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);

if (btnOk != null && btnCancel != null) {
    btnOk.setTextColor(getResources().getColor(R.color.colorGreenButton));
    btnCancel.setTextColor(getResources().getColor(R.color.colorGreenButton));
} else {
    Log.i(TAG, "LogOut: Buttons of Dialog are null");
}


问:
How to traversal an enum?
Type 'string' cannot be assigned to type 'online' | 'offline'.
I should be missing something，But I don't know how to do. </p>

```<code>enum StatusOptions {
  ONLINE = 'ONLINE',
  OFFLINE = 'OFFLINE',
}
Object.keys(StatusOptions).map((item: keyof typeof StatusOptions) => {
    return {
      text: StatusOptions[key],
      value: item
    }
})
</code>```

答:
Type 'string' cannot be assigned to type 'online' | 'offline' results from a mistyped function parameter, which you pass into your map function.

Object.keys is defined as:

    /**
     * Returns the names of the enumerable string properties and methods of an object.
     * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
     */
    keys(o: object): string[];
```

<p>Therefore you have to correctly type your function. Where item, is a <code>string</code></p>

<pre class="lang-js prettyprint-override"><code>Object.keys(StatusOptions).map((item: string) => /* do something with it */);
</code>```

Just in case you want then use the item as a key for StatusOptions like: StatusOptions[item]. You have to cast it as the following:

Object.keys(StatusOptions).map((item: string) => {
    return {
      text: StatusOptions[item as keyof typeof StatusOptions],
      value: item
    }
})
```

Title: How to traversal an enum?

Body:
Type 'string' cannot be assigned to type 'online' | 'offline'.
I should be missing something，But I don't know how to do.

enum StatusOptions {
  ONLINE = 'ONLINE',
  OFFLINE = 'OFFLINE',
}
Object.keys(StatusOptions).map((item: keyof typeof StatusOptions) => {
    return {
      text: StatusOptions[key],
      value: item
    }
})

Body:
Type 'string' cannot be assigned to type 'online' | 'offline' results from a mistyped function parameter, which you pass into your map function.

Object.keys is defined as:

    /**
     * Returns the names of the enumerable string properties and methods of an object.
     * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
     */
    keys(o: object): string[];

Therefore you have to correctly type your function. Where item, is a string

Object.keys(StatusOptions).map((item: string) => /* do something with it */);

Just in case you want then use the item as a key for StatusOptions like: StatusOptions[item]. You have to cast it as the following:

Object.keys(StatusOptions).map((item: string) => {
    return {
      text: StatusOptions[item as keyof typeof StatusOptions],
      value: item
    }
})


问:
How to convert user natural query into SQL query?
I am trying to build a chatbot in Rasa/Dialogflow, the problem i ham facing is to convert English to SQL query so that what user write in English can be converted into SQL fetch data from MYSQL database and display result to use.

Can someone suggest me how to do it?

答:
Ideally this is only possible through solutions like SEQ2SQL(Link here for reference).

But I implemented it in a workaround fashion:-

I got the json using tracker.latest_message .

After which I processed the json to make our own structured json like:

[{'column_name':'a',
'operator': '=',
'value':'100'},
{'column_name':'b',
'operator': '>',
'value':'100'}]

Above structure was used to form the where clause of the query.

Same way I made a custom json for Select Part as well :-

[{sum:column1},{count:column2}]

5.Then I looped through the json I had created and made our queries.

Note:- This json Structure will not be able to cover all possible scenarios but worked decently for me.


问:
Search API data in Ionic 4
I want to search data from the API(backend -> php).
I get the data correctly, but I have a problem with *ngFor and the searchbar.
It only shows the search button when the input in the searchbar field is correct. So when I go to the website, the search button is not shown, it only appears when the input in the searcbar is stored in the database.
How to make the search button always shown, even when the input is not existing in the database.

home.page.html

```<code><ion-grid >
        <ion-row >

            <ion-col size-xs="12" size-sm="12" size-md="8" size-lg="8">
                <ion-searchbar placeholder="Restaurant" [(ngModel)]="searchTermName" (ionChange)="searchName($event)"></ion-searchbar>
            </ion-col>

        </ion-row>
    </ion-grid>

    <div class="btn" *ngFor="let item of (results | async)">
            <ion-button [routerLink]="['/', 'details', item.reid]" color="primary" fill="solid">
                search
            </ion-button>
        </div>

    </div>

</code>```

home.page.ts

```<code>searchName() {
    this.results = this.userService.getName(this.searchTermName);
    console.log(this.results);
  }

</code>```

user.service.ts

```<code> getName(name1) {
    return this.http.get('http://127.0.0.1:8000/searchRestaurantByName', {headers: {name: name1}}).pipe(
        map(name => {
            console.log('RAW: ', name1);
            return name;
        })
    );
  }
</code>```

'asd' is in the database a restaurant

when i type nothing, there is no button??

答:
Home.ts

```<code>searchName() {
   this.userService.getName(this.searchTermName).subscribe((responce) => {
    console.log(responce);
})
</code>```

Change your way of code, keep subscribe promise, untill get responce from API.

Title: Search API data in Ionic 4

Body:
I want to search data from the API(backend -> php).
I get the data correctly, but I have a problem with *ngFor and the searchbar.
It only shows the search button when the input in the searchbar field is correct. So when I go to the website, the search button is not shown, it only appears when the input in the searcbar is stored in the database.
How to make the search button always shown, even when the input is not existing in the database.

home.page.html

<ion-grid >
        <ion-row >

            <ion-col size-xs="12" size-sm="12" size-md="8" size-lg="8">
                <ion-searchbar placeholder="Restaurant" [(ngModel)]="searchTermName" (ionChange)="searchName($event)"></ion-searchbar>
            </ion-col>

        </ion-row>
    </ion-grid>

            <ion-button [routerLink]="['/', 'details', item.reid]" color="primary" fill="solid">
                search
            </ion-button>

home.page.ts

searchName() {
    this.results = this.userService.getName(this.searchTermName);
    console.log(this.results);
  }

user.service.ts

 getName(name1) {
    return this.http.get('http://127.0.0.1:8000/searchRestaurantByName', {headers: {name: name1}}).pipe(
        map(name => {
            console.log('RAW: ', name1);
            return name;
        })
    );
  }

'asd' is in the database a restaurant

when i type nothing, there is no button??

Body:
Home.ts

searchName() {
   this.userService.getName(this.searchTermName).subscribe((responce) => {
    console.log(responce);
})

Change your way of code, keep subscribe promise, untill get responce from API.


问:
Use url args in views, is it possible?
I'd like to use url arguments in views (not templates, I know how to do that).

So is it possible to use them like:

```<code>def item_link(self, item):
    return mainpage_url_name + "%s/%i" % (item.slug, item.cid)
</code>```

mainpage_url_name - is of course defined in url patterns (as name variable)

I'm a total newb in Django...

Thanks

答:
First you should use names for your url patterns as documented here.

Then you can use reverse() to use these names in your views or methods.

Following your comments you are using the syndication framework.

Therefore you should make sure that you define get_absolute_url() for you models, ideally using the permalink decorator (for a clean reversing of your urls).

Looking at the example from Django's docs that should be all that's necessary.

To specify the contents of <link>, you
  have two options. For each item in
  items(), Django first tries calling
  the item_link() method on the Feed
  class. In a similar way to the title
  and description, it is passed it a
  single parameter, item. If that method
  doesn't exist, Django tries executing
  a get_absolute_url() method on that
  object.

Title: Use url args in views, is it possible?

Body:
I'd like to use url arguments in views (not templates, I know how to do that).

So is it possible to use them like:

def item_link(self, item):
    return mainpage_url_name + "%s/%i" % (item.slug, item.cid)

mainpage_url_name - is of course defined in url patterns (as name variable)

I'm a total newb in Django...

Thanks


问:
How do you display content of a .JSON file using Discord.js?
Currently my code reads out as

if(message.content.startsWith(prefix + 'readback')) {

  fs.readFile('msgs.json', (err, data) => {
    if (err) throw err;
    let _msgs = JSON.parse(data);
    message.channel.send(_msgs);
    console.log(_msgs)
  });
}
```

with all appropriate constants and variables

While using prefix + 'readback, the Discord Bot displays _msgs as [object Object] - to make sure it wasn't an issue with the code, I added console.log(_msgs), and the correct JSON file content displays in the console. Is there a way to get the Bot to display the contents of the JSON file in a channel?

答:
You can take advantage of discord markdown.

Code block, as on Stack Overflow, can be used to format code and even add color:

```<code>```json
{
    "some": "json"
}
```
</code>```

will render like this:

Now, as stated by Xander Kyle in comment, you want to use JSON.stringify as message.channel.send use toString to convert variable to string and it doesn't work "as you want" for objects.

fs.readFile('msgs.json', (err, data) => {
  if (err) { throw err; }
  const _msgs = JSON.stringify(JSON.parse(data), null, 2);
  message.channel.send('```json\n' + _msgs + '\n```');
  console.log(_msgs)
});
```

The 2 in stringify make the json indented (documentation)

Body:
Currently my code reads out as

if(message.content.startsWith(prefix + 'readback')) {

  fs.readFile('msgs.json', (err, data) => {
    if (err) throw err;
    let _msgs = JSON.parse(data);
    message.channel.send(_msgs);
    console.log(_msgs)
  });
}

with all appropriate constants and variables

While using prefix + 'readback, the Discord Bot displays _msgs as [object Object] - to make sure it wasn't an issue with the code, I added console.log(_msgs), and the correct JSON file content displays in the console. Is there a way to get the Bot to display the contents of the JSON file in a channel?

Body:
You can take advantage of discord markdown.

Code block, as on Stack Overflow, can be used to format code and even add color:

```json
{
    "some": "json"
}
```

will render like this:

Now, as stated by Xander Kyle in comment, you want to use JSON.stringify as message.channel.send use toString to convert variable to string and it doesn't work "as you want" for objects.

fs.readFile('msgs.json', (err, data) => {
  if (err) { throw err; }
  const _msgs = JSON.stringify(JSON.parse(data), null, 2);
  message.channel.send('```json\n' + _msgs + '\n```');
  console.log(_msgs)
});

The 2 in stringify make the json indented (documentation)


答:
You only show your button when you have a result. So we could change you code like the example below. When the value is changed in the searchbar, your names are requested in the userService. When the value returns in results, an item is shown below the searchbar.

You don't really need a button to search, because the function is executed when the value of the searchbar changes. If you want a button, then you can delete the ionChange event and get the value when you click your search button.

This is just an example to represent how you could do this. You can modify this for your own needs or think of another way to achieve your goals.

<ion-grid>
  <ion-row>
    <ion-col size-xs="12" size-sm="12" size-md="8" size-lg="8">
      <ion-searchbar placeholder="Restaurant" (ionChange)="searchName($event.target.value)"></ion-searchbar>
    </ion-col>
  </ion-row>
  <ion-row>
    <ion-col>
      <ion-item routerLink="['/', 'details', item.reid]" *ngFor="let item of (results | async)">
        {{ item.name }}
      </ion-item>
    </ion-col>
  </ion-row>
</ion-grid>
```

<pre class="lang-js prettyprint-override"><code>searchName(searchValue: string) {
  this.userService.getName(searchValue).subscribe((result: object) => {
    this.users = result;
  });
}
</code>```

Title: Search API data in Ionic 4

Body:
You only show your button when you have a result. So we could change you code like the example below. When the value is changed in the searchbar, your names are requested in the userService. When the value returns in results, an item is shown below the searchbar.

You don't really need a button to search, because the function is executed when the value of the searchbar changes. If you want a button, then you can delete the ionChange event and get the value when you click your search button.

This is just an example to represent how you could do this. You can modify this for your own needs or think of another way to achieve your goals.

<ion-grid>
  <ion-row>
    <ion-col size-xs="12" size-sm="12" size-md="8" size-lg="8">
      <ion-searchbar placeholder="Restaurant" (ionChange)="searchName($event.target.value)"></ion-searchbar>
    </ion-col>
  </ion-row>
  <ion-row>
    <ion-col>
      <ion-item routerLink="['/', 'details', item.reid]" *ngFor="let item of (results | async)">
        {{ item.name }}
      </ion-item>
    </ion-col>
  </ion-row>
</ion-grid>

searchName(searchValue: string) {
  this.userService.getName(searchValue).subscribe((result: object) => {
    this.users = result;
  });
}


问:
Empty IQueryable that implements IAsyncEnumerable
I am looking for an empty IQueryable<T> that implements IAsyncEnumerable<T>. My current code does not work because empty Enumerable does not implement IAsyncEnumerable<T>. Thanks for any help or hint.

I have the following design:

```<code>var result = Enumerable.Empty<Foo>().AsQueryable();  // Not working!

if (condition1)
{
    IQueryable<Foo> part1 = ....;

    result = result.Concat(part1);
}

if (condition2)
{
    IQueryable<Foo> part2 = ....;

    result = result.Concat(part2);
}

return await result.ToListAsync();
</code>```

Error message:

```<code>The source IQueryable doesn't implement IAsyncEnumerable<Foo>. Only sources that implement IAsyncEnumerable can be used for Entity Framework asynchronous operations.
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.AsAsyncEnumerable[TSource](IQueryable`1 source)
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
</code>```

答:
Use the nuget package System.Linq.Async to get the ToAsyncEnumerable() method:

```<code>private static async Task<List<Foo>> GetList()
{
    var result = Enumerable.Empty<Foo>().AsQueryable();

    if (true)
    {
        IQueryable<Foo> part1 = new List<Foo> { new Foo() }.AsQueryable();
        result = result.Concat(part1);
    }

    if (true)
    {
        IQueryable<Foo> part2 = new List<Foo> { new Foo(), new Foo() }.AsQueryable();
        result = result.Concat(part2);
    }

    return await result.ToAsyncEnumerable().ToListAsync();
}
</code>```

Body:
I am looking for an empty IQueryable<T> that implements IAsyncEnumerable<T>. My current code does not work because empty Enumerable does not implement IAsyncEnumerable<T>. Thanks for any help or hint.

I have the following design:

var result = Enumerable.Empty<Foo>().AsQueryable();  // Not working!

if (condition1)
{
    IQueryable<Foo> part1 = ....;

    result = result.Concat(part1);
}

if (condition2)
{
    IQueryable<Foo> part2 = ....;

    result = result.Concat(part2);
}

return await result.ToListAsync();

Error message:

The source IQueryable doesn't implement IAsyncEnumerable<Foo>. Only sources that implement IAsyncEnumerable can be used for Entity Framework asynchronous operations.
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.AsAsyncEnumerable[TSource](IQueryable`1 source)
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)

Body:
Use the nuget package System.Linq.Async to get the ToAsyncEnumerable() method:

private static async Task<List<Foo>> GetList()
{
    var result = Enumerable.Empty<Foo>().AsQueryable();

    if (true)
    {
        IQueryable<Foo> part1 = new List<Foo> { new Foo() }.AsQueryable();
        result = result.Concat(part1);
    }

    if (true)
    {
        IQueryable<Foo> part2 = new List<Foo> { new Foo(), new Foo() }.AsQueryable();
        result = result.Concat(part2);
    }

    return await result.ToAsyncEnumerable().ToListAsync();
}


问:
hyperledger fabric 2.0.0 fabcar running issue
I have installed hyperledger fabric 2.0.0. When I try to run the fabcar example, I am getting an error like this "Error: error getting endorser client for channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: context deadline exceeded".

When I checked in docker logs using docker logs peer0.org1.example.com, It shows warning "Retrying couchdb request in 250ms. Error:Get http://couchdb0:5984/: dial tcp 172.22.0.8:5984: connect: connection refused".

I pruned all the docker images,volumes and networks and installed again. I have tried adding dns search in .yml files. And tried checking docker network inspect, but nothing resolves.

答:
Add this configuration

```<code>dns_search: .

</code>```

to the peer containers in your docker-compose.yaml file.

for more info check this answer:

Error starting hyperledger fabcar sample application

Body:
Add this configuration

dns_search: .

to the peer containers in your docker-compose.yaml file.

for more info check this answer:

Error starting hyperledger fabcar sample application


问:
Mvc 3 Image Upload Gallery
I have implemented a file upload for images using ASP.NET Mvc 3 and the Microsoft.Web.Helpers NuGet package. The implementation is quit simple as it allows you to browse for a file and upload it to a specified directory.

Here is what I have for my image upload solution using ASP.NET MVC 3 and the Microsoft.Web.Helpers NuGet plugin.

Now the ViewModel code

```<code> namespace MvcImageUpload.Models {
    public class ImageUploadViewModel {
        [UIHint("UploadedImage")]
        public string ImageUrl { get; set; }
        public string ImageAltText { get; set; }
    }
}
</code>```

Now for the controller I've simply dropped this into the Home controller, since this is just a mock project to get it working. I just added an ActionResult which takes an ImageUploadViewModel as a parameter.

```<code>      public ActionResult Upload(ImageUploadViewModel model) {
        var image = WebImage.GetImageFromRequest();

        if (image != null) {
            if (image.Width > 500) {
                image.Resize(500, ((500 * image.Height) / image.Width));
            }

            var filename = Path.GetFileName(image.FileName);
            image.Save(Path.Combine("../Uploads/Images", filename));
            filename = Path.Combine("~/Uploads/Images", filename);

                model.ImageUrl = Url.Content(filename);
                model.ImageAltText = image.FileName.Substring(0, image.FileName.Length - 4);

        }

        return View("Index", model);
    }
</code>```

My view for the uploading of images is simple, it has an Html.BeginForm, which handles the Post form method and has the encoding type set to be "multipart/form-data".

Then using The Microsoft.Web.Helpers.FileUpload helper, I request an image from the HTTP post and then display it using a custom DisplayFor template, called ImageViewer.

```<code> @model MvcImageUpload.Models.ImageUploadViewModel
    @using Microsoft.Web.Helpers;
    @{
        ViewBag.Title = "Index";
     }

    <h2>Image Uploader</h2>
    @using (Html.BeginForm("Upload", "Home", FormMethod.Post,
        new { @encType = "multipart/form-data" })) {
        @FileUpload.GetHtml(initialNumberOfFiles: 1, allowMoreFilesToBeAdded: false,
            includeFormTag: false, addText: "Add Files", uploadText: "Upload File") <br />

        <input type="submit" name="submit"
               value="Upload Image" text="Upload Images"
               style="font-size: .9em;" />
        @Html.DisplayFor(x => x, "ImageViewer")<br />
    }
</code>```

Here is what the custom DisplayTemplate looks like

```<code>    @model MvcImageUpload.Models.ImageUploadViewModel
@if (Model != null) {
    <h4 style="color:Green;">Upload Success!</h4>
    <p>
        Alt Text has been set to <strong>@Model.ImageAltText</strong>
    </p>
    <img  style="padding: 20px;"
        src="@(String.IsNullOrEmpty(Model.ImageUrl) ? "" : Model.ImageUrl)"
            id="uploadedImage"  alt="@Model.ImageAltText"/>
}
</code>```

This all works and the image gets successfully uploaded to the /Uploads/Images/FileName.extension on the form post.

My question

How can I now have another view to display all the images in that directory, paged and be able to select and delete and image, from the view and the directory?

Also I know the Microsoft.Web.Helpers.FileUpload, supports uploading of multiple files, but I can't find how to implement this with my current solution. Any help would be greatly appriceated.

答:
what you are asking about looks rather implementation to me then any query....

to Display:
Fetch all images from your Uploads/Images directory through DirectoryInfo... you can search a directory based on some extension and then it will give you a result set which you can iterate.....

Create a view that will display all records as Image links and in controller fetch the resultset to that View.... Bind those records as you want them to display in your VIEW...

```<code>System.IO.DirectoryInfo info = new System.IO.DirectoryInfo("your directory path");
               var filesinfo= info.GetFiles("*.jpg", System.IO.SearchOption.AllDirectories);
               var filenum= filesinfo.GetEnumerator();
               while (filenum.MoveNext())
               {
                   //populate some entity like in your case you have ImageUploadViewModel
               }
</code>```

and you can implement you delete logic using Ajax or through post back depends how you want it....

Asp.net MVC Views following this tutorial and it will let you go through this....

but again what you are asking is more like implementation Code not any issue....

Title: Mvc 3 Image Upload Gallery

Body:
I have implemented a file upload for images using ASP.NET Mvc 3 and the Microsoft.Web.Helpers NuGet package. The implementation is quit simple as it allows you to browse for a file and upload it to a specified directory.

Here is what I have for my image upload solution using ASP.NET MVC 3 and the Microsoft.Web.Helpers NuGet plugin.

Now the ViewModel code

 namespace MvcImageUpload.Models {
    public class ImageUploadViewModel {
        [UIHint("UploadedImage")]
        public string ImageUrl { get; set; }
        public string ImageAltText { get; set; }
    }
}

Now for the controller I've simply dropped this into the Home controller, since this is just a mock project to get it working. I just added an ActionResult which takes an ImageUploadViewModel as a parameter.

      public ActionResult Upload(ImageUploadViewModel model) {
        var image = WebImage.GetImageFromRequest();

        if (image != null) {
            if (image.Width > 500) {
                image.Resize(500, ((500 * image.Height) / image.Width));
            }

            var filename = Path.GetFileName(image.FileName);
            image.Save(Path.Combine("../Uploads/Images", filename));
            filename = Path.Combine("~/Uploads/Images", filename);

                model.ImageUrl = Url.Content(filename);
                model.ImageAltText = image.FileName.Substring(0, image.FileName.Length - 4);

        }

        return View("Index", model);
    }

My view for the uploading of images is simple, it has an Html.BeginForm, which handles the Post form method and has the encoding type set to be "multipart/form-data".

Then using The Microsoft.Web.Helpers.FileUpload helper, I request an image from the HTTP post and then display it using a custom DisplayFor template, called ImageViewer.

 @model MvcImageUpload.Models.ImageUploadViewModel
    @using Microsoft.Web.Helpers;
    @{
        ViewBag.Title = "Index";
     }

Image Uploader

    @using (Html.BeginForm("Upload", "Home", FormMethod.Post,
        new { @encType = "multipart/form-data" })) {
        @FileUpload.GetHtml(initialNumberOfFiles: 1, allowMoreFilesToBeAdded: false,
            includeFormTag: false, addText: "Add Files", uploadText: "Upload File")

        <input type="submit" name="submit"
               value="Upload Image" text="Upload Images"
               style="font-size: .9em;" />
        @Html.DisplayFor(x => x, "ImageViewer")

    }

Here is what the custom DisplayTemplate looks like

    @model MvcImageUpload.Models.ImageUploadViewModel
@if (Model != null) {

Upload Success!

        Alt Text has been set to @Model.ImageAltText

}

This all works and the image gets successfully uploaded to the /Uploads/Images/FileName.extension on the form post.

My question

How can I now have another view to display all the images in that directory, paged and be able to select and delete and image, from the view and the directory?

Also I know the Microsoft.Web.Helpers.FileUpload, supports uploading of multiple files, but I can't find how to implement this with my current solution. Any help would be greatly appriceated.

Body:
what you are asking about looks rather implementation to me then any query....

to Display:
Fetch all images from your Uploads/Images directory through DirectoryInfo... you can search a directory based on some extension and then it will give you a result set which you can iterate.....

Create a view that will display all records as Image links and in controller fetch the resultset to that View.... Bind those records as you want them to display in your VIEW...

System.IO.DirectoryInfo info = new System.IO.DirectoryInfo("your directory path");
               var filesinfo= info.GetFiles("*.jpg", System.IO.SearchOption.AllDirectories);
               var filenum= filesinfo.GetEnumerator();
               while (filenum.MoveNext())
               {
                   //populate some entity like in your case you have ImageUploadViewModel
               }

and you can implement you delete logic using Ajax or through post back depends how you want it....

Asp.net MVC Views following this tutorial and it will let you go through this....

but again what you are asking is more like implementation Code not any issue....


问:
R shiny r-markdown: synchronize zoom in charts
I am creating a flexdashboard with R markdown / shiny.

Assumed the dashboard has two identical scatter plots. Is there a way to synchronize the two charts, if I zoom into one of them? Which is the best package to achieve this and to have it on the flexdashboard?

I tried Plotly. But there I could only synchronize one axis, but not both at the same time. If the charts are vertically oriented it would synchronize the x axis, and if horizontally oriented it would synchronize the y axis.

I am still trying dygraph. I have the impression by grouping the charts, I might be able to synchronize the zoom. Is that right? Would it synchronize both axis at the same time? (Only problem, this is mainly a time series tool, and not meant for scatter plots, i.e. not for data with more than one value per x value. At least this is my impression.)

Is there a package able to handle x and y axis synchronization at the same time? Or did I miss anything with Plotly/dygraph?

Thanks for your help.

答: dygraphs synchronizes only the date range (x axis), if you set the parameter group. To synchronize the y axis you can try to get the zoom callback and to apply the zoom level to the other plot.


问:
Removing specific value from cell of dataframe and shifting the value towards left
I'm working with the pandas data frame. I have unwanted data in some cells. I need to clear that data from specific cells and shift the whole row towards left by one cell. I have tried couple of things but it is not working for me. Here is the example dataframe

```<code>     userId             movieId  ratings  extra
0       1                 500      3.5
1       1                 600      4.5
2       1                www.abcd      700     2.0
3       2                1100      5.0
4       2                1200      4.0
5       3                 600      4.5
6       4                 600      5.0
7       4                1900      3.5
</code>```

Expected Outcome:

```<code>     userId             movieId  ratings   extra
0       1                 500      3.5
1       1                 600      4.5
2       1                 700      2.0
3       2                1100      5.0
4       2                1200      4.0
5       3                 600      4.5
6       4                 600      5.0
7       4                1900      3.5
</code>```

I have tried the following code but it is showing the following error.

```<code>raw = df[f['ratings'].str.contains('www')==True]

#Here I am trying to fix the specific cell value to empty but it shows the following error.
**AttributeError:** 'str' object has no attribute 'at'
df = df.at[raw, 'movieId'] = ' '

#code for shifting the cell value to left
df.iloc[raw,2:-1] = df.iloc[raw,2:-1].shift(-1,axis=1)

</code>```

答:
You can try this:-</p>

```<code>df['movieId'] = pd.to_numeric(df['movieId'], errors='coerce')
df = df.sort_values(by = 'movieId', ascending = 'True')
</code>```

Body:
I'm working with the pandas data frame. I have unwanted data in some cells. I need to clear that data from specific cells and shift the whole row towards left by one cell. I have tried couple of things but it is not working for me. Here is the example dataframe

     userId             movieId  ratings  extra
0       1                 500      3.5
1       1                 600      4.5
2       1                www.abcd      700     2.0
3       2                1100      5.0
4       2                1200      4.0
5       3                 600      4.5
6       4                 600      5.0
7       4                1900      3.5

Expected Outcome:

     userId             movieId  ratings   extra
0       1                 500      3.5
1       1                 600      4.5
2       1                 700      2.0
3       2                1100      5.0
4       2                1200      4.0
5       3                 600      4.5
6       4                 600      5.0
7       4                1900      3.5

I have tried the following code but it is showing the following error.

raw = df[f['ratings'].str.contains('www')==True]

#Here I am trying to fix the specific cell value to empty but it shows the following error.
**AttributeError:** 'str' object has no attribute 'at'
df = df.at[raw, 'movieId'] = ' '

#code for shifting the cell value to left
df.iloc[raw,2:-1] = df.iloc[raw,2:-1].shift(-1,axis=1)

Body:
You can try this:-

df['movieId'] = pd.to_numeric(df['movieId'], errors='coerce')
df = df.sort_values(by = 'movieId', ascending = 'True')


问:
WKWebView won't open social media login popups
I have a WKWebView in my app. Everything is running smooth except the website I show has the social media logon buttons. The problem is, they display (or try to display) a popup where you allow it to have access to your social media account. I have researched this and tried a few things, but none seem to fit. Here is what I tried:

in viewDidLoad, I tried to enable Javascript on the init:

```<code>WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
WKPreferences *thePreferences = [[WKPreferences alloc] init];
thePreferences.javaScriptCanOpenWindowsAutomatically = YES;
thePreferences.javaScriptEnabled = YES;
theConfiguration.preferences = thePreferences;
self.wkWeb = [[WKWebView alloc] initWithFrame:screenRect configuration:theConfiguration];
</code>```

However, this didn't help me. Then I tried to play with the delegates and go that route. I tried playing around with the createWebViewWithConfiguration method, but that seems like overkill because I had to filter out if they are at the login URL then configure a popup and display it. And then this still wasn't working. I also come in here for the if not main frame logic, cancel the request and reload it in the main view, and that is an easy one-line fix where as this was ballooning into 20+ lines.

This seems like a common problem, but I can't seem to find a lot of information out there. Any ideas?

EDIT - Addition

After playing around with Armands answer, I get closer. This is my createWebViewWithConfig method now, which just displays a white screen overlay. It's like I need something to tell the new popup to load the content. Also - I assume I can place this modal window in my current .m file and it doesn't need a completely new file?

```<code>NSURL *url = navigationAction.request.URL;
if(!navigationAction.targetFrame.isMainFrame && [url.absoluteString rangeOfString:@"initiate_"].location != NSNotFound) {
    //open new modal webview
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
    config.processPool = [appDelegate getSharedPool];

    self.popupLogin = [[WKWebView alloc] initWithFrame:self.wkWeb.bounds configuration:config];
    self.popupLogin.frame = CGRectMake(self.wkWeb.frame.origin.x,
                                       self.wkWeb.frame.origin.y,
                                       self.wkWeb.frame.size.width,
                                       self.wkWeb.frame.size.height);
    self.popupLogin.navigationDelegate = self;
    self.popupLogin.UIDelegate = self;
    [webView addSubview:self.popupLogin];
    [self.popupLogin loadRequest:navigationAction.request];
    return nil;
}
</code>```

答:
Swift 4 and Swift 5

Create two instance of WKWebView

```<code>var webView : WKWebView!
var newWebviewPopupWindow: WKWebView?
</code>```

Now implement the methods

```<code>func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
        newWebviewPopupWindow = WKWebView(frame: view.bounds, configuration: configuration)
        newWebviewPopupWindow!.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        newWebviewPopupWindow!.navigationDelegate = self
        newWebviewPopupWindow!.uiDelegate = self
        view.addSubview(newWebviewPopupWindow!)
        return newWebviewPopupWindow!
    }

    func webViewDidClose(_ webView: WKWebView) {
        webView.removeFromSuperview()
        newWebviewPopupWindow = nil
    }
</code>```

Also make sure this string in the Info.plist if your code is still not working.

```<code> <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
</code>```

Body:
I have a WKWebView in my app. Everything is running smooth except the website I show has the social media logon buttons. The problem is, they display (or try to display) a popup where you allow it to have access to your social media account. I have researched this and tried a few things, but none seem to fit. Here is what I tried:

in viewDidLoad, I tried to enable Javascript on the init:

WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
WKPreferences *thePreferences = [[WKPreferences alloc] init];
thePreferences.javaScriptCanOpenWindowsAutomatically = YES;
thePreferences.javaScriptEnabled = YES;
theConfiguration.preferences = thePreferences;
self.wkWeb = [[WKWebView alloc] initWithFrame:screenRect configuration:theConfiguration];

However, this didn't help me. Then I tried to play with the delegates and go that route. I tried playing around with the createWebViewWithConfiguration method, but that seems like overkill because I had to filter out if they are at the login URL then configure a popup and display it. And then this still wasn't working. I also come in here for the if not main frame logic, cancel the request and reload it in the main view, and that is an easy one-line fix where as this was ballooning into 20+ lines.

This seems like a common problem, but I can't seem to find a lot of information out there. Any ideas?

EDIT - Addition

After playing around with Armands answer, I get closer. This is my createWebViewWithConfig method now, which just displays a white screen overlay. It's like I need something to tell the new popup to load the content. Also - I assume I can place this modal window in my current .m file and it doesn't need a completely new file?

NSURL *url = navigationAction.request.URL;
if(!navigationAction.targetFrame.isMainFrame && [url.absoluteString rangeOfString:@"initiate_"].location != NSNotFound) {
    //open new modal webview
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
    config.processPool = [appDelegate getSharedPool];

    self.popupLogin = [[WKWebView alloc] initWithFrame:self.wkWeb.bounds configuration:config];
    self.popupLogin.frame = CGRectMake(self.wkWeb.frame.origin.x,
                                       self.wkWeb.frame.origin.y,
                                       self.wkWeb.frame.size.width,
                                       self.wkWeb.frame.size.height);
    self.popupLogin.navigationDelegate = self;
    self.popupLogin.UIDelegate = self;
    [webView addSubview:self.popupLogin];
    [self.popupLogin loadRequest:navigationAction.request];
    return nil;
}

Body:
Swift 4 and Swift 5

Create two instance of WKWebView

var webView : WKWebView!
var newWebviewPopupWindow: WKWebView?

Now implement the methods

func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
        newWebviewPopupWindow = WKWebView(frame: view.bounds, configuration: configuration)
        newWebviewPopupWindow!.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        newWebviewPopupWindow!.navigationDelegate = self
        newWebviewPopupWindow!.uiDelegate = self
        view.addSubview(newWebviewPopupWindow!)
        return newWebviewPopupWindow!
    }

    func webViewDidClose(_ webView: WKWebView) {
        webView.removeFromSuperview()
        newWebviewPopupWindow = nil
    }

Also make sure this string in the Info.plist if your code is still not working.

 <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>


问:
What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?
What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?

In my opinion, 'VALID' means there will be no zero padding outside the edges when we do max pool.

According to A guide to convolution arithmetic for deep learning, it says that there will be no padding in pool operator, i.e. just use 'VALID' of tensorflow.
But what is 'SAME' padding of max pool in tensorflow?

答:
Tensorflow 2.0 Compatible Answer: Detailed Explanations have been provided above, about "Valid" and "Same" Padding.

However, I will specify different Pooling Functions and their respective Commands in Tensorflow 2.x (>= 2.0), for the benefit of the community.

Functions in 1.x:

tf.nn.max_pool

tf.keras.layers.MaxPool2D

Average Pooling => None in tf.nn, tf.keras.layers.AveragePooling2D

Functions in 2.x:

tf.nn.max_pool if used in 2.x and tf.compat.v1.nn.max_pool_v2 or tf.compat.v2.nn.max_pool, if migrated from 1.x to 2.x.

tf.keras.layers.MaxPool2D if used in 2.x and

tf.compat.v1.keras.layers.MaxPool2D or tf.compat.v1.keras.layers.MaxPooling2D or  tf.compat.v2.keras.layers.MaxPool2D or tf.compat.v2.keras.layers.MaxPooling2D, if migrated from 1.x to 2.x.

Average Pooling => tf.nn.avg_pool2d or tf.keras.layers.AveragePooling2D if used in TF 2.x and

tf.compat.v1.nn.avg_pool_v2 or tf.compat.v2.nn.avg_pool or tf.compat.v1.keras.layers.AveragePooling2D or tf.compat.v1.keras.layers.AvgPool2D or tf.compat.v2.keras.layers.AveragePooling2D or tf.compat.v2.keras.layers.AvgPool2D , if migrated from 1.x to 2.x.

For more information about Migration from Tensorflow 1.x to 2.x, please refer to this Migration Guide.


问:
Make v-select html conversion
I use axios to send data to v-select, but the content is in html format.

I want to use v-html to convert text but it is unsuccessful.

```<code><v-select
 :items="quizs"
 item-text="questiontext"
 item-value="id"
 v-model="quizid"
></v-select>
</code>```

答:
You could use template inside v-select for your custom display. Then use v-html to decode html tags as below :</p>

```<code><v-select :items='quizs' v-model="quizid">
    <template v-slot:item='{item}'>
         <div v-html='item.questiontext'/>
    </template>
    <template v-slot:selection='{item}'>
         <div v-html='item.questiontext'/>
    </template>
</v-select>
</code>```

Title: Make v-select html conversion

Body:
I use axios to send data to v-select, but the content is in html format.

I want to use v-html to convert text but it is unsuccessful.

<v-select
 :items="quizs"
 item-text="questiontext"
 item-value="id"
 v-model="quizid"
></v-select>

Body:
You could use template inside v-select for your custom display. Then use v-html to decode html tags as below :

<v-select :items='quizs' v-model="quizid">
    <template v-slot:item='{item}'>
         <div v-html='item.questiontext'/>
    </template>
    <template v-slot:selection='{item}'>
         <div v-html='item.questiontext'/>
    </template>
</v-select>


问:
Filter Condition not applying to total
I've created a report and want to filter the table down by a category. I've added the formula to filter the table and it works but doesn't apply to the total for that table. How do I resolve this?

The formula I'm using is below:

```<code><?if:ROLE_='BRANCH'?><?end if?>
</code>```

答:
I suspect the formula you provided is only surrounding fields in the table and you have done nothing to the total?

If you are using the sum function for your total, replace FIELD in the formula below by the name of the field you are summing.

```<code><?sum(FIELD[ROLE_='BRANCH'])?>
</code>```

If you are doing something else, or this doesn't work, please provide more information.

Title: Filter Condition not applying to total

Body:
I've created a report and want to filter the table down by a category. I've added the formula to filter the table and it works but doesn't apply to the total for that table. How do I resolve this?

The formula I'm using is below:

<?if:ROLE_='BRANCH'?><?end if?>

Body:
I suspect the formula you provided is only surrounding fields in the table and you have done nothing to the total?

If you are using the sum function for your total, replace FIELD in the formula below by the name of the field you are summing.

<?sum(FIELD[ROLE_='BRANCH'])?>

If you are doing something else, or this doesn't work, please provide more information.