text:
Q: Distribute N items in K sets with minimum overlap I am working on an optimization problem to distribute N distinct items (each of the items is available in infinite quantity), among K sets. Each set should have T items. (The constraint of T can be relaxed as atleast T and atmost T+d)
Objective function is to minimize the sum of pairwise overlap between the sets.
My first approach was to model this as Integer/Linear Programming, but I am unable to model the set overlap constraint.
Could some one please suggest how to approach this problem?
Thanks

A: I am wondering about a greedy algorithm where we 'deal out' items to sets one at a time.  So set 1 gets an item, then set 2 gets an item, and so on.  At each step we choose the least used item that can go into the set (we have to avoid putting the same item into a set more than once, unless we are allowed to go to multisets).  Any time we put an item in a set that is in $t$ other sets already, our overlap sum increases by $t$, but with this algorithm, at least at each step, you are minimizing the additional overlap at that step.


text:
Q: Issue in adding resource to registry path in wso2 APIM I am using WSO2 APIM 2.5.0 and WSo2 IS 5.6.0 and they are well integrated and token management is working fine without issue.
I am now trying to add API using REST API to APIM server and I am getting below error:
TID: [-1234] [] [2019-04-26 10:56:29,403] ERROR {org.wso2.carbon.governance.api.common.GovernanceArtifactManager} -  Failed to add artifact: artifact id: a2bfc1b1-f5ec-4316-b7d6-9e7d54e0213b. Unable to put resource Failed to add resource to path /_system/governance/apimgt/applicationdata/provider/user@user.com/verificationAPI. String or binary data would be truncated. {org.wso2.carbon.governance.api.common.GovernanceArtifactManager}
org.wso2.carbon.registry.core.exceptions.RegistryException: Unable to put resource Failed to add resource to path /_system/governance/apimgt/applicationdata/provider/user@user.com/verificationAPI. String or binary data would be truncated.
    at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.put(MountHandler.java:299)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.put(HandlerManager.java:2503)
    at org.wso2.carbon.registry.core.jdbc.handlers.UserDefinedHandlerManager.put(UserDefinedHandlerManager.java:205)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.put(HandlerLifecycleManager.java:949)
    at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.put(EmbeddedRegistry.java:705)
    at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.put(CacheBackedRegistry.java:591)
    at org.wso2.carbon.registry.core.session.UserRegistry.putInternal(UserRegistry.java:828)
    at org.wso2.carbon.registry.core.session.UserRegistry.access$1000(UserRegistry.java:61)
    at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:804)
    at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:801)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.wso2.carbon.registry.core.session.UserRegistry.put(UserRegistry.java:801)
    at org.wso2.carbon.governance.api.common.GovernanceArtifactManager.addGovernanceArtifact(GovernanceArtifactManager.java:221)
    at org.wso2.carbon.governance.api.generic.GenericArtifactManager.addGenericArtifact(GenericArtifactManager.java:208)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.createAPI(APIProviderImpl.java:2600)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.addAPI(APIProviderImpl.java:672)
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.addAPI(UserAwareAPIProvider.java:59)
    at org.wso2.carbon.apimgt.rest.api.publisher.impl.ApisApiServiceImpl.apisPost(ApisApiServiceImpl.java:295)
    at org.wso2.carbon.apimgt.rest.api.publisher.ApisApi.apisPost(ApisApi.java:577)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:192)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:191)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:80)
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:91)
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:60)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
    at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
    at org.wso2.carbon.event.receiver.core.internal.tenantmgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:48)
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1734)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.wso2.carbon.registry.core.exceptions.RegistryException: Failed to add resource to path /_system/governance/apimgt/applicationdata/provider/user@user.com/verificationAPI. String or binary data would be truncated.
    at org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO.addResourceWithoutContentId(JDBCResourceDAO.java:1404)
    at org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO.add(JDBCResourceDAO.java:448)
    at org.wso2.carbon.registry.core.jdbc.Repository.addEmptyCollection(Repository.java:1198)
    at org.wso2.carbon.registry.core.jdbc.Repository.addEmptyCollection(Repository.java:1156)
    at org.wso2.carbon.registry.core.jdbc.Repository.add(Repository.java:1013)
    at org.wso2.carbon.registry.core.jdbc.Repository.put(Repository.java:305)
    at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.put(EmbeddedRegistry.java:717)
    at org.wso2.carbon.registry.core.session.UserRegistry.putInternal(UserRegistry.java:828)
    at org.wso2.carbon.registry.core.session.UserRegistry.access$1000(UserRegistry.java:61)
    at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:804)
    at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:801)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.wso2.carbon.registry.core.session.UserRegistry.put(UserRegistry.java:801)
    at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.put(MountHandler.java:292)
    ... 70 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1655)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:440)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:385)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:191)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:166)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:328)
    at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
    at com.sun.proxy.$Proxy19.executeUpdate(Unknown Source)
    at org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO.addResourceWithoutContentId(JDBCResourceDAO.java:1385)
    ... 83 more
TID: [-1234] [] [2019-04-26 10:56:29,413] ERROR {org.wso2.carbon.apimgt.impl.UserAwareAPIProvider} -  Error while performing registry transaction operation {org.wso2.carbon.apimgt.impl.UserAwareAPIProvider}
org.wso2.carbon.governance.api.exception.GovernanceException: Failed to add artifact: artifact id: a2bfc1b1-f5ec-4316-b7d6-9e7d54e0213b. Unable to put resource Failed to add resource to path /_system/governance/apimgt/applicationdata/provider/user@user.com/verificationAPI. String or binary data would be truncated.
    at org.wso2.carbon.governance.api.common.GovernanceArtifactManager.addGovernanceArtifact(GovernanceArtifactManager.java:252)
    at org.wso2.carbon.governance.api.generic.GenericArtifactManager.addGenericArtifact(GenericArtifactManager.java:208)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.createAPI(APIProviderImpl.java:2600)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.addAPI(APIProviderImpl.java:672)
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.addAPI(UserAwareAPIProvider.java:59)
    at org.wso2.carbon.apimgt.rest.api.publisher.impl.ApisApiServiceImpl.apisPost(ApisApiServiceImpl.java:295)
    at org.wso2.carbon.apimgt.rest.api.publisher.ApisApi.apisPost(ApisApi.java:577)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:192)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:191)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:80)
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:91)
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:60)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
    at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
    at org.wso2.carbon.event.receiver.core.internal.tenantmgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:48)
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1734)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.wso2.carbon.registry.core.exceptions.RegistryException: Unable to put resource Failed to add resource to path /_system/governance/apimgt/applicationdata/provider/user@user.com/verificationAPI. String or binary data would be truncated.
    at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.put(MountHandler.java:299)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.put(HandlerManager.java:2503)
    at org.wso2.carbon.registry.core.jdbc.handlers.UserDefinedHandlerManager.put(UserDefinedHandlerManager.java:205)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.put(HandlerLifecycleManager.java:949)
    at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.put(EmbeddedRegistry.java:705)
    at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.put(CacheBackedRegistry.java:591)
    at org.wso2.carbon.registry.core.session.UserRegistry.putInternal(UserRegistry.java:828)
    at org.wso2.carbon.registry.core.session.UserRegistry.access$1000(UserRegistry.java:61)
    at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:804)
    at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:801)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.wso2.carbon.registry.core.session.UserRegistry.put(UserRegistry.java:801)
    at org.wso2.carbon.governance.api.common.GovernanceArtifactManager.addGovernanceArtifact(GovernanceArtifactManager.java:221)
    ... 58 more
Caused by: org.wso2.carbon.registry.core.exceptions.RegistryException: Failed to add resource to path /_system/governance/apimgt/applicationdata/provider/user@user.com/verificationAPI. String or binary data would be truncated.
    at org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO.addResourceWithoutContentId(JDBCResourceDAO.java:1404)
    at org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO.add(JDBCResourceDAO.java:448)
    at org.wso2.carbon.registry.core.jdbc.Repository.addEmptyCollection(Repository.java:1198)
    at org.wso2.carbon.registry.core.jdbc.Repository.addEmptyCollection(Repository.java:1156)
    at org.wso2.carbon.registry.core.jdbc.Repository.add(Repository.java:1013)
    at org.wso2.carbon.registry.core.jdbc.Repository.put(Repository.java:305)
    at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.put(EmbeddedRegistry.java:717)
    at org.wso2.carbon.registry.core.session.UserRegistry.putInternal(UserRegistry.java:828)
    at org.wso2.carbon.registry.core.session.UserRegistry.access$1000(UserRegistry.java:61)
    at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:804)
    at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:801)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.wso2.carbon.registry.core.session.UserRegistry.put(UserRegistry.java:801)
    at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.put(MountHandler.java:292)
    ... 70 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1655)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:440)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:385)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:191)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:166)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:328)
    at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
    at com.sun.proxy.$Proxy19.executeUpdate(Unknown Source)
    at org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO.addResourceWithoutContentId(JDBCResourceDAO.java:1385)
    ... 83 more
TID: [-1234] [] [2019-04-26 10:56:29,415] ERROR {org.wso2.carbon.apimgt.rest.api.publisher.impl.ApisApiServiceImpl} -  Error while adding new API : user@user.com-verificationAPI-1.0.0 - Error while performing registry transaction operation {org.wso2.carbon.apimgt.rest.api.publisher.impl.ApisApiServiceImpl}
org.wso2.carbon.apimgt.api.APIManagementException: Error while performing registry transaction operation
    at org.wso2.carbon.apimgt.impl.AbstractAPIManager.handleException(AbstractAPIManager.java:1617)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.createAPI(APIProviderImpl.java:2666)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.addAPI(APIProviderImpl.java:672)
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.addAPI(UserAwareAPIProvider.java:59)
    at org.wso2.carbon.apimgt.rest.api.publisher.impl.ApisApiServiceImpl.apisPost(ApisApiServiceImpl.java:295)
    at org.wso2.carbon.apimgt.rest.api.publisher.ApisApi.apisPost(ApisApi.java:577)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:192)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:191)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:80)
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:91)
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:60)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
    at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
    at org.wso2.carbon.event.receiver.core.internal.tenantmgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:48)
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1734)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.wso2.carbon.governance.api.exception.GovernanceException: Failed to add artifact: artifact id: a2bfc1b1-f5ec-4316-b7d6-9e7d54e0213b. Unable to put resource Failed to add resource to path /_system/governance/apimgt/applicationdata/provider/user@user.com/verificationAPI. String or binary data would be truncated.
    at org.wso2.carbon.governance.api.common.GovernanceArtifactManager.addGovernanceArtifact(GovernanceArtifactManager.java:252)
    at org.wso2.carbon.governance.api.generic.GenericArtifactManager.addGenericArtifact(GenericArtifactManager.java:208)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.createAPI(APIProviderImpl.java:2600)
    ... 56 more
Caused by: org.wso2.carbon.registry.core.exceptions.RegistryException: Unable to put resource Failed to add resource to path /_system/governance/apimgt/applicationdata/provider/user@user.com/verificationAPI. String or binary data would be truncated.
    at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.put(MountHandler.java:299)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.put(HandlerManager.java:2503)
    at org.wso2.carbon.registry.core.jdbc.handlers.UserDefinedHandlerManager.put(UserDefinedHandlerManager.java:205)
    at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:804)
    at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:801)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.wso2.carbon.registry.core.session.UserRegistry.put(UserRegistry.java:801)
    at org.wso2.carbon.governance.api.common.GovernanceArtifactManager.addGovernanceArtifact(GovernanceArtifactManager.java:221)
    ... 58 more
Caused by: org.wso2.carbon.registry.core.exceptions.RegistryException: Failed to add resource to path /_system/governance/apimgt/applicationdata/provider/user@user.com/verificationAPI

Seems like when I am trying to add API in APIM (using correct token), I am getting error which says that it cannot add user@user.com in registry path(/_system/governance/apimgt/applicationdata/provider/...).
Can some one please help me
Thanks

A: Increase the varchar limit of REG_CREATOR & REG_LAST_UPDATOR from REG_RESOURCE table.
After doing this, stop the WSO2 delete the /solr directory from <APIM_HOME> (it's your wso2 directory as /var/opt/WSO2AM-2.5.0) & start the WSO2.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I specify seperators using QDockWidget? I have the following example code:
from PyQt5 import QtWidgets, QtCore, QtGui
import sys

class MainWindow(QtWidgets.QMainWindow):

    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent=parent)
        self.bgcolor = self.palette().color(self.backgroundRole()).name()

        self.central = QtWidgets.QTextEdit(self)
        self.central.setText('this is the central widget')
        self.setCentralWidget(self.central)
        self.setDockOptions(self.AnimatedDocks) #prevent tabbing

        self.rightDock = QtWidgets.QDockWidget('right dock', self)
        self.rightDock.setAllowedAreas(QtCore.Qt.RightDockWidgetArea)
        self.rightDock.setStyleSheet('QDockWidget::title{text-align:left;background:'+self.bgcolor+';}')

        self.everywhereDock = QtWidgets.QDockWidget('everywhere dock',self)
        self.everywhereDock.setAllowedAreas(QtCore.Qt.BottomDockWidgetArea | QtCore.Qt.TopDockWidgetArea | QtCore.Qt.LeftDockWidgetArea | QtCore.Qt.RightDockWidgetArea)
        self.everywhereDock.setFeatures(QtWidgets.QDockWidget.DockWidgetFloatable | QtWidgets.QDockWidget.DockWidgetMovable)
        self.everywhereDock.setStyleSheet('QDockWidget::title{text-align:left;background:'+self.bgcolor+';}')

        self.dockable = QtWidgets.QTextEdit(self.rightDock)
        self.dockable.setText('this is dockable only on the right')
        self.dockable2 = QtWidgets.QTextEdit(self.everywhereDock)
        self.dockable2.setText('this is dockable everywhere, also its not closable')

        self.rightDock.setWidget(self.dockable)
        self.everywhereDock.setWidget(self.dockable2)

        self.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.rightDock)
        self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.everywhereDock)
        self.setTabPosition(QtCore.Qt.AllDockWidgetAreas, QtWidgets.QTabWidget.North)

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    m = MainWindow()
    m.show()
    sys.exit(app.exec_())

The question is how to insert icons, where the borders between DockWidgetAreas are draggable, so that the user has a hint, that there is this functionality.
To clarify:
I want an icon between the black arrows:

A: The QDockWidget supports a "title widget" which is not a separator, but you can add it into every QDockWidget using QDockWidget::setTitleBarWidget(QWidget *widget).
So you can create a generic QWidget to hold this icon using a QHorizontalLayout or something, and put it into the title bar. The default mouse events handled by Qt (such as the drag events) should continue to works normally and you have a customizable title bar.
self.rightDock = QtWidgets.QDockWidget('right dock', self)
self.rightDock.setAllowedAreas(QtCore.Qt.RightDockWidgetArea)

// add custom title widget
self.rightDock.setTitleBarWidget(self.titleWidget)
// add widget to dock widget
self.rightDock.setWidget(self.dockable)

self.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.rightDock)


text:
Q: 404: Q1 2022 Community team roadmap not found Since we are now on our way into the second month of the Q2 of 2022, it is time to address the elephant in the room: where is the Q1 2022 Community team roadmap? It hasn't been published on the blog; it hasn't been announced via a post with the roadmap tag; there hasn't been an MSE Feedback post by the VP of Community.
On a related note... Where's the Q2 2022 roadmap?


text:
Q: onClickListener in onActivityResult doesn't working I have two activities, in first I have button Add, and by click on this button I send intent to second activity. In second activity, I have two EditText views and Save button, after pressing save I return to first activity and create in onActivityResult function TextView and two buttons - edit and go. When I press these buttons, nothing happens.
This is my code:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if(requestCode == AddingRecipe)
    {
        if(resultCode == RESULT_OK)
        {
            LinearLayout ll2 = new LinearLayout(this);
            ll2.setOrientation(LinearLayout.HORIZONTAL);
            TextView tv = new TextView(this);
            tv.setId(id);
            tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            String disease = data.getStringExtra(AddEditRecipesActivity.Disease);
            String doctor = data.getStringExtra(AddEditRecipesActivity.Doctor);
            tv.setText(disease +"\nВрач: "+ doctor);
            ll2.addView(tv);
            ImageButton edit = new ImageButton(this);
            edit.setId(id);
            edit.setClickable(true);
            edit.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    ViewGroup parent = (ViewGroup)LayoutInflater.from(RecipesActivity.this).inflate(R.layout.activity_recipes, null);
                    for (int i = 0; i < parent.getChildCount(); i++) {
                        View child = parent.getChildAt(i);
                        if(child.getClass() == TextView.class && child.getId() == v.getId())
                        {
                        TextView tv2 = (TextView)child;
                        Intent i3 = new Intent(RecipesActivity.this, AddEditRecipesActivity.class);
                        i3.addFlags(EditingRecipe);
                        i3.putExtra(EditRecipe, tv2.getText().toString());
                        startActivityForResult(i3, EditingRecipe);
                        }
                    }
                }
            });
            edit.setBackgroundResource(R.drawable.edit);
            ll2.addView(edit);
            id = id + 1;
            ImageButton go = new ImageButton(this);
            go.setId(id);
            go.setClickable(true);
            go.setBackgroundResource(R.drawable.go);
            go.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    ViewGroup parent = (ViewGroup)LayoutInflater.from(RecipesActivity.this).inflate(R.layout.activity_recipes, null);
                    for (int i = 0; i < parent.getChildCount(); i++) {
                        View child = parent.getChildAt(i);
                        if(child.getClass() == TextView.class && child.getId() == v.getId())
                        {
                        TextView tv2 = (TextView)child;
                        Intent i3 = new Intent(RecipesActivity.this, MedicineActivity.class);
                        i3.putExtra(ShowRecipe, tv2.getId());
                        RecipesActivity.this.startActivity(i3);
                        }
                    }
                }
            });
            id = id + 1;
            ll2.addView(go);
            ll.addView(ll2);
        }
    }
}

What is my mistake? When I put onClickListener from function to onClick, my application crashes.
Thanks.
Updated: Debugger stepped into OnClick function. Maybe a problem in a loop in OnClick function. I identify my TextView and edit button with a same Id, and in a loop, I searching my TextView in all views of Activity with button id. And then it go to second activity again for edit data in TextView. But I can't understand, what's wrong with it.


text:
Q: Troubleshooting of JavaScript/JQuery code with .show() and .hide() functionality I'm building a web-page that has header and footer that stay the same and two alternative groups of elements that will replace each other as a user navigates the site. Web page is being built with JavaScript, JQuery, Bootstrap.
Here are an extremely simplified index.html and the exact copy of my JavaScript/ JQuery functions:
<!DOCTYPE html>

        <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">

        Header

            <form role="search">

                    <input type="text" class="form-control" placeholder="Main text field" id="main_input">

                <button type="submit" class="btn btn-default" id="main_search" onclick="OpenSearchScreen()">Switch to Search</button>
            </form>

We are in Main

We are in Search

        Footer

// hides parts of Home screen
// shows Search screen
function OpenSearchScreen() {
    // hide Main components
    $("[id^='main']").hide();

    // reveal Search components
    $("[id^='search']").show();
}

// hides Search screen
// shows Home screen
function OpenHomeScreen() {
    // hide Search components
    $("[id^='search']").hide();

    // reveal Main components
    $("[id^='main']").show();
}

The above HTML + JS combination does not work: it briefly shows Search and then reverts back to Main.
As I indicated in the comments, if I remove the form and just put in a regular (stand-alone) button with the same onclick setting, everything works as expected: when I press the button Main switches to Search and stays as such.
I have the following two questions/requests:

*

*If you know why it's happening please enlighten me. If have an idea how it can be fixed / worked around please share it with me as well.

*If you can suggest how I can further troubleshoot the problem please do. I'm completely at loss how to proceed, since I can seemingly debug (via Chrome Dev Tools) the JS part only. As soon as the program gets past OpenSearchScreen function and then exits form element I can no longer track its progress.

A: You're using a submit button and not preventing it's default behaviour, hence why it's submitting the form and you're only seeing the change for a split second before the form is submitted.
Instead, you could use something like:
<button type="submit" class="btn btn-default" id="main_search" onclick="OpenSearchScreen(); return false;">
   Switch to Search
</button>

jsFiddle here
Or better yet, remove all the inline JS and handle that externally.


text:
Q: Visual studio test task configuration with single build agent and multiple test machines Lately two tasks became deprecated in vsts: Deploy TestAgent and Run Functional Tests.
Both allowed to specify list of machines where tests would be run and use single build agent.
Now there is Visual Studio Test instead and I am trying to find a solution to keep tests being distributed to multiple test machines with single build agent.
Related tests are ui based.
Browsing msdn blogs contain some suggestions but so far did not helped me to find consistent solution.
Please help?
Links that I tried:
https://blogs.msdn.microsoft.com/devops/2017/03/26/vstest-task-dons-a-new-avatar-testing-with-unified-agents-and-phases/
How do I run tests remotely with VS2015?
https://github.com/Microsoft/vsts-tasks/issues/1410
https://blogs.msdn.microsoft.com/devops/2016/10/10/parallel-test-execution/
https://blogs.msdn.microsoft.com/devops/2016/06/21/remote-testing-distributing-tests-based-on-number-of-machines/
https://blogs.msdn.microsoft.com/devops/2015/05/29/testing-in-continuous-integration-and-continuous-deployment-workflows/
https://blogs.msdn.microsoft.com/allendm/2015/07/20/remote-test-execution-using-team-foundation-server-2015-rc2-and-beyond/

A: No, you need to register multiple build agent in these machines (Deployment Groups uses the build agent too and can use in Deployment group phase)
With single build agent, you can use old way even though the tasks are deprecated, you may refer to the source code of DeployVisualStudioTestAgent and RunDistributedTests to build a custom task extension.

A: Like starian chen said, the two tasks have been replaced but you can accomplish nearly all of the same functionality with the new tasks.  Having the unified agent to handle builds, releases, and test execution does simplify some challenges of deprecated tasks such as copying the files and getting the build agent to communicate via WinRM.  I just wrote a blog post on this.  My next post will cover scaling out multiple machines and doing cross browser testing like you are asking about.
http://www.deliveron.com/blog/configuring-ui-test-agents-using-visual-studio-test-task-vsts/
Is there any reason you can't install a build agent on each of your test agent VMs?  Be sure to put them into their own Agent Queue/Pool.


text:
Q: Decidability of matrix problem in ${\mathbb Z}/p{\mathbb Z}$ Let $p$ be a prime number, $n$ be a positive integer, and let ${\mathbb Z}_p^{n\times n}$ denote the set of $n\times n$-matrices over ${\mathbb Z}/p{\mathbb Z}$.
Suppose we are given an integer $m>0$ and matrices ${\bf A}_1,\ldots, {\bf A}_m\in {\mathbb Z}_p^{n\times n}.$ I am looking at the following problem: if there are positive integers $n_1,\ldots n_m$ such that $${\bf A}_1^{n_1}{\bf A}_2^{n_2}\cdots{\bf A}_m^{n_m} = {\bf 0},$$ output YES, otherwise output NO.
Is this problem decidable for all primes $p$, for all sizes of matrixes $n\times n$, and for all numbers of input matrices $m\in\mathbb{N}$?

A: Yes. If we conider the sequence $A_i^n$, because it is a sequence inside a finite set, it must eventually repeat. After it repeats, the sequence won't take any new values, so we can assume $n_i$ is less than this first repetition. This means that there are only finitely many possibilities, which of course reduces the problem to a finite calculation.

A: Even more is decidable: we may get a list of all possible spaces which are images of the operator $A_1^{n_1}\dots A_m^{n_m}$.
Induction in $m$. Base $m=1$. Consider the spaces $X_k=A^k(\mathbb{Z}_p^n)$. Two of them coincide, since they take only finitely many possible values (and we know an a priori estimate for this number), and if $X_k=X_l$, $k<l$, we have $X_{k+1}=X_{l+1}$ and so on, thus the list of possible spaces is $\{X_0,\dots,X_{l-1}\}$.
Induction step is the same.


text:
Q: How to lock a choice option in Symofny form's select field In my form type for adding entities, I need to lock one option so that a user can change all fields but not the one locked.
Here is my code:
        ->add('network', 'entity', array(
            'class' => 'AcmeBundle:Network',
            'data' => $options['current_network'],
            'disabled' => true,
        ))

$options['current_network'] sets the option in the filed to the expected value. With 'disabled' => true, the field is also locked as expected.
However, when I submit the form, this field is not submitted and Symfony throws  the erros

Integrity constraint violation: 1048 Column 'network_id' cannot be
  null

This is correct, network_id should not be null.
How can I make this field be locked to the value present in $options['current_network'], but still be submitted with the form?

A: You can just remove it from the form and set it at the controller
    ...

    if ($form->isValid()){

       $entity->setNetwork($network); // whatever your network is

       $em->persist($entity);
       $em->flush();
    ...
    }
...

A: You should use readonly instead of disabled. A readonly element is just not editable, but gets sent when the according form submits, a disabled element isn't editable and isn't sent on submit.

A: to do that you need to set the network before binding the form
    $entity = new Entity();
    $entity->setNetwork($network);

    $form->handleRequest($request);

    if ($form->isValid()){
       $em->persist($entity);
       $em->flush();
    }

and at your form :
->add('network', 'entity', array(
        'class' => 'AcmeBundle:Network',
        'disabled' => true,
    ))


text:
Q: vmsplice() and TCP In the original vmsplice() implementation, it was suggested that if you had a user-land buffer 2x the maximum number of pages that could fit in a pipe, a successful vmsplice() on the second half of the buffer would guarantee that the kernel was done using the first half of the buffer.
But that was not true after all, and particularly for TCP, the kernel pages would be kept until receiving ACK from the other side.  Fixing this was left as future work, and thus for TCP, the kernel would still have to copy the pages from the pipe.
vmsplice() has the SPLICE_F_GIFT option that sort-of deals with this, but the problem is that this exposes two other problems - how to efficiently get fresh pages from the kernel, and how to reduce cache trashing.  The first issue is that mmap requires the kernel to clear the pages, and the second issue is that although mmap might use the fancy kscrubd feature in the kernel, that increases the working set of the process (cache trashing).
Based on this, I have these questions:

*

*What is the current state for notifying userland about the safe re-use of pages? I am especially interested in pages splice()d onto a socket (TCP).  Did anything happen during the last 5 years?

*Is mmap / vmsplice / splice / munmap the current best practice for zero-copying in a TCP server or have we better options today?

A: Yes, due to the TCP socket holding on to the pages for an indeterminate time you cannot use the double-buffering scheme mentioned in the example code. Also, in my use case the pages come from circular buffer so I cannot gift the pages to the kernel and alloc fresh pages. I can verify that I am seeing data corruption in the received data.
I resorted to polling the level of the TCP socket's send queue until it drains to 0. This fixes data corruption but is suboptimal because draining the send queue to 0 affects throughput.
n = ::vmsplice(mVmsplicePipe.fd.w, &iov, 1, 0);
while (n) {
    // splice pipe to socket
    m = ::splice(mVmsplicePipe.fd.r, NULL, mFd, NULL, n, 0);
    n -= m;
}

while(1) {
    int outsize=0;
    int result;

    usleep(20000);

    result = ::ioctl(mFd, SIOCOUTQ, &outsize);
    if (result == 0) {
        LOG_NOISE("outsize %d", outsize);
    } else {
        LOG_ERR_PERROR("SIOCOUTQ");
        break;
    }
    //if (outsize <= (bufLen >> 1)) {
    if (outsize == 0) {
        LOG("outsize %d <= %u", outsize, bufLen>>1);
        break;
    }
};


text:
Q: Microsoft test ui automation bug on tabControl There is a bug on test ui automation that it is not able to recognize an element inside a tabControl on Visual Studio 2010
Somebody knows if it is already fixed on VS2012 or if there is a workaround on it??
I will appreciate your answers


text:
Q: How to play audio file from raw/assets folder on the native/default media player? I know i can play an mp3 file in the media player like that:
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File(YOUR_SONG_URI);
intent.setDataAndType(Uri.fromFile(file), "audio/*");
startActivity(intent);

Following this link I tried to get the URI like:
Uri audio = Uri.parse("android.resource://com.audio.test/"+R.raw.audio1);
Log.d(TAG,"uri:"+audio.toString());

and
Uri audio = Uri.parse("android.resource://com.audio.test/raw/audio");
Log.d(TAG,"uri:"+audio.toString());

Which outputs the expected result:
01-24 15:28:23.190: D/MyClass(30234): uri:android.resource://com.audio.test/2131034112
01-24 15:29:13.: D/MyClass(30234): uri:android.resource://com.audio.test/raw/audio1

But it doesn't work. The media player does not start. Any ideas why?
Update
I included a createChooser and instead of the expected list with players i get a "Unable to find application to perform this action" message. This is my exact code:
 public void playAudio(){
          Intent viewMediaIntent = new Intent();
          viewMediaIntent.setAction(android.content.Intent.ACTION_VIEW);
          Uri audio = Uri.parse("android.resource://com.audio.test/raw/"+R.raw.audio1);
          Log.d(TAG,"uri:"+audio.toString());
          viewMediaIntent.setDataAndType(audio, "video/*");
          viewMediaIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
          Log.d(TAG,"Starting");
          Intent i = Intent.createChooser(viewMediaIntent, "Play Music");
            mGap.startActivity(i);
          Log.d(TAG,"Started");
      }

Update 2
Thank you @CommonsWare for the explanation. Now I understand why it doesn't work. But the problem remains, can I achieve what I want? Get a Uri of a file stored in the raw/assets folder with a file:// scheme?
Update 3
I found a way to do it, although it's not the best it works. I have only 3 files and this doesn't delay the execution at all. I am copying the file from the res/raw to a local directory on the phone and getting the Uri from that file. Any suggestions on how to avoid that step are appreciated.
 public void copyFileToDir(String audioFile){
          File test = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC + "/" + audioFile + ".mp3");
          if (test.exists()){
              Toast.makeText(mGap, "Exists", Toast.LENGTH_SHORT).show();
              return;
          }
          File dest = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
          int i = mGap.getResources().getIdentifier("raw/"+audioFile, "string", mGap.getPackageName());
          InputStream in = mGap.getResources().openRawResource(i);
          // Used the File-constructor
          OutputStream out;
        try {
            out = new FileOutputStream(new File(dest, audioFile + ".mp3"));
              // Transfer bytes from in to out
              byte[] buf = new byte[1024];
              int len;
              try {
                  // A little more explicit
                  while ( (len = in.read(buf, 0, buf.length)) != -1){
                       out.write(buf, 0, len);
                  }
              } finally {
                  // Ensure the Streams are closed:
                  in.close();
                  out.close();
              }
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

      }

      public void playAudio(String audioFile){
          copyFileToDir(audioFile);
          File dest = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC + "/" + audioFile + ".mp3");
          Uri r = Uri.fromFile(dest);
          Intent viewMediaIntent = new Intent();
          viewMediaIntent.setAction(android.content.Intent.ACTION_VIEW);
          viewMediaIntent.setDataAndType(r, "audio/*");
          viewMediaIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
          Intent i = Intent.createChooser(viewMediaIntent, "Play Music");
            mGap.startActivity(i);

      }

      public void playVideo(String movieurl){
          Intent intentToPlayVideo = new Intent(Intent.ACTION_VIEW);
          intentToPlayVideo.setDataAndType(Uri.parse(movieurl), "video/*");
          Log.d(TAG,"Playing:" + movieurl);
          mGap.startActivity(intentToPlayVideo);
      }

A: Any reason why don't you use the MediaPlayer directly? You can pass the resource id directly
int resourceId = R.raw.your_media_resource;
MediaPlayer mediaPlayer = MediaPlayer.create( context, resourceId );
mediaPlayer.setOnCompletionListener( new OnCompletionListener()
{
    @Override
    public void onCompletion( MediaPlayer mp )
    {
        mp.release();
    }
} );
mediaPlayer.start();

A: When you call startActivity(), you are trying to start an activity. The Intent you pass to startActivity() indicates what activity -- or selection out of a set of available activities -- you want to start. In your case, you are trying to view an android.resource:// Uri. This is not an http:// Uri, nor an https:// Uri, nor a file:// Uri.
Activities that advertise themselves as supporting operations like this have, in their <intent-filter> a statement of what Uri schemes they support. You are assuming that there is an app, on the user's device, that supports an android.resource:// scheme. Personally, I do not think that this is a safe assumption.
http://, https://, and file:// should be safe, and content:// (for a ContentProvider) is fairly likely as well.
For example, the AOSP Music app does not support the android.resource scheme, based on its current manifest contents.

A: It is not possible to use content from your RES folder outside of the App. The content is inside the App and not reachable from outside the App. If you want to make the content available you have to implement your own ContentProvider returning the data.
@CommonsWare is right. See http://iserveandroid.blogspot.nl/2011/01/how-to-access-resources-from-other.html

A: If you just need to set the sound URI on the Notification.Builder, use
 Uri.parse("android.resource://com.my.great.application/"
                        + R.raw.mysound);

where R.raw.mysound can be something like mysoud.ogg in the raw resources folder.
However I am not sure if MP3 is exactly supported. As these are just internal resources of your application, try to convert to OGG.


text:
Q: isAuthenticated() not working with my custom authentication provider .? I'm new with spring security ,
I have made a custom authentication provider to check if the user haw access to the secured page or not via database.
every thing was ok, but when I added <intercept-url pattern="/home" access="isAuthenticated()" /> to security configuration an error occurs !
this is my userService :
public Authentication authenticate(Authentication auth) throws   AuthenticationException {
     Logger logger = null;
     logger = Logger.getLogger(Logger.class.getName());
     PropertyConfigurator.configure("src/main/resources/log4j.properties");
    ResultSet resultSet = null;
    PreparedStatement preparedStatement = null;
    Connection connection = null;

    name= auth.getName();
    pwd=auth.getCredentials().toString();
    UsernamePasswordAuthenticationToken ret=null;
    String select_auth= "select username,password from users where username=? and password=?";

    try {
        connection = dataSource1.getConnection();
        preparedStatement = connection.prepareStatement(select_auth);
        preparedStatement.setString(1,name);
        preparedStatement.setString(2,pwd);
        resultSet = preparedStatement.executeQuery();
        if(resultSet.next()){
            logger.info("user <"+name+"> is connected");

           ret= new UsernamePasswordAuthenticationToken(name, null);}
        else
        {
        ret= null;
        }

    } catch (SQLException e) {
        logger.error("SQLException: " + e.getMessage());

        e.printStackTrace();
    }

and this is my seurity-config
<http use-expressions="true" auto-config="true">
    <form-login login-page="/login.jsp" default-target-url="/home"
        authentication-failure-url="/403" />
    <logout logout-success-url="/login" />
    <intercept-url pattern="/home" access="isAuthenticated()" />
</http>

could someone help me ,or explain me what's the cause of the problem ?
Thanks in advance.


text:
Q: Boston's "Spaces of constant rank matrices over $\mathrm{GF}(2)$" Let's recall what is spaces of matrices of constant rank, that is, in spaces of matrices in which every nonzero matrix has the same rank. The case is, i'm reading journal by NIGEL BOSTON titled "SPACES OF CONSTANT RANK MATRICES OVER GF(2)", the same with this question's title. In the journal's abstract, it said that, "for each n, we cconsider there exist an (n+1)- dimensional space of n by n matrices GF(2) in which nonzero matrix has rank n-1. Examples are given for n=3,4, and 5, together with evidence for the conjecture that none exist for n>8". The problem is, NIGEL BOSTON used MAGMA to show that there are exactly 1176 such spaces for n=3. And under conjugation by GL(3,2), these fall into 12 orbits. A basis for a representative of each orbit is given by:

I got task from my lecture to make simulation for it (using MAGMA), but we know that there is no trial/free version of MAGMA, so i remember about SAGE, is SAGE be able to do such thing? And if yes, how i do that (the code for SAGE), otherwise if not, is there another program similar to MAGMA (open source or free) and possible to do the simulation? Hope you help me, thanks you so much!
Note: this is link for the journal
journal link


text:
Q: Cant open whatsapp app from my flutter app, this can be run when debugging but when download on playstore it doesn't work I used this code to redirect to whatsapp app, but its only works in debugging mode, when i download my app from play store deosnt work

onTap: () async {
  var whatsappApp = Uri.parse("whatsapp://send?phone=$contactusWhatsapp&text=hello");
  if (await canLaunchUrl(whatsappApp)) {
    await launchUrl(whatsappApp);
  } else {
    ScaffoldMessenger.of(context).showSnackBar(
      const SnackBar(
        content: Text("WhatsApp is not installed on the device"),
      ),
    );
  }
},

A: You can use as below
 onPressed: () async {
                            await launch(
                              "https://wa.me/you write the number here",
                              forceSafariVC: false,
                              forceWebView: false,
                              headers: <String, String>{
                                'my_header_key': 'my_header_value'
                              },
                            );
                          },

To use it this way, you also need to install the url launcher package.


text:
Q: Can't write simple php code to call aws sqs I have very little experience with PHP, so please bear with me. I'm attempting to follow the AWS documentation example to confirm that I can connect to AWS SQS using the AWS PHP SDK, but I'm getting stuck...and it's definitely something dumb that I'm doing. Here's my php file (called stuff.php):
<?php
header('Content-Type: text/plain; charset=utf-8');
require '/home/ubuntu/vendor/autoload.php';
// Create the queue using the AWS-PHP-SDK function, create_queue, and store it
// in the '$newqueue' variable.
$newqueue = $sqs->create_queue($queuename);
// Print the created queue results.
echo '

CREATE QUEUE
';
print '
' . print_r($newqueue, true) . '

';
?>

Which is basically copied from the AWS documentation with the require address updated.
I created an ~/.aws/credentials file using this format:
[default]
aws_access_key_id = YOUR_AWS_ACCESS_KEY_ID
aws_secret_access_key = YOUR_AWS_SECRET_ACCESS_KEY

But when I load the file in my browser, the Apache2 error.log sends me this:
[Mon Dec 15 20:46:26.460172 2014] [:error] [pid 2625] [client 10.0.3.1:48211] PHP Notice:  Undefined variable: sqs in /var/www/html/stuff.php on line 7
[Mon Dec 15 20:46:26.460203 2014] [:error] [pid 2625] [client 10.0.3.1:48211] PHP Fatal error:  Call to a member function create_queue() on a non-object in /var/www/html/stuff.php on line 7

I assumed that $sqs would have a preset value assigned from the SDK,but perhaps I'm supposed to manually assign something: I have no idea what that might be.
Thanks,

A: According to the latest version of the AWS PHP SDK documentation, you need to create an SqsClient object instance using the provided factory method and then you will be able to create SQS queues, receive/send messages from/to them and so on.
Download the latest ZIP version of AWS PHP SDK, unzip it into your directory project and use the following script in order to create and send a message using SQS Client.
N.B.: remember to put the real relative path to the aws-autoloader file and the right AWS credentials.
<?php
require './relative/path/to/aws-autoloader.php';
use Aws\Sqs\SqsClient;
use Aws\Common\Credentials\Credentials;

$credentials = new Credentials('YOUR_ACCESS_KEY', 'YOUR_SECRET_KEY');

// Instantiate the SQS client with your AWS credentials
$client = SqsClient::factory(array(
    'credentials' => $credentials,
    'region'  => '<region name>'
));

$result = $client->createQueue(array('QueueName' => 'my-queue'));
$queueUrl = $result->get('QueueUrl');

echo "SQS queue url: $queueUrl";

$client->sendMessage(array(
    'QueueUrl'    => $queueUrl,
    'MessageBody' => 'Hello World!',
));


text:
Q: How to check a static library is built contain bitcode? I have a static library that is built by other company. I want to know if it's a static library containing bitcode, which command can detect it in terminal?

A: As it was alread written in other answers,
otool -l yourlib.a | grep __LLVM

is the way to go.
An Apple engineer says using
otool -l yourlib.a | grep bitcode

is not reliable.

Searching for a "bitcode" section is not a reliable way to detect if your files contain embedded bitcode. If you want to do that, search for the "__LLVM" segment. You should be aware that a normal build with the -fembed-bitcode-marker option will produce minimal size embedded bitcode sections without any real content. This is done as a way of testing the bitcode-related aspects of your build without slowing down the build process. The actual bitcode content is included when you do an Archive build.

See also the comments by xCocoa.
It seems, that otool does not report the bitcode if code for the iPhone Simulator's architecture is included (x86_64 or i386).
You can list the lib's architectures with:
lipo -info yourlib.a

Then you can check for bitcode for each architecture separately, e.g:
otool -arch armv7 -l yourlib.a  | grep bitcode
otool -arch arm64 -l yourlib.a  | grep bitcode

A: It is recommended to test against LLVM symbols:
otool -l yourlib.a | grep LLVM
You should get some lines with "__LLVM"

A: Disclaimer: I'm the author of LibEBC.
You can use ebcutil to see whether bitcode is present in a Mach-O binary or library. You can even use it to extract the embedded bitcode from it.
https://github.com/JDevlieghere/LibEBC

A: And if you want to check if a specific file (yourFile.o) in the static library is bitcode enabled, you can extract the 'staticLibrary.a' and use the same otool command. However macOS doesn't allow to extract your staticLibrary.a at times with the default extract utility and most 3rd party tools doesn't work either.
You can follow these steps to check specific .o files

*

*Get the info of the architecture
lipo -info yourStaticLibrary.a

eg output: armv7 arm64

*Extract yourStaticLibrary.a for any or both of the above architecture
lipo yourStaticLibrary.a -thin armv7 -output yourStaticLibraryarmv7.a

(specify the output path you want to extract to)

*You get the 'yourStaticLibraryarmv7.a' which then can be easily extracted with the default mac unarchiver

*On extracting, you then get a folder 'yourStaticLibraryarmv7' containing all the .o files

*otool -l yourFile.o | grep bitcode
or with the specific architecture
otool -arch armv7 -l yourFile.o  | grep bitcode

If the file is bitcode enabled , you get 'sectname __bitcode' in the commandline

A: *

*lipo -info lib.a // Your static library

*Check architectures, select your architecture

*lipo lib.a -thin arm64 -output lib_arm64.a // Extract your architecture

*ar -tv lib_arm64.a // List the files

*ar -xv lib_arm64.a  yourfile.o // File extracted

*otool -arch armm64 -l yourfile.o  | grep bitcode

If the file is bitcode enabled, you get 'sectname __bitcode'

A: You can try:
otool -l (.o or .a file)
and look for "__bitcode" section
It was answered here:
How do I xcodebuild a static library with Bitcode enabled?


text:
Q: How to set UTF-8 charset in exim4? Using Ubuntu server 14.04 how to set UTF-8 CHARSET? It's using now ANSI by default so i can't see cyrillic letters.
I am using non-split config mode, so i have 2 files in /etc/exim4:

*

*/etc/exim4/exim4.conf.template

*/etc/exim4/update-exim4.conf.conf

Using exim4 only as send-mail server only.

A: Exim4 is character set agnostic. It just provides the transport and delivery mechanism for your email.  It handles UTF-8 and a wide variety of other character sets.
Character set selection must be specified.  The content should specify utf-8 if it is using it.
A content-type header can be used to indicate utf-8 content:
Content-Type: text/plain; charset="utf-8"

Headers containing utf-8 content should be appropriately prefixed and quoted:
From: =?utf-8?Q?Iceland=20Naturally?= <icelandnatural@gmail.com>
Subject: =?utf-8?q?People_vs=2E_Ebola_-_thousands_volunteering!?=

Which clients are you using and how are they configured.


text:
Q: What are the advantages of @MatrixVariable over @RequestParam? I am reading in this article http://www.kscodes.com/spring-mvc/spring-mvc-matrix-variable-example/ that one advantage is that you can use the variable type Map for the matrix variable and you can't use this type when using @RequestParam. But aside from that, are there any other reasons for why I should use @MatrixVariable instead of @RequestParam?
Thank you

A: Unlike the @RequestParam the @MatrixVariable is separated by a semicolon ; and multiple values are separated by a comma ,. Read its documentation:

Annotation which indicates that a method parameter should be bound to a name-value pair within a path segment. Supported for RequestMapping annotated handler methods.

There are plenty of examples and variations of the usage. Here are some exapmles:

*

*URL: localhost:8080/person/Tom;age=25;height=175 and Controller:
@GetMapping("/person/{name}")
@ResponseBody
public String person(
    @PathVariable("name") String name,
    @MatrixVariable("age") int age,
    @MatrixVariable("height") int height) {

    // ...
}

*It can be even mapped to String[].
URL: localhost:8080/person/Tom;languages=JAVA,JAVASCRIPT,CPP,C and Controller
public String person(
    @PathVariable("name") String name,
    @MatrixVariable("languages") String[] languages) {

    // ...
}


text:
Q: One to one relationship for entities So I've got 3 classes. For instance:
class Project {
    int id
}

class User {
    int id
}

class UserProjectLink {
    int projectId
    int userId
}

I have this approach in order to avoid NULL values in my database.
Entity framework however sets the projectId on my User table, thus resulting in NULL values. (note that the classes above are not the actual classes).
How can I solve this issue? A user will only have 1 project and a project will only have 1 user. The project may not yet have a user in which case the absence of a row in the UserProjectLink table would tell me there is not yet a user there.
Any ideas may be useful.

A: What you're describing is a setup where a project is a weak entity in relation to a user. This means that in order for a project to exist it must have a user as its owner, and it can't be referenced by any other users (i.e. it has a single owner).
So, you don't need the UserProjectLink table.
class User {
    int id
}

class UserProject { // or just "Project"
    int projectId
    int userId
}

A: class User {
    [Key, ForeginKey("Project")]
    int id
    public Virtual Project Project{get; set;}
}
class Project {
    int id
    public virtual User User {get; set;}
}


text:
Q: Swift Navigation bar not appearing when storyboard is referenced after login When I launch a build for the application the login and signup work just fine but when it transfers to the HomeVC storyboard it appears empty. To make sure that it is referenced correctly I put labels on it and those were appearing during builds what just really remains invisible is the navigation bar. Pls help :)
How the HomeVC storyboard is referenced in Login and Signup
Login:
 else {
      let homeViewController = self.storyboard?.instantiateViewController(identifier: Constants.Storyboard.homeViewController) as? HomeViewController
       self.view.window?.rootViewController = homeViewController
       self.view.window?.makeKeyAndVisible()

SignUp:
func transitionToHome(){
     let homeViewController = storyboard?.instantiateViewController(identifier: Constants.Storyboard.homeViewController) as? HomeViewController
     view.window?.rootViewController = homeViewController
     view.window?.makeKeyAndVisible()

Here is the login storyboard

The navigation bar is clearly apparent in the storyboards

A: You could try to use a segue
// This is used to perform the segue with the approporiate identifier
    self.performSegue(withIdentifier: "Your unique identifer of the seugue", sender: self)

// Prepare for segue is used if you want to modify some properities in the desintation viewcontroller
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "Your identifier of the segue" {
        // This is used to fetch the destination and cast it to pass over the values
        if let dc = segue.destination as? YourClassOfTheDestination {
            // Here can you type into dc and pass over the values

            //Example
            dc.curentFruit = "Pear"
        }
    }
}

Here is an image on how to specify the custom identifier of the segue in the storyboard. Here is the image
If you don't want the navigation bar to be visible in certain screens you can simply use:
override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    self.navigationController?.navigationBar.isHidden = true
}

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillAppear(animated)

    self.navigationController?.navigationBar.isHidden = false
}

Remember to make it visible again when the view disappears.
Great question, hope the answer helps!

A: I believe the issue is you are making the view controller the key window and you are not adding the navigation controller. Try making the home view controller's navigation controller the key window.


text:
Q: What does the colon : mean in x86 assembly GAS syntax as in %ds:(%bx)? I am new to x86 assembly and I am trying to understand the code in this document : http://www.cs.cmu.edu/~410-s07/p4/p4-boot.pdf page 3 :
movw $0x1234, %ax
movw %ax, %ds
movw $0x5678, %bx
# The following instruction is the same as "movw $0x1337, (%bx)".
movw $0x1337, %ds:(%bx) # Places 0x1337 into memory word 0x179b8.
# Segment Base: %ds << 4: 12340
# Offset: %bx: + 5678
# -------
# Linear Address: 179b8

But I am not understanding the command :
movw $0x1337, %ds:(%bx) # Places 0x1337 into memory word 0x179b8.

Why concatenating %ds with (%bx) is the same as ((%ds << 4) | %bx) ?
As I am in real mode (16 bits), the concatenation shouldn't be %ds << 8 ? instead of %ds << 4?
And why the parenthesis is just around %bx? And not around the whole structure like : movw $0x1337, (%ds:%bx) ?

A: In real mode, the segment register is used to provide a 20-bit address. In this case, the data segment register ds provides the 'high' 16 bits of the address: (0x1234 << 4 = 0x12340), and the offset in the segment is given by: 0x5678, to yield: 0x179b8.
The data segment register is implicit, so it's not necessary to use: ds:(%bx). If you were using another segment register, like es, it would need to be explicit.
I hope I've understood your question. As to why it's not written as (%ds:%bx), that's really just a syntactic decision that you're stuck with.


text:
Q: XSLT 2.0 XPATH expression with variable I'm working on a Java based xsl-transformation (XSLT 2.0, could also be XSLT 3.0 if there is a free processor for java) with different input xml files. one input file could look like this:
<?xml version="1.0" encoding="UTF-8"?>
<TEST>
    <MyElement>
        <CHILD>A</CHILD>
        <CHILDBEZ>ABEZ</CHILDBEZ>
        <NotInteresting></NotInteresting>
    </MyElement>
    <MyElement>
        <CHILD>B</CHILD>
        <CHILDBEZ>BBEZ</CHILDBEZ>
        <NotInteresting2></NotInteresting2>
    </MyElement>
</TEST>

I want to copy all elements but "NotInteresting" and rename the two nodes CHILD and CHILDBEZ based on two parameters that I get from a mapping file:

*

*the xpath expression that tells me where the text of interest is placed (in this case: TEST/MyFirstElement/CHILD and TEST/MyFirstElement/CHILDBEZ)

*and the names of the elements what they should have in the output file (in this case: childName and childBez)

the mapping file:
<?xml version="1.0" encoding="UTF-8"?>
<element root="TEST">
    <childName>TEST/MyElement/CHILD</childName>
    <childBez>TEST/MyElement/CHILDBEZ</childBez>
</element>

desired output:
<TEST>
    <MyElement>
        <childName>A</childName>
        <childBez>ABEZ</childBez>
    </MyElement>
    <MyElement>
        <childName>B</childName>
        <childBez>BBEZ</childBez>
    </MyElement>
</TEST>

what I have so far:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="2.0 "
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.apoverlag.at"
    xmlns:apo="http://www.apoverlag.at">

    <xsl:variable name="vars" select="document('mapping.xml')"/>
    <xsl:param name="src" />
     <xsl:variable name="path" xpath-default-namespace="" select="$src/path"/> <!-- = TEST/*-->

    <xsl:template match="/">
        <xsl:for-each select="$path">
            <xsl:call-template name="buildNode">
                <xsl:with-param name="currentNode" select="current()"></xsl:with-param>
            </xsl:call-template>
        </xsl:for-each>
    </xsl:template>

    <xsl:template name="buildNode">
        <xsl:param name="currentNode" />
        <xsl:element name="test">
            <xsl:for-each select="$vars/element/@root">
                <xsl:for-each select="$vars/element/*">
                    <xsl:element name="{name(.)}"> <xsl:value-of select="concat($currentNode,'/',current())" />
                        </xsl:element>
                </xsl:for-each>
            </xsl:for-each>
        </xsl:element>
    </xsl:template>
</xsl:transform>

My problem is that:
<xsl:value-of select="concat($currentNode,'/',current())" />

gives me "/TEST/MyFirstElement/CHILD" when I try it hardcoded with:
<xsl:value-of select="$currentNode/CHILD" />

I receive my desired output. Can anyone give me a hint how to solve this problem?

A: I would suggest a radically different approach. To simplify, I have used a mapping document with full paths (starting with the /  root node):
mapping xml
<element root="TEST">
    <childName>/TEST/MyElement/CHILD</childName>
    <childBez>/TEST/MyElement/CHILDBEZ</childBez>
</element>

XSLT 2.0
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:param name="mapping" select="document('mapping.xml')"/>
<xsl:key name="map" match="*" use="." />

<xsl:template match="/">
    <xsl:variable name="first-pass">
        <xsl:apply-templates mode="first-pass"/>
    </xsl:variable>
    <xsl:apply-templates select="$first-pass/*"/>
</xsl:template>

<xsl:template match="*" mode="first-pass">
    <xsl:param name="parent-path"/>
    <xsl:variable name="path" select="concat($parent-path, '/', name())" />
    <xsl:variable name="replacement" select="key('map', $path, $mapping)" />
    <xsl:element name="{if ($replacement) then name($replacement) else name()}">
        <xsl:attribute name="original" select="not($replacement)"/>
        <xsl:apply-templates mode="first-pass">
            <xsl:with-param name="parent-path" select="$path"/>
        </xsl:apply-templates>
    </xsl:element>
</xsl:template>

<xsl:template match="*">
    <xsl:copy>
        <xsl:apply-templates/>
    </xsl:copy>
</xsl:template>

<xsl:template match="*[@original='true' and not(descendant::*/@original='false')]"/>

</xsl:stylesheet>

Result, when applied to the provided input:
<?xml version="1.0" encoding="UTF-8"?>
<TEST>
   <MyElement>
      <childName>A</childName>
      <childBez>ABEZ</childBez>
   </MyElement>
   <MyElement>
      <childName>B</childName>
      <childBez>BBEZ</childBez>
   </MyElement>
</TEST>


text:
Q: connecting Postgres database via doctrine in Heroku I am running a Symfony app on Heroku. It uses a Postgres database. I want to connect to the database by running
heroku run php bin/console doctrine:database:create
and it gives me this error message
[Doctrine\DBAL\Exception\ConnectionException]                                        An exception occured in driver: SQLSTATE[08006] [7] FATAL:  permission denied for database "postgres"DETAIL:  User does not have CONNECT privilege.
although i can access the database by running
heroku pg:psql


text:
Q: Clips defRule defined successfully but does not fire with other defrules Here is my code the first Defrule fires "get-patientnationalic" but the second one called "fever" does not
I am trying to make a clips program that test symptoms from the user and gives a diagnosis for their illness if any
this is a uni project and i have a deadline closing in but i can't get this bit to run
(deftemplate patient
   (slot name)
   (slot fever))

(defrule get-patientnationalic
   =>
   (printout t "What is your national-IC? " crlf)
   (bind ?nationalic (readline))
   (assert (patients's-nationalic ?nationalic)))

(defrule get-patientgender
   =>
   (printout t "What is your gender?" crlf)
   (bind ?gender (readline))
   (assert (patient's-gender ?gender)))

(defrule fever
   (or (fever ?n)
       (fever ?n))
   ?patient <- (patient (name ?name))
   =>
   (printout t crlf "Does "?name" has fever? (yes/no)" crlf)
   (printout t " Answer: ")
   (bind ?fever (lowcase (readline)))
   (if (eq ?fever yes)
      then
      (bind ?fever y)
      else
      (if (eq ?fever no)
         then
         (bind ?fever n)))
   (assert (fever ?fever))
   (modify ?patient (fever ?fever)))

A: The conditions of your fever rule can't be matched because no patient fact exists and the fever fact required by the rule is only asserted by the same rule. Just modify your code accordingly:
         CLIPS (6.4 2/9/21)
CLIPS>
(deftemplate patient
   (slot name)
   (slot gender (default unknown))
   (slot fever (default unknown))
   (slot IC (default unknown)))
CLIPS>
(defrule get-patient-name
   =>
   (printout t "What is your name? ")
   (bind ?name (readline))
   (assert (patient (name ?name))))
CLIPS>
(defrule get-patient-nationalic
   ?patient <- (patient (IC unknown))
   =>
   (printout t "What is your national-IC? ")
   (bind ?nationalic (readline))
   (modify ?patient (IC ?nationalic)))
CLIPS>
(defrule get-patient-gender
   ?patient <- (patient (gender unknown))
   =>
   (printout t "What is your gender? ")
   (bind ?gender (readline))
   (modify ?patient (gender ?gender)))
CLIPS>
(defrule fever
   ?patient <- (patient (name ?name) (fever unknown))
   =>
   (printout t "Does " ?name " has fever? (yes/no) ")
   (bind ?fever (lowcase (readline)))
   (if (eq ?fever yes)
      then
      (bind ?fever y)
      else
      (if (eq ?fever no)
         then
         (bind ?fever n)))
   (modify ?patient (fever ?fever)))
CLIPS> (reset)
CLIPS> (run)
What is your name? Fred
What is your national-IC? US
What is your gender? male
Does Fred has fever? (yes/no) yes
CLIPS> (facts)
f-1     (patient (name "Fred") (gender "male") (fever "yes") (IC "US"))
For a total of 1 fact.
CLIPS>


text:
Q: Merge large number of files and removing them of the fly I am trying to concatenate a large number of files (~20k) on different directories into a single big one.
The issue is the global size of the files is around 40G and I don't have enough space on the drive to store a second 40G file. I plan to run a simple script which will cat and rm files to empty space.
#!/usr/bin/bash

for file in library/*/*
do
    echo $file
    cat $file >> teeest
    rm $file
done

I tried it on a small test sample and it seems to works fine. However I'm a bit concerned about >> and memory usage.
Since I will remove a concatenated file instantly I want to be sure it wont crash midway because it runs out of memory, because I made a mistake in the script or something I haven't thought about.
The machine I'm working on have 64GB of RAM and 16 cores.
Thank for your help :)


text:
Q: How to search on pairs of values in this SQL stored procedure I have the following SQL procedure/select statement that I am working on modifying. I derived this from a previous question I had which can be referenced here: Need help with SQL query
This works pretty good when I do not have the conditional in there checking for years of experience, but I actually want to modify this so that if I have a list passed in @csvList and another list of @csvYears, then I can pair the values - that is, I can search for Skill1 with 5 years of experience, and Skill2 with 3 years of experience.
Can I just do another JOIN on the table of csvYears? (The SplitCSVStrings function returns a table, and splits the CSV list of values)
So behold the existing code:
    ALTER PROCEDURE [dbo].[EmployeeQuerySkill]
    @csvList varchar(400),
    @years int,
    @fudge int,
    @hitAll int = 0
AS
BEGIN
  SELECT last_name, id, name, SUM(Experience ) AS 'YearsExperience'
  FROM
  (
      SELECT e.last_name, e.id, s.name, CASE WHEN r.end_date ='01/01/1901' THEN MAX(datediff(YY,r.start_date, GETDATE())) ELSE MAX(datediff(YY,r.start_date, r.end_date)) END AS 'Experience'
      FROM employee as e
      INNER JOIN project AS p ON e.id = p.employee_id
      INNER JOIN role AS r ON p.id = r.project_id
      INNER JOIN role_skill AS rs ON rs.role_id = r.id
      INNER JOIN skill AS s ON s.id = rs.skill_id
      JOIN SplitCSVStrings(@csvList)            AS CSV ON CSV.val = s.name

     GROUP BY e.last_name, e.id, s.name, r.end_date
  )  table1
  WHERE table1.Experience >= @years
  GROUP BY last_name, id, name

  END
END

How can I modify this to allow me to search for a different condition for each of the skills? @csvList is coming in like "C++, Java" and I want @years to come in as "5, 3" and the corresponding search to show me people that have 5 years of C++ experience, and 3 years of Java experience.
Thanks!

A: I think that you need to modify the function SplitCSVStrings for this to work. Yo should make it so the table that it returns has one extra column indicating the position in the csv. For example, if the parameter is "C++, Java", the result should be:
id val
1  C++
2  Java

If you do that, then you can modify your query to be like this:
ALTER PROCEDURE [dbo].[EmployeeQuerySkill]
    @csvList varchar(400),
    @years int,
    @fudge int,
    @hitAll int = 0
AS
BEGIN
  SELECT last_name, id, name, SUM(Experience ) AS 'YearsExperience'
  FROM
  (
      SELECT e.last_name, e.id, s.name, CASE WHEN r.end_date ='01/01/1901' THEN MAX(datediff(YY,r.start_date, GETDATE())) ELSE MAX(datediff(YY,r.start_date, r.end_date)) END AS 'Experience', CSV2.val Years
      FROM employee as e
      INNER JOIN project AS p ON e.id = p.employee_id
      INNER JOIN role AS r ON p.id = r.project_id
      INNER JOIN role_skill AS rs ON rs.role_id = r.id
      INNER JOIN skill AS s ON s.id = rs.skill_id
      JOIN SplitCSVStrings(@csvList) AS CSV ON CSV.val = s.name
      LEFT JOIN SplitCSVStrings(@years) AS CSV2 ON CSV.id = CSV2.id

     GROUP BY e.last_name, e.id, s.name, r.end_date, CSV2.val
  )  table1
  WHERE table1.Experience >= years
  GROUP BY last_name, id, name

  END
END

In any case, you shoud be careful that the parameters passed in both @csvlist AND @years are the same.


text:
Q: Is an array of vectors entirely contiguous memory? I know vectors are guaranteed to be contiguous memory, and so are arrays. So what happens when I do something like this:
std::vector<uint8_t> my_array[10];
my_array[2].push_back(11);
my_array[2].push_back(7);

What would the memory look like? If both need to be contiguous, would every element of the array after my_array[2] be pushed forward a byte every time I do a push_back() on my_array[2]?
Would this be the same situation as when I have an array of structs, where the structs have a member that has a variable size, such as a string or another vector?

A: Memory footprint of std::vector consists of two parts:

*

*The memory for the std::vector object itself (very small, and independent of the size), and

*The memory for the data of the vector (depends on the number of elements in the vector).

The first kind of data will be contiguous in an array; the second kind of data is allocated dynamically, so it would not be contiguous in an array.
This would not be the same as with a C struct that has a flexible data member, because the data portion of std::vector is not always allocated in the same kind of memory, let alone being adjacent to it. The vector itself may be allocated in static, dynamic, or automatic memory areas, while its data is always in the dynamic area. Moreover, when vector is resized, the memory for its data may be moved to a different region.
Each time you call push_back, std::vector checks if it has enough dynamic memory to accommodate the next data element. If there is not enough memory, then the vector allocates a bigger chunk of memory, and moves its current content there before pushing the new item.

A: The vector memory structure is contiguous in memory; however std::vector's all contain a pointer pointing to dynamically allocated memory for the actual storage (which is very very likely not contiguous).
Knowing this, std::vector::push_back will only check to see if the (external) dynamically allocated array has enough capacity to hold the new item, if not it will reallocate space. A push_back on the first vector that overflows will not cause the second vector in the array to reallocate memory, that isn't how it works.
Also, there is no such thing as a struct having a variable size, the size of structures and classes have to be known at compile time.
std::string also has a fixed size, although you may think it is variable, because it also (like vector) has a pointer to the char* it contains.


text:
Q: Can a variable be used as a placeholder for a function call? I am writing a program which has several structs and functions to handle these structs differently. I am having a generic function which calls the required function based on the inputs.  Is there a generic way to use the returned value from getStruct()?
package main

var X func(s []string) A
var Y func(s []string) B

type A struct {
    Name  string
    Place string
}

type B struct {
    Name  string
    Place string
    Value string
}

func newA(s []string) A {
    a := A{
        Name:  s[0],
        Place: s[1],
    }
    return a
}

func newB(s []string) B {
    a := B{
        Name:  s[0],
        Place: s[1],
        Value: s[2],
    }
    return a
}

func getStruct(t string) interface{} {

    switch {
    case t == "A":
        return X
    case t == "B":
        return Y
    default:
        return //someStruct
    }

}

func main() {

    buildNewStruct := getStruct("A") //Lets assume "A" here is got as an argument

    var strSlice = []string{"Bob", "US"}
    buildNewStruct(strSlice) //How to do this operation?
                             //I am hoping to use buildNewStruct(strSlice) to dynamically call
                             //either of newA(strSlice) or newB(strSlice) function

}

I have tried looking at this and this the later is not exactly the same as my question.
Since I am new to go, I am not sure if something like this is possible.

A: The problem is the return type for the function.
func newA(in []string) interface{} {...}
func newB(in []string) interface{} {...}

func getStruct(name string) func([]string) interface{} {
  switch name {
     case "A": return newA
     case "B": return newB
  }
  return nil
}

func main() {
  buildNewStruct := getStruct("A")
  var strSlice = []string{"Bob", "US"}
  str:=buildNewStruct(strSlice)
  if a, ok:=str.(A); ok {
     ...
  }
}

With this approach, even though you saved some code by calling a unified buildNewStruct(), you have to use type assertions to figure out what is returned from that function, so this may not make a lot of sense. It depends on your exact use case though.

A: you can use the reflect package to set the struct properties to the equivalent index positioned value from an []interface{} slice.
package main

import (
    "fmt"
    "log"
    "reflect"
)

func main() {
    var a A
    err := decode(&a, []interface{}{"Name", "Place"})
    log.Println(err)
    log.Println(a)
}

func decode(dst interface{}, values []interface{}) error {
    rvptr := reflect.ValueOf(dst)
    if rvptr.Kind() != reflect.Ptr {
        return fmt.Errorf("value must be ptr")
    }
    rv := rvptr.Elem()
    if rv.NumField() < len(values) {
        return fmt.Errorf("too many values")
    }
    if rv.NumField() > len(values) {
        return fmt.Errorf("too few values")
    }
    rvalues := reflect.ValueOf(values)
    for i := range values {
        f := rv.FieldByIndex([]int{i})
        f.Set(rvalues.Index(i).Elem())
    }
    return nil
}

type A struct {
    Name  string
    Place string
}

type B struct {
    Name  string
    Place string
    Value string
}

prints
$ go run main.go
2019/11/21 17:00:17 <nil>
2019/11/21 17:00:17 {Name Place}


text:
Q: How Can I get find text of element of id , css with Java I am trying to write a Test Scenario with Java ( using Selenium Webdriver, Junit ,testng).**
@Test
public void clickAllSee(){
    page.myProfilPages().clickSeeAllWriting();  //here is going to where I want to go.

In this
Also this is my html

Özgeçmişler

add Yeni Yeni Özgeçmiş Oluştur

I want to get text of "Yeni Özgeçmiş oluştur Button" which is "Yeni Özgeçmiş Oluştur" . When I am trying to use "cssSelector" or "id" like down my codes, its not working.
    String h = TLDriver.getDriver().findElement(By.cssSelector(".row.load-more-button")).getText(); //here codes give error
   String h = TLDriver.getDriver().findElement(By.id("mobil-create-resume")).getText();

     Assert.assertEquals(h,"Yeni Özgeçmiş Oluştur");

}

*- How Can I reach "Yeni Özgeçmiş Oluştur" text using **findElement(By. ...) ?***
After Fails scenario , console gives like this error;
This is error of "csselement" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":".row.load-more-button"}

A: Yeni Özgeçmiş Oluştur Button:
(By.XPATH, "//*[text()='Yeni Özgeçmiş Oluştur']")

Özgeçmiş Name Input:
(By.XPATH, "//input[@id='text']")

Özgeçmiş Oluştur Button:
(By.XPATH, "//button[@class='btn btn-secondary']")


text:
Q: Django how hide empty category I have a hoodie category and two gender divisions male and female. How can I hide a category hoodie for a gender that does not have this product?
    {% get_genders as genders %}
                    {% for gender in genders %}

                    Категории

                    {{ gender }}
                    <input type="checkbox" id="drop-2">

                        {% get_category as categories %}
                        {% for category in categories %}

{{category.name}}

                        {% endfor %}

                {% endfor %}

I'm try make many to many field gender for category, but I don't know how to write in html
models.py
class Gender(models.Model):
    name = models.CharField(max_length=100)
    slug = models.SlugField(max_length=200, unique=True)

    class Meta:
        verbose_name = 'Гендер'
        verbose_name_plural = 'Гендеры'

    def __str__(self):
        return self.name

    def get_absolute_url(self):
        return reverse('gender', kwargs={'gender_slug': self.slug})

class Category(models.Model):
    name = models.CharField(max_length=100)
    gender = models.ManyToManyField(Gender)
    slug = models.SlugField(max_length=200, unique=True)

    class Meta:
        verbose_name = 'Категория'
        verbose_name_plural = 'Категории'

    def __str__(self):
        return self.name

    def get_absolute_url(self):
        return reverse('category', kwargs={'category_slug': self.slug})

A: Okay, i got it
It took to add new tag
@register.simple_tag()
def get_all(gender, category):
    stuff = Stuff.objects.filter(gender=gender, category=category).first()
    if stuff is None:
        return False
    else:
        return True


text:
Q: c2593 error (operator identifier is ambiguous) when compiling for x64 platform I'm trying to compile a C++ project using Microsoft VisualStudio 2008. This particular project compiles fine if you use Win32 as target platform. If I try to compile the same project for the x64 platform I get a C2593 'operator identifier' is ambiguous error in this line:
case 't':  os_ << (size_t)path->rnode->char_type;     break;

Anyone has a clue why the same line compiles fine for 32-bit but fails for 64-bit with such a high level error?

A: Ok, got it. The problem is the size_t data type which has different sizes for the two different plattforms. The operator << is defined for a various list of data types:
StringBuffer& operator<<(unsigned short int n) { _UITOA(n); }
StringBuffer& operator<<(unsigned int n)       { _UITOA(n); }

On a 32-bit platform "unsigned int" is a perfect match for size_t. On 64-bit platforms size_t is 64 bits and doesn't match exactly on any operator declaration.
The solution is to choose the exact operator by using the correct data type:
case 't':  os_ << (unsigned int)path->rnode->char_type;     break;

Or overload the operator using size_t:
StringBuffer& operator<<(size_t)       { _UITOA(n); }


text:
Q: Help wth number to roman numeral Python script I am trying to convert numbers (up to 30) to roman numerals. Using a script for another field calculator function as a template, I created this script that doesn't want to work. Any help would be greatly appreciated!
def NumberToRomanNumeral ( !CONCESSION! ):
 if CONCESSION == "1":
  newstr = "I"
elif CONCESSION == 2:
 newstr = "II"
elif CONCESSION == 3:
 newstr = "III"
elif CONCESSION == 4:
 newstr = "IV"
elif CONCESSION == 5:
  newstr = "V"
elif CONCESSION == 6:
 newstr = "VI"
elif CONCESSION == 7:
 newstr = "VII"
elif CONCESSION == 8:
 newstr = "VIII"
elif CONCESSION == 9:
 newstr = "IX"
elif CONCESSION == 10:
 newstr = "X"
elif CONCESSION == 11:
 newstr = "XI"
elif CONCESSION == 12:
 newstr = "XII"
elif CONCESSION == 13:
 newstr = "XIII"
elif CONCESSION == 14:
 newstr = "XIV"
elif CONCESSION == 15:
 newstr = "XV"
elif CONCESSION == 16:
 newstr = "XVI"
elif CONCESSION == 17:
 newstr = "XVII"
elif CONCESSION == 18:
 newstr = "XVIII"
elif CONCESSION == 19:
 newstr = "XIX"
elif CONCESSION == 20:
 newstr = "XX"
elif CONCESSION == 21:
 newstr = "XXI"
elif CONCESSION == 22:
 newstr = "XXII"
elif CONCESSION == 23:
 newstr = "XXIII"
elif CONCESSION == 24:
 newstr = "XXIV"
elif CONCESSION == 25:
 newstr = "XXV"
elif CONCESSION == 26:
 newstr = "XXVI"
elif CONCESSION == 27:
 newstr = "XXVII"
elif CONCESSION == 28:
 newstr = "XXVIII"
elif CONCESSION == 29:
 newstr = "XXIX"
elif CONCESSION == 30:
 newstr = "XXX"

else:
   newstr = ""
return newstr

A: Exclamation marks are in wrong place - it should be
Expression:
NumberToRomanNumeral(!CONCESSION!)

Code Block: starting...
def NumberToRomanNumeral(CONCESSION):