text:
Q: Apache Ignite Near Cache Always Missed When using a near cache everything will work fine until a second client (could be visor) attempts to connect or disconnect to the cluster while a cache operation is in process.
After the second client connects/disconnects, the original client will always miss the near cache until and the original client restarts. Almost as if the cluster informs the client their are issues and to keep the cluster as the source of truth.
We have been able to reproduce this by running our test and connecting/disconnect with visor. During a disconnect we can see a Timeout mentioned in the logs on the original client IgniteTxManager$NodeFailureTimeoutObject.
Below is a snippet of the logs with the org.apache.ignite.internal.processors suppressed.

[2017-10-09 14:26:52.148] boot - 9955 DEBUG [http-nio-8081-exec-8] --- CacheHelper: Total time accessing cache ng-security-service-ORG_SPEC_CACHE for key * | value com.cache.model.PrefixCluster@78475a88: 0 millis
  [2017-10-09 14:26:52.150] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridDiscoveryManager: Daemon node left topology: TcpDiscoveryNode [id=4cc6c321-d9cc-4149-a6ef-cba68877a269, addrs=[10.70.255.8, 127.0.0.1, 172.17.0.1], sockAddrs=[/172.17
  .0.1:0, /127.0.0.1:0, /10.70.255.8:0], discPort=0, order=57, intOrder=31, lastExchangeTime=1507577126368, loc=false, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=true]
  [2017-10-09 14:26:52.150] boot - 9955 DEBUG [http-nio-8081-exec-8] --- OrgSpecCacheImpl: OrgSpec Cache Stats: OrgSpec ObjId: IgniteCacheProxy [delegate=GridNearCacheAdapter [], opCtx=null, restartFut=null] HitCount: 120, MissCount: 50, AvgReadTime:
  120, Eviction Count: 0
  [2017-10-09 14:26:52.150] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridDeploymentPerVersionStore: Processing node departure event: DiscoveryEvent [evtNode=TcpDiscoveryNode [id=4cc6c321-d9cc-4149-a6ef-cba68877a269, addrs=[10.70.255.8, 127.0.0.1, 172.17.0.1], sockAddrs=[/172.17.0.1:0, /127.0.0.1:0, /10.70.255.8:0], discPort=0, order=57, intOrder=31, lastExchangeTime=1507577126368, loc=false, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=true], topVer=58, nodeId8=2e573c60, msg=Node left: TcpDiscoveryNode [id=4cc6c321-d9cc-4149-a6ef-cba68877a269, addrs=[10.70.255.8, 127.0.0.1, 172.17.0.1], sockAddrs=[/172.17.0.1:0, /127.0.0.1:0, /10.70.255.8:0], discPort=0, order=57, intOrder=31, lastExchangeTime=1507577126368, loc=false, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=true], type=NODE_LEFT, tstamp=1507577212142]
  [2017-10-09 14:26:52.163] boot - 9955  INFO [exchange-worker-#27%null%] --- time: Started exchange init [topVer=AffinityTopologyVersion [topVer=58, minorTopVer=0], crd=false, evt=11, node=TcpDiscoveryNode [id=2e573c60-45f0-4429-a3fa-068489663148, addrs=[0:0:0:0:0:0:0:1%lo, 10.70.242.138, 127.0.0.1], sockAddrs=[port-svc-inc-13.tw-test.net/10.70.242.138:0, /0:0:0:0:0:0:0:1%lo:0, /127.0.0.1:0], discPort=0, order=56, intOrder=0, lastExchangeTime=1507576971754, loc=true, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=true], evtNode=TcpDiscoveryNode [id=2e573c60-45f0-4429-a3fa-068489663148, addrs=[0:0:0:0:0:0:0:1%lo, 10.70.242.138, 127.0.0.1], sockAddrs=[port-svc-inc-13.tw-test.net/10.70.242.138:0, /0:0:0:0:0:0:0:1%lo:0, /127.0.0.1:0], discPort=0, order=56, intOrder=0, lastExchangeTime=1507576971754, loc=true, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=true], customEvt=null]
  [2017-10-09 14:26:52.164] boot - 9955  INFO [exchange-worker-#27%null%] --- GridDhtPartitionsExchangeFuture: Snapshot initialization completed [topVer=AffinityTopologyVersion [topVer=58, minorTopVer=0], time=0ms]
  [2017-10-09 14:26:52.164] boot - 9955  INFO [exchange-worker-#27%null%] --- GridDhtPartitionsExchangeFuture: Snapshot initialization completed [topVer=AffinityTopologyVersion [topVer=58, minorTopVer=0], time=0ms]
  [2017-10-09 14:26:52.164] boot - 9955  INFO [exchange-worker-#27%null%] --- time: Finished exchange init [topVer=AffinityTopologyVersion [topVer=58, minorTopVer=0], crd=false]
  [2017-10-09 14:26:52.203] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridDeploymentLocalStore: Deployment meta for local deployment: GridDeploymentMetadata [depMode=SHARED, alias=org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1, clsName=org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1, userVer=null, sndNodeId=2e573c60-45f0-4429-a3fa-068489663148, clsLdrId=null, clsLdr=null, participants=null, parentLdr=null, record=true, nodeFilter=null, seqNum=n/a]
  [2017-10-09 14:26:52.203] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- LocalDeploymentSpi: Registering [ldrRsrcs={org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f={org.apache.ignite.internal.util.typedef.T2=org.apache.ignite.internal.util.typedef.T2, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap, java.util.Collections$UnmodifiableList=java.util.Collections$UnmodifiableList, org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask=org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap, org.apache.ignite.internal.processors.service.GridServiceProcessor$1=org.apache.ignite.internal.processors.service.GridServiceProcessor$1, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMap}}, ldr=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f, rsrc=class org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1]
  [2017-10-09 14:26:52.203] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- LocalDeploymentSpi: Resources to register: {org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1=org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1}
  [2017-10-09 14:26:52.203] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- LocalDeploymentSpi: New resources: {org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1=org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1}
  [2017-10-09 14:26:52.203] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- LocalDeploymentSpi: Removing resources [clsLdrToIgnore=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f, rsrcs={org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1=org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1}]
  [2017-10-09 14:26:52.203] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridDeploymentLocalStore: Retrieved auto-loaded resource from spi: DeploymentResourceAdapter [name=org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1, rsrcCls=class org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1, clsLdr=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f]
  [2017-10-09 14:26:52.203] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridDeploymentLocalStore: Acquired deployment class: GridDeployment [ts=1507576972855, depMode=SHARED, clsLdr=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f, clsLdrId=6d9e6920f51-2e573c60-45f0-4429-a3fa-068489663148, userVer=0, loc=true, sampleClsName=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap, pendingUndeploy=false, undeployed=false, usage=0]
  [2017-10-09 14:26:52.203] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridResourceProcessor: Injecting resources [target=org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1@61ea2cff]
  [2017-10-09 14:26:52.211] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridDeploymentLocalStore: Deployment meta for local deployment: GridDeploymentMetadata [depMode=SHARED, alias=org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1, clsName=org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1, userVer=null, sndNodeId=2e573c60-45f0-4429-a3fa-068489663148, clsLdrId=null, clsLdr=null, participants=null, parentLdr=null, record=true, nodeFilter=null, seqNum=n/a]
  [2017-10-09 14:26:52.211] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- LocalDeploymentSpi: Registering [ldrRsrcs={org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f={org.apache.ignite.internal.util.typedef.T2=org.apache.ignite.internal.util.typedef.T2, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap, java.util.Collections$UnmodifiableList=java.util.Collections$UnmodifiableList, org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask=org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap, org.apache.ignite.internal.processors.service.GridServiceProcessor$1=org.apache.ignite.internal.processors.service.GridServiceProcessor$1, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMap, org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1=org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1}}, ldr=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f, rsrc=class org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1]
  [2017-10-09 14:26:52.211] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- LocalDeploymentSpi: Resources to register: {org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1=org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1}
  [2017-10-09 14:26:52.211] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- LocalDeploymentSpi: New resources: {org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1=org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1}
  [2017-10-09 14:26:52.211] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- LocalDeploymentSpi: Removing resources [clsLdrToIgnore=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f, rsrcs={org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1=org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1}]
  [2017-10-09 14:26:52.211] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridDeploymentLocalStore: Retrieved auto-loaded resource from spi: DeploymentResourceAdapter [name=org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1, rsrcCls=class org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1, clsLdr=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f]
  [2017-10-09 14:26:52.212] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridDeploymentLocalStore: Acquired deployment class: GridDeployment [ts=1507576972855, depMode=SHARED, clsLdr=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f, clsLdrId=6d9e6920f51-2e573c60-45f0-4429-a3fa-068489663148, userVer=0, loc=true, sampleClsName=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap, pendingUndeploy=false, undeployed=false, usage=0]
  [2017-10-09 14:26:52.212] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridResourceProcessor: Injecting resources [target=org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1@1ff41d49]
  [2017-10-09 14:26:52.213] boot - 9955 DEBUG [pub-#34%null%] --- GridClosureProcessor: Grid runnable started: closure-proc-worker
  [2017-10-09 14:26:52.213] boot - 9955 DEBUG [pub-#34%null%] --- GridClosureProcessor: Grid runnable finished normally: closure-proc-worker
  [2017-10-09 14:26:52.216] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- TcpCommunicationSpi: Forcing NIO client close since node has left [nodeId=4cc6c321-d9cc-4149-a6ef-cba68877a269, client=GridTcpNioCommunicationClient [ses=GridSelectorNioSessionImpl [worker=DirectNioClientWorker [super=AbstractNioClientWorker [idx=3, bytesRcvd=714, bytesSent=6799, bytesRcvd0=0, bytesSent0=0, select=true, super=GridWorker [name=grid-nio-worker-tcp-comm-3, igniteInstanceName=null, finished=false, hashCode=1557230104, interrupted=false, runner=grid-nio-worker-tcp-comm-3-#20%null%]]], writeBuf=java.nio.DirectByteBuffer[pos=0 lim=32768 cap=32768], readBuf=java.nio.DirectByteBuffer[pos=0 lim=32768 cap=32768], inRecovery=GridNioRecoveryDescriptor [acked=0, resendCnt=0, rcvCnt=1, sentCnt=1, reserved=true, lastAck=0, nodeLeft=false, node=TcpDiscoveryNode [id=4cc6c321-d9cc-4149-a6ef-cba68877a269, addrs=[10.70.255.8, 127.0.0.1, 172.17.0.1], sockAddrs=[/172.17.0.1:0, /127.0.0.1:0, /10.70.255.8:0], discPort=0, order=57, intOrder=31, lastExchangeTime=1507577126368, loc=false, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=true], connected=true, connectCnt=0, queueLimit=4096, reserveCnt=1, pairedConnections=false], outRecovery=GridNioRecoveryDescriptor [acked=0, resendCnt=0, rcvCnt=1, sentCnt=1, reserved=true, lastAck=0, nodeLeft=false, node=TcpDiscoveryNode [id=4cc6c321-d9cc-4149-a6ef-cba68877a269, addrs=[10.70.255.8, 127.0.0.1, 172.17.0.1], sockAddrs=[/172.17.0.1:0, /127.0.0.1:0, /10.70.255.8:0], discPort=0, order=57, intOrder=31, lastExchangeTime=1507577126368, loc=false, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=true], connected=true, connectCnt=0, queueLimit=4096, reserveCnt=1, pairedConnections=false], super=GridNioSessionImpl [locAddr=/10.70.242.138:47100, rmtAddr=/10.70.255.8:53916, createTime=1507577162587, closeTime=0, bytesSent=6799, bytesRcvd=714, bytesSent0=0, bytesRcvd0=0, sndSchedTime=1507577162587, lastSndTime=1507577162697, lastRcvTime=1507577162617, readsPaused=false, filterChain=FilterChain[filters=[GridNioCodecFilter [parser=org.apache.ignite.internal.util.nio.GridDirectParser@9573b3b, directMode=true], GridConnectionBytesVerifyFilter], accepted=true]], super=GridAbstractCommunicationClient [lastUsed=1507577162587, closed=false, connIdx=0]]]
  [2017-10-09 14:26:52.217] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- TcpCommunicationSpi: Offered move [ses=GridSelectorNioSessionImpl [worker=DirectNioClientWorker [super=AbstractNioClientWorker [idx=3, bytesRcvd=714, bytesSent=6799, bytesRcvd0=0, bytesSent0=0, select=true, super=GridWorker [name=grid-nio-worker-tcp-comm-3, igniteInstanceName=null, finished=false, hashCode=1557230104, interrupted=false, runner=grid-nio-worker-tcp-comm-3-#20%null%]]], writeBuf=java.nio.DirectByteBuffer[pos=0 lim=32768 cap=32768], readBuf=java.nio.DirectByteBuffer[pos=0 lim=32768 cap=32768], inRecovery=GridNioRecoveryDescriptor [acked=0, resendCnt=0, rcvCnt=1, sentCnt=1, reserved=true, lastAck=0, nodeLeft=false, node=TcpDiscoveryNode [id=4cc6c321-d9cc-4149-a6ef-cba68877a269, addrs=[10.70.255.8, 127.0.0.1, 172.17.0.1], sockAddrs=[/172.17.0.1:0, /127.0.0.1:0, /10.70.255.8:0], discPort=0, order=57, intOrder=31, lastExchangeTime=1507577126368, loc=false, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=true], connected=true, connectCnt=0, queueLimit=4096, reserveCnt=1, pairedConnections=false], outRecovery=GridNioRecoveryDescriptor [acked=0, resendCnt=0, rcvCnt=1, sentCnt=1, reserved=true, lastAck=0, nodeLeft=false, node=TcpDiscoveryNode [id=4cc6c321-d9cc-4149-a6ef-cba68877a269, addrs=[10.70.255.8, 127.0.0.1, 172.17.0.1], sockAddrs=[/172.17.0.1:0, /127.0.0.1:0, /10.70.255.8:0], discPort=0, order=57, intOrder=31, lastExchangeTime=1507577126368, loc=false, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=true], connected=true, connectCnt=0, queueLimit=4096, reserveCnt=1, pairedConnections=false], super=GridNioSessionImpl [locAddr=/10.70.242.138:47100, rmtAddr=/10.70.255.8:53916, createTime=1507577162587, closeTime=0, bytesSent=6799, bytesRcvd=714, bytesSent0=0, bytesRcvd0=0, sndSchedTime=1507577162587, lastSndTime=1507577162697, lastRcvTime=1507577162617, readsPaused=false, filterChain=FilterChain[filters=[GridNioCodecFilter [parser=org.apache.ignite.internal.util.nio.GridDirectParser@9573b3b, directMode=true], GridConnectionBytesVerifyFilter], accepted=true]], fut=NioOperationFuture [op=CLOSE]]
  [2017-10-09 14:26:52.217] boot - 9955 DEBUG [disco-event-worker-#26%null%] --- GridIoManager: Removed messages from discovery startup delay list (sender node left topology): null
  [2017-10-09 14:26:52.217] boot - 9955 DEBUG [pub-#35%null%] --- GridClosureProcessor: Grid runnable started: closure-proc-worker
  [2017-10-09 14:26:52.217] boot - 9955 DEBUG [pub-#35%null%] --- GridClosureProcessor: Grid runnable finished normally: closure-proc-worker
  [2017-10-09 14:26:52.283] boot - 9955 DEBUG [grid-timeout-worker-#15%null%] --- GridTimeoutProcessor: Timeout has occurred: org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject@7ff59c90
  [2017-10-09 14:26:52.284] boot - 9955 DEBUG [grid-timeout-worker-#15%null%] --- GridDeploymentLocalStore: Deployment meta for local deployment: GridDeploymentMetadata [depMode=SHARED, alias=org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$2, clsName=org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$2, userVer=null, sndNodeId=2e573c60-45f0-4429-a3fa-068489663148, clsLdrId=null, clsLdr=null, participants=null, parentLdr=null, record=true, nodeFilter=null, seqNum=n/a]
  [2017-10-09 14:26:52.285] boot - 9955 DEBUG [grid-timeout-worker-#15%null%] --- LocalDeploymentSpi: Registering [ldrRsrcs={org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f={org.apache.ignite.internal.util.typedef.T2=org.apache.ignite.internal.util.typedef.T2, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap, java.util.Collections$UnmodifiableList=java.util.Collections$UnmodifiableList, org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask=org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap, org.apache.ignite.internal.processors.service.GridServiceProcessor$1=org.apache.ignite.internal.processors.service.GridServiceProcessor$1, org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1=org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap, org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMap=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMap, org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1=org.apache.ignite.internal.processors.task.GridTaskProcessor$TaskDiscoveryListener$1}}, ldr=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f, rsrc=class org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$2]
  2017-10-09 14:26:52.285] boot - 9955 DEBUG [grid-timeout-worker-#15%null%] --- GridDeploymentLocalStore: Retrieved auto-loaded resource from spi: DeploymentResourceAdapter [name=org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$2, rsrcCls=class org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$2, clsLdr=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f]
  [2017-10-09 14:26:52.285] boot - 9955 DEBUG [grid-timeout-worker-#15%null%] --- GridDeploymentLocalStore: Acquired deployment class: GridDeployment [ts=1507576972855, depMode=SHARED, clsLdr=org.springframework.boot.loader.LaunchedURLClassLoader@7adf9f5f, clsLdrId=6d9e6920f51-2e573c60-45f0-4429-a3fa-068489663148, userVer=0, loc=true, sampleClsName=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap, pendingUndeploy=false, undeployed=false, usage=0]
  [2017-10-09 14:26:52.285] boot - 9955 DEBUG [grid-timeout-worker-#15%null%] --- GridResourceProcessor: Injecting resources [target=org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$2@3f183e4]
  [2017-10-09 14:26:52.317] boot - 9955 DEBUG [http-nio-8081-exec-8] --- CacheHelper: Total time accessing cache ng-security-service-ORG_SPEC_CACHE for key * | value com.cache.model.PrefixCluster@6954be5d: 167 millis
  [2017-10-09 14:26:52.319] boot - 9955 DEBUG [http-nio-8081-exec-8] --- OrgSpecCacheImpl: OrgSpec Cache Stats: OrgSpec ObjId: IgniteCacheProxy [delegate=GridNearCacheAdapter [], opCtx=null, restartFut=null] HitCount: 126, MissCount: 53, AvgReadTime: 126, Eviction Count: 0
  [2017-10-09 14:26:52.321] boot - 9955 DEBUG [sys-#36%null%] --- GridClosureProcessor: Grid runnable started: closure-proc-worker

My question is, is this expected behavior? Can we get the near cache not be bypassed, or in the least re-establish using the near cache after the bad client disconnects.

A: It turns out their is a bug with the near cache. When a topology change occurs it can wipe out the topology version on the NearCacheGridEntry which will cause every call to check if the entry is valid to return false.
Bug has been submitted https://issues.apache.org/jira/browse/IGNITE-6767


text:
Q: extract and group data from a multidimensional array I want to print out information from a multidimensional array.
Here is my array structure:
// A two-dimensional array
$cars=array
(
    array('service' => "Windows8",'host' => Sydney1,'state' => on),
    array('service' => "unix",'host' => Newyork2,'state' => off),
    array('service' => "Windows8",'host' => Singapore3,'state' => on),
    array('service' => "unix",'host' => Tokyo4,'state' => off),
    array('service' => "Windows8",'host' => Tokyo4,'state' => on),
);

I want to arrange the data to print out the following:
Data grouped by service: desired output:
Windows8 (3): Sydney1 (on), Singapore3 (on), Tokyo4 (on)
unix (2): Newyork2 (off), Tokyo4 (off)

Data grouped by host: desired output:
Sydney1 (1): Windows8 (on)
Newyork2 (1): unix (off)
Singapore3 (1): Windows8 (on)
Tokyo4 (2): unix (off), Windows8 (on)

Here is the code I have tried so far:
    $arr = array();

    foreach($cars as $key => $item)
    {
       $arr[$item['service_name']][$key] = $item;
    }
    echo '
';
    print_r($arr);
    echo '
';

    $size = sizeof($arr);
    $i=1;
    foreach($arr as $key => $item)
    {
        echo $key;
    }

A: The trick to manipulating arrays is to arranging them into data structures that will make it easy for you to retrieve the data you need.
$cars=array (
       array('service' => "Windows8",'host' => 'Sydney1','state' => 'on'),
       array('service' => "unix",'host' => 'Newyork2','state' => 'off'),
       array('service' => "Windows8",'host' => 'Singapore3','state' => 'on'),
       array('service' => "unix",'host' => 'Tokyo4','state' => 'off'),
       array('service' => "Windows8",'host' => 'Tokyo4','state' => 'on'),
);

# initialise an array to group data by service and by location
$data = array();

foreach ($cars as $c) {
    # the key is the service name, and the value is an array of host/state pairs
    $data['by_service'][ $c['service'] ][] = array( $c['host'] , $c['state'] );

    # the key is the location name, and the value is an array of service/state pairs
    $data['by_location'][ $c['host'] ][] = array( $c['service'] , $c['state'] );
}

# create a function that we can use to print data from the pairs in the
# data structures above: it creates a string with the first array item
# followed by the second item in brackets
function print_arr ($arr) {
    return $arr[0] . " (" . $arr[1] . ")";
}

# group by service:
foreach ($data['by_service'] as $s => $host) {
    # print the service type, $s, and count the number of hosts
    echo "$s (" . count($host) . "): ";

    # print the details for the individual hosts, using print_arr for the details
    # array_map is an extremely useful function that allows you to apply a function
    # to every member of an array. It saves having to create new arrays or alter
    # the array using foreach and you can include it in an echo statement.
    echo implode(", ", array_map( "print_arr", $host ) ) . "\n";
}

echo "\n\n";

# group by location
foreach ($data['by_location'] as $l => $host) {
    # print the location and the count for the number of hosts
    echo "$l (" . count($host) . "): ";
    echo implode(", ", array_map( "print_arr", $host ) ) . "\n";
}

Output:
Windows8 (3): Sydney1 (on), Singapore3 (on), Tokyo4 (on)
unix (2): Newyork2 (off), Tokyo4 (off)

Sydney1 (1): Windows8 (on)
Newyork2 (1): unix (off)
Singapore3 (1): Windows8 (on)
Tokyo4 (2): unix (off), Windows8 (on)

You might find a print_r of the $data structure helpful if you're getting lost in the code.

A: $cars=array
   (
    array('service'=> "Windows8",'host'=> 'Sydney1','state'   => 'on'),
    array('service'=> "unix",'host'    => 'Newyork2','state'  => 'off'),
    array('service'=> "Windows8",'host'=> 'Singapore3','state'=> 'on'),
    array('service'=> "unix",'host'    => 'Tokyo4','state'    => 'off'),
    array('service'=> "Windows8",'host'=> 'Tokyo4','state'    => 'on'),
   );

    $windows    = array();
    $i          = 0;
    $j          = 0;
while(list($carval, $value) = each($cars))
{

     // echo $key." = ".$value."
\n";
     if($value['service']=="Windows8"){
        $windows[$i++] = $value['host']."(".$value['state'].")";
     }
     else{
        $unix[$j++] = $value['host']."(".$value['state'].")";
     }

}
echo "Windows8 (".count($windows).") : ";
foreach($windows as $vall)
{
    echo $vall.", ";
}

echo "
Unix (".count($unix).") : ";

foreach($unix as $vall)
{
    echo $vall.", ";
}

this is for the first part wait ill catch you with full ans...

A: <?php

$cars = array
(
    array('service' => 'Windows8','host' => 'Sydney1','state' => 'on'),
    array('service' => 'unix','host' => 'Newyork2','state' => 'off'),
    array('service' => 'Windows8','host' => 'Singapore3','state' => 'on'),
    array('service' => 'unix','host' => 'Tokyo4','state' => 'off'),
    array('service' => 'Windows8','host' => 'Tokyo4','state' => 'on'),
);

// Create the output array
$output = array();
foreach($cars as $car)
{
    // If the service isn't added yet, add it otherwise increase it
    // I do it this way to prevent the php warning
    if(empty($output[$car["service"]]["count"])) $output[$car["service"]]["count"] = 1;
    else $output[$car["service"]]["count"]++;

    // Add the host, only if its not exists on the specific service
    if(!in_array($car["host"], $output[$car["service"]]["hosts"]))
        $output[$car["service"]]["hosts"][] = $car["host"];

    // Check if the states there within the host as key
    if(!array_key_exists($car["host"], $output[$car["service"]]["states"]))
        $output[$car["service"]]["states"][$car["host"]] = $car["state"];
}

// Create the first output
foreach($output as $service => $data)
{
    $hosts = array();
    foreach($data["hosts"] as $index => $host)
        $hosts[] = $host . "(" . $data["states"][$host] . ")";

    // Combine the hosts to the string
    $hosts = implode(", ", $hosts);

    echo $service . "(" . $data["count"] . ") : " . $hosts;
    echo "
"; // HTML new line ?
}

// Now the second output, prepare it
$hosts = array(); // Let's store the hosts here, to make the code simple to read :)
foreach($output as $service => $data)
{
    foreach($data["hosts"] as $index => $host)
        $hosts[$host][] = $service . "(" . $data["states"][$host] . ")";
}

// Print it
foreach($hosts as $hostName => $hostData)
{
    $hostValue = array();

    foreach($hostData as $service)
        $hostValue[] = $service;

    echo $hostName . "(" . count($hostData) . ") \t\t: " . implode(", ", $hostValue);
    echo "
"; // HTML new line ?
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Color consecutive higher cells I am trying to create a macro that color cells that are higher than the previous one. I want to color only cells that follow a serie of 5 cells each one hiher than the previous one.
In this screenshot, if I have such a series, only D14 should be colored in red, because D14>D13>D12>D11>D10>D9.
In other terms, because from D9 to D13, the 5 cells are always higher than the previous one.

This is my code but it is not working:
Sub Consecutive_HigherCells()

Dim i, j As Integer

For j = 1 To 5

    If Cells (i,4).Value >> Cells(i-j,4).Value Then

    Cells(i, 4).Select

    With Selection.Font
        .Color = -16776961
        .TintAndShade = 0
    End With

    End If

Next j

End Sub

Thanks for helping me

A: Clearly the first candidate is cell A6 (since it has 5 predecessors):
Sub BetterRedThanDead()
    Dim i As Long, N As Long
    N = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 6 To N
        If boo(Cells(i - 1, 1), Cells(i - 2, 1), Cells(i - 3, 1), Cells(i - 4, 1), Cells(i - 5, 1)) Then
            Cells(i, 1).Interior.ColorIndex = 3
        End If
    Next i
End Sub

Public Function boo(a, b, c, d, e) As Boolean
    boo = False
    If a > b And b > c And c > d And d > e Then boo = True
End Function

For example:

A: You are missing to declare i variable. also >> is not the right way to compare values.
Line should be:
If Cells (i,4).Value > Cells(i-j,4).Value Then

Also you need to add something like
If j = 5 Then 'It implies your validation is success
 With Selection.Font
        .Color = -16776961
        .TintAndShade = 0
    End With
End If


text:
Q: JQuery Mobile: focused input text doesn't respect z-index, appearing above everything else I have a Phonegap application for Android with jQuery Mobile.
On an HTC Desire, if an input box is focused, it always go to the front, no matter which elements has above.

A: Did you try to apply the css property -webkit-transform : translate3d(0,0,0); to your input field ?


text:
Q: Reading chart data from a powerpoint file I have a pptx file which has text, tables and charts. I am trying to automate validation of the data contained in the file using VBScript (not VBA or VB).
I am able to read all the text and table data but unable to read the chart data. Can someone help me to understand how to go about reading pptx chart data using vbscript?

A: SOLVED!
Office 2007 - Slide.Shape.Chart.ChartData.Workbook.Worksheets(1) contains the chart data.


text:
Q: How to Set Color of Column Graph On Click in amCharts? I am trying to change color of selected column in a column graph (built using amCharts).
I have an event listener in place like this:
function handleClick(event) {

        event.item.graph.backgroundColor = "#3C3C3C"; // NOT WORKING
        display_value = event.item.graph.valueField + ": " + event.item.category + ": "  + event.item.values.value;
        console.log(display_value);

}
chart.addListener('clickGraphItem', handleClick);

This didn't work and I couldn't find any related example. I saw an example for Maps, but chart objects work differently.
Please siggest

A: you need to access the SVG element directly and change it's fill/stroke color, access like following within your event callback
event.item.bulletGraphics.node

http://codepen.io/amcharts/pen/3abea07c9fd4c1f44d3523d3dd80d489


text:
Q: Parsing an XML File - Losing My Mind I've looked all over, including here and Google to find a simple way to parse an XML file for iOS6. Everything I've found is slightly different from the next causing extreme confusion on my part. So far this is what I have:
XMLParser.h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class Profile;

@interface XMLParser : NSObject <NSXMLParserDelegate>{
    NSData *profileData;

@private
    Profile *currentProfileObject;

    NSMutableArray *currentParsedBatch;
    NSMutableArray *currentParsedCharacterData;

    BOOL accumlatingParsedCharacterData;
    BOOL didAbortParsing;

    NSUInteger parsedProfilesCounters;
}

@property (copy, readonly) NSData *profileData;

-(id)initWithData:(NSData *)parseData;

@end

My XMLParser.m
#import "XMLParser.h"
#import "Profile.h"

//Create a delegate
@interface XMLParser () <NSXMLParserDelegate>
    @property (nonatomic, retain) Profile *currentProfileObject;
    @property (nonatomic, retain) NSMutableArray *currentParsedBatch;
    @property (nonatomic, retain) NSMutableArray *currentParsedCharacterData;
@end

@implementation XMLParser
@synthesize profileData, currentProfileObject, currentParsedBatch, currentParsedCharacterData;

-(id)initWithData:(NSData *)parseData{
    if(self = [super init]){
        profileData = [parseData copy];
    }
    return self;
}

-(void)addProfilesToList:(NSArray *)profiles{
    assert([NSThread isMainThread]);

}

-(void)main{
    self.currentParsedBatch = [NSMutableArray array];
    self.currentParsedCharacterData = [NSMutableString string];

    NSXMLParser *parser = [[NSXMLParser alloc] initWithData:profileData];

    [parser setDelegate:self];
    [parser parse];

    if([self.currentParsedBatch count] > 0){
        [self performSelectorOnMainThread:@selector(addProfilesToList:) withObject:self.currentParsedBatch waitUntilDone:NO];
    }

    self.currentParsedBatch = nil;
    self.currentProfileObject = nil;
    self.currentParsedCharacterData = nil;

    parser = nil;
}

/*
-(void)dealloc{
    [profileData release];
    [currentParsedCharacterData release];
    [currentParsedBatch release];

    [super dealloc];
}
*/

-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{

    NSLog(@"Parsing...");

    if([elementName isEqualToString:@"profiles"]){
        Profile *profile = [[Profile alloc] init];
        self.currentProfileObject = profile;
        //[profile release];
        profile = nil;
    }
    else if([elementName isEqualToString:@"profile"]){
        NSLog(@"Parsing....");

        [self.currentProfileObject setLastName:[attributeDict valueForKey:@"lastName"]];
        [self.currentProfileObject setFirstName:[attributeDict valueForKey:@"firstName"]];
        [self.currentProfileObject setMobile:[attributeDict valueForKey:@"mobile"]];
        [self.currentProfileObject setPhone:[attributeDict valueForKey:@"phone"]];
        [self.currentProfileObject setEmail:[attributeDict valueForKey:@"email"]];
        [self.currentProfileObject setAltEmail:[attributeDict valueForKey:@"altEmail"]];
        [self.currentProfileObject setAddress:[attributeDict valueForKey:@"address"]];
        [self.currentProfileObject setCity:[attributeDict valueForKey:@"city"]];
        [self.currentProfileObject setState:[attributeDict valueForKey:@"state"]];
        [self.currentProfileObject setZipCode:[attributeDict valueForKey:@"zipCode"]];
        [self.currentProfileObject setProfilePicture:[attributeDict valueForKey:@"profilePicture"]];
    }
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
  namespaceURI:(NSString *)namespaceURI
 qualifiedName:(NSString *)qName{

    if([elementName isEqualToString:@"profile"]){
        [self.currentParsedBatch addObject:self.currentProfileObject];
        parsedProfilesCounters++;

    }
    else if([elementName isEqualToString:@"profiles"]){
        return;

    }
}

@end

Now in my appdelegate file I'm doing this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.

    NSString *xmlFile = [[NSBundle mainBundle] pathForResource:@"profileXML" ofType:@"xml"];
    NSData *xmlData = [[NSData alloc] initWithContentsOfFile:xmlFile];

    [[XMLParser alloc] init];

    MediDirectoryMasterViewController *masterViewController = [[MediDirectoryMasterViewController alloc] initWithNibName:@"MediDirectoryMasterViewController" bundle:nil];
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    return YES;
}

None of this seems to work as I get no response from the log. If you couldn't tell, this is my first iOS app I've ever written so I'm not sure about how to go about all of this. Again, help is greatly appreciated as I'm starting to lose faith.

A: *

*If you think that calling [[XMLParser alloc] init]; will cause to execute XMLParser main method then you are wrong. If you want to call any method of the class you should have reference to instance of that class and then call needed method. For example, in your case:
XMLParser *parser = [[XMLParser alloc] initWithData:xmlData];
[parser main];
[parser release];

*You have a lot of other bugs in your code that will take a lot of time to discuss. That is why I am suggesting you to read some simple examples from Apple Docs, i.e. Your First iOS App. And if you are not familiar with classes and objects you should read about object-oriented programming too.


text:
Q: Check file extension with PHP I was wondering how to make PHP to check what extension it have, and then execute a code. For example, lets see it's a .mp3 file then it would execute: echo 'This is a mp3 file.'; Of course not with that code of course - but more advanced.
Anyhow, got any ideas etc?

A: Use the pathinfo() function to isolate the extension of the file and then use that value in an if statement.

A: There are multiple ways to do this.  If all you are doing is checking for mp3, just explode on the period, pop the last one and then see if the string equal.
for example:
$name = "song.mp3";
$parts = explode('.', $name);
$extension = array_pop($parts);
if( $extension == 'mp3'){
    echo 'This is a mp3 file.';
}

If you are checking for a wide variety of extensions and they are uploaded use
$_FILES['file']['type'];

A: Check this two options to do it:
$filename = 'music.mp3'
$ext = substr(strrchr($filename, '.'), 1);

or
$filename = 'music.mp3';
$ext = pathinfo($filename, PATHINFO_EXTENSION);

Hope it helps :)

A: You can use filetype() or $_FILES[$file][type] to get the file type
.

A: try this
    $file_name = "test.txt";
    $extension = pathinfo($file_name);
    echo "Your file extension is ".$extension ['extension'];

A: If you want to properly detect a file's type, use Fileinfo.
Example ripped for PHP's comments:
<?php
$fi = new finfo(FILEINFO_MIME,'/usr/share/file/magic');
$mime_type = $fi->buffer(file_get_contents($file));


text:
Q: how to measure the processor speed in GHz in JAVA i was able to measure the execution time of program but dont know how to calculate the processor speed. This is required for calculating the clock cycles.
noofclockcycles = time * processorspeed * pow(10,9) / pow(10,3);

A: What you call processor "speed" (clock rate) has no direct relationship to processing capacity, and much less with what part of that processing capacity your program will be assigned by the OS.  It's like trying to find out the RPM of a motor only by its current power output or maximum torque.
You can do an extremely rough approximation by clockRate_B = ( execTime_A * clockRate_A ) / execTime_B, where ( execTime_A * clockRate_A ) was obtained from a  typical machine (or set of typical machines).  However, this doesn't account for CPU architecture differences that can make your test run several times faster or slower at exactly the same clock rate.
Best thing you can do is to exec OS utilities (like cpuinfo in Linux and wmic in Windows) to obtain this information.


text:
Q: Redirecting the new user to the Facebook login page if no session is available with Facebook JavaScript I am developing a Facebook iframe application in JavaScript. The issue is if the user hit my Facebook application URL, I want to redirect the user to the Facebook login page if they are not logged in and after they enter their credentials they will be directed to my application, NOT their Facebook homepage. Here is my code:

        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>Psych-oh! Meter</title>

Welcome

So when I hit the URL while I am not logged into Facebook, I see the Facebook login page's blue header and the below page is saying Page not Found and when I log in on that page, it redirects to my home page of Facebook, not to my application's home index page.

A: Would you be opposed to using the function FB.login to prompt the user to sign in using a  popup?
EDIT
I spoke too soon. From the FB.login docs:

FB.login opens a popup window, and therefore you should only call FB.login when bound to a user driven click. Most browsers block popups, unless they were initiated from a user event, such as a click on a button or a link.


text:
Q: How to show message box until calculations are done? I want place this macro to autoopen and wait until finished to avoid user abort calculations.
This is macro that I found and seems to do what I want. But I want to show msxbog to display "Please wait until calculations are finished" and after its done, then close it. Any idea how I can do it?
Sub WaitUntilFinishedLoop()

    'Loop until all your calculations are done
    Application.Calculate 'Optional - recalculates all formulas
    Do Until Application.CalculationState = xlDone
        ' Show msgbox / dialog?
    Loop

End Sub

A: Make your sub showing the userform vbModal
Sub WaitUntilFinishedLoop()
    Userform1.Show vbModal
End Sub

And make your userform performing the calculation and close it.
Public CalcWasStarted As Boolean

Private Sub UserForm_Activate()
    If CalcWasStarted Then Exit Sub 'make sure it can only run once
    CalcWasStarted = True

    'RemoveCloseButton Me 'see [1]

    'Loop until all your calculations are done
    Application.Calculate 'Optional - recalculates all formulas
    Do Until Application.CalculationState = xlDone
        DoEvents
    Loop
    Unload Me
End Sub

[1] You might want to use what I posted here to hide the  [X] in the userform to prevent that a user can close the form before calculation is finished.
If you want to prevent it from closing with Alt+F4 add the following to your userform code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    If CloseMode = 0 Then Cancel = True
End Sub

A: If you create a userform with the information you want then you can just do this:
Userform1.Show (0)
Application.Calculate 'Optional - recalculates all formulas
Do Until Application.CalculationState = xlDone
    doevents
Loop
unload Userform1

The user can still close the window but I don't think there is any way to stop a user from having the control, without disabling mouse clicks and such.
And I'm not sure that is such a good idea.


text:
Q: How to pack a rails application into an exe file to distrubute it with tar2rubyscript? I was following this How-To on Distributing Rails Applications
http://www.erikveen.dds.nl/distributingrubyapplications/rails.html
but by the time i do
$ ruby tar2rubyscript.rb desktopApp/
the output is
#=> tar2rubyscript.rb doesn't contain an init.rb .
so i followed this steps here:
https://github.com/ryanbooker/tar2rubyscript
and nope... it's still not working.
any help on this or any alternative to tar2rubyscript?
Thank you all.


text:
Q: Auto layout issue with embed YouTube video I am having auto layout issues with an embed YouTube video.  In fact Apple have just rejected the App I have sent them on these grounds.  This is the code that I have submitted.
import UIKit

 class ImproveViewController: UIViewController {

@IBOutlet weak var videoView: UIWebView!

override func viewDidLoad() {
    super.viewDidLoad()
    let youTubeUrl = "https://www.youtube.com/embed/NpepI1dtIz8"
    videoView.allowsInlineMediaPlayback = true

    dispatch_async(dispatch_get_main_queue(), { () -> Void in

        self.videoView.loadHTMLString("<iframe width=\"\(self.videoView.frame.width)\" height=\"\(self.videoView.frame.height)\" src=\"\(youTubeUrl)\" frameborder=\"0\" allowfullscreen></iframe>", baseURL: nil)

        print("This is run on the main queue, after the previous code in outer block")
    })

    // Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    // Get the new view controller using segue.destinationViewController.
    // Pass the selected object to the new view controller.
}
*/

}

This what is looks like when I run in the simulator.
How can this be fixed? Any help will be greatly appreciated.  I have added the Web View constraints to the entire screen.  Thanks again for your help.

A: Your code look okay and I have tested it. I think you have problem in constraints.
Just add Top, Bottom, Leading and trailing constraints with constants = 0 to superview


text:
Q: How to use BeanMapHandler with field to column mapping with key as ID in a nested SELECT query? I have a nested SQL query to fetch employee details using their ID.
Right now I am using BeanListHandler to fetch data as a List<Details> but want to store it as a Map<String, Details> where the ID I originally pass needs to be the key for easy retrieval instead of searching the List with streams every time.
I have tried to convert to Maps but I am not sure of how to map the ID as String nor how to get the original ID passed to the inner Query as a column in the final result.
MainTest.java:
String candidateId = "('1111', '2222', '3333', '4444')";

String detailsQuery =
    "select PARTNER, BIRTHDT, XSEXM, XSEXF from \"schema\".\"platform.view/table2\" where partner IN \r\n"
            + "(select SID from \"schema\".\"platform.view/table1\" where TYPE='BB' and CLASS='yy' and ID IN \r\n"
            + "(select SID from \"schema\".\"platform.view/table1\" where TYPE='AA' and CLASS='zz' and ID IN"
            + candidateId + "\r\n" + "))";

Map<String, Details> detailsView = queryRunner.query(conn, detailsQuery, new DetailsViewHandler());

Details.java:
public class Details {

    private String candidateId;
    private String birthDate;
    private String maleSex;
    private String femaleSex;

    // getter and setter
}

DetailsViewHandler.java:
public class DetailsViewHandler extends BeanMapHandler<String, Details> {

    public DetailsViewHandler() {
        super(Details.class, new BasicRowProcessor(new BeanProcessor(getColumnsToFieldsMap())));
    }

    public static Map<String, String> getColumnsToFieldsMap() {
        Map<String, String> columnsToFieldsMap = new HashMap<>();
        columnsToFieldsMap.put("PARTNER", "candidateId");
        columnsToFieldsMap.put("BIRTHDT", "birthDate");
        columnsToFieldsMap.put("XSEXM", "maleSex");
        columnsToFieldsMap.put("XSEXF", "femaleSex");
        return columnsToFieldsMap;
    }
}

Is there a way to get the ID (candidateId) in the result and what am I missing in terms of creating the key-value pairing ?

A: From the doc https://commons.apache.org/proper/commons-dbutils/apidocs/org/apache/commons/dbutils/handlers/BeanMapHandler.html
of constructor which you are using
public BeanMapHandler(Class<V> type,
                      RowProcessor convert)

// Creates a new instance of BeanMapHandler. The value of the first column of each row will be a key in the Map.

Above should work.
You can also try overriding createKey like so
protected K createKey(ResultSet rs)
               throws SQLException {
return rs.getString("PARTNER"); // or getInt whatever suits

}


text: Q: How to add multi line text in ui grid column? Suppose there  are $scope.gridoptions.columns =[ 5cols]. I need to make one of the ui grid column to wrap to multi line text area. On click of  edit cell, it should come in multi line format


text:
Q: Clicking the button does not trigger Confirm-box popup I am using jQuery confirm box plugin and want to trigger it on anchor-click event. The code I use does not work:
Add Grid

function addData(){
    $('.example-p-2').on('click', function () {
        $.confirm({
            confirmButtonClass: 'btn-info',
            cancelButtonClass: 'btn-danger'
        });
    });
}

When i click on the button above, it should open a small fancy confirm box, but instead it reloads the page. I also get an error: object cant find property.
Please correct me.

A: You need to stop the event default behaviour, in this case its an a element thus it will try to naviate to the href you provide. You can prevent this by doing evt.preventDefault(). You also dont need the function definition.
Replace your code from:
function addData(){
    $('.example-p-2').on('click', function () {
        $.confirm({
            confirmButtonClass: 'btn-info',
            cancelButtonClass: 'btn-danger'
        });
    });
}

to:
 $('.example-p-2').on('click', function (evt) {
      evt.preventDefault();
      $.confirm({
           confirmButtonClass: 'btn-info',
           cancelButtonClass: 'btn-danger'
      });
 });

Hope this helps.

A: Your addData() function is only adding the event listener to the button the first time it's called, to show your confirm popup you should use directly
$('.example-p-2').on('click', function () {
                                $.confirm({
                                    confirmButtonClass: 'btn-info',
                                    cancelButtonClass: 'btn-danger'
                                });

                            });

and your button should look like
Add Grid

Here's a working Plunker

A: Change your code to this:
Add Grid

http://jsfiddle.net/nzezu5zy/

A: You can try this...
Add Grid

$('#addData').bind('click',function(){

});


text:
Q: How to extract an arithmetic operation from a string with Pandas In a Pandas DataFrame
>> df.head()

    A                               B             C
0   1    â#0.00 + "s=?0.07 + 'due0.93    rt@-[ 3.01
1   2    â#0.02 + "s=?0.16 + 'due0.82    rt@-[ 2.97
...

I would like to extract only the numeric values. Column C I can do with, e.g.,
>> extr = df['C'].str.extract(r'(\d+\.\d+)', expand=False)
>> df['C'] = pd.to_numeric(extr)
>> df.head()

    A                               B       C
0   1    â#0.00 + "s=?0.07 + 'due0.93    3.01
1   2    â#0.02 + "s=?0.16 + 'due0.82    2.97
...

but I have problems with the B column. How can I extract the + operations, as well as the floats? I tried
>> extr = df['B'].str.extract(r'(\d+\.\d+)\+(\d+\.\d+)\+(\d+\.\d+)', expand=False)

which I was hoping would give me something like
                    0
0    '0.00+0.07+0.93'
1    '0.02+0.16+0.82'
...

but instead it gives me three columns with NaN values in them:
       0      1      2
0    NaN    NaN    NaN
1    NaN    NaN    NaN
...

So how could I extract the whole arithmetic operations?
(Only the + operations are needed, and any other characters, such as -, can be ignored.)

A: An alternate approach using Series.str.findall:
df['B'] = df['B'].str.findall(r'(\d+(?:.\d+)?)').agg('+'.join)

# print(df)
   A               B     C
0  1  0.00+0.07+0.93  3.01
1  2  0.02+0.16+0.82  2.97

timeit comparision of all the solutions:
df.shape
(20000, 4)

%%timeit -n100 @Shubham solution
df['B'].str.findall(r'(\d+(?:.\d+)?)').agg('+'.join)
31.9 ms ± 1.51 ms per loop (mean ± std. dev. of 7 runs, 100 loops each)

%%timeit -n100 @Rakesh solution
df["B"].str.findall(r"(\d+\.\d+)").str.join("+")
32.7 ms ± 1.71 ms per loop (mean ± std. dev. of 7 runs, 100 loops each)

%%timeit -n100 @Sammy solution
["+".join(re.findall("(\d+\.?\d+)",entry)) for entry in df.B]
36.8 ms ± 431 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

%%timeit -n100 @JudV solution
df['B'].str.replace(r'[^\d.+]', '')
59.7 ms ± 5.81 ms per loop (mean ± std. dev. of 7 runs, 100 loops each)

A: One way is to run a str join on the extracted data, using + as the delimiter
import re

df = pd.read_clipboard(sep='\s{2,}')

df['extract'] = ["+".join(re.findall("(\d+\.?\d+)",entry)) for entry in df.B]

    A                 B                  C         extract
0   1   â#0.00 + "s=?0.07 + 'due0.93    3.01    0.00+0.07+0.93
1   2   â#0.02 + "s=?0.16 + 'due0.82    2.97    0.02+0.16+0.82

A: Python is not my forte but I'd use replace instead and do the operation for both columns, maybe look into:
df[['B', 'C']] = df[['B','C']].replace(r'[^\d.+]', '', regex=True)
print(df)

Result:
   A               B     C
0  1  0.00+0.07+0.93  3.01
1  2  0.02+0.16+0.82  2.97

If it's just column B you are after than maybe simply use:
extr = df['B'].str.replace(r'[^\d.+]', '')

A: This is one approach using str.findall & .str.join("+")
Ex:
df = pd.DataFrame({"B": ["""â#0.00 + "s=?0.07 + 'due0.93""", """â#0.02 + "s=?0.16 + 'due0.82"""]})
df["Z"] = df["B"].str.findall(r"(\d+\.\d+)").str.join("+")

print(df)

Output:
                              B               Z
0  â#0.00 + "s=?0.07 + 'due0.93  0.00+0.07+0.93
1  â#0.02 + "s=?0.16 + 'due0.82  0.02+0.16+0.82


text:
Q: Insert JFrame into a Tab in Swing I Have an already given JFrame frame, that I want to show it (insert it) into a tab of JTabbedPane, but that was not possible explicitely like that:
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

mainTabs.addTab("Editor", null, frame, null);

And the error was:
java.lang.IllegalArgumentException: adding a window to a container

I tried some solutions like to insert the frame into a JPanel but also in vain. I have the idea to convert it into an InternalJFrame but I don't have any idea about that.
Is that any solution to insert that frame?
UPDATE:
I tried that soluion:
 mainTabs.addTab("Editor", null, frame.getContentPane(), null);

But i lost the JMenuBar that I added.

A: You can't add JFrame(or another top-level component) to another component/container, but you can use getContentPane() method of frame, to get main panel of your frame and add that to JTabbedPane tab. Like next:
JTabbedPane tabs = new JTabbedPane();
JFrame frame = new JFrame();
frame.add(new JButton("button"));
tabs.addTab("1", frame.getContentPane());

Also you can change JFrame to JPanel and use that.
Read about JInternalFrame, top-level containers.
EDIT: getContentPane() doesn't return any decorations or JMenuBar, this components you need to add manually, like in next example with menu:
JTabbedPane tabs = new JTabbedPane();

JFrame frame = new JFrame();
JMenuBar bar = new JMenuBar();
bar.add(new JMenu("menu"));
frame.setJMenuBar(bar);
frame.add(new JButton("button"));

JPanel tab1 = new JPanel(new BorderLayout());
tab1.add(frame.getJMenuBar(),BorderLayout.NORTH);
tab1.add(frame.getContentPane());
tabs.addTab("1", tab1);


text:
Q: Zend & Doctrine2: Error with proxies from command line scripts I'm working with Zend and Doctrine2 and I needed to create some cronjobs using the same structure. the problem is, when I tried to get the repository from a Model with relationship with another Model, I got an error (only in command-line, in the website works fine if I do the same).
This is the error I get in the command-line:
Fatal error: Class 'Proxy\Model_MediaPresetsProxy' not found in c:\php\library\Doctrine\ORM\Proxy\ProxyFactory.php on line 92
I have the proxies in this folder /application/models/proxies/ and the file Model_MediaPresetsProxy is in that directory
<?php

namespace Proxy;

/**
 * THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
 */
class Model_MediaPresetsProxy extends \Model_MediaPresets implements \Doctrine\ORM\Proxy\Proxy
{
[...]

Here is what I created for the crons
/crons/init.php
<?php

$time = microtime(true);
$memory = memory_get_usage();

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', 'cldev');

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

defined('NL')
    || define('NL', "\n");

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap();

// set bootstrap param
$bootstrap = $application->getBootstrap();
$front = $bootstrap->getResource('FrontController');
$front->setParam('bootstrap', $bootstrap);

register_shutdown_function('__shutdown');

function __shutdown()
{
    global $time, $memory;
    $endTime = microtime(true);
    $endMemory = memory_get_usage();

    echo '
    Time [' . ($endTime - $time) . '] Memory [' . number_format(( $endMemory - $memory) / 1024) . 'Kb]
';
}

and then I created my cronjob to test that everything was working
/crons/queue/processQueue.php
<?php

require realpath( dirname(__FILE__) . '/../init.php');

$paths = Helper_Media::getPaths();
$magick = new App_PhMagick();

$em = Zend_Registry::getInstance()->entityManager;

$queue = $em->getRepository('Model_MediaQueue')->findAll();

echo 'Items in the queue: ' . count($queue) . NL;

And this are the models I'm using for that
/application/models/MediaQueue.php
<?php

use Doctrine\Common\Collections\ArrayCollection;

/**
 * @Entity
 * @Table(name="media_queue")
 */
class Model_MediaQueue
{
    /**
     * @Id @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    private $queue_id;

    /**
     * @ManyToOne(targetEntity="Model_MediaPresets")
     * @JoinColumn(name="queue_preset_id", referencedColumnName="preset_id")
     */
    private $media_preset;

    /**
     * @ManyToOne(targetEntity="Model_Sites", inversedBy="media_list")
     * @JoinColumn(name="queue_site_id", referencedColumnName="site_id")
     */
    private $media_site;

    /**
     * @Column(type="string")
     */
    private $source_media_file;

    /** @Column(type="integer") */
    private $result_media_id;

    /** @Column(type="integer") */
    private $queue_status;

    /** @Column(type="integer") */
    private $queue_added;

    /** @Column(type="integer") */
    private $queue_processed;

    public function __construct()
    {
        $this->media_preset = new \Doctrine\Common\Collections\ArrayCollection();
        $this->media_site = new \Doctrine\Common\Collections\ArrayCollection();
    }

    [...]
}

/application/models/MediaPresets.php
<?php

/**
 * @Entity
 * @Table(name="media_presets")
 */
class Model_MediaPresets
{
    /**
     * @Id @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    private $preset_id;

    /**
     * @Column(name="preset_type", type="string", columnDefinition="enum('video', 'photo')")
     */
    private $preset_type;

    /** @Column(type="string") */
    private $preset_name;

    /** @Column(type="string") */
    private $preset_formats_order;

    /** @Column(type="integer") */
    private $preset_size_w;

    /** @Column(type="integer") */
    private $preset_size_h;

    /**
     * @Column(name="preset_resize_method", type="string", columnDefinition="enum('Maintain', 'Stretch', 'Centre', 'Abort')")
     */
    private $preset_resize_method;

    /** @Column(type="string") */
    private $preset_watermark;

    /** @Column(type="string") */
    private $preset_background;

}

any clues?
Many thanks :)

A: Well after a while I found myself the solution.
The problem was that I created 2 different Environments: DEVELOPMENT and CLDEV (Command-line development)
and my getEntityManager() function had a line with
[...]
$config->setAutoGenerateProxyClasses((APPLICATION_ENV == 'development'));
[...]

So I replaced it with
[...]
$config->setAutoGenerateProxyClasses((APPLICATION_ENV == 'development' || APPLICATION_ENV == 'cldev'));
[...]

and the problem is solved. Hope it will help somebody else in the future.


text:
Q: Implement cache using closure I want to implement a cache-like closure that cache the results to perform faster. e.g imagine two numbers are given and the purpose is to return the multiply of them, first we look at the cache whether it is calculated before or not, if so it returns the value quickly, otherwise it should be calculated and saved in the cache.
Here is what I've implemented:
var Obj = {
    h(x, y) {
        return x + y;
    },
    slow(x, y) {
        alert('called slow function with ' + x + ', ' + y);
        return x * y * this.h(x, y)
    }
}

function c (func){
    var cache = {};
    return function(x, y){
        if (!cache[[x, y]]){
            cache[[x, y]] = func(x, y);
        }
        return cache[[x, y]];
    }
}

Obj.slow = c(Obj.slow);
alert(Obj.slow(1, 4));
alert(Obj.slow(1, 2));
alert(Obj.slow(1, 4));
alert(Obj.slow(1, 3));
alert(Obj.slow(1, 2));
alert(Obj.slow(1, 3));

I don't know why it doesn't work. I would be thankful if anyone could help me.
The error is at line 7 with this keyword.

TypeError: this.h is not a function

A: this in slow method when call is run in the context of window so it doesn't have h method avaiable. bind the context to Obj will make it work.
Updated code
var Obj = {
    h(x, y) {
        return x + y;
    },
    slow(x, y) {
        alert('called slow function with ' + x + ', ' + y);
        return x * y * this.h(x, y)
    }
}

function c (func){
    var cache = {};
    return function(x, y){
        if (!cache[[x, y]]){
            cache[[x, y]] = func(x, y);
        }
        return cache[[x, y]];
    }
}
Obj.slow = Obj.slow.bind(Obj); // You have to bind the object slow method to object context

Obj.slow = c(Obj.slow);
alert(Obj.slow(1, 4));
alert(Obj.slow(1, 2));
alert(Obj.slow(1, 4));
alert(Obj.slow(1, 3));
alert(Obj.slow(1, 2));
alert(Obj.slow(1, 3));


text:
Q: Simplest GeoJSON map script I have used Polymaps in the past but can anyone point me to some really simple script that generates a map from geojson without extra bloat and library dependencies?
I have a country.json file with geojson and want to render the map without d3, openLayers, or other libraries.

A: It's not a standalone script, but a library, but I've used OpenLayers in the past. Pretty simple to use and works with GeoJson.
The examples on their website are pretty useful too. From their GeoJson example:

map = new OpenLayers.Map( 'map' );
            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                    "http://vmap0.tiles.osgeo.org/wms/vmap0",
                    {layers: 'basic'} );
            map.addLayer(layer);
            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
            var featurecollection = {
              "type": "FeatureCollection",
              "features": [
                {"geometry": {
                    "type": "GeometryCollection",
                    "geometries": [
                        {
                            "type": "LineString",
                            "coordinates":
                                [[11.0878902207, 45.1602390564],
                                [15.01953125, 48.1298828125]]
                        },
                        {
                            "type": "Polygon",
                            "coordinates":
                                [[[11.0878902207, 45.1602390564],
                                  [14.931640625, 40.9228515625],
                                  [0.8251953125, 41.0986328125],
                                  [7.63671875, 48.96484375],
                                  [11.0878902207, 45.1602390564]]]
                        },
                        {
                            "type":"Point",
                            "coordinates":[15.87646484375, 44.1748046875]
                        }
                    ]
                },
                "type": "Feature",
                "properties": {}}
              ]
           };
           var geojson_format = new OpenLayers.Format.GeoJSON();
           var vector_layer = new OpenLayers.Layer.Vector();
           map.addLayer(vector_layer);
           vector_layer.addFeatures(geojson_format.read(featurecollection));


text:
Q: Debug push error using SFMC SDK I'm testing to send push notification from SFMC to mobile app using the app configured in MobilePush with FCM server key and APNS p8 Auth Key set.

I sent a test push notification using Mobile Push:

The result was the message only pushed to iOS app but not Android app. The audience was selected correctly, as I can find the corresponding error by filtering the contact in SFMC.

However, I can't find out the reason of error in this page. May I know in SFMC, do we have logs somewhere for debugging?
p.s. I've tried to use my FCM key to send push directly by API, the message can be pushed to my Android app.


text:
Q: Xamarin.Forms: Several Oxyplots on a single ScrollView I am trying to figure this out for about 3 days now.
TL;DR:
How can I put several OxyPlots (of different kinds) in a scrollable ScrollPage (on a ContentPage)?
Can someone explain me in which relationship which element in XAML and the CS Codebase is?

The question seems simple, but I struggle to get this going. Every page shows the same examples or is not specific enough for my problem, only scattered problems.
Basically, I want to do this:

So now I encounter a few problems like the graph fills the whole site, the graph doesnt display, I cant use MultiView for some reason, etc. etc.
Most of the tutorials rely on setting the whole content of the page as the chart. Some others can bypass that but only with cryptic XAML or XAML that wont work (MultiView, I use a ScrollPage instead of a ContentPage, so I cant set the <ContentPage.BindingContext/> attribute, or overrides void OnAppearing().
Also setting the BindingContext via Code in CS wont help, because it seems that that only applies to single- chart- pages.
(I initialized the renderer. I already had charts being shown in my app.)
So this is how I understand it:
<?xml version="1.0" encoding="UTF-8"?>
<ScrollView xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:oxy="clr-namespace:OxyPlot.Xamarin.Forms;assembly=OxyPlot.Xamarin.Forms"
             mc:Ignorable="d"
             x:Class="PieCharter.Test">
    <ScrollView.Content>
        <oxy:PlotView Model="{Binding Model}" IsVisible="True"/>
    </ScrollView.Content>
</ScrollView>

I can set one (or more) of those charts here in XAML, and they should appear as the page content with this codebase:
using System;
using System.Text;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

using OxyPlot;
using OxyPlot.Series;
using OxyPlot.Xamarin;
using OxyPlot.Xamarin.Forms;

namespace PieCharter
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class Test : ScrollView
    {

        public Test()
        {
            InitializeComponent();

            Content = new PlotView
            {
                Model = CreatePieChart()
            };
        }

        private PlotModel CreatePieChart()
        {
            var model = new PlotModel { Title = "PieChart" };

            var ps = new PieSeries
            {
                StrokeThickness = 0.25,
                InsideLabelPosition = 0.25,
                AngleSpan = 360,
                StartAngle = 0
            };

            ps.Slices.Add(new PieSlice("Slice 1, 50");
            ps.Slices.Add(new PieSlice("Slice 2, 50");
            ps.Slices.Add(new PieSlice("Slice 3, 50");

            model.Series.Add(ps);

            return model;
        }
    }
}

But this gives me problems because it sets the whole page to the chart and I cant compartmentalize them into e.g. a Grid view (also while using Layout container and multiple PlotViews it didnt help).
Why cant I just create a few private PlotView PiePlotView, give them the Model = CreateXChart() as argument and set the content of my page in the XAML files as the PlotViews?
It really confuses me, and the documentation is not really helpful, unfortunately.
What does the Model="{Binding Model}" actually mean? Is Model a member of PlotView? (It should be, but I've seen people using other variables.) And if so, how would my XAML know which Model to use when putting multiple OxyPlots into one file? I suppose it has to do with the BindingContext/<ContentPage.BindingContext/> or something.
Can someone please explain it to me in a bit more detail how to accomplish this, and if you dont provide a solution, please help me at least understanding what is going on at all. Its irritating and I honestly somehow think that XAML seems to be quite the inelegant and messy solution (at least it looks to me like that).
I have knowledge of the basics of XAML, I dont know nothing. But its just the interaction between these two parts I cant wrap my head around...

What I already tried (and many more, but probably got various things wrong):
1, 2, 3,
4, 5, ...

A: ScrollView can have only one children, so you can add a children which in turn can have multiple children like StackLayout or Grid
Model refers to current model for the graph/chart, you have to set it , if you are using Binding the page needs to have same BindingContext mapped to the viewmodel having property with same name, and Viewmodel should implement INotifyPropertyChanged
In code behind of content page
public TestPage()
{
    BindingContext = new TestViewModel();
}

TestViewModel
public class TestViewModel : INotifyPropertyChanged
{
    public TestViewModel ()
    {
        //initialize Model 1..4
    }

    public Model Model1
    {
        get => _Model1;

        set
        {
            _Model1 = value;
            //set value
            NotifyPropertyChanged (); // implemented method for INotifyPropertyChanged
        }
    }

}

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:oxy="clr-namespace:OxyPlot.Xamarin.Forms;assembly=OxyPlot.Xamarin.Forms"
             mc:Ignorable="d"
             x:Class="PieCharter.Test">
    <ContentPage.Content>
        <ScrollView>
            <StackLayout>
                <Label Text="Some label1 " />
                <Label Text="And some stuff" />
                <PlotView x:Name="plotview1"
                    Model="{Binding Model1}"
                    IsVisible="True"
                    HeightRequest="300" />
                <PlotView x:Name="plotview2"
                    Model="{Binding Model2}"
                    IsVisible="True"
                    HeightRequest="300" />
                <PlotView x:Name="plotview3"
                    Model="{Binding Model3}"
                    IsVisible="True"
                    HeightRequest="300" />
                <PlotView x:Name="plotview4"
                    Model="{Binding Model4}"
                    IsVisible="True"
                    HeightRequest="300" />
            </StackLayout>
        </ScrollView>
    </ContentPage.Content>
</ContentPage>


text:
Q: Interface implementation with only empty methods I'm using log4net in an application for logging.
I want to avoid a discussion about implementing a logging facade, but essentially, I'm creating some classes which will allow an ILog implementation to be injected via the constructor.  Eg:
abstract class MigratorBase<T> : IMigrator<T>
{
        private ILog logger;

        public MigratorBase(ILog logger)
        {
            this.logger = logger;
        }
}

I also would like to provide a default constructor on the class, which if called, essentially disables logging (or logs to nothing).  Instead of scattering fragments of code that check if the logger is null, such as this:
if (this.logger != null)
   Log.DebugFormat("Connecting to {0}", this.href);

I thought a better way to accomplish this functionality would be to assign an implementation of ILog that was purely empty methods.  I could call it a NullLog, and would look similar to this:
class NullLog : ILog
{
    public void Debug(object message, Exception exception) { }
    public void Debug(object message) { }
    public void DebugFormat(IFormatProvider provider, string format, params object[] args) { }
    ...
    ...
}

and then in the default constructor I could assign an object of this type to the class's private member, as such:
abstract class MigratorBase<T> : IMigrator<T>
{
        private ILog logger;

        public MigratorBase(ILog logger)
        {
            this.logger = logger;
        }

        public MigratorBase()
        {
            this.logger = new NullLog();
        }
}

This approach seems more object oriented to me, so I think I like it, but googling seems to reveal people suggesting that it's a bad idea to implement an interface with empty methods.
Can anyone suggest why the above might be a bad idea?  Or is it in fact an ok idea?

A: What you describe is called the Null Object pattern. Martin Fowler coined this term and explains it thoroughly in the book Patterns of Enterprise Application Architecture.
I think this is a great pattern to remove all the if-conditions in the code to check for not null. A downside could be that you have to explain a pattern in you development team and maybe add a comment about not adding functionality inside your NullLog class. Otherwise I couldn't find a downside with this pattern.


text:
Q: Azure Users Shared Between Accounts I'm making an app for a business where all the employees of the company should be able to sign in.
Employees have an account in Azure Active Directory (in the company's Azure Account ofc.) and add them as users to my API App as if they were users from my AAD (copying them is not an option).
Is how I'm describing it possible?
I have been looking into things like Single-Sign-On, B2B, but haven't quite understood neither of them.
Thanks

A: Short answer: Yes it is possible.
You can invite their users as guests into your Azure AD, and then you will be able to assign them access to apps in your tenant.
I assume you have some kind of front-end for your API?
After they have redeemed the invite and you have granted them access, they will be able to login through your front-end as if they were users in your AAD tenant.
Be sure to use the tenant-specific login endpoint though, since if you use the "common" endpoint, they'll login against their own AAD tenant.


text:
Q: Prevent files from being processed multiple times in AWS Glue We are using glue for computing purposes. The data flow is happening like this landing->raw->stage->curated->Redshift.
However, when the everyday the data flows right -> the data is exactly getting doubled.
For example:

*

*Aug 1: I have 100 records

*Aug 2: I have 20 records

In Redshift, I would like to see 120 records at end of August 2. Instead of that, it is getting 220 records. Please refer me to a way to avoid this scenario.
Would like to retain partition based on the run date in both raw and stage.

A: It seems that you want to track files that have already been processed. You can prevent that by using the job bookmarking feature of Glue.


text:
Q: Restrict your android activity to be accessible from other activity I have an Android activity defined in my Manifest:
   <activity
       android:name="com.me.myapp.myactivity">
       <intent-filter>
           <action android:name="android.intent.action.VIEW" />

           <category android:name="android.intent.category.DEFAULT" />
           <category android:name="android.intent.category.BROWSABLE" />

           <data android:scheme="myapp" />
       </intent-filter>
   </activity>

I want to restrict this activity to be accessible only to one other activity outside my app, let's call that activity "com.others.theirapp.theiractivity". How do I accomplish this restriction?
I do not have any information about the other app and its activity, the only information I have is its activity name, "com.others.theirapp.theiractivity".

A: There is basically two ways to handle this

*

*If other app is invoking you app with startActivityForResult then you can use getCallingPackage() to get and check calling app package name

*Other way is that you can pass a unique id in intent from calling activity to you activity and check its matching or not to ensure that its a trusted call (You have to secure this unique id so that other user can't spoof it)

A: Permissions applied using the android:permission attribute to the  tag in the manifest restrict who can start that Activity. The permission is checked during Context.startActivity() and Activity.startActivityForResult(). If the caller doesn't have the required permission, then a SecurityException occurs.

A: In Manifest you can use Exported to false if that helps
<activity
        android:name=".UpdateActivity"
        android:exported="false"
        android:parentActivityName=".HomeActivity"
        android:screenOrientation="portrait"/>


text:
Q: How to get the first and the last record per group in SQL Server 2008? How can a select be crafted to where the first and last row of each set of the rows are grouped with a GROUP BY.
I've this table with the following data:
id  group   val   start   end
1   10      36    465     89
2   10      35    55      11
3   10      34    20      456
4   20      38   1140     1177
5   20      22    566     788
6   20      1235  789     4796
7   20      7894  741     1067

What I need to get is the first value of the column start and last value of the column end with group by the group column.
The resultant table should be as below:
   id  group   val   start   end
    1   10      36    465     89
    3   10      34    20      456
    4   20      38   1140     1177
    7   20      7894  741     1067

I did a query but with FIRST_VALUE and LAST_VALUE and over (partition by). It works in SQL Server 2012 but didn't work in SQL Server 2008. I need a query that can be executed in SQL Server 2008.

A: This is one way -
select  t.*
from    tbl t
join    (
        select [group],
               min(val) as val_1,
               max(val) as val_2
        from   tbl
        group by [group]
        ) v
     on t.[group] = v.[group]
    and (t.val = v.val_1
     or t.val = v.val_2);

Fiddle: http://sqlfiddle.com/#!3/c682f/1/0
Another approach:
select id, [group], val, [start], [end]
from(
select t.*,
       max(val) over(partition by [group]) as max_grp,
       min(val) over(partition by [group]) as min_grp
from tbl t
) x
where val in (max_grp,min_grp)

A: How about using ROW_NUMBER:
SQL Fiddle
WITH Cte AS(
    SELECT *,
        RnAsc = ROW_NUMBER() OVER(PARTITION BY [group] ORDER BY val),
        RnDesc = ROW_NUMBER() OVER(PARTITION BY [group] ORDER BY val DESC)
    FROM tbl
)
SELECT
    id, [group], val, start, [end]
FROM Cte
WHERE
    RnAsc = 1 OR RnDesc = 1
ORDER BY [group], val

A: How to two query 'UNION'
SELECT TOP 1 EmployeeId, AttendenceId, Intime
FROM EmployeeAttendence
WHERE AttendenceDate >='1/18/2020 00:00:00'
  AND AttendenceDate <='1/18/2020 23:59:59'
GROUP BY EmployeeId,AttendenceId,Intime
ORDER BY AttendenceId

SELECT TOP 1 EmployeeId, AttendenceId, OutTime
FROM EmployeeAttendence
WHERE AttendenceDate >='1/18/2020 00:00:00'
  AND AttendenceDate <='1/18/2020 23:59:59'
GROUP BY EmployeeId, AttendenceId, OutTime
ORDER BY AttendenceId desc

A: Here is a bankaccount example:
create table transactions (
id integer identity(1,1),
aDateTime datetime not null default getdate(),
OnHand float,
AmountWithDrawn float,
AmountDeposited float,
NewOnhand float
)

insert into transactions (aDateTime, OnHand, AmountWithDrawn, AmountDeposited, NewOnhand) values ('01-jan-2021 08:15', 0, 0, 1000, 1000);

insert into transactions (aDateTime, OnHand, AmountWithDrawn, AmountDeposited, NewOnhand) values ('05-jan-2021 08:15', 1000, 100, 0, 900);

insert into transactions (aDateTime, OnHand, AmountWithDrawn, AmountDeposited, NewOnhand) values ('06-jan-2021 08:15', 900, 200, 0, 700);

insert into transactions (aDateTime, OnHand, AmountWithDrawn, AmountDeposited, NewOnhand) values ('01-feb-2021 08:15', 700, 0, 1000, 1700);

insert into transactions (aDateTime, OnHand, AmountWithDrawn, AmountDeposited, NewOnhand) values ('09-feb-2021 08:15', 1700, 200, 0, 1500);

insert into transactions (aDateTime, OnHand, AmountWithDrawn, AmountDeposited, NewOnhand) values ('10-feb-2021 08:15', 1500, 300, 0, 1200);

insert into transactions (aDateTime, OnHand, AmountWithDrawn, AmountDeposited, NewOnhand) values ('01-mar-2021 08:15', 1200, 0, 1000, 2200);

insert into transactions (aDateTime, OnHand, AmountWithDrawn, AmountDeposited, NewOnhand) values ('07-mar-2021 08:15', 2200, 400, 0, 1800);

insert into transactions (aDateTime, OnHand, AmountWithDrawn, AmountDeposited, NewOnhand) values ('11-mar-2021 08:15', 1800, 500, 0, 1300);

List:
select * from transactions order by id

Now we want to group per month:
select distinct month(adatetime) aMonth, sum(amountWithDrawn) SumWithDrawn, sum(amountDeposited) SumDeposited from transactions group by month(adatetime);

But how can we get Onhand and NewOnhand in the query?
with cte as
(select distinct month(adatetime) aMonth, sum(amountWithDrawn) SumWithDrawn, sum(amountDeposited) SumDeposited, min(id) MinId, max(id) MaxId from transactions group by month(adatetime))
select aMonth, (select Onhand from transactions where id = minid) FirstOnhand, SumWithDrawn, SumDeposited, (select NewOnhand from transactions where id = maxid) LastNewOnhand from cte

This way would be quite efficient (add index to ID) and the code quite is easy to read and comprehend.

A: select tt.id, tt.groups, tt.val, x.sstart, tt.[end] from test_table tt join
(Select groups,First_value(start) over (partition by groups order by groups) sstart from test_table
Union
Select groups,Last_Value(start) over (partition by groups order by groups) sstart from test_table) as x
on tt.start=x.sstart
Order by tt.groups, sstart Desc


text:
Q: What is meaning for -- (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating') I have got a problem while download a project from github.
Error is as:
F:\Tikam\Sample Project\Advance Design Project\ActivitySceneTransitionBasic\Application\build\intermediates\exploded-aar\com.android.support\cardview-v7\23.3.0\res\values-v23\values-v23.xml
Error:(3, 5) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating').
Error:Execution failed for task ':Application:processDebugResources'.
Error:(3, 5) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating').

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'F:\Android Development\sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1

my v23\values-v23.xml file is as:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="CardView" parent="Base.CardView">
        <item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item>
    </style>
</resources>


text:
Q: FlipView To Flip Eternaly Is it possible to make a FlipView continue to "flip" at the end of the DataSource Items and start over at Index 0? Also same going the other way from -1 to Items.Count?

A: I think it might not be supported built-in - there is a CarouselPanel that sounds like it might do the trick if not for the fact that the documentation states it's only supported by ComboBox.


text:
Q: Java Fortify issue For Storing password in String object In my application password is storing in String & fortify is complainng about this.
Remediation says that "stores sensitive data in a String object, making it impossible to reliably purge the data from memory"
Could anyone help me on this.
Do I need to store password in Char[] anything which are not immutable & how can I do ?
This encrypt function is called from number of place in my application
public static void main(String[] args)
    {
        System.out.println(Accessible.encrypt("ABCD"));
    }

    public final static String encrypt(String plaintext)
    {
        StringBuilder pwd = new StringBuilder();
        pwd.append(plaintext);
        return new String(pwd.toString().getBytes());
    }


text:
Q: Obfuscating return values in Objective-C I am writing an app and for security reasons I'd like to obfuscate the value returned from a static method.  The result from calling the static methods from ClassA should be a BOOL but I'd like to make it as hard as possible for an attacker to get the real value of the return (i.e. I do not want to return a BOOL, I want to return some junk that looks random but is somehow meaningful).
// in ClassA
returnValue = [ClassB staticMethod];
BOOL actaulReturnValue = // some magic to de-obfuscate returnValue

For example: returning 1024 bits of mostly random junk but somewhere is a single meaningful digit (possibly a different bit every time).
Another example: returning 10 or so seemingly random digits, but if those 10 digits appear in the first 1000 digits of pi then the real value is TRUE (accepting the fact that there will be a 1 in 10,000,000,000 false positive rate).
Those are two examples I can think of, but I leave it to the stackoverflow community to help think of other (possibly better) ways of doing this.  Bonus points if you can also provide code.
EDIT: The harder to reverse engineer the better. If I can run cycript and determine the secret the game is over.
EDIT 2: Even if an attacker knows how I am obfuscating the return value it should still be hard (if not impossible) to figure out the real value (which is also a problem with my second example)
EDIT 3: I preform pen tests of iOS apps for a living.  I understand anything in memory can be read because I do it on a daily basis for clients.  I am also not trying to imply that obfuscation and security are the same thing.  That being said, I am trying to figure out a way to prevent an attacker from patching a single API call to always return FALSE.
Thanks!

A: I'll be honest with you: don't bother. Here's why:
At some point you will need to load the un-encrypted value into memory
Suppose you craft your method to obfuscate its return value - what happens when you actually need to use that value? You un-obfuscate it and load it into a variable, which exists in memory. And then your attacker just needs to inspect that memory location, which on a jailbroken device and with some additional tools is trivial.
You will never get over this problem. There's absolutely no point doing what you're trying to do. You're basically doomed to failure. If you're interested in making your apps more secure there's a great book published by O'Reilly that I found very useful.

A: You can do some tricky bitwise operations on your result to get some bit index, and check the bit at that index to see if it is set or not, for example.
In the following example:

*

*Given then 32-bit cryptic result, I compute the XOR of the 2nd and 4th bytes of your cryptic result, and then again XOR the upper 4 bits with the lower 4 bits. This gives me a 4-bit result that can be interpreted as an index between 0 and 15.

*Then I use this index to know which bit I need to check in the remaining 2 bytes: I concatenate the 3rd byte and the 1st byte to have a 16-bit word, and check the index-th bit of that word to see if the bit is set or not.

Here is the decoding function I tested:
-(BOOL)decodeCrypticResult:(long)crypticResult
{
  u_int8_t* bytes = (u_int8_t*)&crypticResult;

  u_int8_t xor = bytes[1] ^ bytes[3];
  u_int8_t idx = ((xor>>4)&0xF) ^ (xor&0xF); // value in range [0..15]
  u_int16_t word = ((bytes[2]<<8) & 0xFF00) | bytes[0]; // bytes 2 and 0 concatenated into a 16-bit word
  BOOL res = (word >> idx) & 1; // check the idx-th bit of this word
  return res;
}

To generate your cryptic result to return either a cryptic YES or NO from the staticMethod of your library, that's quite easy:

*

*Generate a random 32-bit number

*Compute the bit index as above from the representation of this random number

*set or unset (depending of the BOOL you need to return) the corresponding bit in the 1st or 3rd byte of your random number before returning it

So this gives the following code:
-(long)returnCrypticBoolValue:(BOOL)boolValue
{
  u_int32_t crypticResult = arc4random();
  u_int8_t* bytes = (u_int8_t*)&crypticResult;

  u_int8_t xor = bytes[1] ^ bytes[3];
  u_int8_t idx = ((xor>>4)&0xF) ^ (xor&0xF); // value in range [0..15]
  if (boolValue) {
    // set the idx-th bit of byte 2 or 0
    bytes[ (idx&8)?2:0 ] |=  (1 << (idx&7));
  } else {
    // unset the idx-th bit of byte 2 or 0
    bytes[ (idx&8)?2:0 ] &= ~(1 << (idx&7));
  }
  return crypticResult;
}


text:
Q: adding a top margin to flex centering I have the following code which centers vert and horiz a div inside the jumbotron.
css
#s-text {
text-align: center;
width: 65%;
margin: 0 auto;
}

.jumbotron {
position: relative;
min-height: 600px;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin: 0; padding: 0;
border-radius: 0 !important;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
}

 <?php the_secondary_title(); ?>

 ... more content ...

I have a 100px header fixed to the top of the page so there needs to be a 100px top margin/padding/space at the top so they don't overlap but the centering with flex doesn't seem to allow that

A: First of all I think the additional flexbox for #s-text is not necessary. Even with more than one child inside .jumbotron it should be possible only with one flexbox. text-align: center on all children of #s-text should suffice. (inherit on children possible)
To the main problem:
before we get too deep into crazy things a rather obvious approach, which we all know is simple to oversee in too many cases while working for 12 hours straight :D
Does the layout allow padding / margin on .row?


text:
Q: Idiom for "trying to figure something out"? In Swedish, we have an idiom that goes, "to suck on the/that caramel [for a while]" and is used either when you need to contemplate a decision ("I'll have to suck on that caramel for a while before deciding.") or to try and figure something out ("He had been sucking on that caramel just as long as I had, but neither of us had an answer.")
I can't find a good English equivalent to the second meaning of the idiom, but I'm sure there is one.
So, I need an idiom for trying/having tried to figure something out (without luck, so far.)

A: A similar idiom in English: "I'll have to chew on that for a while."  How it may affect your dental health compared to sucking caramal is debatable.
Less interesting, but gets the job done: to mull something over.

A: I think rack one's brain may fit in your context:

to strain in mental effort, esp to remember something or to find the solution to a problem.

(Collide Dictionary)

A: think something over TFD an idiom:

*

*to think about something and whether one will choose to do it.

*

*I need a few minutes to think it over. Let me think over your request
for a day or so.


text:
Q: Errors when including Entity Data Model across referenced projects Decided to take a dive into recreating a website so that it's an ASP.NET MVC web application. We were originally using the Entity Framework for it, figured to still use it since it works nicely enough. When doing some reading, noticed the there is no such thing as the App_Code/ folder for MVC applications, and that most people were creating a class library for their needs like that. So what I ended up doing was creating my MVC application and a class library, both in the same solution, and the MVC application was referencing the class library. The class library has my EDMX Entity Data Model file in it since some of my classes reference it and I thought that it would be easiest to have it in the library to reference. So here is a picture to what my solution layout is. But when I build and run the website, I get an error on a page that would reference the Entity Data Model. Here is a picture of what the error is.
So I thought, what if I placed the EDMX into my models folder since the error looks like it's complaining about not finding the entities. Here's a picture of my solution now with the move. But now, I'm getting a different error (picture). I'm kind of at a loss as to where to go from here. Is the way I have everything laid out and designed the proper and most efficient way to do it? If not could someone give me some advice?
Thanks, it's really appreciated!

A: Yes, you should be able to have the edmx in a class library and reference if from your main project. The first error is likely due to an incorrect connection string (check this blog post) but you may also have changed the build action of the edmx file somehow, make sure it is "Entity Deploy".
The second error is probably because you copied the edmx from your class library into the Models folder and it is still referencing the old namespace. To fix that, open the edmx in designer view and click on the background. One of the properties in the property window is Namespace, make sure that's set to the new place you want to keep it.
Edit:
Some things to try:

*

*Clean and rebuild the project

*Delete the Temporary ASP.NET Files folder referenced in the error message

*Double check your cshtml files for old references to URG_MVC.Models namespace. For example, the line in the error should be IEnumerable<URGLibrary.Proposal>

*Right click the edmx file and select Run Custom Tool to regenerate the model files


text:
Q: SPFx Webpart with AngularJS and Kendo UI defined as external I'm developing an SPFx webpart with AngularJS and Kendo UI. Kendo UI requires jQuery before AngularJS. As I want to develop multiple webparts with AngularJS and Kendo UI I decided to reference AngularJS and Kendo UI from external cdns.
This is the externals section in my config.json:
"externals": {
"jquery": {
  "path": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js",
  "globalName": "jquery"
},
"angular": {
  "path": "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.min.js",
  "globalName": "angular",
  "globalDependencies": [
    "jquery"
  ]
},
"kendo": {
  "path": "https://kendo.cdn.telerik.com/2017.2.621/js/kendo.all.min.js",
  "globalName": "kendo",
  "globalDependencies": [
    "jquery",
    "angular"
  ]
}
},

I load AngularJS and Kendo UI in my Webpart.ts file:
import * as angular from "angular";
import "kendo";

My Angular app is working and the kendo.all.min.js file is loaded. I try to load the Kendo module like this:
angular.module("TestExternalWebpart", [ "kendo.directives" ]);

I get the following error from AngularJS:
Module 'kendo.directives' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

I've already tried to load Kendo with the following code in my webpart but I get same error:
import * as angular from "angular";
require("kendo");

How can I load Kendo UI from external cdn in a SPFx webpart?

A: If I follow the steps you mentioned, I'm getting an error that 'jquery' is an unknown component or is not defined in the manifest. After changing your code to:
import "jquery";
import * as angular from "angular";
import "kendo";

everything works as expected;