问:
OCI runtime error when sending Hyperledger Fabric's chaincode instantiation request to peers
Using the Hyperledger Fabric Java SDK with GO chaincode, I'm getting an error after trying to initiate my chaincode using
channel.sendInstantiationProposal(instantiateProposalRequest, company.getPeers());.

This is after I successfully installed the chaincode. After calling said method, I will eventually get this error:

[dockercontroller] Start -> ERRO 352 start-could not start container: API error (404): {"message":"oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\"\n"}.

This is peculiar on its own, since chaincode is not a binary that I'm aware of. Does it perhaps mean peer chaincode?

Versions

Hyperledger fabric: 1.0.4

docker: 17.05.0-ce

docker-compose: 1.17.0

hyperledger/fabric-orderer: 1.0.0

hyperledger/fabric-peer: 1.0.0

hyperledger/fabric-ccenv: 1.0.0

hyperledger/fabric-ca: 1.0.0

hyperledger/fabric-baseos: 0.3.1

tomcat (docker container): 8.5.23

My instantiation proposal request looks like this (printed with Reflection):

```<code>tomcat              | 2017-12-01 10:41:03 DEBUG Debug:24 - org.hyperledger.fabric.sdk.InstantiateProposalRequest
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getProposalWaitTime: 20000
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getChaincodeName: test_cc_go
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getChaincodePath: super/test_cc
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getChaincodeVersion: 0.0.1
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:43 -   getChaincodeEndorsementPolicy:
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:24 -     org.hyperledger.fabric.sdk.ChaincodeEndorsementPolicy
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:43 -       getChaincodeEndorsementPolicyAsBytes:
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:24 -         [B
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:41 -   getTransientMap:
tomcat              | {}
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getChaincodeLanguage: GO_LANG
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:43 -   getChaincodeID:
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:24 -     org.hyperledger.fabric.sdk.ChaincodeID
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:41 -       getFabricChaincodeID:
tomcat              | path: "super/test_cc"
tomcat              | name: "test_cc_go"
tomcat              | version: "0.0.1"
tomcat              |
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -       getVersion: 0.0.1
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -       getName: test_cc_go
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -       getPath: super/test_cc
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getFcn: init
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:38 -   getArgBytes: null
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:41 -   getArgs:
tomcat              | [testarg!]
</code>```

It looks like it fails to properly create a container, since I'm getting stop container dev-peer0.company.org-test_cc_go-0.0.1(Container not running: dev-peer0.company.org-test_cc_go-0.0.1) before the main error.

The full log of my tomcat container and one of the peers:

```<code>tomcat              | 2017-12-01 10:41:03 DEBUG HyperledgerConfigurator:370 - Building instantiateProposalRequest...
tomcat              | 2017-12-01 10:41:03 DEBUG HyperledgerConfigurator:391 - Reading endorsement policy from path: /etc/hyperledger/chaincodeendorsementpolicy.yaml
tomcat              | 2017-12-01 10:41:03 DEBUG HyperledgerConfigurator:404 - Sending instantiation request to all peers...
tomcat              | 2017-12-01 10:41:03 DEBUG NettyClientHandler:147 -
tomcat              | ----------------OUTBOUND--------------------
tomcat              | [id: 0x0d3de89a, L:/172.18.0.11:41906 - R:peer0.company.org/172.18.0.8:7051] HEADERS: streamId=7, headers=GrpcHttp2OutboundHeaders[:authority: peer0.company.org, :path: /protos.Endorser/ProcessProposal, :method: POST, :scheme: https, content-type: application/grpc, te: trailers, user-agent: grpc-java-netty/1.5.0, grpc-accept-encoding: gzip], streamDependency=0, weight=16, exclusive=false, padding=0, endStream=false
tomcat              | ------------------------------------
tomcat              | 2017-12-01 10:41:03 DEBUG NettyClientHandler:147 -
tomcat              | ----------------OUTBOUND--------------------
tomcat              | [id: 0x0d3de89a, L:/172.18.0.11:41906 - R:peer0.company.org/172.18.0.8:7051] DATA: streamId=7, padding=0, endStream=true, length=1247, bytes=00000004da0a8f090a93070a72080310011a0c08bfe384d10510c082fc8102221270726573746174696f6e2d6368616e6e656c2a403263393063616131343431...
tomcat              | ------------------------------------
peer0.company.org      | 2017-12-01 10:41:03.545 UTC [endorser] ProcessProposal -> DEBU 2f9 Entry
peer0.company.org      | 2017-12-01 10:41:03.545 UTC [protoutils] ValidateProposalMessage -> DEBU 2fa ValidateProposalMessage starts for signed proposal 0xc42177e420
peer0.company.org      | 2017-12-01 10:41:03.545 UTC [protoutils] validateChannelHeader -> DEBU 2fb validateChannelHeader info: header type 3
peer0.company.org      | 2017-12-01 10:41:03.545 UTC [protoutils] checkSignatureFromCreator -> DEBU 2fc checkSignatureFromCreator starts
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [protoutils] checkSignatureFromCreator -> DEBU 2fd checkSignatureFromCreator info: creator is &{DCMSP 47c36cc8e5813d60b506bf2f8757150a0ee044e386f271d8f7df23626c0c3131}
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [protoutils] checkSignatureFromCreator -> DEBU 2fe checkSignatureFromCreator info: creator is valid
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [protoutils] checkSignatureFromCreator -> DEBU 2ff checkSignatureFromCreator exists successfully
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [protoutils] validateChaincodeProposalMessage -> DEBU 300 validateChaincodeProposalMessage starts for proposal 0xc420307400, header 0xc42177e450
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [protoutils] validateChaincodeProposalMessage -> DEBU 301 validateChaincodeProposalMessage info: header extension references chaincode name:"lscc"
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [endorser] ProcessProposal -> DEBU 302 processing txid: 2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [fsblkstorage] retrieveTransactionByID -> DEBU 303 retrieveTransactionByID() - txId = [2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6]
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [lockbasedtxmgr] NewTxSimulator -> DEBU 304 constructing new tx simulator
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [lockbasedtxmgr] newLockBasedTxSimulator -> DEBU 305 constructing new tx simulator [7ee0c1a2-4569-49a4-bbca-dd6eb4b6688e]
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [endorser] simulateProposal -> DEBU 306 Entry - txid: 2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6 channel id: super-channel
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [endorser] callChaincode -> DEBU 307 Entry - txid: 2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6 channel id: super-channel version: 1.0.0
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [ccprovider] NewCCContext -> DEBU 308 NewCCCC (chain=super-channel,chaincode=lscc,version=1.0.0,txid=2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6,syscc=true,proposal=0xc420307400,canname=lscc:1.0.0
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [chaincode] Launch -> DEBU 309 chaincode is running(no need to launch) : lscc:1.0.0
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] Execute -> DEBU 30a Entry
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] Execute -> DEBU 30b chaincode canonical name: lscc:1.0.0
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] sendExecuteMessage -> DEBU 30c [2c90caa1]Inside sendExecuteMessage. Message TRANSACTION
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] setChaincodeProposal -> DEBU 30d Setting chaincode proposal context...
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] setChaincodeProposal -> DEBU 30e Proposal different from nil. Creating chaincode proposal context...
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] sendExecuteMessage -> DEBU 30f [2c90caa1]sendExecuteMsg trigger event TRANSACTION
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] processStream -> DEBU 310 [2c90caa1]Move state message TRANSACTION
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] HandleMessage -> DEBU 311 [2c90caa1]Fabric side Handling ChaincodeMessage of type: TRANSACTION in state ready
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] filterError -> DEBU 312 Ignoring NoTransitionError: no transition
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] processStream -> DEBU 313 [2c90caa1]sending state message TRANSACTION
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] func1 -> DEBU 314 [2c90caa1]Received message TRANSACTION from shim
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] handleMessage -> DEBU 315 [2c90caa1]Handling ChaincodeMessage of type: TRANSACTION(state:ready)
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] beforeTransaction -> DEBU 316 [2c90caa1]Received TRANSACTION, invoking transaction on chaincode(Src:ready, Dst:ready)
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] handleGetState -> DEBU 317 [2c90caa1]Sending GET_STATE
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] processStream -> DEBU 318 [2c90caa1]Received message GET_STATE from shim
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] HandleMessage -> DEBU 319 [2c90caa1]Fabric side Handling ChaincodeMessage of type: GET_STATE in state ready
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] afterGetState -> DEBU 31a [2c90caa1]Received GET_STATE, invoking get state from ledger
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] filterError -> DEBU 31b Ignoring NoTransitionError: no transition
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] func1 -> DEBU 31c [2c90caa1] getting state for chaincode lscc, key test_cc_go, channel super-channel
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [stateleveldb] GetState -> DEBU 31d GetState(). ns=lscc, key=test_cc_go
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] func1 -> DEBU 31e [2c90caa1]No state associated with key: test_cc_go. Sending RESPONSE with an empty payload
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] 1 -> DEBU 31f [2c90caa1]handleGetState serial send RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] func1 -> DEBU 320 [2c90caa1]Received message RESPONSE from shim
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] handleMessage -> DEBU 321 [2c90caa1]Handling ChaincodeMessage of type: RESPONSE(state:ready)
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] sendChannel -> DEBU 322 [2c90caa1]before send
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] sendChannel -> DEBU 323 [2c90caa1]after send
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] afterResponse -> DEBU 324 [2c90caa1]Received RESPONSE, communicated (state:ready)
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] handleGetState -> DEBU 325 [2c90caa1]GetState received payload RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] handlePutState -> DEBU 326 [2c90caa1]Inside putstate
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] handlePutState -> DEBU 327 [2c90caa1]Sending PUT_STATE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] processStream -> DEBU 328 [2c90caa1]Received message PUT_STATE from shim
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] HandleMessage -> DEBU 329 [2c90caa1]Fabric side Handling ChaincodeMessage of type: PUT_STATE in state ready
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] filterError -> DEBU 32a Ignoring NoTransitionError: no transition
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] func1 -> DEBU 32b [2c90caa1]state is ready
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] func1 -> DEBU 32c [2c90caa1]Completed PUT_STATE. Sending RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] 1 -> DEBU 32d [2c90caa1]enterBusyState trigger event RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] processStream -> DEBU 32e [2c90caa1]Move state message RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] HandleMessage -> DEBU 32f [2c90caa1]Fabric side Handling ChaincodeMessage of type: RESPONSE in state ready
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] filterError -> DEBU 330 Ignoring NoTransitionError: no transition
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] processStream -> DEBU 331 [2c90caa1]sending state message RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] func1 -> DEBU 332 [2c90caa1]Received message RESPONSE from shim
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] handleMessage -> DEBU 333 [2c90caa1]Handling ChaincodeMessage of type: RESPONSE(state:ready)
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] sendChannel -> DEBU 334 [2c90caa1]before send
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] sendChannel -> DEBU 335 [2c90caa1]after send
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] handlePutState -> DEBU 336 [2c90caa1]Received RESPONSE. Successfully updated state
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] afterResponse -> DEBU 337 [2c90caa1]Received RESPONSE, communicated (state:ready)
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] func1 -> DEBU 338 [2c90caa1]Transaction completed. Sending COMPLETED
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] func1 -> DEBU 339 [2c90caa1]Move state message COMPLETED
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] handleMessage -> DEBU 33a [2c90caa1]Handling ChaincodeMessage of type: COMPLETED(state:ready)
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] func1 -> DEBU 33b [2c90caa1]send state message COMPLETED
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] processStream -> DEBU 33c [2c90caa1]Received message COMPLETED from shim
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] HandleMessage -> DEBU 33d [2c90caa1]Fabric side Handling ChaincodeMessage of type: COMPLETED in state ready
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] HandleMessage -> DEBU 33e [2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6]HandleMessage- COMPLETED. Notify
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] notify -> DEBU 33f notifying Txid:2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] Execute -> DEBU 340 Exit
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [ccprovider] NewCCContext -> DEBU 341 NewCCCC (chain=super-channel,chaincode=test_cc_go,version=0.0.1,txid=2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6,syscc=false,proposal=0xc420307400,canname=test_cc_go:0.0.1
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] Launch -> DEBU 342 launchAndWaitForRegister fetched 1587 bytes from file system
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] getArgsAndEnv -> DEBU 343 Executable is chaincode
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] getArgsAndEnv -> DEBU 344 Args [chaincode -peer.address=peer0.company.org:7051]
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] launchAndWaitForRegister -> DEBU 345 start container: test_cc_go:0.0.1(networkid:dev,peerid:peer0.company.org)
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] launchAndWaitForRegister -> DEBU 346 start container with args: chaincode -peer.address=peer0.company.org:7051
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] launchAndWaitForRegister -> DEBU 347 start container with env:
peer0.company.org      |    CORE_CHAINCODE_ID_NAME=test_cc_go:0.0.1
peer0.company.org      |    CORE_PEER_TLS_ENABLED=true
peer0.company.org      |    CORE_CHAINCODE_LOGGING_LEVEL=debug
peer0.company.org      |    CORE_CHAINCODE_LOGGING_SHIM=debug
peer0.company.org      |    CORE_CHAINCODE_LOGGING_FORMAT=%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [container] lockContainer -> DEBU 348 waiting for container(dev-peer0.company.org-test_cc_go-0.0.1) lock
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [container] lockContainer -> DEBU 349 got container (dev-peer0.company.org-test_cc_go-0.0.1) lock
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [dockercontroller] Start -> DEBU 34a Cleanup container dev-peer0.company.org-test_cc_go-0.0.1
peer0.company.org      | 2017-12-01 10:41:03.550 UTC [dockercontroller] stopInternal -> DEBU 34b Stop container dev-peer0.company.org-test_cc_go-0.0.1(Container not running: dev-peer0.company.org-test_cc_go-0.0.1)
peer0.company.org      | 2017-12-01 10:41:03.550 UTC [dockercontroller] stopInternal -> DEBU 34c Kill container dev-peer0.company.org-test_cc_go-0.0.1 (API error (500): {"message":"Cannot kill container dev-peer0.company.org-test_cc_go-0.0.1: Container 935c3c20aca77b6a8a398aea553e524a734a30f6dfceab5fd4ca4683b3e1eb8f is not running"}
peer0.company.org      | )
peer0.company.org      | 2017-12-01 10:41:03.611 UTC [dockercontroller] stopInternal -> DEBU 34d Removed container dev-peer0.company.org-test_cc_go-0.0.1
peer0.company.org      | 2017-12-01 10:41:03.611 UTC [dockercontroller] Start -> DEBU 34e Start container dev-peer0.company.org-test_cc_go-0.0.1
peer0.company.org      | 2017-12-01 10:41:03.611 UTC [dockercontroller] getDockerHostConfig -> DEBU 34f docker container hostconfig NetworkMode: compose_default
peer0.company.org      | 2017-12-01 10:41:03.612 UTC [dockercontroller] createContainer -> DEBU 350 Create container: dev-peer0.company.org-test_cc_go-0.0.1
peer0.company.org      | 2017-12-01 10:41:03.754 UTC [dockercontroller] createContainer -> DEBU 351 Created container: dev-peer0.company.org-test_cc_go-0.0.1
peer0.company.org      | 2017-12-01 10:41:04.514 UTC [dockercontroller] Start -> ERRO 352 start-could not start container: API error (404): {"message":"oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\"\n"}
peer0.company.org      | 2017-12-01 10:41:04.514 UTC [container] unlockContainer -> DEBU 353 container lock deleted(dev-peer0.company.org-test_cc_go-0.0.1)
peer0.company.org      | 2017-12-01 10:41:04.514 UTC [chaincode] Launch -> ERRO 354 launchAndWaitForRegister failed Error starting container: API error (404): {"message":"oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\"\n"}
peer0.company.org      | 2017-12-01 10:41:04.514 UTC [endorser] callChaincode -> DEBU 355 Exit
peer0.company.org      | 2017-12-01 10:41:04.514 UTC [endorser] simulateProposal -> ERRO 356 failed to invoke chaincode name:"lscc"  on transaction 2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6, error: Error starting container: API error (404): {"message":"oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\"\n"}
</code>```

If anyone can give me some direction, that would greatly be appreciated! Thank you in advance!

EDIT: Here's how the chaincode is put on the peers:

The chaincode source is located at /etc/hyperledger/chaincode/src/super/test_cc/test_cc.go and I'm using the client.sendInstallProposal(installProposalRequest, company.getPeers()); command to send it to the peers. Here's how the install proposal looks and how the peers' reponses look afterwards:

```<code>2017-12-03 17:08:25 INFO  HyperledgerConfigurator:326 - Installing super.chaincode as company into channel super-channel
tomcat              | 2017-12-03 17:08:25 DEBUG HyperledgerConfigurator:330 - Chaincode source path: /etc/hyperledger/chaincode/
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:24 - org.hyperledger.fabric.sdk.InstallProposalRequest
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:41 -   getChaincodeSourceLocation:
tomcat              | /etc/hyperledger/chaincode
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:38 -   getChaincodeInputStream: null
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -   getProposalWaitTime: 20000
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -   getChaincodeName: test_cc_go
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -   getChaincodePath: super/test_cc
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -   getChaincodeVersion: 0.0.1
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:38 -   getChaincodeEndorsementPolicy: null
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:38 -   getTransientMap: null
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -   getChaincodeLanguage: GO_LANG
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:43 -   getChaincodeID:
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:24 -     org.hyperledger.fabric.sdk.ChaincodeID
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:41 -       getFabricChaincodeID:
tomcat              | path: "super/test_cc"
tomcat              | name: "test_cc_go"
tomcat              | version: "0.0.1"
tomcat              |
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -       getVersion: 0.0.1
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -       getName: test_cc_go
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -       getPath: super/test_cc
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:31 -   getFcn: null
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:38 -   getArgBytes: null
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:38 -   getArgs: null
tomcat              | 2017-12-03 17:08:25 DEBUG HyperledgerConfigurator:350 - Sending chaincode installation request...
...
tomcat              | 2017-12-03 17:08:25 DEBUG HyperledgerConfigurator:361 - Responses:
tomcat              | 2017-12-03 17:08:25 DEBUG HyperledgerConfigurator:363 - TransactionID: fd72977b40808609e781cd658454f7753599ec8c27f61acb4629fae4dc520e10, peer: peer0.company.org, decision: SUCCESS
tomcat              | 2017-12-03 17:08:25 DEBUG HyperledgerConfigurator:363 - TransactionID: fd72977b40808609e781cd658454f7753599ec8c27f61acb4629fae4dc520e10, peer: peer1.company.org, decision: SUCCESS
</code>```

EDIT2: The chaincode of the peer is found at /var/hyperledger/production/chaincodes/test_cc_go.0.0.1, but this is not in its path /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin. It's also not called chaincode which it tries to call.

答:
Turns out my chaincode used a dependency (scrypt in my case), which caused the build to fail. The code would pass its unit test and compile just fine, but it wouldn't run on peers because of this.
You may want to install your go dependencies onto your ccenv (which is used to compile your chaincode), or in my case I ditched it in favor of Hyperledger Fabric 1.1's built-in encryption support.</p>

Body:
Using the Hyperledger Fabric Java SDK with GO chaincode, I'm getting an error after trying to initiate my chaincode using
channel.sendInstantiationProposal(instantiateProposalRequest, company.getPeers());.

This is after I successfully installed the chaincode. After calling said method, I will eventually get this error:

[dockercontroller] Start -> ERRO 352 start-could not start container: API error (404): {"message":"oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\"\n"}.

This is peculiar on its own, since chaincode is not a binary that I'm aware of. Does it perhaps mean peer chaincode?

Versions

Hyperledger fabric: 1.0.4

docker: 17.05.0-ce

docker-compose: 1.17.0

hyperledger/fabric-orderer: 1.0.0

hyperledger/fabric-peer: 1.0.0

hyperledger/fabric-ccenv: 1.0.0

hyperledger/fabric-ca: 1.0.0

hyperledger/fabric-baseos: 0.3.1

tomcat (docker container): 8.5.23

My instantiation proposal request looks like this (printed with Reflection):

tomcat              | 2017-12-01 10:41:03 DEBUG Debug:24 - org.hyperledger.fabric.sdk.InstantiateProposalRequest
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getProposalWaitTime: 20000
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getChaincodeName: test_cc_go
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getChaincodePath: super/test_cc
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getChaincodeVersion: 0.0.1
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:43 -   getChaincodeEndorsementPolicy:
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:24 -     org.hyperledger.fabric.sdk.ChaincodeEndorsementPolicy
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:43 -       getChaincodeEndorsementPolicyAsBytes:
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:24 -         [B
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:41 -   getTransientMap:
tomcat              | {}
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getChaincodeLanguage: GO_LANG
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:43 -   getChaincodeID:
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:24 -     org.hyperledger.fabric.sdk.ChaincodeID
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:41 -       getFabricChaincodeID:
tomcat              | path: "super/test_cc"
tomcat              | name: "test_cc_go"
tomcat              | version: "0.0.1"
tomcat              |
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -       getVersion: 0.0.1
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -       getName: test_cc_go
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -       getPath: super/test_cc
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:33 -   getFcn: init
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:38 -   getArgBytes: null
tomcat              | 2017-12-01 10:41:03 DEBUG Debug:41 -   getArgs:
tomcat              | [testarg!]

It looks like it fails to properly create a container, since I'm getting stop container dev-peer0.company.org-test_cc_go-0.0.1(Container not running: dev-peer0.company.org-test_cc_go-0.0.1) before the main error.

The full log of my tomcat container and one of the peers:

tomcat              | 2017-12-01 10:41:03 DEBUG HyperledgerConfigurator:370 - Building instantiateProposalRequest...
tomcat              | 2017-12-01 10:41:03 DEBUG HyperledgerConfigurator:391 - Reading endorsement policy from path: /etc/hyperledger/chaincodeendorsementpolicy.yaml
tomcat              | 2017-12-01 10:41:03 DEBUG HyperledgerConfigurator:404 - Sending instantiation request to all peers...
tomcat              | 2017-12-01 10:41:03 DEBUG NettyClientHandler:147 -
tomcat              | ----------------OUTBOUND--------------------
tomcat              | [id: 0x0d3de89a, L:/172.18.0.11:41906 - R:peer0.company.org/172.18.0.8:7051] HEADERS: streamId=7, headers=GrpcHttp2OutboundHeaders[:authority: peer0.company.org, :path: /protos.Endorser/ProcessProposal, :method: POST, :scheme: https, content-type: application/grpc, te: trailers, user-agent: grpc-java-netty/1.5.0, grpc-accept-encoding: gzip], streamDependency=0, weight=16, exclusive=false, padding=0, endStream=false
tomcat              | ------------------------------------
tomcat              | 2017-12-01 10:41:03 DEBUG NettyClientHandler:147 -
tomcat              | ----------------OUTBOUND--------------------
tomcat              | [id: 0x0d3de89a, L:/172.18.0.11:41906 - R:peer0.company.org/172.18.0.8:7051] DATA: streamId=7, padding=0, endStream=true, length=1247, bytes=00000004da0a8f090a93070a72080310011a0c08bfe384d10510c082fc8102221270726573746174696f6e2d6368616e6e656c2a403263393063616131343431...
tomcat              | ------------------------------------
peer0.company.org      | 2017-12-01 10:41:03.545 UTC [endorser] ProcessProposal -> DEBU 2f9 Entry
peer0.company.org      | 2017-12-01 10:41:03.545 UTC [protoutils] ValidateProposalMessage -> DEBU 2fa ValidateProposalMessage starts for signed proposal 0xc42177e420
peer0.company.org      | 2017-12-01 10:41:03.545 UTC [protoutils] validateChannelHeader -> DEBU 2fb validateChannelHeader info: header type 3
peer0.company.org      | 2017-12-01 10:41:03.545 UTC [protoutils] checkSignatureFromCreator -> DEBU 2fc checkSignatureFromCreator starts
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [protoutils] checkSignatureFromCreator -> DEBU 2fd checkSignatureFromCreator info: creator is &{DCMSP 47c36cc8e5813d60b506bf2f8757150a0ee044e386f271d8f7df23626c0c3131}
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [protoutils] checkSignatureFromCreator -> DEBU 2fe checkSignatureFromCreator info: creator is valid
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [protoutils] checkSignatureFromCreator -> DEBU 2ff checkSignatureFromCreator exists successfully
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [protoutils] validateChaincodeProposalMessage -> DEBU 300 validateChaincodeProposalMessage starts for proposal 0xc420307400, header 0xc42177e450
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [protoutils] validateChaincodeProposalMessage -> DEBU 301 validateChaincodeProposalMessage info: header extension references chaincode name:"lscc"
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [endorser] ProcessProposal -> DEBU 302 processing txid: 2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [fsblkstorage] retrieveTransactionByID -> DEBU 303 retrieveTransactionByID() - txId = [2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6]
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [lockbasedtxmgr] NewTxSimulator -> DEBU 304 constructing new tx simulator
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [lockbasedtxmgr] newLockBasedTxSimulator -> DEBU 305 constructing new tx simulator [7ee0c1a2-4569-49a4-bbca-dd6eb4b6688e]
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [endorser] simulateProposal -> DEBU 306 Entry - txid: 2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6 channel id: super-channel
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [endorser] callChaincode -> DEBU 307 Entry - txid: 2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6 channel id: super-channel version: 1.0.0
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [ccprovider] NewCCContext -> DEBU 308 NewCCCC (chain=super-channel,chaincode=lscc,version=1.0.0,txid=2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6,syscc=true,proposal=0xc420307400,canname=lscc:1.0.0
peer0.company.org      | 2017-12-01 10:41:03.546 UTC [chaincode] Launch -> DEBU 309 chaincode is running(no need to launch) : lscc:1.0.0
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] Execute -> DEBU 30a Entry
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] Execute -> DEBU 30b chaincode canonical name: lscc:1.0.0
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] sendExecuteMessage -> DEBU 30c [2c90caa1]Inside sendExecuteMessage. Message TRANSACTION
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] setChaincodeProposal -> DEBU 30d Setting chaincode proposal context...
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] setChaincodeProposal -> DEBU 30e Proposal different from nil. Creating chaincode proposal context...
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] sendExecuteMessage -> DEBU 30f [2c90caa1]sendExecuteMsg trigger event TRANSACTION
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] processStream -> DEBU 310 [2c90caa1]Move state message TRANSACTION
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] HandleMessage -> DEBU 311 [2c90caa1]Fabric side Handling ChaincodeMessage of type: TRANSACTION in state ready
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] filterError -> DEBU 312 Ignoring NoTransitionError: no transition
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] processStream -> DEBU 313 [2c90caa1]sending state message TRANSACTION
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] func1 -> DEBU 314 [2c90caa1]Received message TRANSACTION from shim
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] handleMessage -> DEBU 315 [2c90caa1]Handling ChaincodeMessage of type: TRANSACTION(state:ready)
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] beforeTransaction -> DEBU 316 [2c90caa1]Received TRANSACTION, invoking transaction on chaincode(Src:ready, Dst:ready)
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] handleGetState -> DEBU 317 [2c90caa1]Sending GET_STATE
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] processStream -> DEBU 318 [2c90caa1]Received message GET_STATE from shim
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] HandleMessage -> DEBU 319 [2c90caa1]Fabric side Handling ChaincodeMessage of type: GET_STATE in state ready
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] afterGetState -> DEBU 31a [2c90caa1]Received GET_STATE, invoking get state from ledger
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] filterError -> DEBU 31b Ignoring NoTransitionError: no transition
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] func1 -> DEBU 31c [2c90caa1] getting state for chaincode lscc, key test_cc_go, channel super-channel
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [stateleveldb] GetState -> DEBU 31d GetState(). ns=lscc, key=test_cc_go
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] func1 -> DEBU 31e [2c90caa1]No state associated with key: test_cc_go. Sending RESPONSE with an empty payload
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [chaincode] 1 -> DEBU 31f [2c90caa1]handleGetState serial send RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] func1 -> DEBU 320 [2c90caa1]Received message RESPONSE from shim
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] handleMessage -> DEBU 321 [2c90caa1]Handling ChaincodeMessage of type: RESPONSE(state:ready)
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] sendChannel -> DEBU 322 [2c90caa1]before send
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] sendChannel -> DEBU 323 [2c90caa1]after send
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] afterResponse -> DEBU 324 [2c90caa1]Received RESPONSE, communicated (state:ready)
peer0.company.org      | 2017-12-01 10:41:03.547 UTC [shim] handleGetState -> DEBU 325 [2c90caa1]GetState received payload RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] handlePutState -> DEBU 326 [2c90caa1]Inside putstate
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] handlePutState -> DEBU 327 [2c90caa1]Sending PUT_STATE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] processStream -> DEBU 328 [2c90caa1]Received message PUT_STATE from shim
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] HandleMessage -> DEBU 329 [2c90caa1]Fabric side Handling ChaincodeMessage of type: PUT_STATE in state ready
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] filterError -> DEBU 32a Ignoring NoTransitionError: no transition
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] func1 -> DEBU 32b [2c90caa1]state is ready
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] func1 -> DEBU 32c [2c90caa1]Completed PUT_STATE. Sending RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] 1 -> DEBU 32d [2c90caa1]enterBusyState trigger event RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] processStream -> DEBU 32e [2c90caa1]Move state message RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] HandleMessage -> DEBU 32f [2c90caa1]Fabric side Handling ChaincodeMessage of type: RESPONSE in state ready
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] filterError -> DEBU 330 Ignoring NoTransitionError: no transition
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] processStream -> DEBU 331 [2c90caa1]sending state message RESPONSE
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] func1 -> DEBU 332 [2c90caa1]Received message RESPONSE from shim
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] handleMessage -> DEBU 333 [2c90caa1]Handling ChaincodeMessage of type: RESPONSE(state:ready)
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] sendChannel -> DEBU 334 [2c90caa1]before send
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] sendChannel -> DEBU 335 [2c90caa1]after send
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] handlePutState -> DEBU 336 [2c90caa1]Received RESPONSE. Successfully updated state
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] afterResponse -> DEBU 337 [2c90caa1]Received RESPONSE, communicated (state:ready)
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] func1 -> DEBU 338 [2c90caa1]Transaction completed. Sending COMPLETED
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] func1 -> DEBU 339 [2c90caa1]Move state message COMPLETED
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] handleMessage -> DEBU 33a [2c90caa1]Handling ChaincodeMessage of type: COMPLETED(state:ready)
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [shim] func1 -> DEBU 33b [2c90caa1]send state message COMPLETED
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] processStream -> DEBU 33c [2c90caa1]Received message COMPLETED from shim
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] HandleMessage -> DEBU 33d [2c90caa1]Fabric side Handling ChaincodeMessage of type: COMPLETED in state ready
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] HandleMessage -> DEBU 33e [2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6]HandleMessage- COMPLETED. Notify
peer0.company.org      | 2017-12-01 10:41:03.548 UTC [chaincode] notify -> DEBU 33f notifying Txid:2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] Execute -> DEBU 340 Exit
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [ccprovider] NewCCContext -> DEBU 341 NewCCCC (chain=super-channel,chaincode=test_cc_go,version=0.0.1,txid=2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6,syscc=false,proposal=0xc420307400,canname=test_cc_go:0.0.1
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] Launch -> DEBU 342 launchAndWaitForRegister fetched 1587 bytes from file system
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] getArgsAndEnv -> DEBU 343 Executable is chaincode
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] getArgsAndEnv -> DEBU 344 Args [chaincode -peer.address=peer0.company.org:7051]
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] launchAndWaitForRegister -> DEBU 345 start container: test_cc_go:0.0.1(networkid:dev,peerid:peer0.company.org)
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] launchAndWaitForRegister -> DEBU 346 start container with args: chaincode -peer.address=peer0.company.org:7051
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [chaincode] launchAndWaitForRegister -> DEBU 347 start container with env:
peer0.company.org      |    CORE_CHAINCODE_ID_NAME=test_cc_go:0.0.1
peer0.company.org      |    CORE_PEER_TLS_ENABLED=true
peer0.company.org      |    CORE_CHAINCODE_LOGGING_LEVEL=debug
peer0.company.org      |    CORE_CHAINCODE_LOGGING_SHIM=debug
peer0.company.org      |    CORE_CHAINCODE_LOGGING_FORMAT=%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [container] lockContainer -> DEBU 348 waiting for container(dev-peer0.company.org-test_cc_go-0.0.1) lock
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [container] lockContainer -> DEBU 349 got container (dev-peer0.company.org-test_cc_go-0.0.1) lock
peer0.company.org      | 2017-12-01 10:41:03.549 UTC [dockercontroller] Start -> DEBU 34a Cleanup container dev-peer0.company.org-test_cc_go-0.0.1
peer0.company.org      | 2017-12-01 10:41:03.550 UTC [dockercontroller] stopInternal -> DEBU 34b Stop container dev-peer0.company.org-test_cc_go-0.0.1(Container not running: dev-peer0.company.org-test_cc_go-0.0.1)
peer0.company.org      | 2017-12-01 10:41:03.550 UTC [dockercontroller] stopInternal -> DEBU 34c Kill container dev-peer0.company.org-test_cc_go-0.0.1 (API error (500): {"message":"Cannot kill container dev-peer0.company.org-test_cc_go-0.0.1: Container 935c3c20aca77b6a8a398aea553e524a734a30f6dfceab5fd4ca4683b3e1eb8f is not running"}
peer0.company.org      | )
peer0.company.org      | 2017-12-01 10:41:03.611 UTC [dockercontroller] stopInternal -> DEBU 34d Removed container dev-peer0.company.org-test_cc_go-0.0.1
peer0.company.org      | 2017-12-01 10:41:03.611 UTC [dockercontroller] Start -> DEBU 34e Start container dev-peer0.company.org-test_cc_go-0.0.1
peer0.company.org      | 2017-12-01 10:41:03.611 UTC [dockercontroller] getDockerHostConfig -> DEBU 34f docker container hostconfig NetworkMode: compose_default
peer0.company.org      | 2017-12-01 10:41:03.612 UTC [dockercontroller] createContainer -> DEBU 350 Create container: dev-peer0.company.org-test_cc_go-0.0.1
peer0.company.org      | 2017-12-01 10:41:03.754 UTC [dockercontroller] createContainer -> DEBU 351 Created container: dev-peer0.company.org-test_cc_go-0.0.1
peer0.company.org      | 2017-12-01 10:41:04.514 UTC [dockercontroller] Start -> ERRO 352 start-could not start container: API error (404): {"message":"oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\"\n"}
peer0.company.org      | 2017-12-01 10:41:04.514 UTC [container] unlockContainer -> DEBU 353 container lock deleted(dev-peer0.company.org-test_cc_go-0.0.1)
peer0.company.org      | 2017-12-01 10:41:04.514 UTC [chaincode] Launch -> ERRO 354 launchAndWaitForRegister failed Error starting container: API error (404): {"message":"oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\"\n"}
peer0.company.org      | 2017-12-01 10:41:04.514 UTC [endorser] callChaincode -> DEBU 355 Exit
peer0.company.org      | 2017-12-01 10:41:04.514 UTC [endorser] simulateProposal -> ERRO 356 failed to invoke chaincode name:"lscc"  on transaction 2c90caa144141c930234edc062ab6c2f85df97905bc4596ed8f425eecaf88bb6, error: Error starting container: API error (404): {"message":"oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\"\n"}

If anyone can give me some direction, that would greatly be appreciated! Thank you in advance!

EDIT: Here's how the chaincode is put on the peers:

The chaincode source is located at /etc/hyperledger/chaincode/src/super/test_cc/test_cc.go and I'm using the client.sendInstallProposal(installProposalRequest, company.getPeers()); command to send it to the peers. Here's how the install proposal looks and how the peers' reponses look afterwards:

2017-12-03 17:08:25 INFO  HyperledgerConfigurator:326 - Installing super.chaincode as company into channel super-channel
tomcat              | 2017-12-03 17:08:25 DEBUG HyperledgerConfigurator:330 - Chaincode source path: /etc/hyperledger/chaincode/
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:24 - org.hyperledger.fabric.sdk.InstallProposalRequest
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:41 -   getChaincodeSourceLocation:
tomcat              | /etc/hyperledger/chaincode
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:38 -   getChaincodeInputStream: null
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -   getProposalWaitTime: 20000
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -   getChaincodeName: test_cc_go
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -   getChaincodePath: super/test_cc
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -   getChaincodeVersion: 0.0.1
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:38 -   getChaincodeEndorsementPolicy: null
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:38 -   getTransientMap: null
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -   getChaincodeLanguage: GO_LANG
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:43 -   getChaincodeID:
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:24 -     org.hyperledger.fabric.sdk.ChaincodeID
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:41 -       getFabricChaincodeID:
tomcat              | path: "super/test_cc"
tomcat              | name: "test_cc_go"
tomcat              | version: "0.0.1"
tomcat              |
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -       getVersion: 0.0.1
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -       getName: test_cc_go
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:33 -       getPath: super/test_cc
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:31 -   getFcn: null
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:38 -   getArgBytes: null
tomcat              | 2017-12-03 17:08:25 DEBUG Debug:38 -   getArgs: null
tomcat              | 2017-12-03 17:08:25 DEBUG HyperledgerConfigurator:350 - Sending chaincode installation request...
...
tomcat              | 2017-12-03 17:08:25 DEBUG HyperledgerConfigurator:361 - Responses:
tomcat              | 2017-12-03 17:08:25 DEBUG HyperledgerConfigurator:363 - TransactionID: fd72977b40808609e781cd658454f7753599ec8c27f61acb4629fae4dc520e10, peer: peer0.company.org, decision: SUCCESS
tomcat              | 2017-12-03 17:08:25 DEBUG HyperledgerConfigurator:363 - TransactionID: fd72977b40808609e781cd658454f7753599ec8c27f61acb4629fae4dc520e10, peer: peer1.company.org, decision: SUCCESS

EDIT2: The chaincode of the peer is found at /var/hyperledger/production/chaincodes/test_cc_go.0.0.1, but this is not in its path /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin. It's also not called chaincode which it tries to call.


来源: stackexchange

问:
How to autowire SessionFactory to a Repository class in Spring
Can someone please help me to autowire SessionFactory to a Repository class in Spring? Following code gives me this error. Any suggestion to overcome this problem. I checked many similar topics in StackOverflow but none of them were successful.

"Error creating bean with name 'appointmentController': Unsatisfied
  dependency expressed through field 'iFactory': Error creating bean
  with name 'appointmentFactory': Unsatisfied dependency expressed
  through field 'factory': No qualifying bean of type
  [org.hibernate.SessionFactory] found for dependency ...etc"

Repository class

```<code>@Repository
    @ComponentScan({"org.hibernate.SessionFactory"})
    public class AppointmentFactory {
        @Autowired
        private SessionFactory factory ;

        public SessionFactory getFactory() {
            return factory;
        }

        public void setFactory(SessionFactory factory) {
            this.factory = factory;
        }
    }
</code>```

Controller class

```<code>@RestController
@ComponentScan({"com.mobios.ep.services","com.ombios.ep.entity.factory")
public class AppointmentController {
    @Autowired
    private AppointmentService iService;
    @Autowired
    private AppointmentFactory iFactory;

    @RequestMapping(value="appointment/get", method=RequestMethod.POST)
    public AppoinmentWM getApointmentById(@RequestBody AppointmentReq appointment) throws Exception{
        Log4JUtil.logger.info("APPOINTMENT,appointment_get_request,Request="+appointment.toString());
        AppointmentService appoinmentService = new AppointmentService();
        StatsService statsService = new StatsService();
        Mapper mapper = new Mapper();
        AppoinmentWM gotAppointment = null;

    }
</code>```

答:
Try the following

```<code>        @Autowired
        private Environment env;
            @Autowired
            DataSource dataSource;

            @Bean(name = { "sessionFactory" })
            public LocalSessionFactoryBean sessionFactory() {

                LocalSessionFactoryBean sessionFactory  = new LocalSessionFactoryBean();
                sessionFactory.setDataSource(dataSource);
                sessionFactory.setPackagesToScan(new String[] { "com.mypackage.my.entities" });
                sessionFactory.setHibernateProperties(hibernateProperties());
                return sessionFactory;
            }

        @Bean
        public HibernateTransactionManager transactionManager() {
            final HibernateTransactionManager txManager = new HibernateTransactionManager();
            txManager.setSessionFactory(sessionFactory().getObject());
            return txManager;
        }
          Properties hibernateProperties() {
            return new Properties() {
                {
                    // @formatter:off
                setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
                setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
                setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.dialect"));

             }
          };
    }
</code>```

Or

```<code>@Configuration
public class DataConfigTest {
    @Autowired
    EntityManagerFactory entityManagerFactory;
    //@Autowired
    //HibernateJpaSessionFactoryBean hibernateJpaSessionFactoryBean;

    @Autowired
    HibernateEntityManagerFactory hemf;

    @Autowired
    DataSource dataSource;
    @Bean(name = { "sessionFactory" })
    public SessionFactory sessionFactory() {
        return hemf.getSessionFactory();
        // HibernateJpaSessionFactoryBean factory = new
        // HibernateJpaSessionFactoryBean();
        // factory.setEntityManagerFactory(entityManagerFactory);
        // return factory.getObject();
    }
    @Bean
    public HibernateTransactionManager transactionManager() {
        final HibernateTransactionManager txManager = new HibernateTransactionManager();
        txManager.setSessionFactory(sessionFactory());
        return txManager;
    }
}
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Can someone please help me to autowire SessionFactory to a Repository class in Spring? Following code gives me this error. Any suggestion to overcome this problem. I checked many similar topics in StackOverflow but none of them were successful.

"Error creating bean with name 'appointmentController': Unsatisfied
  dependency expressed through field 'iFactory': Error creating bean
  with name 'appointmentFactory': Unsatisfied dependency expressed
  through field 'factory': No qualifying bean of type
  [org.hibernate.SessionFactory] found for dependency ...etc"

Repository class

@Repository
    @ComponentScan({"org.hibernate.SessionFactory"})
    public class AppointmentFactory {
        @Autowired
        private SessionFactory factory ;

        public SessionFactory getFactory() {
            return factory;
        }

        public void setFactory(SessionFactory factory) {
            this.factory = factory;
        }
    }

Controller class

@RestController
@ComponentScan({"com.mobios.ep.services","com.ombios.ep.entity.factory")
public class AppointmentController {
    @Autowired
    private AppointmentService iService;
    @Autowired
    private AppointmentFactory iFactory;

    @RequestMapping(value="appointment/get", method=RequestMethod.POST)
    public AppoinmentWM getApointmentById(@RequestBody AppointmentReq appointment) throws Exception{
        Log4JUtil.logger.info("APPOINTMENT,appointment_get_request,Request="+appointment.toString());
        AppointmentService appoinmentService = new AppointmentService();
        StatsService statsService = new StatsService();
        Mapper mapper = new Mapper();
        AppoinmentWM gotAppointment = null;

    }

Body:
Try the following

        @Autowired
        private Environment env;
            @Autowired
            DataSource dataSource;

            @Bean(name = { "sessionFactory" })
            public LocalSessionFactoryBean sessionFactory() {

                LocalSessionFactoryBean sessionFactory  = new LocalSessionFactoryBean();
                sessionFactory.setDataSource(dataSource);
                sessionFactory.setPackagesToScan(new String[] { "com.mypackage.my.entities" });
                sessionFactory.setHibernateProperties(hibernateProperties());
                return sessionFactory;
            }

        @Bean
        public HibernateTransactionManager transactionManager() {
            final HibernateTransactionManager txManager = new HibernateTransactionManager();
            txManager.setSessionFactory(sessionFactory().getObject());
            return txManager;
        }
          Properties hibernateProperties() {
            return new Properties() {
                {
                    // @formatter:off
                setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
                setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
                setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.dialect"));

             }
          };
    }

Or

@Configuration
public class DataConfigTest {
    @Autowired
    EntityManagerFactory entityManagerFactory;
    //@Autowired
    //HibernateJpaSessionFactoryBean hibernateJpaSessionFactoryBean;

    @Autowired
    HibernateEntityManagerFactory hemf;

    @Autowired
    DataSource dataSource;
    @Bean(name = { "sessionFactory" })
    public SessionFactory sessionFactory() {
        return hemf.getSessionFactory();
        // HibernateJpaSessionFactoryBean factory = new
        // HibernateJpaSessionFactoryBean();
        // factory.setEntityManagerFactory(entityManagerFactory);
        // return factory.getObject();
    }
    @Bean
    public HibernateTransactionManager transactionManager() {
        final HibernateTransactionManager txManager = new HibernateTransactionManager();
        txManager.setSessionFactory(sessionFactory());
        return txManager;
    }
}


问:
Add active state to first item in jCarousel Lite
When I initialize jCarousel Lite I want to be able to add a 'class="active"' state to my first element in the list. How would I approach this without modifying the plugin?

Current setup -

```<code>$('#viewport').jCarouselLite({
    speed: 500,
    visible: 3,
    scroll: 1,
    start: 0, // Just for testing purposes
    circular: true,
    btnNext: '#next',
    btnPrev: '#previous',
    beforeStart: function(a) {
        $(a[0]).animate({opacity: .5}, 250).toggleClass('active');
    },
    afterEnd: function(a) {
        $(a[0]).animate({opacity: 1}, 500).toggleClass('active');
    }
});
</code>```

答:
```<code>beforeStart: function(a) {
     $(a[0]).toggleClass('active').siblings().removeClass('active');
</code>```

}

// Finished with only this little script

Body:
When I initialize jCarousel Lite I want to be able to add a 'class="active"' state to my first element in the list. How would I approach this without modifying the plugin?

Current setup -

$('#viewport').jCarouselLite({
    speed: 500,
    visible: 3,
    scroll: 1,
    start: 0, // Just for testing purposes
    circular: true,
    btnNext: '#next',
    btnPrev: '#previous',
    beforeStart: function(a) {
        $(a[0]).animate({opacity: .5}, 250).toggleClass('active');
    },
    afterEnd: function(a) {
        $(a[0]).animate({opacity: 1}, 500).toggleClass('active');
    }
});

Body:
beforeStart: function(a) {
     $(a[0]).toggleClass('active').siblings().removeClass('active');

}

// Finished with only this little script


问:
Check if three points are coo linear or not
I have got a problem to check if three points form a triangle or not. If it forms a triangle the program should print the square of maximum length of the three sides of the triangle. If not the program will print "Coolinear".
 Anyways here is a sample of what I have tried:

```<code>#include <iostream>
#include <cmath>
using namespace std;
int main () {
  double x1,y1,x2,y2,x3,y3;
  double area;
  double s1,s2,s3;

cin >> x1 >> y1;
cin >> x2 >> y2;
cin >> x3 >> y3;

    area = 0.5*abs(((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)));
    s1 = ((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2));
    s2 = ((x2-x3)*(x2-x3))+((y2-y3)*(y2-y3));
    s3 = ((x1-x3)*(x1-x3))+((y1-y3)*(y1-y3));
if (area!=0){

     if (s1 >= s2 && s1 >= s3)
        cout<<s1<<endl;
     if (s2 >= s1 && s2 >= s3)
        cout<<s2<<endl;
     if (s3 >= s1 && s3 >= s2)
        cout <<s3<<endl;
}

else
    cout <<"Coollinear";
return 0;

}
</code>```

I submitted this code on codeforces website as it is my last problem on a contest. It gives me wrong answer at test 9, What else should I use? and Why is my answer wrong?

Anyways Here is the text of the problem:

Like all problem solvers, Meiko loves eating crepe! As we all know, crepe usually served in a triangular shape. Now Meiko wants to know how large can a crepe side be! So he tries to draw a triangle on a plane using three points and calculate the maximum length of the three sides of the triangle. But sometimes he falls asleep as he has been busy with the team preparing the training problems! As a result, the three points he uses may not form a triangle that could represent a piece of crepe! A triangle can represent a piece of crepe only if it has a positive area. So you are here to help Meiko! Given the coordinates Meiko used, determine whether they form a triangle that could represent a piece of crepe or not.

Input
Three integer coordinates (X,Y) that represent the three points Meiko used. Each point on a separate line. (-10^9<=X,Y<=10^9)

Output
If the points form a triangle that can represent a piece of crepe, print the square of the maximum length of the three sides of the triangle. Otherwise print "Collinear" without quotes.

答:
If at least two sides have same length and are longer than the third one then this code will output multiple results. The three if-statements must be fixed

```<code>#include <iostream>
#include <cmath>
using namespace std;
int main () {
  double x1,y1,x2,y2,x3,y3;
  double area;
  double s1,s2,s3;

cin >> x1 >> y1;
cin >> x2 >> y2;
cin >> x3 >> y3;

    area = 0.5*abs(((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)));
    s1 = ((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2));
    s2 = ((x2-x3)*(x2-x3))+((y2-y3)*(y2-y3));
    s3 = ((x1-x3)*(x1-x3))+((y1-y3)*(y1-y3));
if (area!=0){

     if (s1 >= s2 && s1 >= s3)
        cout<<s1<<endl;
     else if (s2 >= s1 && s2 >= s3)
        cout<<s2<<endl;
     else if (s3 >= s1 && s3 >= s2)
        cout <<s3<<endl;
}

else
    cout <<"Coollinear";
return 0;

}
</code>```

Body:
I have got a problem to check if three points form a triangle or not. If it forms a triangle the program should print the square of maximum length of the three sides of the triangle. If not the program will print "Coolinear".
 Anyways here is a sample of what I have tried:

#include <iostream>
#include <cmath>
using namespace std;
int main () {
  double x1,y1,x2,y2,x3,y3;
  double area;
  double s1,s2,s3;

cin >> x1 >> y1;
cin >> x2 >> y2;
cin >> x3 >> y3;

    area = 0.5*abs(((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)));
    s1 = ((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2));
    s2 = ((x2-x3)*(x2-x3))+((y2-y3)*(y2-y3));
    s3 = ((x1-x3)*(x1-x3))+((y1-y3)*(y1-y3));
if (area!=0){

     if (s1 >= s2 && s1 >= s3)
        cout<<s1<<endl;
     if (s2 >= s1 && s2 >= s3)
        cout<<s2<<endl;
     if (s3 >= s1 && s3 >= s2)
        cout <<s3<<endl;
}

else
    cout <<"Coollinear";
return 0;

}

I submitted this code on codeforces website as it is my last problem on a contest. It gives me wrong answer at test 9, What else should I use? and Why is my answer wrong?

Anyways Here is the text of the problem:

Like all problem solvers, Meiko loves eating crepe! As we all know, crepe usually served in a triangular shape. Now Meiko wants to know how large can a crepe side be! So he tries to draw a triangle on a plane using three points and calculate the maximum length of the three sides of the triangle. But sometimes he falls asleep as he has been busy with the team preparing the training problems! As a result, the three points he uses may not form a triangle that could represent a piece of crepe! A triangle can represent a piece of crepe only if it has a positive area. So you are here to help Meiko! Given the coordinates Meiko used, determine whether they form a triangle that could represent a piece of crepe or not.

Input
Three integer coordinates (X,Y) that represent the three points Meiko used. Each point on a separate line. (-10^9<=X,Y<=10^9)

Output
If the points form a triangle that can represent a piece of crepe, print the square of the maximum length of the three sides of the triangle. Otherwise print "Collinear" without quotes.

Body:
If at least two sides have same length and are longer than the third one then this code will output multiple results. The three if-statements must be fixed

#include <iostream>
#include <cmath>
using namespace std;
int main () {
  double x1,y1,x2,y2,x3,y3;
  double area;
  double s1,s2,s3;

cin >> x1 >> y1;
cin >> x2 >> y2;
cin >> x3 >> y3;

    area = 0.5*abs(((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)));
    s1 = ((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2));
    s2 = ((x2-x3)*(x2-x3))+((y2-y3)*(y2-y3));
    s3 = ((x1-x3)*(x1-x3))+((y1-y3)*(y1-y3));
if (area!=0){

     if (s1 >= s2 && s1 >= s3)
        cout<<s1<<endl;
     else if (s2 >= s1 && s2 >= s3)
        cout<<s2<<endl;
     else if (s3 >= s1 && s3 >= s2)
        cout <<s3<<endl;
}

else
    cout <<"Coollinear";
return 0;

}


问:
Powershell command to List the services on a specific/individual cluster node
How to find the list of service on a specific node in a given cluster using Powershell?

There are 2 nodes in this cluster group ServerName_1 and ServerName_2, I am trying to fetch the services on Server_name1.

I have tried running the below commands but I did not get any output or error.

I tried using the below command and I could get the results:

```<code>PS C:\Users\sd> Get-ClusterGroup | Where-Object {$_.State -EQ "Online"}

Name                    OwnerNode           State
----                    ---------           -----
Service_1              ServerName_1       Online
Service_2              ServerName_2       Online
</code>```

However, when i tried to extract the OwnerNode using the same command i do not see any result , as observed below:

```<code>PS C:\Users\sd> Get-ClusterGroup | Where-Object {$_.OwnerNode -EQ <ServerName_1>}
PS C:\Users\sd>
</code>```

As I do not see any output, I am not sure whether the command i executed is correct?

I need this, so that I may start the specific service on ServerName_1 alone.

```<code>PS C:\Users\sd> Start-ClusterGroup -Name <ServiceName> | Where-Object
 { $_.OwnerNode -eq "<ServerName1>" }

PS C:\Users\sd>
</code>```

答:
You don't need the < > in your code, update

```<code>Get-ClusterGroup | Where-Object {$_.OwnerNode -EQ <ServerName_1>}
</code>```

to

```<code>Get-ClusterGroup | Where-Object {$_.OwnerNode -EQ "ServerName_1"}
</code>```

Body:
How to find the list of service on a specific node in a given cluster using Powershell?

There are 2 nodes in this cluster group ServerName_1 and ServerName_2, I am trying to fetch the services on Server_name1.

I have tried running the below commands but I did not get any output or error.

I tried using the below command and I could get the results:

PS C:\Users\sd> Get-ClusterGroup | Where-Object {$_.State -EQ "Online"}

Name                    OwnerNode           State
----                    ---------           -----
Service_1              ServerName_1       Online
Service_2              ServerName_2       Online

However, when i tried to extract the OwnerNode using the same command i do not see any result , as observed below:

PS C:\Users\sd> Get-ClusterGroup | Where-Object {$_.OwnerNode -EQ <ServerName_1>}
PS C:\Users\sd>

As I do not see any output, I am not sure whether the command i executed is correct?

I need this, so that I may start the specific service on ServerName_1 alone.

PS C:\Users\sd> Start-ClusterGroup -Name <ServiceName> | Where-Object
 { $_.OwnerNode -eq "<ServerName1>" }

PS C:\Users\sd>

Body:
You don't need the < > in your code, update

Get-ClusterGroup | Where-Object {$_.OwnerNode -EQ <ServerName_1>}

to

Get-ClusterGroup | Where-Object {$_.OwnerNode -EQ "ServerName_1"}


问:
R - Can't customize values of cuts when plotting points with spplot
I am using spplot to plot a shapefile. I need to give a different color to each point of the shapefile according to its attribute value.

My shapefile attribute table looks like this:
Attribute_Table. I have to plot points according to the value of Fall, Winter, Spring and Summer (in total I have 4 plots, 1 for each season).

By running this code (r_values is my shapefile):

```<code># Defining point size
point_size = 0.8

# Defining where cuts are
classes_R = seq(-1,1,0.05)

# Defining color of scale bar
my.palette_R = brewer.pal(n = 10, name = "RdBu")

spplot(r_values, zcol = c("Fall","Winter","Spring","Summer"), do.log = F,as.table = T,
   pch = 20, cex = point_size, key.space = "right", col.regions = my.palette_R,
   main = "R Values - P Model", colorkey = T, at=classes_R,
   sp.layout=(list(new_layer_1,new_layer_2))) #sp.layout is for 2 other layers (you can see the states in gray and the lakes in blue in backround
</code>```

I obtain this plot: Plot.

Changing the cuts(the classes) in classes_R doesn't change the resulting plot.

What I would like to obtain is a map with cuts ranging from -1 to +1 every 0.05 and labels on the right of the scale bar with these cuts.

Here is a link to download an excel file with some data. It's a dataframe containing the coordinates of the points

https://drive.google.com/open?id=1WPyS5TFGCxBDNhJIJc_jKvFmJd5hthl4

答:
The answer is in the R documentation of "ssplot". It says:

cuts: number of cuts, or, for objects of class SpatialPointsDataFrame only, the actual cuts to use

So in this case "cuts" is not an integer indicating the number of cuts, but it's a vector containing the actual cuts to use.

I changed the code using the option "cuts" instead of "at" and it worked.

Body:
I am using spplot to plot a shapefile. I need to give a different color to each point of the shapefile according to its attribute value.

My shapefile attribute table looks like this:
Attribute_Table. I have to plot points according to the value of Fall, Winter, Spring and Summer (in total I have 4 plots, 1 for each season).

By running this code (r_values is my shapefile):

# Defining point size
point_size = 0.8

# Defining where cuts are
classes_R = seq(-1,1,0.05)

# Defining color of scale bar
my.palette_R = brewer.pal(n = 10, name = "RdBu")

spplot(r_values, zcol = c("Fall","Winter","Spring","Summer"), do.log = F,as.table = T,
   pch = 20, cex = point_size, key.space = "right", col.regions = my.palette_R,
   main = "R Values - P Model", colorkey = T, at=classes_R,
   sp.layout=(list(new_layer_1,new_layer_2))) #sp.layout is for 2 other layers (you can see the states in gray and the lakes in blue in backround

I obtain this plot: Plot.

Changing the cuts(the classes) in classes_R doesn't change the resulting plot.

What I would like to obtain is a map with cuts ranging from -1 to +1 every 0.05 and labels on the right of the scale bar with these cuts.

Here is a link to download an excel file with some data. It's a dataframe containing the coordinates of the points

https://drive.google.com/open?id=1WPyS5TFGCxBDNhJIJc_jKvFmJd5hthl4


问:
It sould be so obvious, but why does this fail?
Been coding .net for years now yet I feel like a n00b. Why is the following code failing?

```<code>byte[] a = Guid.NewGuid().ToByteArray(); // 16 bytes in array
string b = new UTF8Encoding().GetString(a);
byte[] c = new UTF8Encoding().GetBytes(b);
Guid d = new Guid(c);    // Throws exception (32 bytes recived from c)
</code>```

Update

Approved the answer from CodeInChaos. Reason for the 16 bytes becomming 32 bytes can be read in his answer. Also stated in the answer:

the default constructor of
  UTF8Encoding has error checking
  disabled

IMHO the UTF8 encoder should throw exception when trying to encode a byte array to string that contains invalid bytes. To make the .net framework behave properly the code should have been written as follows

```<code> byte[] a = Guid.NewGuid().ToByteArray();
 string b = new UTF8Encoding(false, true).GetString(a);  // Throws exception as expected
 byte[] c = new UTF8Encoding(false, true).GetBytes(b);
 Guid d = new Guid(c);
</code>```

答:
Because var b is type string, which means it's a unicode string (2 bytes per character).  In your second line, you're creating a 16-character string out of a 16-byte array, but that 16-character string is stored in 32 bytes.

Why not just do this:

```<code>var d = Guid.NewGuid();
</code>```

ContentLicense: CC BY-SA 2.5

Body:
Been coding .net for years now yet I feel like a n00b. Why is the following code failing?

byte[] a = Guid.NewGuid().ToByteArray(); // 16 bytes in array
string b = new UTF8Encoding().GetString(a);
byte[] c = new UTF8Encoding().GetBytes(b);
Guid d = new Guid(c);    // Throws exception (32 bytes recived from c)

Update

Approved the answer from CodeInChaos. Reason for the 16 bytes becomming 32 bytes can be read in his answer. Also stated in the answer:

the default constructor of
  UTF8Encoding has error checking
  disabled

IMHO the UTF8 encoder should throw exception when trying to encode a byte array to string that contains invalid bytes. To make the .net framework behave properly the code should have been written as follows

 byte[] a = Guid.NewGuid().ToByteArray();
 string b = new UTF8Encoding(false, true).GetString(a);  // Throws exception as expected
 byte[] c = new UTF8Encoding(false, true).GetBytes(b);
 Guid d = new Guid(c);

Body:
Because var b is type string, which means it's a unicode string (2 bytes per character).  In your second line, you're creating a 16-character string out of a 16-byte array, but that 16-character string is stored in 32 bytes.

Why not just do this:

var d = Guid.NewGuid();


问:
Backport C++14 return type deduction to C++11
How can I make this code c++11 compliant?

```<code>template <class ...Args>
auto operator()(Args&&... args) const
{
    return _delegate(std::forward<Args>(args)...);
}
</code>```

The code is part of a templated struct.
_delegate is a member and defined like below.

```<code>/// The implementation of the slot, as a delegate.
typedef fastdelegate::FastDelegate<Signature> impl_delegate;
impl_delegate _delegate;
</code>```

The complete files can be found here. It is the slot.hpp.
https://github.com/miguelmartin75/Wink-Signals/tree/master/wink

答:
You can simply add a trailing return type:

```<code>template <class ...Args>
auto operator()(Args&&... args) const
    -> decltype(_delegate(std::forward<Args>(args)...))
{
    return _delegate(std::forward<Args>(args)...);
}
</code>```

live wandbox example

If your compiler is complaining about _delegate in the trailing return type, try using std::declval</* type of '_delegate' */>() instead.

Note that the code above might behave differently from the C++14 one. Consider the case where it's overloaded with the following member function:

```<code>auto operator()(...) const { }
</code>```

In C++14, automatic return type deduction is not SFINAE-friendly, so the original  function in the question will probably cause an hard compilation error if _delegate(std::forward<Args>(args)...) is ill-formed instead of SFINAE-ing away.

In C++11, _delegate(std::forward<Args>(args)...) is part of the signature - if it is ill-formed, other overloads will have a chance to be selected.

Here's a live example on wandbox. Uncomment line 15 to see the changes.

Body:
How can I make this code c++11 compliant?

template <class ...Args>
auto operator()(Args&&... args) const
{
    return _delegate(std::forward<Args>(args)...);
}

The code is part of a templated struct.
_delegate is a member and defined like below.

/// The implementation of the slot, as a delegate.
typedef fastdelegate::FastDelegate<Signature> impl_delegate;
impl_delegate _delegate;

The complete files can be found here. It is the slot.hpp.
https://github.com/miguelmartin75/Wink-Signals/tree/master/wink

Body:
You can simply add a trailing return type:

template <class ...Args>
auto operator()(Args&&... args) const
    -> decltype(_delegate(std::forward<Args>(args)...))
{
    return _delegate(std::forward<Args>(args)...);
}

live wandbox example

If your compiler is complaining about _delegate in the trailing return type, try using std::declval</* type of '_delegate' */>() instead.

Note that the code above might behave differently from the C++14 one. Consider the case where it's overloaded with the following member function:

auto operator()(...) const { }

In C++14, automatic return type deduction is not SFINAE-friendly, so the original  function in the question will probably cause an hard compilation error if _delegate(std::forward<Args>(args)...) is ill-formed instead of SFINAE-ing away.

In C++11, _delegate(std::forward<Args>(args)...) is part of the signature - if it is ill-formed, other overloads will have a chance to be selected.

Here's a live example on wandbox. Uncomment line 15 to see the changes.


问:
()=> over function() throwing me an Angular error
Ok so I'm currently trying to create a registration process following a MEAN stack tutorial and I've started using ()=>{} functions over the old syntax.

Now when I used the old syntax as follows

```<code>    .controller('regCtrl', function(){
    this.regUser = function(){
      console.log('testing');
    };

    });
</code>```

The code runs fine and doesn't throw me any errors in the console however when I use the new function syntax

```<code>.controller('regCtrl', ()=>{
  this.regUser = ()=>{
    console.log('testing');
  };
});
</code>```

I receive this in the console log

```<code>angular.js:14700 TypeError: Function.prototype.bind.apply(...) is not a constructor
    at Object.instantiate (angular.js:5055)
    at angular.js:11015
    at Object.link (angular-route.js:1214)
    at angular.js:1385
    at wa (angular.js:10545)
    at q (angular.js:9934)
    at f (angular.js:9174)
    at angular.js:9039
    at angular.js:9430
    at d (angular.js:9217) "<h2 ng-view="" class="ng-scope">"
</code>```

I'm can only assume that this an issue that is within angularjs or that I've syntaxed incorrectly however I am unable to see the issue.

My apologies if this seems like rookie mistake I'm quite an inexperienced coder.

答:
arrows functions don't rebind this to the function scope. You shouldn't just just arrows functions because it's prettier syntax. There is a reason and when to use the. So in these 2 examples this.regUser are referring to different objects.

An arrow function does not have its own this; the this value of the
  enclosing execution context is used. Thus, in the following code, the
  this within the function that is passed to setInterval has the same
  value as this in the enclosing function

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

Body:
Ok so I'm currently trying to create a registration process following a MEAN stack tutorial and I've started using ()=>{} functions over the old syntax.

Now when I used the old syntax as follows

    .controller('regCtrl', function(){
    this.regUser = function(){
      console.log('testing');
    };

    });

The code runs fine and doesn't throw me any errors in the console however when I use the new function syntax

.controller('regCtrl', ()=>{
  this.regUser = ()=>{
    console.log('testing');
  };
});

I receive this in the console log

angular.js:14700 TypeError: Function.prototype.bind.apply(...) is not a constructor
    at Object.instantiate (angular.js:5055)
    at angular.js:11015
    at Object.link (angular-route.js:1214)
    at angular.js:1385
    at wa (angular.js:10545)
    at q (angular.js:9934)
    at f (angular.js:9174)
    at angular.js:9039
    at angular.js:9430
    at d (angular.js:9217) "
"

I'm can only assume that this an issue that is within angularjs or that I've syntaxed incorrectly however I am unable to see the issue.

My apologies if this seems like rookie mistake I'm quite an inexperienced coder.


答:
Your code will output multiple results if the maximum length is not unique.

You can get rid of the complicated logic:

```<code>#include <algorithm>

//...
if (area == 0) {
    cout << "Collinear";
}
else {
    cout << max({s1, s2, s3}));
}
</code>```

Late addendum, in case this hasn't been solved yet (and I can't sleep):

The clue to solving this is in the word "integers" in the description.

The test case you're failing on has been constructed so that

```<code>(x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)
</code>```

is non-zero when using floating point, and zero when using integers.

You don't need 0.5 * abs(... to determine whether the area is zero or not, and I expect the following to work:

```<code>#include <algorithm>
#include <iostream>
using namespace std;

int square(int x) { return x * x; }

int main () {
    int x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    cin >> x3 >> y3;

    int area = (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
    if (area != 0){
        int s1 = square(x1 - x2) + square(y1 - y2);
        int s2 = square(x2 - x3) + square(y2 - y3);
        int s3 = square(x1 - x3) + square(y1 - y3);
        cout << max(s1, max(s2, s3));
    }
    else
    {
        cout <<"Collinear";
    }
}
</code>```

Title: Check if three points are coo linear or not

Body:
Your code will output multiple results if the maximum length is not unique.

You can get rid of the complicated logic:

#include <algorithm>

//...
if (area == 0) {
    cout << "Collinear";
}
else {
    cout << max({s1, s2, s3}));
}

Late addendum, in case this hasn't been solved yet (and I can't sleep):

The clue to solving this is in the word "integers" in the description.

The test case you're failing on has been constructed so that

(x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)

is non-zero when using floating point, and zero when using integers.

You don't need 0.5 * abs(... to determine whether the area is zero or not, and I expect the following to work:

#include <algorithm>
#include <iostream>
using namespace std;

int square(int x) { return x * x; }

int main () {
    int x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    cin >> x3 >> y3;

    int area = (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
    if (area != 0){
        int s1 = square(x1 - x2) + square(y1 - y2);
        int s2 = square(x2 - x3) + square(y2 - y3);
        int s3 = square(x1 - x3) + square(y1 - y3);
        cout << max(s1, max(s2, s3));
    }
    else
    {
        cout <<"Collinear";
    }
}


问:
Expression of type list(object) doesn't conform to expected list scala
Supposedly I have the following

```<code>case class test {
                   a:string
                   b: string
                   c: Int
                   d: Int }

var temp = List(test("lol","lel",1,2))
var total = List(test)

total = total:::temp //this doesn't work because temp is of type [test] while total is of type [test.type]
</code>```

I do not understand the difference.
The reason I want to use this is that I want to have a running list where elements will be conditionally added in a loop.
So in this instance, total should initially an empty list which takes test objects. How do I do this?

Any feedback is appreciated!

答:
Let me begin by explaining few basics about Scala.

In Scala, you define a class like following,

```<code>scala> class Demo(a: String, b: Int) {
 |   def stringify: String = a + " :: " + b
 | }
// defined class Demo
</code>```

You can think of a class as a blueprint given to Scala which will be used to create instances of that class. Here, every instance of class Demo will have two properties - a which will be a String and b which will be an Int and one method - stringify which will return a String.

```<code>scala> val demo1 = new Demo("demo1", 1)
// demo1: Demo = Demo@21eee94f

scala> demo1.getClass
// res0: Class[_ <: Demo] = class Demo
</code>```

Here demo1 is an instance of class Demo and has type Demo.

Scala also has a concept of object which are instances of specially generated inner classes.

```<code>scala> object OtherDemo {
 | val a: Int = 10
 | }
// defined object OtherDemo

scala> DemoObject.getClass
// res2: Class[_ <: OtherDemo.type] = class OtherDemo$
</code>```

Here OtherDemo will be the only instance of that specially generated class OtherDemo$ and has type OtherDemo.type.

And then there are case class in Scala

```<code>scala> case class AnotherDemo(a: Int)
// defined class AnotherDemo
</code>```

This will create not only a class AnotherDemo but also an object AnotherDemo which we call a companion object. Which is equivalent to,

```<code>class AnotherDemo(a: Int)

object AnotherDemo {

  def apply(a: Int): AnotherDemo = new AnotherDemo(a)

  def unapply(anotherDemo: AnotherDemo): Option[Int] = Some(anotherDemo.a)

  // And many more utility functions
}
</code>```

We call this object AnotherDemo as companion object of class AnotherDemo.

We can create instances of AnotherDemo in two ways,

```<code>// By using new keyword, as we can do for any class
scala> val anotherDemo1 = new AnotherDemo(1)
// anotherDemo1: AnotherDemo = AnotherDemo(1)

// Or we can use `apply` method provided by companion object
scala> val anotherDemo2 = AnotherDemo(2)
// anotherDemo2: AnotherDemo = AnotherDemo(2)

scala> anotherDemo1.getClass
// res6: Class[_ <: AnotherDemo] = class AnotherDemo

scala> anotherDemo2.getClass
// res7: Class[_ <: AnotherDemo] = class AnotherDemo

scala> AnotherDemo.getClass
// res8: Class[_ <: AnotherDemo.type] = class AnotherDemo$
</code>```

Also, In Scala your class names should start with Capital Letter. This enables you to easily distinguish them from instance variable which should start with small letters. This helps you in avoiding confusion.

Now, it is supposed to be a: String and not a: string.

```<code>scala> case class Test(
 |       a: String,
 |       b: String,
 |       c: Int,
 |       d: Int
 |     )
// defined class Test
</code>```

Now, when you write,

```<code>scala> var temp = List(Test("lol","lel",1,2))
// temp: List[Test] = List(Test(lol,lel,1,2))
</code>```

It is actually equivalent to,

```<code>var temp = List.apply(Test.apply("lol","lel",1,2))
</code>```

Or,

```<code>val test1 = Test.apply("lol","lel",1,2)
var temp = List.apply(test1)
</code>```

The Test in Test.apply is not your class Test but the companion object Test. And calling Test.apply returns an instance of class Test  which is being passed to List.apply to finally get a List of type List[Test] containing this instance of Test.

But when you write this,

```<code>scala> var total = List(Test)
// total: List[Test.type] = List(Test)
</code>```

You are creating a List of type List[Test.type] containing that companion object of Test.

Focus on total: List[Test.type] part... this means that total is a variable of type List[Test.type] which means that it will want to point to a value/instance of type List[Test.type], and will refuse to point to anything else.

Now... you are trying to do this,

```<code>total = total ::: temp
</code>```

Which is equivalent to,

```<code>val x = total ::: temp
total = x
</code>```

which is actually,

```<code>val x = temp.:::(total)
total = x
</code>```

Now look at this val x = total ::: temp,

```<code>scala> val x = total ::: temp
// x: List[Serializable] = List(Test, Test(lol,lel,1,2))
</code>```

You see... this x is of type List[Serializable]. So when you try total = x, you will get following error,

```<code>scala> total = x
// <console>:13: error: type mismatch;
// found   : List[Serializable]
// required: List[Test.type]
//       total = x
//               ^
</code>```

Which means that total required a List[Test.type] but you are giving it a List[Serializable].

Body:
Supposedly I have the following

case class test {
                   a:string
                   b: string
                   c: Int
                   d: Int }

var temp = List(test("lol","lel",1,2))
var total = List(test)

total = total:::temp //this doesn't work because temp is of type [test] while total is of type [test.type]

I do not understand the difference.
The reason I want to use this is that I want to have a running list where elements will be conditionally added in a loop.
So in this instance, total should initially an empty list which takes test objects. How do I do this?

Any feedback is appreciated!

Body:
Let me begin by explaining few basics about Scala.

In Scala, you define a class like following,

scala> class Demo(a: String, b: Int) {
 |   def stringify: String = a + " :: " + b
 | }
// defined class Demo

You can think of a class as a blueprint given to Scala which will be used to create instances of that class. Here, every instance of class Demo will have two properties - a which will be a String and b which will be an Int and one method - stringify which will return a String.

scala> val demo1 = new Demo("demo1", 1)
// demo1: Demo = Demo@21eee94f

scala> demo1.getClass
// res0: Class[_ <: Demo] = class Demo

Here demo1 is an instance of class Demo and has type Demo.

Scala also has a concept of object which are instances of specially generated inner classes.

scala> object OtherDemo {
 | val a: Int = 10
 | }
// defined object OtherDemo

scala> DemoObject.getClass
// res2: Class[_ <: OtherDemo.type] = class OtherDemo$

Here OtherDemo will be the only instance of that specially generated class OtherDemo$ and has type OtherDemo.type.

And then there are case class in Scala

scala> case class AnotherDemo(a: Int)
// defined class AnotherDemo

This will create not only a class AnotherDemo but also an object AnotherDemo which we call a companion object. Which is equivalent to,

class AnotherDemo(a: Int)

object AnotherDemo {

  def apply(a: Int): AnotherDemo = new AnotherDemo(a)

  def unapply(anotherDemo: AnotherDemo): Option[Int] = Some(anotherDemo.a)

  // And many more utility functions
}

We call this object AnotherDemo as companion object of class AnotherDemo.

We can create instances of AnotherDemo in two ways,

// By using new keyword, as we can do for any class
scala> val anotherDemo1 = new AnotherDemo(1)
// anotherDemo1: AnotherDemo = AnotherDemo(1)

// Or we can use `apply` method provided by companion object
scala> val anotherDemo2 = AnotherDemo(2)
// anotherDemo2: AnotherDemo = AnotherDemo(2)

scala> anotherDemo1.getClass
// res6: Class[_ <: AnotherDemo] = class AnotherDemo

scala> anotherDemo2.getClass
// res7: Class[_ <: AnotherDemo] = class AnotherDemo

scala> AnotherDemo.getClass
// res8: Class[_ <: AnotherDemo.type] = class AnotherDemo$

Also, In Scala your class names should start with Capital Letter. This enables you to easily distinguish them from instance variable which should start with small letters. This helps you in avoiding confusion.

Now, it is supposed to be a: String and not a: string.

scala> case class Test(
 |       a: String,
 |       b: String,
 |       c: Int,
 |       d: Int
 |     )
// defined class Test

Now, when you write,

scala> var temp = List(Test("lol","lel",1,2))
// temp: List[Test] = List(Test(lol,lel,1,2))

It is actually equivalent to,

var temp = List.apply(Test.apply("lol","lel",1,2))

Or,

val test1 = Test.apply("lol","lel",1,2)
var temp = List.apply(test1)

The Test in Test.apply is not your class Test but the companion object Test. And calling Test.apply returns an instance of class Test  which is being passed to List.apply to finally get a List of type List[Test] containing this instance of Test.

But when you write this,

scala> var total = List(Test)
// total: List[Test.type] = List(Test)

You are creating a List of type List[Test.type] containing that companion object of Test.

Focus on total: List[Test.type] part... this means that total is a variable of type List[Test.type] which means that it will want to point to a value/instance of type List[Test.type], and will refuse to point to anything else.

Now... you are trying to do this,

total = total ::: temp

Which is equivalent to,

val x = total ::: temp
total = x

which is actually,

val x = temp.:::(total)
total = x

Now look at this val x = total ::: temp,

scala> val x = total ::: temp
// x: List[Serializable] = List(Test, Test(lol,lel,1,2))

You see... this x is of type List[Serializable]. So when you try total = x, you will get following error,

scala> total = x
// <console>:13: error: type mismatch;
// found   : List[Serializable]
// required: List[Test.type]
//       total = x
//               ^

Which means that total required a List[Test.type] but you are giving it a List[Serializable].


问:
Comparing two integers without any comparison
Is it possible to find the greatest of two integers without any comparison? I found some  solutions:

```<code>if(!(a/b)) // if a is less than b then division result will be zero.
{
    cout << " b is greater than a";
}
else if (!(a-b)) // we know a is greater than or equal to b now.  check whether they are equal.
{
    cout << "a and b are equal";
}
else
    cout << "a is greater than b";
</code>```

But if(c) or if(!c) is a comparison to zero. In addition it doesn't work for negative numbers. In fact I need a solution that avoids any if statement. Instead I should use switch statements and arithmetic operators. ThanX.

答:
As a pointless exercise, here's a way of implementing a cond function - to serve the purpose of if, supposing it (and switch, and ?:) had somehow disappeared from the language, and you're using C++0x.

```<code>void cond(bool expr, std::function<void ()> ifTrue, std::function<void ()> ifFalse)
{
    std::function<void ()> choices[2] = { ifTrue, ifFalse };
    choices[expr == false]();
}
</code>```

e.g.

```<code>cond(x > y,
    /*then*/ [] { std::cout << "x is greater than y"; },
    /*else*/ [] { std::cout << "x is not greater than y"; });
</code>```

Like I say, pointless.

OwnerDisplayName: kvphxga

Body:
Is it possible to find the greatest of two integers without any comparison? I found some  solutions:

if(!(a/b)) // if a is less than b then division result will be zero.
{
    cout << " b is greater than a";
}
else if (!(a-b)) // we know a is greater than or equal to b now.  check whether they are equal.
{
    cout << "a and b are equal";
}
else
    cout << "a is greater than b";

But if(c) or if(!c) is a comparison to zero. In addition it doesn't work for negative numbers. In fact I need a solution that avoids any if statement. Instead I should use switch statements and arithmetic operators. ThanX.

LastEditorDisplayName: kvphxga

Body:
As a pointless exercise, here's a way of implementing a cond function - to serve the purpose of if, supposing it (and switch, and ?:) had somehow disappeared from the language, and you're using C++0x.

void cond(bool expr, std::function<void ()> ifTrue, std::function<void ()> ifFalse)
{
    std::function<void ()> choices[2] = { ifTrue, ifFalse };
    choices[expr == false]();
}

e.g.

cond(x > y,
    /*then*/ [] { std::cout << "x is greater than y"; },
    /*else*/ [] { std::cout << "x is not greater than y"; });

Like I say, pointless.

OwnerDisplayName: Earwicker

LastEditorDisplayName: Earwicker


问:
Why does hovering the mouse over a combobox make my tabpage re-paint itself?
I have a tabpage. And I have a combobox in it.
When I hover my mouse over it, my tabpage's paint function runs.
Why?

The Combobox has no functions handled. It is just a Combobox.
I move the combobox out of the tabpage, and now the tabpage won't paint when I hover my mouse over the combobox. Weird..

答:
This isn't specific to a TabPage, the same thing happens when you put the combo on a form.  It is affected by visual styles, the container paint requests stop when you turn that off.  I'm guessing it has something to do with the rounded corners you get when the DropDown property is set to DropDownList, the combo glows on a mouse hover.  With it probably asking the container control to draw the pixels in the corner.  Explaining it for DropDown = DropDown is harder.

Same thing happens with a Button, the container control paint is documented in the Reference Source to support transparency effects.  Even if the button doesn't have anything transparent.  Visual styles is less than optimized like this, perhaps.  It is otherwise very similar to what WPF does.  Long story short, this is normal.