text:
Q: use ignite,but the same configuration, cache rebrance can be used in the 2.6 , but rebrance skip is always prompted in the 2.8 version please help me !I Upgrade ignite version from 2.6 to 2.8, but the same configuration, cache rebrance can be used in the 2.6 , but rebrance skip is always prompted in the 2.8 version
this is my configurations:

these are start logs:
skip reblance in version 2.8:
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=gatewayNodeAndMqttTopicCache, localNodeId=a59d358f-ba85-4dcd-8a68-844cb720c4f2
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=ignite-sys-cache, localNodeId=a59d358f-ba85-4dcd-8a68-844cb720c4f2
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=routeInfoAndComputeCache, localNodeId=a59d358f-ba85-4dcd-8a68-844cb720c4f2
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=thingInfoCache, localNodeId=a59d358f-ba85-4dcd-8a68-844cb720c4f2
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=nodeInfoCache, localNodeId=a59d358f-ba85-4dcd-8a68-844cb720c4f2
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=Compute-192.168.111.65-53400, localNodeId=a59d358f-ba85-4dcd-8a68-844cb720c4f2
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=Compute-192.168.111.56-8082, localNodeId=a59d358f-ba85-4dcd-8a68-844cb720c4f2
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture - Completed partition exchange [localNode=a59d358f-ba85-4dcd-8a68-844cb720c4f2, exchange=GridDhtPartitionsExchangeFuture [topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], evt=NODE_JOINED, evtNode=TcpDiscoveryNode [id=a59d358f-ba85-4dcd-8a68-844cb720c4f2, consistentId=4f304981-0904-4dbb-adf3-08daf37b0a80, addrs=ArrayList [0:0:0:0:0:0:0:1%lo, 127.0.0.1, 192.168.111.56], sockAddrs=HashSet [/0:0:0:0:0:0:0:1%lo:47500, /127.0.0.1:47500, /192.168.111.56:47500], discPort=47500, order=2, intOrder=2, lastExchangeTime=1594168281653, loc=true, ver=2.8.1#20200521-sha1:86422096, isClient=false], done=true, newCrdFut=null], topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0]]
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture - Exchange timings [startVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], resVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], stage="Waiting in exchange queue" (79 ms), stage="Exchange parameters initialization" (6 ms), stage="Baseline change callback" (27 ms), stage="Components activation" (39 ms), stage="Determine exchange type" (370 ms), stage="Preloading notification" (1 ms), stage="WAL history reservation" (3 ms), stage="Restore partition states" (25 ms), stage="After states restored callback" (24 ms), stage="Waiting for Full message" (233 ms), stage="Affinity recalculation" (48 ms), stage="Full map updating" (20 ms), stage="Detect lost partitions" (13 ms), stage="Exchange done" (41 ms), stage="Total time" (929 ms)]
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture - Exchange longest local stages [startVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], resVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], stage="Affinity fetch" (364 ms) (parent=Determine exchange type), stage="Restore partition states [grp=gatewayNodeAndMqttTopicCache]" (24 ms) (parent=Restore partition states), stage="Restore partition states [grp=GateWay-192.168.111.65-53400]" (24 ms) (parent=Restore partition states), stage="Restore partition states [grp=thingInfoCache]" (23 ms) (parent=Restore partition states), stage="Affinity initialization (local join) [grp=thingInfoCache]" (48 ms) (parent=Affinity recalculation), stage="Affinity initialization (local join) [grp=nodeInfoCache]" (48 ms) (parent=Affinity recalculation), stage="Affinity initialization (local join) [grp=gatewayNodeAndMqttTopicCache]" (48 ms) (parent=Affinity recalculation)]
[exchange-worker-#45%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager - Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=2, minorTopVer=0], force=false, evt=NODE_JOINED, node=a59
reblance worked in version 2.6 and 2.7:
[sys-#53%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=ignite-sys-cache, localNodeId=662140b5-f5f5-4ec8-8cba-375232bd89ae
[sys-#53%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=routeInfoAndComputeCache, localNodeId=662140b5-f5f5-4ec8-8cba-375232bd89ae
[sys-#53%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=thingInfoCache, localNodeId=662140b5-f5f5-4ec8-8cba-375232bd89ae
[sys-#53%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=Compute-192.168.111.65-53400, localNodeId=662140b5-f5f5-4ec8-8cba-375232bd89ae
[sys-#53%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCacheProcessor - Finish proxy initialization, cacheName=nodeInfoCache, localNodeId=662140b5-f5f5-4ec8-8cba-375232bd89ae
[sys-#53%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture - Completed partition exchange [localNode=662140b5-f5f5-4ec8-8cba-375232bd89ae, exchange=GridDhtPartitionsExchangeFuture [topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], evt=NODE_JOINED, evtNode=TcpDiscoveryNode [id=662140b5-f5f5-4ec8-8cba-375232bd89ae, addrs=[0:0:0:0:0:0:0:1%lo, 127.0.0.1, 192.168.111.56], sockAddrs=[/0:0:0:0:0:0:0:1%lo:47500, /127.0.0.1:47500, /192.168.111.56:47500], discPort=47500, order=2, intOrder=2, lastExchangeTime=1594192501312, loc=true, ver=2.7.6#20190912-sha1:21f7ca41, isClient=false], done=true], topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], durationFromInit=2318]
[exchange-worker-#43%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager - Rebalancing scheduled [order=[nodeInfoCache, thingInfoCache, routeInfoAndComputeCache, gatewayNodeAndMqttTopicCache], top=AffinityTopologyVersion [topVer=2, minorTopVer=0], force=false, evt=NODE_JOINED, node=662140b5-f5f5-4ec8-8cba-375232bd89ae]
[exchange-worker-#43%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Prepared rebalancing [grp=nodeInfoCache, mode=SYNC, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, partitionsCount=512, topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], parallelism=1]
[sys-#54%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Started rebalance routine [nodeInfoCache, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, topic=0, fullPartitions=[0-511], histPartitions=[]]
[sys-#55%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Completed (final) rebalancing [grp=nodeInfoCache, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], progress=1/1, time=101 ms]
[sys-#55%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Completed rebalance future: RebalanceFuture [grp=CacheGroupContext [grp=nodeInfoCache], topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], rebalanceId=1, routines=1]
[sys-#55%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Prepared rebalancing [grp=thingInfoCache, mode=SYNC, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, partitionsCount=512, topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], parallelism=1]
[sys-#56%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Started rebalance routine [thingInfoCache, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, topic=0, fullPartitions=[0-511], histPartitions=[]]
[sys-#57%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Completed (final) rebalancing [grp=thingInfoCache, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], progress=1/1, time=21 ms]
[sys-#57%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Completed rebalance future: RebalanceFuture [grp=CacheGroupContext [grp=thingInfoCache], topVer=AffinityTopologyVersion [topVer=2,minorTopVer=0], rebalanceId=1, routines=1]
[sys-#57%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Prepared rebalancing [grp=routeInfoAndComputeCache, mode=SYNC, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, partitionsCount=512,topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], parallelism=1]
[sys-#58%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Started rebalance routine [routeInfoAndComputeCache, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, topic=0, fullPartitions=[0-511], histPartitions=[]]
[sys-#59%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Completed (final) rebalancing [grp=routeInfoAndComputeCache, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], progress=1/1, time=26 ms]
[sys-#59%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Completed rebalance future: RebalanceFuture [grp=CacheGroupContext [grp=routeInfoAndComputeCache], topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], rebalanceId=1, routines=1]
[sys-#59%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Prepared rebalancing [grp=gatewayNodeAndMqttTopicCache, mode=SYNC, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, partitionsCount=512, topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], parallelism=1]
[sys-#46%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Started rebalance routine [gatewayNodeAndMqttTopicCache, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, topic=0, fullPartitions=[0-511], histPartitions=[]]
[sys-#53%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Completed (final) rebalancing [grp=gatewayNodeAndMqttTopicCache, supplier=c6c121bc-dd87-453d-b524-0cf5b6b13fe1, topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], progress=1/1, time=10 ms]
[sys-#53%ignite-192.168.111.56-8082%] INFO org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander - Completed rebalance future: RebalanceFuture [grp=CacheGroupContext [grp=gatewayNodeAndMqttTopicCache], topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], rebalanceId=1, routines=1][main] INFO org.apache.ignite.internal.managers.deployment.GridDeploymentLocalStore - Class locally deployed: class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate


text:
Q: CURL certificate validation vs openssl s_client? I've had an issue where connecting with curl to https://server failed with:
curl: (60) server certificate verification failed.
but initiating a connection with openssl s_client worked fine.
The problem was somehow related to the server side, but I do not understand what could cause curl to reject the connection while openssl s_client was ok. OpenSSL 1.0.2s-fips
Help ?

A: Bummer. it was not the chain but the actual cert that had expired.
Somehow openssl s_client did not catch that. Nor did I.
(openssl s_client -showcerts did show chain certs but not server cert)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Изменение цвета Овала Есть круг, код:
<Ellipse x:Name="EllipseBackgound" Fill="#FF282E33" HorizontalAlignment="Left" Height="94" Margin="384,22,0,0" Stroke="#FF282E33" VerticalAlignment="Top" Width="99" StrokeThickness="0"/>

Он без рамки, и нужно изменить его цвет с помощью анимации в C# коде.
Однако это не работает:
ColorAnimation a0 = new ColorAnimation(Color.FromRgb(0, 150, 135), TimeSpan.FromSeconds(10));
EllipseBackgound.BeginAnimation(SolidColorBrush.ColorProperty, a0);

Я не нашел в Ellipse.СВОЙСТВО того свойства, через которое можно изменять цвет заливки, а FillProperty только для чтения

Почему и как сделать так, что бы это работало?

A: У меня работает так:
ColorAnimation a0 = new ColorAnimation(Color.FromRgb(0, 150, 135), TimeSpan.FromSeconds(10));
var brush = EllipseBackgound.Fill;
brush.BeginAnimation(SolidColorBrush.ColorProperty, a0);

Дело в том, что вам нужно анимировать не кисть (Brush), которая является заполнением фона вашей фигуры, а цвет этой кисти. Соответственно и анимацию надо запускать у кисти, а не у эллипса.


text:
Q: How to dynamically change components in VueJS I want to build an app in vue.js where you can dynamically switch between app views without page reloading.
What is the best way to do it?
And why this code doesn't work? Thank you!
var View01 = {
    template: `<button @click="swapComponent('view-02')" type="submit">NEXT VIEW</button>`
}
var View02 = {
    template: `<button @click="swapComponent('view-01')" type="submit">BACK TO PREVIOUS VIEW</button>`
}

var vm = new Vue({
    el: '#app',
    data: {
        currentComponent: 'view-01'
    },
    components: {
        'view-01': View01,
        'view-02': View02,
    },
    methods: {
        swapComponent: function(component) {
            this.currentComponent = component;
        }
    }
})

A: You're trying to call a parent method from the child components. You need to pass the method as a prop so it is in the child's scope.

var View01 = {
  template: `<button @click="swapComponent('view-02')" type="submit">NEXT VIEW</button>`,
  props: ['swapComponent']
}
var View02 = {
  template: `<button @click="swapComponent('view-01')" type="submit">BACK TO PREVIOUS VIEW</button>`,
  props: ['swapComponent']
}

var vm = new Vue({
  el: '#app',
  data: {
    currentComponent: 'view-01'
  },
  components: {
    'view-01': View01,
    'view-02': View02,
  },
  methods: {
    swapComponent: function(component) {
      this.currentComponent = component;
    }
  }
})


text:
Q: Node.js: can not install iconv module I try to install iconv module, but it always stay at:
^Cyippeeyippee@mini: server$ npm install iconv
npm http GET https://registry.npmjs.org/iconv
npm http 304 https://registry.npmjs.org/iconv

> iconv@1.2.3 install /Users/yippeeyippee/Desktop/nodejs/tinman/server/node_modules/iconv
> node-gyp rebuild

gyp http GET http://nodejs.org/dist/v0.8.7/node-v0.8.7.tar.gz
gyp http 200 http://nodejs.org/dist/v0.8.7/node-v0.8.7.tar.gz

I don't know what happened,success or failed, how can I solve this problem?
Update:
After waiting a long time:, I got the failed information like this:
xcode-select: Error: No Xcode is selected. Use xcode-select -switch /Applications/Xcode.app to select /Applications/Xcode.app, or see the xcode-select manpage (man xcode-select) for further information.

Traceback (most recent call last):
  File "/Users/yippeeyippee/.node-gyp/0.8.7/tools/gyp/gyp", line 18, in <module>
    sys.exit(gyp.main(sys.argv[1:]))
  File "/Users/yippeeyippee/.node-gyp/0.8.7/tools/gyp/pylib/gyp/__init__.py", line 480, in main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "/Users/yippeeyippee/.node-gyp/0.8.7/tools/gyp/pylib/gyp/generator/make.py", line 2082, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "/Users/yippeeyippee/.node-gyp/0.8.7/tools/gyp/pylib/gyp/generator/make.py", line 764, in Write
    self.Pchify))
  File "/Users/yippeeyippee/.node-gyp/0.8.7/tools/gyp/pylib/gyp/generator/make.py", line 1137, in WriteSources
    cflags = self.xcode_settings.GetCflags(configname)
  File "/Users/yippeeyippee/.node-gyp/0.8.7/tools/gyp/pylib/gyp/xcode_emulation.py", line 259, in GetCflags
    sdk_root = self._SdkPath()
  File "/Users/yippeeyippee/.node-gyp/0.8.7/tools/gyp/pylib/gyp/xcode_emulation.py", line 248, in _SdkPath
    return os.path.join(self._GetSdkBaseDir(), '%s.sdk' % sdk_root)
  File "/Users/yippeeyippee/.node-gyp/0.8.7/tools/gyp/pylib/gyp/xcode_emulation.py", line 234, in _GetSdkBaseDir
    raise Exception('Error %d running xcode-select' % job.returncode)
Exception: Error 1 running xcode-select
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:346:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! stack     at Process._handle.onexit (child_process.js:674:10)
gyp ERR! System Darwin 11.4.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/yippeeyippee/Desktop/nodejs/tinman/server/node_modules/iconv
gyp ERR! node -v v0.8.7
gyp ERR! node-gyp -v v0.6.8
gyp ERR! not ok
npm ERR! iconv@1.2.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the iconv@1.2.3 install script.
npm ERR! This is most likely a problem with the iconv package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls iconv
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 11.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "iconv"
npm ERR! cwd /Users/yippeeyippee/Desktop/nodejs/tinman/server
npm ERR! node -v v0.8.7
npm ERR! npm -v 1.1.49
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/yippeeyippee/Desktop/nodejs/tinman/server/npm-debug.log
npm ERR! not ok code 0

A: The Command Line Tools Only (No Xcode) Method

*

*Download and install the Mac OS X Developer Command Line Tools

*run sudo xcode-select --switch /usr/bin. See homebrew issue 10245 for details

*Retry your npm install iconv
The Xcode Version (Untested by me)

*

*Download and install full Xcode

*try your npm install iconv again. If it works, you're done.

*If you get the same error, try sudo xcode-select --switch /Applications/Xcode.app then retry your npm install iconv

A: At this step node-gyp installer download node.js source code. This may take a long time and depending on your connection speed. For example: I waiting about 20-25 minutes at this step on server with very slow connection located in China.


text:
Q: How to upload the gradle build java project into sonar server I have added the sonar properties into my build.gradle file to upload the project into server when build the project using gradle. below is my build.gradle file.
import org.tmatesoft.svn.core.wc
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'findbugs'
apply plugin: 'sonar-runner'
apply plugin: "jacoco"
group = 'com.example.service'
sourceCompatibility = 1.5
version = '1.0'
jar {
    manifest {
        attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version
    }
}
findbugs {
        // make findbugs non build breaking
        ignoreFailures = true
}
repositories {
    mavenLocal()
    mavenCentral()
}
dependencies {
    compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
    compile 'org.apache.commons:commons-lang3:3.1'
    compile "org.codehaus.sonar.runner:sonar-runner-api:2.4"
    testCompile group: 'junit', name: 'junit', version: '4.+'
}
test {
    systemProperties 'property': 'value'
}
sonarRunner {
    sonarProperties {
        property "sonar.host.url", "http://localhost:9000"
        property "sonar.sourceEncoding", "UTF-8"
        property "sonar.projectName", "$project.name"
        property "sonar.projectKey", "$project.group:$project.name"
        property "sonar.projectBaseDir","$project.projectDir"
        property "sonar.working.directory","$project.buildDir/sonar"
        property "sonar.jacoco.reportPath", "${project.buildDir}/jacoco/test.exec"
    }
}
test {
    jacoco {
      destinationFile = file("$buildDir/jacoco/test.exec")
    }
}
uploadArchives {
        repositories {
            mavenLocal()
        }
    }

But when I build the project from eclipse nothing happens. No error message in the console, and project is also not uploaded to the sonar server.
Does anyone know how to upload the project into the Sonar Server when building with Gradle?

A: See couple of my posts and you'll find what you are looking for. Mainly, you have to use:

*

*apply plugin: 'sonar-runner'

*Then, I have following config in < YOUR_GRADLE_HOME >/init.d/someglobal.gradle file

allprojects {

   apply plugin: 'java'
   apply plugin: 'codenarc'
   apply plugin: 'pmd'
   apply plugin: 'findbugs'
   apply plugin: 'checkstyle'
   apply plugin: 'jacoco'

   apply plugin: 'sonar-runner'

   //JavaCompile(Works with recent Gradle versions) or Compile (works with Gradle 1.6)
   //tasks.withType(Compile) {
   tasks.withType(JavaCompile) {
     options.debug = true
     options.compilerArgs = ["-g"]
   }

   //You don't need sourceSets if your project is following Maven/Gradle standard structure. In my case, we don't follow src/main/java but have src/java thus, in the global file, I have dont_change_me as the value for sourceSets main java and I'm setting it to src/java in the Project's build.gradle. dont_change_me is required here as I'm/was using sourceSet.main.xx.xxx values in few of the tasks here.

   sourceSets {
      main {
         java {
            srcDir 'dont_change_me'
         }
         resources {
            srcDir 'dont_change_me'
         }
      }
      test {
         java {
            srcDir 'dont_change_me'
         }
         resources {
            srcDir 'dont_change_me'
         }
      }
      integrationTest {
         java {
            srcDir 'dont_change_me'
         }
         resources {
            srcDir 'dont_change_me'
         }
      }
      acceptanceTest {
         java {
            srcDir 'dont_change_me'
         }
         resources {
            srcDir 'dont_change_me'
         }
      }

   }

   def sonarServerUrl = "kobalori.company.com"

   sonarRunner {
    sonarProperties {
         property "sonar.host.url", "http://$sonarServerUrl:9000"
         property "sonar.jdbc.url", "jdbc:h2:tcp://$sonarServerUrl:9092/sonar"
         property "sonar.jdbc.driverClassName", "org.h2.Driver"
         property "sonar.jdbc.username", "sonar"
         property "sonar.jdbc.password", "sonar"
         property "sonar.junit.reportsPath", "build/test-results/UT"
         property "sonar.surefire.reportsPath", "build/test-results/UT"
         //property "sonar.dynamicAnalysis", "reuseReports"
         property "sonar.binaries", "build/classes/main"
         property "sonar.java.binaries", "build/classes/main"
        // property "sonar.libraries", "build/libs/*.jar"
         property "sonar.sources", "src/java"
         //property "sonar.sources", "src/main/groovy"
         //property "sonar.sources", "src/java, src/main/groovy"
         //property "sonar.tests", "test/java, src/test/groovy, src/groovy-test, src/java-test"
         //property "sonar.tests", "src/test/groovy"
         property "sonar.tests", "test/java, src/java-test"

         //properties ["sonar.sources"] = sourceSets.main.allSource.srcDirs
         //properties ["sonar.tests"] += sourceSets.test.allJava.srcDirs
         //properties ["sonar.tests"] += sourceSets.integrationTest.allJava.srcDirs

      }
   }

   //sonarRunner {
   // toolVersion = '2.4'
   //}

   checkstyle {
        configFile = new File(rootDir, "config/checkstyle.xml")
        ignoreFailures = true
        //sourceSets = [sourceSets.main, sourceSets.test, sourceSets.integrationTest]
        sourceSets = [sourceSets.main]
   }

   findbugs {
        ignoreFailures = true
        sourceSets = [sourceSets.main]
        //toolVersion = "2.0.3"
   }

  // pmd {
  //      ruleSets = ["basic", "braces", "design"]
  //      ignoreFailures = true
  // }

  //Required with Gradle 2.0+ -- 2.0+ -- 2.3
  pmd {
       ruleSets = ["java-basic", "java-braces", "java-design" ]
       ignoreFailures = true
  }

 //Try this or later version too.
 //pmd {
 // toolVersion = '4.3'
 //}

   jacoco {
        //toolVersion = "0.6.2.201302030002"
        //toolVersion = "0.7.0.201403182114"
        //toolVersion = "0.7.1.201404171759"
        toolVersion = "0.7.2.201409121644"

        reportsDir = file("$buildDir/customJacocoReportDir")

   }

task testReport(type: TestReport) {
    destinationDir = file("$buildDir/reports/tests/allTests")
    //testResultDirs = file("$buildDir/test-results/allTests")
}

   test {
     maxParallelForks = 5
     forkEvery = 50
     ignoreFailures = true

     //testReportDir = file("$buildDir/reports/tests/UT")
     //destinationDir = file("$buildDir/reports/tests/UT")
     //testResultsDir = file("$buildDir/test-results/UT")

     //testLogging.showStandardStreams = true

     //onOutput { descriptor, event ->
     //    logger.lifecycle("Test: " + descriptor + " produced standard out/err: " + event.message )
     //}

     //Following Jacoco test section is required only in Jenkins instance extra common file
     jacoco {
        //The following vars works ONLY with 1.6 of Gradle
     //   destPath = file("$buildDir/jacoco/UT/jacocoUT.exec")
     //   classDumpPath = file("$buildDir/jacoco/UT/classpathdumps")

        //Following vars works only with versions >= 1.7 version of Gradle
        destinationFile = file("$buildDir/jacoco/UT/jacocoUT.exec")
        //  classDumpFile = file("$buildDir/jacoco/UT/classpathdumps")
     }
   }

   task integrationTest( type: Test) {
     //Always run tests
     outputs.upToDateWhen { false }
     ignoreFailures = true

     testClassesDir = sourceSets.integrationTest.output.classesDir
     classpath = sourceSets.integrationTest.runtimeClasspath

     //testReportDir = file("$buildDir/reports/tests/IT")
     //testResultsDir = file("$buildDir/test-results/IT")

     //Following Jacoco test section is required only in Jenkins instance extra common file
     jacoco {
        //This works with 1.6
        //destPath = file("$buildDir/jacoco/IT/jacocoIT.exec")
      //  classDumpPath = file("$buildDir/jacoco/IT/classpathdumps")

        //Following works only with versions >= 1.7 version of Gradle
        destinationFile = file("$buildDir/jacoco/IT/jacocoIT.exec")
        //  classDumpFile = file("$buildDir/jacoco/IT/classpathdumps")
     }
  }

   task acceptanceTest ( type: Test) {
     //Always run tests
     outputs.upToDateWhen { false }
     ignoreFailures = true

     testClassesDir = sourceSets.integrationTest.output.classesDir
     classpath = sourceSets.integrationTest.runtimeClasspath

     //testReportDir = file("$buildDir/reports/tests/AT")
     //testResultsDir = file("$buildDir/test-results/AT")

     //Following Jacoco test section is required only in Jenkins instance extra common file
     jacoco {
        //This works with 1.6
        //destPath = file("$buildDir/jacoco/AT/jacocoAT.exec")
      //  classDumpPath = file("$buildDir/jacoco/AT/classpathdumps")

        //Following works only with versions >= 1.7 version of Gradle
        destinationFile = file("$buildDir/jacoco/AT/jacocoAT.exec")
        //  classDumpFile = file("$buildDir/jacoco/AT/classpathdumps")
     }
  }

  jacocoTestReport {
      group = "Reporting"
      description = "Generate Jacoco coverage reports after running tests."
      //ignoreFailures = true

      //executionData = files('build/jacoco/UT/jacocoUT.exec')
      //executionData = files('build/jacoco/IT/jacocoIT.exec')
      //executionData = files('build/jacoco/UT/jacocoUT.exec', 'build/jacoco/IT/jacocoIT.exec')

      //executionData = files(['build/jacoco/UT/jacocoUT.exec', 'build/jacoco/IT/jacocoIT.exec'])
      executionData = fileTree(dir: 'build/jacoco', include: '**/*.exec')

      reports {
             xml{
                 enabled true
                 //Following value is a file
                 destination "${buildDir}/reports/jacoco/xml/jacoco.xml"
             }
             csv.enabled false
             html {
                 enabled true
                 //Following value is a folder
                 destination "${buildDir}/reports/jacoco/html"
             }
      }

      //sourceDirectories = files(sourceSets.main.allJava.srcDirs)
      sourceDirectories = files(['src/java','src/main/java', 'src/main/groovy'])
      classDirectories =  files('build/classes/main')

      //------------------------------------------
      //additionalSourceDirs = files(['test/java','test/groovy','src/java-test', 'src/groovy-test'])
      //additionalSourceDirs = files(['src/test/groovy'])
      //additionalSourceDirs += files('src/java-test')

      //additionalClassDirs = files('build/classes/test')
      //additionalClassDirs += files('build/classes/integrationTest')
      //additionalClassDirs += files('build/classes/acceptanceTest')
      //------------------------------------------

      //IGNORE THE FOLLOWING
      //------------------------------------------
      //sourceDirectories = files(sourceSets.main.allJava.srcDirs)
       //classDirectories = files(sourceSets.main.output.classesDir)
       //classDirectories = files("build/classes/main")

      //additionalSourceDirs  = files("test/java")
      //additionalSourceDirs += files("src/java-test")

      //additionalClassDirs   = files("build/classes/test")
      //additionalClassDirs  += files("build/classes/integrationTest")

      //additionalSourceDirs = fileTree(dir: "test", include: "**/*.*")
      //additionalSourceDirs += fileTree(dir: "src/java-test", include: "**/*.*")

      //additionalClassDirs = fileTree(dir: "build/*est", include: "**/*.class")
      //additionalClassDirs += fileTree(dir: "build/jacoco/*T/classpathdumps/com/thc", include: "**/*.class")

      //additionalClassDirectories = fileTree(dir: "build/*est", include: "**/*.class")
      //additionalClassDirectories += fileTree(dir: "build/jacoco/*T/classpathdumps/com/thc", include: "**/*.class")

      //additionalSourceDirs = files(['test/java', 'src/java-test'])
      //additionalSourceDirs = files(sourceSets.test.allJava.srcDirs)
      //additionalSourceDirs += files(sourceSets.integrationTest.allJava.srcDirs)
      //additionalSourceDirs += files(sourceSets.acceptanceTest.allJava.srcDirs)
      // additionalClassDirs = files(['build/jacoco/UT/classpathdumps/com/thc', 'build/jacoco/IT/classpathdumps/com/thc'])
       //additionalClassDirs = files(['build/jacoco/UT/classpathdumps/com/thc'])

     //additionalSourceDirs = files('test/java', 'src/java-test')
     // additionalClassDirs = files('build/jacoco/UT/classpathdumps/com/thc', 'build/jacoco/IT/classpathdumps/com/thc')

     //sourceDirectories = files('src/main/java')
     // classDirectories = files('build/classes/main')

     //sourceDirectories = fileTree('src/main/java')
     // classDirectories = fileTree('build/classes/main')

     //additionalSourceDirectories = fileTree('test/java', 'test/resources', 'src/java-test')
     // additionalClassDirectories = fileTree('build/classes/test', 'build/classes/integrationTest')

     //additionalSourceDirs = files(sourceSets.test.allJava.srcDirs,sourceSets.integrationTest.allJava.srcDirs)
     //additionalSourceDirs = files(sourceSets.*.allJava.srcDirs)
     //additionalSourceDirs += files(sourceSets.test.allJava.srcDirs)
     //additionalSourceDirs += files(sourceSets.integrationTest.allJava.srcDirs)

     //additionalSourceDirs = files('src/java', 'test/java', 'test/resources', 'src/java-test', 'conf')
     //additionalClasseDirs = files('build/classes')
     //executionData = files('build/jacoco/test.exec', 'build/jacoco/integrationTest.exec', 'build/jacoco/acceptanceTest.exec')

     //additionalSourceDirs = files(sourceSets.integrationTest.allSource.srcDirs)

     //additionalSourceDirs = files('src/java', 'test/java', 'test/resources', 'src/java-test', 'conf')
     //additionalSourceDirs = files(sourceSets.test.allJava.srcDirs)
     //additionalSourceDirs = files(sourceSets.integrationTest.allJava.srcDirs)
     //additionalSourceDirs = files([sourceSets.main.allJava.srcDirs)
  }
}

You can ignore the // commented out lines as I was just playing around. Once your Gradle build is complete, you need to run jacocoTestReport task.
I run this:
gradle clean build jacocoTestReport

(This will get me a build, code coverage of source main code via Unit tests).
For getting, IT (Integration test code coverage or any non Unit tests coverage), I first run a external JVM (Tomcat etc). Then, I pass jacoco agent info to the external JVM (i.e. Tomcat in my case) like this (where I'm putting jacocoagent.jar inside some folder (tomcat in my case), and telling external JVM (Tomcat instance) to start populating Jacoco code coverage, this will create jacocoIT.exec file for code coverage of main source code via IT tests instead of Unit tests). NOTE: I have this PROJ_EXTRA_JVM_OPTS variable embedded in Tomcat startup script where I'm passing it to the Tomcat start command so that Tomcat instance know where to create jacocoIT.exec file:
export PROJ_EXTRA_JVM_OPTS=-javaagent:tomcat/jacocoagent.jar=destfile=build/jacoco/IT/jacocoIT.exec,append=false

Then I run Gradle task to run IT tests,
gradle integrationTest

Then, once they run successfully, you'll notice jacocoIT.exec has some file size (but it's still not complete). For Tomcat to flush the code coverage info into jacocoIT.exec file, you have to now STOP tomcat (target JVM) instance.
I run stop tomcat script and Tomcat is now stopped. At this point, I now find that my jacocoIT.exec file is now fully populated with more file size (than it what it had before Stop tomcat).
At this point, I run Gradle jacocoTestReport and SonarRunner task by running (which generates a COMBINED Unit + IT code coverage of main source code via both Unit+IT tests + also sends the info to Sonar by using/setting the -Dsonar.xx.yy=value (which you can easily pass at command line OR in Jenkins (Invoke Gradle Plugin > Switches/options box):
gradle jacocoTestReport -x test -x testClasses sonarRunner

NOTE: Make sure you pass -Dsonar.xx variable correctly.
For ex: I pass the following options/switches while calling sonarRunner task (this assumes in SonarQube instance, you have the project dashboard with required Widgets in place/enabled):
Here variable ${testType} has value=IT in it. All other variables are defined in Jenkins Global configuration (JENKINS_URL etc or they are available as Jenkins default environment variables). I'm using SVN (as source control tool) thus, SVN_URL is used (which is Jenkins default env variable if your Jenkins job is using SVN as Source control to checkout source code).
--stacktrace -x test -x testClasses -Dsonar.jacoco.itReportPath=build/jacoco/${testType}/jacoco${testType}.exec -Dsonar.sources=src/java -Dsonar.java.binaries=build/classes/main -Dsonar.binaries="build/classes/main" -Dsonar.tests=test/java,src/java-test -Dsonar.jacoco.reportPath=build/jacoco/UT/jacocoUT.exec  -Dsonar.junit.reportsPath=build/test-results -Dsonar.surefire.reportsPath=build/test-results -Dsonar.dynamicAnalysis=reuseReports -Dsonar.build-stability.url=jenkins:${JENKINS_URL}/job/${JOB_NAME} -Dsonar.scm.url=scm:svn:${SVN_URL}


text: Q: What winding pattern would be the most efficient for generating electricity? I'm looking to build a hand crank or pedal powered generator for a personal project, almost completely from scratch. I'm making my own coils, and looking to see what pattern would be the best for it, three-phase, single-phase, DC with a commutator, or some other one I don't know yet. My own research was not doing well, I couldn't seem to find the right keywords to get results. If anyone has any tips it would be greatly appreciated.


text:
Q: Vue Formulate FormulateForm issue Trying to use Vue Formulate to generate dynamic forms based on a schema. The problem I'm having is if I have two elements that are the same in my schema I get a duplicate keys detected error. Is it possible to specify the index as the key? Or is there a way I can incorporate IDs into my schema to avoid this error? thanks in advance.

A: Unclear whether this is your issue, but I've found that non-form elements in the schema, e.g. a <component>, h3, or <div> often produce this error, but can have a "key" attribute added in the schema to fix it e.g.:
[
  {
    "component": "h3",
    "key": "h3",
    "children": "Sample Text",
    "class": "m-image-request-form__h3"
  },
 ]


text:
Q: Why is unsigned integer overflow defined behavior but signed integer overflow isn't? Unsigned integer overflow is well defined by both the C and C++ standards.  For example, the C99 standard (§6.2.5/9) states

A computation involving unsigned operands can never overflow,
  because a result that cannot be represented by the resulting unsigned integer type is
  reduced modulo the number that is one greater than the largest value that can be
  represented by the resulting type.

However, both standards state that signed integer overflow is undefined behavior.  Again, from the C99 standard (§3.4.3/1)

An example of undefined behavior is the behavior on integer overflow

Is there an historical or (even better!) a technical reason for this discrepancy?

A: In addition to the other issues mentioned, having unsigned math wrap makes the unsigned integer types behave as abstract algebraic groups (meaning that, among other things, for any pair of values X and Y, there will exist some other value Z such that X+Z will, if properly cast, equal Y and Y-Z will, if properly cast, equal X).  If unsigned values were merely storage-location types and not intermediate-expression types (e.g. if there were no unsigned equivalent of the largest integer type, and arithmetic operations on unsigned types behaved as though they were first converted them to larger signed types, then there wouldn't be as much need for defined wrapping behavior, but it's difficult to do calculations in a type which doesn't have e.g. an additive inverse.
This helps in situations where wrap-around behavior is actually useful - for example with TCP sequence numbers or certain algorithms, such as hash calculation. It may also help in situations where it's necessary to detect overflow, since performing calculations and checking whether they overflowed is often easier than checking in advance whether they would overflow, especially if the calculations involve the largest available integer type.

A: Perhaps another reason for why unsigned arithmetic is defined is because unsigned numbers form integers modulo 2^n, where n is the width of the unsigned number. Unsigned numbers are simply integers represented using binary digits instead of decimal digits. Performing the standard operations in a modulus system is well understood.
The OP's quote refers to this fact, but also highlights the fact that there is only one, unambiguous, logical way to represent unsigned integers in binary. By contrast, Signed numbers are most often represented using two's complement but other choices are possible as described in the standard (section 6.2.6.2).
Two's complement representation allows certain operations to make more sense in binary format. E.g., incrementing negative numbers is the same that for positive numbers (expect under overflow conditions). Some operations at the machine level can be the same for signed and unsigned numbers. However, when interpreting the result of those operations, some cases don't make sense - positive and negative overflow. Furthermore, the overflow results differ depending on the underlying signed representation.

A: The historical reason is that most C implementations (compilers) just used whatever overflow behaviour was easiest to implement with the integer representation it used. C implementations usually used the same representation used by the CPU - so the overflow behavior followed from the integer representation used by the CPU.
In practice, it is only the representations for signed values that may differ according to the implementation: one's complement, two's complement, sign-magnitude. For an unsigned type there is no reason for the standard to allow variation because there is only one obvious binary representation (the standard only allows binary representation).
Relevant quotes:
C99 6.2.6.1:3:

Values stored in unsigned bit-fields and objects of type unsigned char shall be represented using a pure binary notation.

C99 6.2.6.2:2:

If the sign bit is one, the value shall be modified in one of the following ways:
— the corresponding value with sign bit 0 is negated (sign and magnitude);
— the sign bit has the value −(2N) (two's complement);
— the sign bit has the value −(2N − 1) (one's complement).

Nowadays, all processors use two's complement representation, but signed arithmetic overflow remains undefined and compiler makers want it to remain undefined because they use this undefinedness to help with optimization. See for instance this blog post by Ian Lance Taylor or this complaint by Agner Fog, and the answers to his bug report.

A: Aside from Pascal's good answer (which I'm sure is the main motivation), it is also possible that some processors cause an exception on signed integer overflow, which of course would cause problems if the compiler had to "arrange for another behaviour" (e.g. use extra instructions to check for potential overflow and calculate differently in that case).
It is also worth noting that "undefined behaviour" doesn't mean "doesn't work". It means that the implementation is allowed to do whatever it likes in that situation. This includes doing "the right thing" as well as "calling the police" or "crashing". Most compilers, when possible, will choose "do the right thing", assuming that is relatively easy to define (in this case, it is). However, if you are having overflows in the calculations, it is important to understand what that actually results in, and that the compiler MAY do something other than what you expect (and that this may very depending on compiler version, optimisation settings, etc).

A: First of all, please note that C11 3.4.3, like all examples and foot notes, is not normative text and therefore not relevant to cite!
The relevant text that states that overflow of integers and floats is undefined behavior is this:
C11 6.5/5

If an exceptional condition occurs during the evaluation of an
  expression (that is, if the result is not mathematically defined or
  not in the range of representable values for its type), the behavior
  is undefined.

A clarification regarding the behavior of unsigned integer types specifically can be found here:
C11 6.2.5/9

The range of nonnegative values of a signed integer type is a subrange
  of the corresponding unsigned integer type, and the representation of
  the same value in each type is the same. A computation involving
  unsigned operands can never overflow, because a result that cannot be
  represented by the resulting unsigned integer type is reduced modulo
  the number that is one greater than the largest value that can be
  represented by the resulting type.

This makes unsigned integer types a special case.
Also note that there is an exception if any type is converted to a signed type and the old value can no longer be represented. The behavior is then merely implementation-defined, although a signal may be raised.
C11 6.3.1.3

6.3.1.3 Signed and unsigned integers
When a value with integer
  type is converted to another integer type other than _Bool, if the
  value can be represented by the new type, it is unchanged.
Otherwise, if the new type is unsigned, the value is converted by
  repeatedly adding or subtracting one more than the maximum value that
  can be represented in the new type until the value is in the range of
  the new type.
Otherwise, the new type is signed and the value
  cannot be represented in it; either the result is
  implementation-defined or an implementation-defined signal is raised.

A: The most technical reason of all, is simply that trying to capture overflow in an unsigned integer requires more moving parts from you (exception handling) and the processor (exception throwing).
C and C++ won't make you pay for that unless you ask for it by using a signed integer.  This isn't a hard-fast rule, as you'll see near the end, but just how they proceed for unsigned integers.  In my opinion, this makes signed integers the odd-one out, not unsigned, but it's fine they offer this fundamental difference as the programmer can still perform well-defined signed operations with overflow.  But to do so, you must cast for it.
Because:

*

*unsigned integers have well defined overflow and underflow

*casts from signed -> unsigned int are well defined, [uint's name]_MAX - 1 is conceptually added to negative values, to map them to the extended positive number range

*casts from unsigned -> signed int are well defined, [uint's name]_MAX - 1 is conceptually deducted from positive values beyond the signed type's max, to map them to negative numbers)

You can always perform arithmetic operations with well-defined overflow and underflow behavior, where signed integers are your starting point, albeit in a round-about way, by casting to unsigned integer first then back once finished.
int32_t x = 10;
int32_t y = -50;

// writes -60 into z, this is well defined
int32_t z = int32_t(uint32_t(y) - uint32_t(x));

Casts between signed and unsigned integer types of the same width are free, if the CPU is using 2's compliment (nearly all do).  If for some reason the platform you're targeting doesn't use 2's Compliment for signed integers, you will pay a small conversion price when casting between uint32 and int32.
But be wary when using bit widths smaller than int
usually if you are relying on unsigned overflow, you are using a smaller word width, 8bit or 16bit.  These will promote to signed int at the drop of a hat (C has absolutely insane implicit integer conversion rules, this is one of C's biggest hidden gotcha's), consider:
unsigned char a = 0;
unsigned char b = 1;
printf("%i", a - b);  // outputs -1, not 255 as you'd expect

To avoid this, you should always cast to the type you want when you are relying on that type's width, even in the middle of an operation where you think it's unnecessary.  This will cast the temporary and get you the signedness AND truncate the value so you get what you expected.  It's almost always free to cast, and in fact, your compiler might thank you for doing so as it can then optimize on your intentions more aggressively.
unsigned char a = 0;
unsigned char b = 1;
printf("%i", (unsigned char)(a - b));  // cast turns -1 to 255, outputs 255

A: C++ just picks up this behaviour from C.
I believe that with C that a disconnect has developed between it's users and it's implementers. C was designed as a more portable alternative to assembler and originally did not have a standard as such, just a book describing the language. In early C low level platform specific hacks were common and accepted practice. Many real-world C programmers still think of C this way.
When a standard was introduced, it's goal was largely to standardise existing practice. Some things were left undefined or implementation defined. I'm not convinced that much attention was paid to which stuff was undefined and which stuff was implementation defined.
At the time when C was standardised, twos complement was the most common approach, but other approaches were around, so C couldn't outright require twos complement.
If you read the rationale for standard C at https://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf where they discuss the choice of promotion semantics they decided that the "value preserving" semantics were safer, however they made this decision based on the assumption that most implementations used twos complement and handled wraparound quietly in the obvious manner.
Compiler vendors at some point however started treating signed overflow as an optimisation opportunity. This has turned signed overflow into a major footgun. Unless you carefully check every arithmetic operation to make sure it can't overflow you can end up triggering undefined behaviour.
Once undefined behaviour is triggered, "anything can happen". What that means in practice is that the value a variable actually contains may be outside the range of values the compiler assumes it can contain. That in turn can render bounds checking ineffective.


text:
Q: Empty struct after calling a function to populate it I have a struct
typedef struct
{
  my ints
  and char's
} structname;

in my server .c file inside main()
structname Header;

I'm calling the function(Header);
which looks at another .c file
And populates the header with e.g. strcpy(Header.Name1,pch);
Which gets populated correctly as i have used gdb to debug it
(gdb) p Header.Name1
$5 = "Bilka\000\332\326\377\177\000\000\001\000\000\000\000\000\000\000\b]\022\"E\177\000\000p\356\332\326\377\177\000\000\034\000\000\000\000\000\000\000\t\000\000\000\000"

After this function ends and returns TRUE it goes back to the next line on the server.c but if i do a print on Header.Name1 i'm getting a blank header what could be the reason.

A: Function arguments in C are passed by value. So if your function's signature looks like this:
foo function(structname Header);

It means that the argument is copied when the function is called. You then modify that temporary copy inside the function, but that doesn't change the original object. You might want to pass a pointer to your struct to the function instead:
foo function(structname * Header)
{
  //...
  strcpy(Header->Name1, pch);
}

// ...
structname Header;
function(&Header);
printf("%s\n", Header.Name1);

A: C functions are pass-by-value, so when you call function(Header);, you are passing a copy of the struct and modify it, you should pass a pointer to the struct to the other function:
function(&Header);


text:
Q: Is it possible to detect motion when screen is off? My app simply need to detect any motion of the device while screen is off.
I know that accelerometer is used for this task but it don't work while screen is off in all devices. this is a list of devices http://www.saltwebsites.com/2012/android-accelerometers-screen-off
so is there a way of taking accelerometer sensor data while screen is off that works on all devices?
or is there a way to detect motion using another sensors?

A: Partial Wake Lock is all you need to access accelerometer readings while the screen is off.
You can use it like this:
private PowerManager.WakeLock mWakeLock;

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
mWakeLock.acquire();

And after you're done, just release the lock:
mWakeLock.release();

If you obtain accelerometer data in a Service, you could simply acquire lock in it's onCreate() and release in onDestroy().

A: Yes you can use accelerometer in the background or when screen is off
but you need to hold a WakeLock [Link] to prevent the device from sleeping.
If you need to detect if the device is still or if it started moving again you might be interested in Recognizing the User's Current Activity  from Google Services.

A: After a quick research I found that most of android devices does not send the accelarometer events when the screen is off. To know more about this bug please take a look on here. Also here too.

A: When the screen is off the CPU goes to sleep and you cannot capture events without taking a partial wakelock. I suggest you to take a partial wakelock when you call the onPause and release it onResume. Be careful with wakelocks they make your phone drain a really big amount of energy, you should manage them carefully.
PS: You have to acquire the wakelock in the onPause method because if you try to call it somewhere else you might not be able to gain it because the CPU may be already shutted down.


text:
Q: Where is my SQLite file? Using the ADT, I created a SQLite database as follows:
    SQLiteDatabase myDB;
    myDB = this.openOrCreateDatabase("ddk.db", MODE_PRIVATE, null);
    myDB.execSQL("CREATE TABLE IF NOT EXISTS Tablezz (Field1 VARCHAR, Field2 INT(3));");

I cannot find a file called ddk.db anywhere on my computer (PC/Windows 7). The app seems to find it okay. Why can't I?
Thanks.

A: In my applications, my SQLite files end up at:
/data/data/<package_name>/databases/<db_name>.db

I'm not sure if this is default for every IDE or not, but I also used ADT.


text:
Q: SQLAlchemy Default DateTime, now plus n days from now I want to have a column with DateTime type which has a default value of 30 days from now
I cant set default now using default=datetime.datetime.utcnow but when I try to use something like default=(datetime.datetime.utcnow + datetime.timedelta(days=30))
It returns and error TypeError: unsupported operand type(s) for +: 'builtin_function_or_method' and 'datetime.timedelta'
A better example of my code:
class Example(Base):
    id = Column(Integer, primary_key=True)
    name = Column(String, nullable=False, unique=True)
    date = Column(DateTime, default=(datetime.datetime.utcnow + datetime.timedelta(days=30)))

How can I do this without hardcoding?

A: Create own function that will return the result:
def gen_valid_until():
    valid_until = date.today() + timedelta(days=7)
    return valid_until

And pass the function (not a result, so don't add ()) to default
class Share(db.Model):
    valid_until = db.Column(db.DateTime, nullable=False, default=gen_valid_until)

A: Ok, when datetime.datetime.utcnow is a function u can use datetime.datetime.utcnow() as datetime.datetime class

date = Column(DateTime, default=(datetime.datetime.utcnow() + datetime.timedelta(days=30)))

A: Seems like the solution to this problem is not setting a default, or setting datetime.datetime.utcnow as default and then assign its default value on the class __init__ method
class Example(Base):
    __tablename__ = 'example'
    id = Column(Integer, primary_key=True)
    name = Column(String, nullable=False, unique=True)
    date = Column(DateTime)

    def __init__(self, name, date=None):
        self.name = name
        self.date = date if date else datetime.datetime.utcnow() + datetime.timedelta(days=30)

This is the only way that works
Dont ever use:
date = Column(DateTime, default=(datetime.datetime.utcnow() + datetime.timedelta(days=30)))

You can't just pass a called argument as default, u have to pass the function itself, otherwise it will run the first time, and it will be replaced with its result on the first object you create, which means every object u create will have the same date as the first object..


text:
Q: hbase-indexer+Phoenix: hbase replication not working? I have a cluster with HBASE+Phoenix.
I've installed SOLR on it.
Now I'm trying to set up hbase replication for the cluster, following this manual:
https://community.hortonworks.com/articles/1181/hbase-indexing-to-solr-with-hdp-search-in-hdp-23.html
Started hbase-indexer server, added hbase-indexer, put data via hbase shell, requested commit via browser.
But there are no changes in the collection in SOLR - zero new records.
Status 'replication' command in hbase shell increases sizeOfLogQueue with each PUT command to the indexed table.
When greping hbase log (hbase-hbase-regionserver-myserver.log) I found lots of records like this:

Indexer_hbaseindexer: Total replicated edits: 0, currently replicating
  from:
  hdfs://HDP-Test/apps/hbase/data/WALs/myserver,16020,1519204674681/myserver%2C16020%2C1519204674681.default.1519204995372
  at position: 45671433

The position here never changes.
Issue author on this link tells that when changing WAL codec to IndexedWALEditCodec, the hbase replication stops.
Is it real that IndexedWALEditCodec stops hbase replication from working correctly? That shouldn't be true.
What may be a problem then? Any hint would be appreciated
env:

*

*HDFS           2.7.3

*HBASE          1.1.2

*SOLR           5.5.2

*HBASE  INDEXER 2.2.8

p.s. When restarting Hbase, then querying solr commit, the changes appear. But afterwards it doesn't do anything.


text:
Q: Unable to access the jsp page I just started using spring boot and JSP  on IntelliJ idea using gradle as a build tool.When i run the application I see 404 error on browser and on server console log i see the following message - No mapping found for HTTP request with URI [/WEB-INF/views/index.jsp] in DispatcherServlet with name 'dispatcherServlet'
I tried a lot and could not able to find out what is the RCA for the above mentioned issue. Can some one help me by out looking into the code repository : https://github.com/vmaramreddy1/spring-jsp-setup

A: You need to move the resources in your 'web' directory to the 'src/main/webapp' directory. That's where Spring is expecting the views to be found.


text:
Q: How can I improve this piece of code written in Scala? I was wondering how can I improve this code to be more readable and fluid. I appreciate your help, Thank You.
// filter DWT based on Zone
val dwtListZon = query.zoneOpt match {
  case None => dwtListStn
  case Some(zon) => {
    if (zon.crwStn333 == "all") {
      dwtListStn
    }
    dwtListStn.filter(_.crwStnAbbr3 == zon.crwStnAbbr3)
  }
}

I just want to learn how this code ought to be written, in terms of simplicity and readability, in a more declarative (if it could be) fashion.
Answers below show different style of doing same thing which also helps broaden my insight on FP and Scala in general. Thanks for that!

A: You might also consider the fold function which is available on Option.  It is often a nice syntax for Options with a default value, and you get to use the elegant partial function syntax:
query.zoneOpt.fold(dwtListStn) {
    case zon if zon.crwStn333 == "all" => dwtListStn
    case zon => dwtListStn.filter(_.crwStnAbbr3 == zon.crwStnAbbr3)
}

Another general strategy here would be to flip the operation around.  All branches of logic return some filtered or unfiltered version of dwtListStn, so you could conceive of the whole operation as a filter:
dwtListStn.filter { dwt =>
    query.zoneOpt match {
        case Some(zone) if zone.crwStn333 == "all" => false
        case Some(zone) => dwt.crwStnAbbr3 == zon.crwStnAbbr3
        case None => false
    }
}

A: val dwtListZon = query.zoneOpt filter (_.crwStn333 != "all") map (zon =>
 dwtListStn.filter(_.crwStnAbbr3 == zon.crwStnAbbr3) ) getOrElse dwtListStn

or if you want readability
val filteredSomething = for(zon <- query.zoneOpt if zon.crwStn333 != "all")
    yield dwtListStn.filter(_.crwStnAbbr3 == zon.crwStnAbbr3)
val dwtListZon = filteredSomething getOrElse dwtListStn

A: Normal match can be clear too. Just reverse if condition:
query.zoneOpt match {
   case Some(zon) if (zon.crwStn333 != "all") =>
      dwtListStn.filter(_.crwStnAbbr3 == zon.crwStnAbbr3)
   case _ =>
      dwtListStn
}


text:
Q: Use fewer columns on SQL query through Hibernate Projections on Entity with ManyToOne relation I'm trying to build a smaller SQL, to avoid the "select * from A" that is being build by default for hibernate Criteria.
If I use simple fields (no relation), through "Transformers", I have can manage to have this SQL:
select description, weight from Dog;

Hi, I have this Entity:
@Entity
public class Dog
{
   Long id;
   String description;
   Double weight;
   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(name = "person_id", nullable = false)
   Person owner;
}

@Entity
public class Person
{
   Long id;
   String name;
   Double height;
   Date birthDate;
}

My goal is to have this:
select description, weight, owner.name from Dog

I tried this with with Criteria (and subcriteria):
Criteria dogCriteria = sess.createCriteria(Dog.class);
ProjectionList proList = Projections.projectionList();
proList.add(Projections.property("description"), description);
proList.add(Projections.property("weight"), weigth);
dogCriteria.setProjection(proList);

Criteria personCriteria = dogCriteria.createCriteria("owner");
ProjectionList ownerProList = Projections.projectionList();
ownerProList.add(Projections.property("name"), description);
dogCriteria.setProjection(ownerProList);  //After this line,  debugger shows that the
                                          //projection on dogCriteria gets overriden
                                          //and the query fails, because "name" is
                                          //not a field of Dog entity.

How should I use Projections, to get a smaller SQL, less columns ?
Thanks in advance.

A: First of all,
select description, weight, owner.name from Dog

is not valid SQL. It would have to be something like
select description, weight, Person.name
 from Dog join Person on Dog.person_id = Person.id

instead. Secondly, why? While it's possible to do what you want (see below), it's extremely verbose to do so via Criteria API and you gain nothing to show for it. Savings on data transfer for a couple of columns are negligible unless said columns are huge blobs or you're selecting hundreds of thousands of records. In either case there are better ways to deal with this issue.
Anywho, to do what you want for criteria, you need to join linked table (Person) via alias and specify projection on main criteria using said alias:
Criteria criteria = session.createCriteria(Dog.class, "dog")
 .createAlias("owner", "own")
 .setProjection( Projections.projectionList()
   .add(Projections.property("dog.description"))
   .add(Projections.property("dog.weight"))
   .add(Projections.property("own.name"))
 );

There's a description and an example of the above in Criteria Projections documentation. Keep in mind that, when executed, the above criteria would return a list of object arrays. You'll need to specify a ResultTransformer in order to have results converted into actual objects.

A: I didn't tried it yet by myself, but I think you can also use another constructor in your Entity (Pojo) and pass the columns there.
See https://www.thoughts-on-java.org/hibernate-best-practices/ chapter "1.2 Pojo" for a detailed instruction.
Altough for me it's not yet clear if this also works for ManyToOne relationships too. I will have a try.


text:
Q: Retrieving binary data from SQL table in JAVA with Byte array and BitSet class Table Structure - Column X(Binary (15),null)
Value in Column X - 000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000
i.e 15x8=120 bits
SQL query
Select X from tablename;

Java Code part for retrieving value: barray is byte[] and bits is new BitSet().
barray = resultset.getBytes("X");

if(barray != null) {
   for (int i = 0; i < barray.length * 8; i++) {
      if ((barray[barray.length-i/8-1]&(1<<(i%8))) > 0) {
         bits.set(i);
      }
   }
}

Problem: The 2nd if statement is returning false value(not sure y?) thus the bits object is not getting populated. Please suggest a solution.

A: I think your mistake is outside of the code you posted, as I wrapped it in this program, and it works here:
package de.fencing_game.paul.examples;

import java.util.BitSet;

/**
 * Test class for http://stackoverflow.com/questions/5391097/retrieving-binary-data-from-sql-table-in-java-with-byte-array-and-bitset-class.
 */
public class BitSetByteArrayTest {

    public static void main(String[] params) {

        byte[] barray= new byte[]{ 0x01, 0x02, 0x04, 0x08,
                                   0x10, 0x20, 0x40, (byte)0x80,
                                   };
        BitSet bits = new BitSet();

        if(barray!=null){
            for (int i=0; i<barray.length*8; i++) {
                if ((barray[barray.length-i/8-1]&(1<<(i%8))) > 0) {
                    bits.set(i);
                }
            }
        }
        System.out.println(bits);
    }
}

It works also with your input
    byte[] barray = { 0,    0, 0, 0, 0,
                      0x20, 0, 0, 0, 0,
                      0,    0, 0, 0, 0};

instead of the sample array, showing {77} then.


text:
Q: Adding Progress to Action Bar Compat shows both spinner and progress indicator Im trying to show a spinner to the action bar (compat). This is my code
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
            supportRequestWindowFeature(Window.FEATURE_PROGRESS);//Giving an Error if do not include it
    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setSupportProgressBarIndeterminate(true);

    setContentView(R.layout.activity_doonline);
}

Now the trouble is when i set the visibility as true i get both a spinner and a progress bar on top of the action bar.I want only a spinner.
The code is
myActivity.setSupportProgressBarIndeterminateVisibility(true);

I know i added two supportRequestFeatures(wont work if I do not give 'FEATURE_PROGRESS'). I also noticed that

supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

will only work if I have

supportRequestWindowFeature(Window.FEATURE_PROGRESS);

A: Remove
supportRequestWindowFeature(Window.FEATURE_PROGRESS);

and
setSupportProgressBarIndeterminate(true);

Do not know exactly why but this worked for me. It seems that requesting the two features FEATURE_PROGRESS and FEATURE_INDETERMINATE_PROGRESS create both progress indicators and join them as a while and calling setSupportProgressBarIndeterminateVisibility or setSupportProgressBarVisibility change both visibility. But using FEATURE_INDETERMINATE_PROGRESS is enough to configure the indeterminate progress indicator. I wonder if it is a bug. Someone could want to use both indicators and this behaviour prevent this on older android systems.


text:
Q: Search results with persistent result checkboxes I'm working on a sheet that will help my team track permits in cities across the United States. There are 4 projects that each have specific needs. My idea was to create a drop-down to select the state and a vlookup to search the city under the state. I want my team to be able to select their checkbox and have the check status linked to the searched city. IE we should be able to select the box when we know a permit is needed and lookup the city again to know we have needed it before. Any ideas? Please see the attached sheet.
https://docs.google.com/spreadsheets/d/1bka6k582_cLCCMU1MToiWILPfOIBS9KjGtxaDqRgPl4/edit#gid=0


text:
Q: $c$-dense set with perfect set A set  $D\subset\mathbb R$ is called continuum dense if $|D\cap(a,b)|=c$ ($c$ is cardinality of $\mathbb R$) for every $a,b\in\mathbb R$ and $a<b.$ Let $P\subset\mathbb R$ be perfect set (uncountable closed set without isolated set). How about $$D\cap P \ ?$$  can be empty set ? what is the cardinality?  Any will be appreciated greatly

A: There's nothing nontrivial we can say.
Removing a nowhere-dense set won't affect the "density character" of a given set. In particular, if we let $C$ be a perfect nowhere-dense set (e.g. the usual Cantor set) then $\mathbb{R}\setminus C$ is still continuum-dense but of course $C\cap (\mathbb{R}\setminus C)=\emptyset$.


text:
Q: Password Change Not Working (Big Sur) I am trying to change my password on big Sur using recovery mode.(resetpassword  doesn't work) I am using dscl . -passwd /users/username which comes up with the error:
Passwd: invalid path
<dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)
If anyone knows a fix or another command I would be very grateful. I cannot log into any accounts on the computer so I can only use recovery mode commands in terminal.
Thanks.


text:
Q: How to publish a asp.net project to filesystem in VSTS Build I have a aps.net 3.5 solution stored in TFS. Usally I choose "publish" in VS2015 to get only the needed files into a target directory. That I use to create a package for deployment to a webserver.
Now I want to use the buildserver to create that package. My problem is, I can build the solution with a "Visual Studio Build"-Step, but I can't tell which files to copy by a "Copy Files"-Step.
I thought to call msbuild.exe using powershell but had no success setting a target directory for an existing profile. With /p:OutDir it copied the wrong files.
A "IIS Deployment"-Step does no simple filesystem copies, as far as I can see.
So how can I do what VS2015 does by "publish" with target filesystem on the Build-Server using dynamic output directories.

A: Refer to these steps:

*

*Click new to create a new build definition

*Select ASP.NET build template

*Select Visual Studio Build task and choose corresponding version of VS in Visual Studio Version input box

*(optional) Remove Visual Studio Test and Publish symbols path tasks.
With ASP.NET build template, you can find that, there is the MSBuild Arguments like this, which is used to create web deployment package and put it to artifact directory:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"


text:
Q: Remove unnecessary horizontal space from amsmath align between two & How do you remove unnecessary horizontal space in an amsmath align environment between two &?
Consider:
\documentclass{article}
\usepackage{amsmath}

\begin{document}

Version 1:
\begin{align*}
a &= b = d\\
bb &= cc = d
\end{align*}

Version 2:
\begin{align*}
a &= b &= d\\
bb &= cc &= d
\end{align*}

\end{document}

I want all the equal signs to line up.  I could do manual spacing, but thats a horrible solution.
I apologize if this a repost: I cannot find this answer anywhere.

A: you should use the alignat environment, which removes the space between the pairs of left and right hand sides. Skipping the left hand side of the second equation gives the result :
\begin{alignat*}{2}
a &= b &&= d\\
bb &= cc &&= d
\end{alignat*}

See for instance this question for a more detailed explanation.


text:
Q: 1172: Definition caurina.transitions:Tweener could not be found Hi I am new in flash and I am testing a flash code from site demo
but it gives errors like
 Scene 1, Layer 'Layer 1', Frame 1, Line 1  1172: Definition caurina.transitions:Tweener could not be found.
 Scene 1, Layer 'Layer 1', Frame 1, Line 1  1172: Definition caurina.transitions:Tweener could not be found.
 Scene 1, Layer 'Layer 1', Frame 1, Line 31 1120: Access of undefined property Tweener.
 Scene 1, Layer 'Layer 1', Frame 1, Line 41 1120: Access of undefined property Tweener.
 Scene 1, Layer 'Layer 1', Frame 1, Line 44 1120: Access of undefined property Tweener.

My code is:
import caurina.transitions.Tweener;

var last_item:Number;
var first_item:Boolean = true;
var rand_num:Number;
var timer:Timer = new Timer(4000, 1);

// Create MovieClips

for(var i=0; i<8;i++) {
   var newNum = i + 1;
   var clip = new Array();
   clip[i] = new item();
   clip[i].name = "clip" + newNum;
   clip[i].x = 337;
   clip[i].dyn_text.text = newNum;
   addChild(clip[i]);
}

// Begin scrolling of content

auto_scroll();

function auto_scroll():void  {
   //Generate random number between 1 and array length
   rand_num = randomNumber(1, clip.length);
   //Generate another random number until is doesn't equal the last one
   while(rand_num == last_item)  {
       rand_num = randomNumber(1, clip.length);
   }
   //Only scroll in content if item is the first one
   if(first_item == true)  {
       Tweener.addTween(getChildByName("clip" + rand_num), {x: 10, time:1, transition:"Linear"});
       first_item = false;
       last_item = rand_num;
   }
   timer.addEventListener(TimerEvent.TIMER, transition_items);
   timer.start();
}

function transition_items(event:TimerEvent):void  {
   // Scroll last item out of view and scroll new content in
   Tweener.addTween(getChildByName("clip" + last_item), {x: -336, time:1, transition:"Linear", onComplete: function():void  {getChildByName("clip" + last_item).x = 337;} });
   Tweener.addTween(getChildByName("clip" + rand_num), {x: 10, time:1.2, transition:"Linear", onComplete: function():void  {last_item = rand_num;auto_scroll()} });
}

function randomNumber(low:Number=0, high:Number=1):Number  {
    return Math.floor(Math.random() * (1+high-low)) + low;
}

I am unable to sort out this error this code gives error when I press ctrl+Enter to test it.I also download tweener package and placed that folder where my fla file is present.But unfortunately it doesn't works.
It may be possible duplicate of link stackoverflow, but I don't understand this solution.
Any Help?

A: Make a new folder in the directory where your Game.fla is present Name that folder Classes
after that put caurina folder in that Classes folder now go to File->Actionscript Settings->Source Path click(+) and write ./Classes
this did the trick for me


text:
Q: Add , update Drools rules dynamically I intend to create a data quality stream process with Java to read data from Kafka and apply some quality rules.
The main expectation is to add new rules or update an existing one at runtime, dynamically. So I should not stop the process.
Is it possible with Drools?
Let's say there is a rule that the ClienName attribute can't have the string value of "AAA"
ClienName != "AAA"

Can I do the following changes at runtime without restarting the process?

*

*Add "BBB" to this rule without removing the "AAA"

ClientName !="AAA" || ClienName !="BBB"

or like
{"AAA", "BBB"}.contains(ClientName)

*

*Change "AAA" to "BBB" as

ClienName == "BBB"

*

*add an addition to this rule like ClienName's length can not be larger than 10? as

ClienName == "AAA" && ClienName.length <= 10

*

*Add a new rule such as

LastName !="DDD"

But again, the main point is keeping the process running for those changes in the rules.
Thanks!
getting the idea if Drool rules can be updated dynamically without recompiling code or restarting the running app.


text:
Q: JavaScript get variable from function I'm no professional in JavaScript and I've seen searching a long time for this on the internet.
I'm having a problem getting a variable from another function. My code is looking like this:
var variabeltje;
$.post('js/ajax/handle_time.php', {'time': $(this).find('input').val()},
  function(data) {
    alert(data);
    variabeltje=data;
  }
);
alert(window.variabeltje);

The variable variabeltje must get the information from data. When I put the alert below variabeltje=data it's working, but I need the data variable after the function.
Edit:
I have changed it to what people said, I now have this:
                var XHR = $.post('js/ajax/handle_time.php', {time: $(this).find('input').val()});
                XHR.done(function(data) {
                    console.log(data);
                    getData(data);
                });

                function getData(data) {
                if(data == 'true') {
                    alert(data);
                    $(this).unbind('keypress');
                    $(this).html($(this).find('input').val());
                }
                }

But now the $(this) isn't passing into the function. How can I solve this?

A: As it's asynchronous the data will only be available after the ajax call is completed, so you'll have to modify your code to work with that and wait until after the ajax is done to do your stuff:
var XHR = $.post('js/ajax/handle_time.php', {time: $(this).find('input').val()});

XHR.done(function(data) {
    console.log(data);
});

or in other function:
function XHR(time){
   return $.post('js/ajax/handle_time.php', {time: time});
}

function doStuff(element) {
    XHR($(element).find('input').val()).done(function(data) {
        console.log(data);
    });
}

EDIT:
based on your edit, it looks like it's a scoping issue:
var self = this,
    XHR = $.post('js/ajax/handle_time.php', {time: $(self).find('input').val()});

XHR.done(function(data) {
    console.log(data);
    getData(data);
});

function getData(data) {
    if(data == 'true') { //normally you'd try to pass true as a boolean, not string
      alert(data);
      $(self).unbind('keypress').html($(self).find('input').val());
    }
}

A: This is because the $.post method runs asynchronously.
Please take a look at this question on SO.
Edit: You can change your code and put the part after post method inside the body of the anonymous function triggered on success. As follows:
$.post('js/ajax/handle_time.php', {'time': $(this).find('input').val()},
  function(data) {
    alert(data);
    variabeltje=data;
    alert(window.variabeltje); // or whatever function you need to call, call it here...
  }
);

A: The problem is that post method is executed asynchronously. This is, a post is sent to the server but execution flow continues so your alert is trying to access a value that wasn't set since post haven't returned yet.
You could use ajax method if you need a synchronic execution.


text:
Q: HasVirtualAuthenticator not found I am getting the following error when I try to run a TestNg test using a testng xml.
java: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for org.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator not found

This is my testng.xml:
<suite name="testng">
    <parameter name="apkPath"
               value="Test"/>
    <test name="Placeholder">
        <classes>
            <class name="Placeholder"></class>
        </classes>
    </test>
</suite>

It seems to be related to Selenium since it stops occurring if I remove  the selenium-java dependency from my pom.xml.
My pom.xml is very simple:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>CoreAppsFramework</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>7.5.1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.12.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.5</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

At this stage I am literally just trying to run a test that does a System.out.println().
I can't seem to find anything that can help me solve this. I also tried using different versions of selenium-java from the maven repo, but it happens every time.


text:
Q: I cant catch the server respond message for exception 400 - Java API I'm starting scans from my java engine to Rapid7 tool via API.
I want to catch and print the message from the server when the respond is 400.
Server returns JSON
 {
    "status": 400,
    "message": "An unexpected error occurred. See the log file for more information or contact support.",
    "links": [
        {
            "href": "api/3/sites/3/scans",
            "rel": "self"
        }
    ]
 }

I want to print this message to the console.
starting scan and reading respond back works fine (server respond https 200,201).
the issue is server respond 400.
code for reading server respond
httpsCode = connection.getResponseCode();

while (true)
                    {
                        //Read
                        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
// jumps from here to Catch when https code = 400

                        String lines = null;                         StringBuilder stringBuilder = new StringBuilder();
                        while ((lines = bufferedReader.readLine()) != null)
                        {
                            stringBuilder.append(lines);
                        }
                        bufferedReader.close();
                        result = stringBuilder.toString();

                        JSONParser parser = new JSONParser();
                        JSONObject json2 = (JSONObject) parser.parse(result);

                        if(httpsCode ==200 || httpsCode ==201)
                        {
                            if(methodType == MethodType.Add_host_To_Site && method.equals("POST"))
                            {
                                System.out.print("\n Rapid7 : Successful POST, host was added to Rapid7, " + splunkdata.getHost_fqdn() );
                                String asset_id= json2.get("id").toString();
                                splunkdata.getScan().setAsset_Id(Integer.parseInt(asset_id));
                                System.out.print("\n Rapid7 : Asset_id is set successfully , " + splunkdata.getHost_fqdn() );
                            }
}

 if (httpsCode == 400 || httpsCode == 401)
                        {
                            System.out.print(" Rapid7 : Rapid7 InsightVM throws Exception, \n Message : " + json2.get("message")  );
                        }

 connection.disconnect();

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (ProtocolException e) {
            e.printStackTrace();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) { // jump to IOException
            e.printStackTrace();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (KeyManagementException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();

what could be causing this problem?
Thank you


text:
Q: Wi-Fi very slow except for when another computer uses it We recently moved to a new home in a new state, with a new ISP. I'm a software guy, and I work from home frequently through the vpn, so I ordered the fastest connection they have. Everything works fine for me when I'm using the network at home.
When I'm at work, my wife is constantly complaining about how slow the internet is. Streaming video is basically impossible on her iMac. Latency is through the roof. We pay a lot for our cable+internet, so this was making both of us pretty upset.
She noticed, however, that while I'm at home using my personal computer (over Wi-Fi, having no problems), all of her speed issues disappear. So, she has started using my laptop at home while on her iMac, and everything works. I thought she was crazy, but just this morning I watched as my bank's webpage refused to load on her iMac, so I whipped out my laptop and hit google and the page came right up.
What could possibly be causing this kind of behavior?


text:
Q: Is this possible to change the recurring payment amount after signing up? I am Ritu from India.
I have a requirement that after signing up with a particular amount at PayPal Recurring Subscription, I need to change the amount from the next month. Is there any way for Standard PayPal Recurring Payment Subscription for changing the amount after the first month? If so, please let me know.
Thanks....

A: You have to cancel the current subscription and create a new subscription. Paypal does not want to have people agreeing to a subscription at one amount and then the person or business who is receiving the money changing that amount without the permission of the subscriber. So you must go through the approval process again if you want to change the amount.


text:
Q: Add read and publish permission together to ParseFacebookUtils Above is my code but i cant find out together usage, always gives error

Cannot pass a publish or manage permission (publish_actions) to a request for read authorization

This is my Permission list
private Collection<String> permissions = new ArrayList<>();
permissions.add("public_profile");
permissions.add("email");
permissions.add("user_birthday");
permissions.add("publish_actions");

And this is login request
ParseFacebookUtils.logInWithReadPermissionsInBackground(activity, permissions, new LogInCallback() {
@Override
public void done(ParseUser parseUser, ParseException parseException) {

       if (parseUser == null) {

       } else {

       }
    }
});

How can i use this together?

A: After long hours, this is solution. You must behave twice login to facebook. Once is publish and other one is read permissions. If you need public profile data , just publish permission is enough but in my case i need birthday, email, etc.. So code is below;
These are my permissions lists;
Collection<String> readPermissions = new ArrayList<>();
readPermissions.add("public_profile");
readPermissions.add("email");
readPermissions.add("user_birthday");
Collection<String> publishPermissions = new ArrayList<>();
publishPermissions.add("publish_actions");

Firstly, I should login with readpermission
ParseFacebookUtils.logInWithReadPermissionsInBackground(activity, readPermissions, new LogInCallback() {
        @Override
        public void done(ParseUser parseUser, ParseException parseException) {

            if (parseUser == null) {
                listener.onFailure(new UserCancelledFacebookLogin());
            } else {
                getPublishPermissions(parseUser);
            }
        }
    });

After this, here my "getPublishPermissions" method; FacebookRequestListener is my own listener , don't care/mind delete it.
public void getPublishPermissions(final ParseUser parseUser) {
    LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {

            GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
                @Override
                public void onCompleted(JSONObject object, GraphResponse response) {
                    // User succesfully login with all permissions
                    // After this with these json and ParseUser , you can save your user to Parse
                }
            });
            Bundle parameters = new Bundle();
            parameters.putString("fields", "id,first_name,last_name,name,email,gender,birthday");
            request.setParameters(parameters);
            request.executeAsync();
        }

        @Override
        public void onCancel() {

        }

        @Override
        public void onError(FacebookException facebookException) {

        }
    });

    LoginManager.getInstance().logInWithPublishPermissions(activity, publishPermissions);
}

that's all folks =)
happy coding to everyone

A: The error message means you should not request read and write permissions at the same time. Login with read permissions when the User enters your App, request write permission (publish_actions) only right before you post.
Use ParseFacebookUtils.logInWithPublishPermissionsInBackground for that.
That error message is already well known, take a look at some other thread about it:

*

*How to set permission "publish_actions" in LoginButton using facebook sdk?

*Facebook, setReadPermissions and setPublishPermissions

*facebook login Cannot pass a publish or manage permission (email) to a request for read authorization

A: You need to do a POST request instead of a GET one. See:

*

*https://developers.facebook.com/docs/graph-api/reference/v2.2/user/scores/#publish
Sample:
  Bundle param = new Bundle();
param.putString("message", "picture caption");
param.putByteArray("picture", ImageBytes);
mAsyncRunner.request("me/photos", param, "POST", new SampleUploadListener());

this is your answer check link


text:
Q: Android Studio 1.3 test module (com.android.test) The release notes from Android 1.3 state that it's now possible to have application tests under a separate module (source: http://android-developers.blogspot.ro/2015/07/get-your-hands-on-android-studio-13.html)

For more flexibility in app testing, you now have the option to place
  your code tests in a separate module and use the new test plugin
  ('com.android.test') instead of keeping your tests right next to your
  app code. This feature does require your app project to use the Gradle
  Plugin 1.3

However, I haven't seen any option in AS to create such module and when I try to create one myself (first create Java library module, then alter its build.gradle file), like:
apply plugin: 'com.android.test'

android {

    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    targetProjectPath ':app'
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

I'm getting an error:

Error:Configuration with name 'debug-classes' not found.

Has anyone managed to get this working?
P. S. I'm using AS 1.3 with Android Gradle plugin v1.3.


text:
Q: Flutter input field collapsed when showing error message I was add 2 input field in the same row in the mobile screen input fields are collapsed when showing error.
Row(
children: <Widget>[
  Expanded(
      flex: 2,
      child: TextFormField(
        autovalidateMode: AutovalidateMode
            .onUserInteraction,
        keyboardType: TextInputType.number,
        controller: controller.plz,
        validator: ValidationBuilder(
                localeName: localeLanguage)
            .digits()
            .minLength(5)
            .required()
            .build(),
        decoration: inputdecoration(),
      )),
  SizedBox(width: 10.0),
  Expanded(
      flex: 3,
      child: TextFormField(
        autovalidateMode: AutovalidateMode
            .onUserInteraction,
        validator: ValidationBuilder(
                localeName: localeLanguage)
            .required()
            .build(),
        controller: controller.place,
        decoration: inputdecoration(),
      ))
],
),

InputDecoration(
errorMaxLines: 3,
helperText: '',
contentPadding:
new EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
fillColor: AsianmastaColors.white,
filled: true,
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 1.0)))
//after showing error
new

A: Its hard to read the code. First update your question adding the code on code block. You will find {} symbol just above the text pad.

A: give the Row crossAxisAlignment.start and it will work
Row(
crossAxisAlignment: CrossAxisAlignment.start
children: <Widget>[
Expanded(
  flex: 2,
  child: TextFormField(
    autovalidateMode: AutovalidateMode
        .onUserInteraction,
    keyboardType: TextInputType.number,
    controller: controller.plz,
    validator: ValidationBuilder(
            localeName: localeLanguage)
        .digits()
        .minLength(5)
        .required()
        .build(),
    decoration: inputdecoration(),
  )),
  SizedBox(width: 10.0),
  Expanded(
  flex: 3,
  child: TextFormField(
    autovalidateMode: AutovalidateMode
        .onUserInteraction,
    validator: ValidationBuilder(
            localeName: localeLanguage)
        .required()
        .build(),
    controller: controller.place,
    decoration: inputdecoration(),
  ))
],
),


text:
Q: How to create a 3 D surface plot I have unique combinations of x, y and z data and wanted to create 3d scatter plot and a surface plot.
The 3d scatter plot worked with this code:
s3d <-scatterplot3d(x,z,y, pch=16, highlight.3d=TRUE, type="h", main="3D Scatterplot")

But I fail to create  a surface plot using the base graphics.
 persp(x, z, y)  gave me the error message: "increasing 'x' and 'y' values expected .
I also tried the rgl package the rgl package:
require(rgl)
surface3d(x, y, z)

which resulted in "Error in rgl.surface(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,  :
  y length != x rows * z cols"
I have looked at previous posts here and also here, but most need some alteration or interpolation of the data. How can I create a 3d  surface plot with the sample data without changing /much alteration of the content.
Sample data follows:
dput(df)
structure(list(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5), z = c(1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10), y = c(0.300000041723251, 0.400000065565109,
0.499999970197678, 0.600000023841858, 0.700000047683716, 0.800000071525574,
1.20000004768372, 1.59999990463257, 1.99999988079071, 2.39999985694885,
1.40000009536743, 1.60000002384186, 1.79999983310699, 1.99999988079071,
2.19999980926514, 2.39999985694885, 3, 3.59999990463257, 4.19999980926514,
4.79999971389771, 2.49999976158142, 2.79999971389771, 3.09999990463257,
3.39999961853027, 3.69999980926514, 4, 4.79999971389771, 5.59999990463257,
6.39999961853027, 7.19999980926514, 3.59999990463257, 4, 4.39999961853027,
4.79999971389771, 5.19999980926514, 5.59999990463257, 6.59999990463257,
7.59999942779541, 8.60000038146973, 9.60000038146973, 4.69999980926514,
5.19999980926514, 5.69999980926514, 6.19999980926514, 6.69999980926514,
7.19999980926514, 8.40000057220459, 9.60000038146973, 10.8000011444092,
12.0000009536743)), datalabel = "", time.stamp = "19 Dec 2013 17:54", .Names = c("x",
"z", "y"), formats = c("%9.0g", "%9.0g", "%9.0g"), types = c(254L,
254L, 254L), val.labels = c("", "", ""), var.labels = c("", "",
""), version = 12L, row.names = c("1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17",
"18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28",
"29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39",
"40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50"
), class = "data.frame")

A: I'm assuming your y & z columns are inverted, but you can do something like this - basically you need x & y for the axes and a z-grid for the intersect values:
require(rgl)
require(reshape2)
df.x<-unique(df$x)
df.y<-unique(df$z)
df.z<-acast(df,x~z)
persp(df.x,df.y,df.z)
surface3d(df.x,df.y,df.z)


text:
Q: how to rotate a UIView to face a point I have a UIView that I want to rotate when I move my finger across the screen (like in a circle). I want the UIView to rotate so that it faces my touchpoint. I then want to shoot something from my UIView (like a bullet) in the direction that the UIView is facing. Any Ideas???

A: Glad I remember triginometry

-(void)degreesToRotateObjectWithPosition:(CGPoint)objPos andTouchPoint:(CGPoint)touchPoint{

   float dX = touchPoint.x-objPos.x;        // distance along X
   float dY = touchPoint.y-objPos.y;        // distance along Y
   float radians = atan2(dY, dX);          // tan = opp / adj

   //Now we have to convert radians to degrees:
   float degrees = radians*M_PI/360;

   return degrees;
}

Once you have your nice method, just do this:
CGAffineTransform current = view.transform;

[view setTransform:CGAffineTransformRotate(current,                 [view degreesTorotateObjectWithPosition:view.frame.origin                                   andTouchPoint:[touch locationInView:parentView]]

//Note: parentView = The view that your object to rotate is sitting in.
This is pretty much all the code that you'll need.The math is right, but I'm not sure about the setTransform stuff. I'm at school writing this in a browser. You should be able to figure it out from here.
Good luck,
Aurum Aquila


text:
Q: Did JKR base her description of Smeltings Academy on a real school? We get very little information about Smeltings Academy - the school where Dudley goes:

Dudley had been accepted at Uncle Vernon's old private school,
  Smeltings.
...
That evening, Dudley paraded around the living room for the family in
  his brand-new uniform. Smeltings' boys wore maroon tailcoats, orange
  knickerbockers, and flat straw hats called boaters. They also carried
  knobbly sticks, used for hitting each other while the teachers weren't
  looking. This was supposed to be good training for later life.

Is there a real-life equivalent of this school that JKR used as model? The thing with the stick seems really distinctive.

A: Smeltings Academy seems to be an amalgam of several famous English public schools; notably Eton College, Harrow School, Hill House School and The King's School.
Eton = Tailcoats

Harrow = Boater hats

Hill House = Awful colour-scheme & knickerbocker trousers

Kings School, Canterbury = Swagger Sticks