问:
spark streaming mapPartition/map is re-running method?
I build yarn cluster(docker) to run java base SparkStreaming

I don't know why spark re-run the same function mapPartitions at KafkaStreaming.

executor1 transfer in locally.

and I found executor 2 transfer data from remotely twice.

do I need to config something let spark don't re-run same function?

```</p>

```JavaPairInputDStream<String, String> inputDStream = KafkaUtils.createStream(jssc,String.class,String.class,StringDecoder.class,StringDecoder.class,kafkaConfig,topic,StorageLevel.MEMORY_ONLY_SER_2());
...
JavaDStream<Data> mapPartitions = inputDStream.mapPartitions(new FlatMapFunction<Iterator<Tuple2<String, String>>, Data>() {
                private static final long serialVersionUID = -640088436146512943L;

                @Override
                public Iterator<Data> call(Iterator<Tuple2<String, String>> t) throws Exception {
                    List<Data> result = new ArrayList<>();
                    Logger log = Logger.getLogger(this.getClass());
                    while (t.hasNext()) {
                        Tuple2<String,String> tuple = t.next();
                        log.info("key="+tuple._1())
                        Data d = new Data();
                        String[] arr =tuple._2().split(",");
                        d.setKey(tuple._1());
                        d.setUser(arr[0]);
                    ......//do somthing
                        result.add(data);
                    }
                    return result.iterator();

                }

            });
```

<p>```

And I found print the same stderr log in different Executor
,that mean run not only one times

driver log can find block key word

"input-0-1498129808200"

```<code>19:10:08.004 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3057
19:10:08.004 INFO org.apache.spark.rdd.MapPartitionsRDD:54 Removing RDD 3056 from persistence list
19:10:08.004 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3056
19:10:08.004 INFO org.apache.spark.rdd.BlockRDD:54 Removing RDD 3055 from persistence list
19:10:08.004 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3055
19:10:08.004 INFO org.apache.spark.streaming.kafka.KafkaInputDStream:54 Removing blocks of RDD BlockRDD[3055] at createStream at KafkaStreaming.java:146 of time 1498129808000 ms
19:10:08.005 INFO org.apache.spark.streaming.scheduler.ReceivedBlockTracker:54 Deleting batches: 1498129807000 ms
19:10:08.005 INFO org.apache.spark.streaming.scheduler.InputInfoTracker:54 remove old batch metadata: 1498129807000 ms
19:10:08.403 INFO org.apache.spark.storage.BlockManagerInfo:54 Added input-0-1498129808200 in memory on slave2:50830 (size: 245.0 B, free: 983.0 MB)
19:10:08.414 INFO org.apache.spark.storage.BlockManagerInfo:54 Added input-0-1498129808200 in memory on slave1:41063 (size: 245.0 B, free: 983.1 MB)
19:10:08.501 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Added jobs for time 1498129808500 ms
19:10:08.501 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129808500 ms.0 from job set of time 1498129808500 ms
19:10:08.502 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129808500 ms.0 from job set of time 1498129808500 ms
19:10:08.502 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129808500 ms.1 from job set of time 1498129808500 ms
19:10:08.502 DEBUG example.spark.streaming.KafkaStreaming$VoidFunctionImpl:201 run foreachMapPartitionsRDD[3062] at mapPartitions at KafkaStreaming.java:170
19:10:08.502 INFO org.apache.spark.scheduler.DAGScheduler:54 Got job 2044 (foreachPartitionAsync at KafkaStreaming.java:239) with 1 output partitions
19:10:08.503 INFO org.apache.spark.scheduler.DAGScheduler:54 Final stage: ResultStage 15 (foreachPartitionAsync at KafkaStreaming.java:239)
19:10:08.503 INFO org.apache.spark.scheduler.DAGScheduler:54 Parents of final stage: List()
19:10:08.503 INFO org.apache.spark.scheduler.DAGScheduler:54 Missing parents: List()
19:10:08.503 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting ResultStage 15 (MapPartitionsRDD[3063] at mapPartitions at KafkaStreaming.java:172), which has no missing parents
19:10:08.503 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129808500 ms.1 from job set of time 1498129808500 ms
19:10:08.503 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129808500 ms.2 from job set of time 1498129808500 ms
19:10:08.505 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_15 stored as values in memory (estimated size 3.4 KB, free 1105.8 MB)
19:10:08.506 INFO org.apache.spark.SparkContext:54 Starting job: print at KafkaStreaming.java:177
19:10:08.508 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_15_piece0 stored as bytes in memory (estimated size 2.2 KB, free 1105.8 MB)
19:10:08.508 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_15_piece0 in memory on slave2:53474 (size: 2.2 KB, free: 1105.9 MB)
19:10:08.508 INFO org.apache.spark.SparkContext:54 Created broadcast 15 from broadcast at DAGScheduler.scala:996
19:10:08.509 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting 1 missing tasks from ResultStage 15 (MapPartitionsRDD[3063] at mapPartitions at KafkaStreaming.java:172)
19:10:08.509 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Adding task set 15.0 with 1 tasks
19:10:08.509 INFO org.apache.spark.scheduler.FairSchedulableBuilder:54 Added task set TaskSet_15.0 tasks to pool default
19:10:08.510 INFO org.apache.spark.scheduler.DAGScheduler:54 Got job 2045 (foreachPartitionAsync at KafkaStreaming.java:202) with 1 output partitions
19:10:08.510 INFO org.apache.spark.scheduler.DAGScheduler:54 Final stage: ResultStage 16 (foreachPartitionAsync at KafkaStreaming.java:202)
19:10:08.510 INFO org.apache.spark.scheduler.DAGScheduler:54 Parents of final stage: List()
19:10:08.510 INFO org.apache.spark.scheduler.TaskSetManager:54 Starting task 0.0 in stage 15.0 (TID 83, slave2, executor 1, partition 0, NODE_LOCAL, 6301 bytes)
19:10:08.510 INFO org.apache.spark.scheduler.DAGScheduler:54 Missing parents: List()
19:10:08.510 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting ResultStage 16 (MapPartitionsRDD[3062] at mapPartitions at KafkaStreaming.java:170), which has no missing parents
19:10:08.511 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_16 stored as values in memory (estimated size 3.0 KB, free 1105.8 MB)
19:10:08.514 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_16_piece0 stored as bytes in memory (estimated size 2.0 KB, free 1105.8 MB)
19:10:08.514 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_16_piece0 in memory on slave2:53474 (size: 2.0 KB, free: 1105.9 MB)
19:10:08.515 INFO org.apache.spark.SparkContext:54 Created broadcast 16 from broadcast at DAGScheduler.scala:996
19:10:08.515 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting 1 missing tasks from ResultStage 16 (MapPartitionsRDD[3062] at mapPartitions at KafkaStreaming.java:170)
19:10:08.515 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Adding task set 16.0 with 1 tasks
19:10:08.515 INFO org.apache.spark.scheduler.FairSchedulableBuilder:54 Added task set TaskSet_16.0 tasks to pool default
19:10:08.516 INFO org.apache.spark.scheduler.DAGScheduler:54 Got job 2046 (print at KafkaStreaming.java:177) with 1 output partitions
19:10:08.516 INFO org.apache.spark.scheduler.DAGScheduler:54 Final stage: ResultStage 17 (print at KafkaStreaming.java:177)
19:10:08.517 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_15_piece0 in memory on slave2:50830 (size: 2.2 KB, free: 983.0 MB)
19:10:08.516 INFO org.apache.spark.scheduler.TaskSetManager:54 Starting task 0.0 in stage 16.0 (TID 84, slave2, executor 2, partition 0, NODE_LOCAL, 6301 bytes)
19:10:08.517 INFO org.apache.spark.scheduler.DAGScheduler:54 Parents of final stage: List()
19:10:08.518 INFO org.apache.spark.scheduler.DAGScheduler:54 Missing parents: List()
19:10:08.518 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting ResultStage 17 (MapPartitionsRDD[3063] at mapPartitions at KafkaStreaming.java:172), which has no missing parents
19:10:08.519 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_17 stored as values in memory (estimated size 3.2 KB, free 1105.8 MB)
19:10:08.522 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_17_piece0 stored as bytes in memory (estimated size 2.1 KB, free 1105.8 MB)
19:10:08.522 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_17_piece0 in memory on slave2:53474 (size: 2.1 KB, free: 1105.9 MB)
19:10:08.523 INFO org.apache.spark.SparkContext:54 Created broadcast 17 from broadcast at DAGScheduler.scala:996
19:10:08.523 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting 1 missing tasks from ResultStage 17 (MapPartitionsRDD[3063] at mapPartitions at KafkaStreaming.java:172)
19:10:08.523 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Adding task set 17.0 with 1 tasks
19:10:08.523 INFO org.apache.spark.scheduler.FairSchedulableBuilder:54 Added task set TaskSet_17.0 tasks to pool default
19:10:08.524 INFO org.apache.spark.scheduler.TaskSetManager:54 Starting task 0.0 in stage 17.0 (TID 85, slave2, executor 2, partition 0, NODE_LOCAL, 6904 bytes)
19:10:08.526 INFO org.apache.spark.storage.BlockManagerInfo:54 Added rdd_3061_0 in memory on slave2:50830 (size: 245.0 B, free: 983.0 MB)
19:10:08.528 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_16_piece0 in memory on slave1:41063 (size: 2.0 KB, free: 983.1 MB)
19:10:08.534 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_17_piece0 in memory on slave1:41063 (size: 2.1 KB, free: 983.1 MB)
19:10:08.547 INFO org.apache.spark.scheduler.TaskSetManager:54 Finished task 0.0 in stage 17.0 (TID 85) in 23 ms on slave2 (executor 2) (1/1)
19:10:08.547 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Removed TaskSet 17.0, whose tasks have all completed, from pool default
19:10:08.547 INFO org.apache.spark.scheduler.DAGScheduler:54 ResultStage 17 (print at KafkaStreaming.java:177) finished in 0.023 s
19:10:08.547 INFO org.apache.spark.scheduler.DAGScheduler:54 Job 2046 finished: print at KafkaStreaming.java:177, took 0.041731 s
19:10:08.548 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129808500 ms.2 from job set of time 1498129808500 ms
19:10:08.548 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Total delay: 0.048 s for time 1498129808500 ms (execution: 0.047 s)
19:10:08.548 INFO org.apache.spark.rdd.MapPartitionsRDD:54 Removing RDD 3060 from persistence list
19:10:08.548 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3060
19:10:08.549 INFO org.apache.spark.rdd.MapPartitionsRDD:54 Removing RDD 3059 from persistence list
19:10:08.549 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3059
19:10:08.549 INFO org.apache.spark.rdd.BlockRDD:54 Removing RDD 3058 from persistence list
19:10:08.549 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3058
19:10:08.549 INFO org.apache.spark.streaming.kafka.KafkaInputDStream:54 Removing blocks of RDD BlockRDD[3058] at createStream at KafkaStreaming.java:146 of time 1498129808500 ms
19:10:08.550 INFO org.apache.spark.streaming.scheduler.ReceivedBlockTracker:54 Deleting batches: 1498129807500 ms
19:10:08.550 INFO org.apache.spark.streaming.scheduler.InputInfoTracker:54 remove old batch metadata: 1498129807500 ms
19:10:08.588 INFO org.apache.spark.scheduler.TaskSetManager:54 Finished task 0.0 in stage 16.0 (TID 84) in 72 ms on slave1 (executor 2) (1/1)
19:10:08.588 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Removed TaskSet 16.0, whose tasks have all completed, from pool default
19:10:08.588 INFO org.apache.spark.scheduler.DAGScheduler:54 ResultStage 16 (foreachPartitionAsync at KafkaStreaming.java:202) finished in 0.073 s
19:10:08.620 INFO org.apache.spark.scheduler.TaskSetManager:54 Finished task 0.0 in stage 15.0 (TID 83) in 110 ms on slave2 (executor 1) (1/1)
19:10:08.620 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Removed TaskSet 15.0, whose tasks have all completed, from pool default
19:10:08.620 INFO org.apache.spark.scheduler.DAGScheduler:54 ResultStage 15 (foreachPartitionAsync at KafkaStreaming.java:239) finished in 0.111 s
19:10:09.002 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Added jobs for time 1498129809000 ms
19:10:09.002 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129809000 ms.0 from job set of time 1498129809000 ms
19:10:09.003 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129809000 ms.0 from job set of time 1498129809000 ms
19:10:09.003 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129809000 ms.1 from job set of time 1498129809000 ms
19:10:09.003 DEBUG example.spark.streaming.KafkaStreaming$VoidFunctionImpl:201 run foreachMapPartitionsRDD[3065] at mapPartitions at KafkaStreaming.java:170
19:10:09.003 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129809000 ms.1 from job set of time 1498129809000 ms
19:10:09.004 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129809000 ms.2 from job set of time 1498129809000 ms
19:10:09.004 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129809000 ms.2 from job set of time 1498129809000 ms
19:10:09.004 INFO org.apache.spark.rdd.MapPartitionsRDD:54 Removing RDD 3063 from persistence list
19:10:09.004 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Total delay: 0.004 s for time 1498129809000 ms (execution: 0.002 s)
19:10:09.004 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3063
19:10:09.004 INFO org.apache.spark.rdd.MapPartitionsRDD:54 Removing RDD 3062 from persistence list
19:10:09.004 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3062
19:10:09.004 INFO org.apache.spark.rdd.BlockRDD:54 Removing RDD 3061 from persistence list
19:10:09.005 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3061
19:10:09.005 INFO org.apache.spark.streaming.kafka.KafkaInputDStream:54 Removing blocks of RDD BlockRDD[3061] at createStream at KafkaStreaming.java:146 of time 1498129809000 ms
19:10:09.005 INFO org.apache.spark.streaming.scheduler.ReceivedBlockTracker:54 Deleting batches: 1498129808000 ms
19:10:09.005 INFO org.apache.spark.streaming.scheduler.InputInfoTracker:54 remove old batch metadata: 1498129808000 ms
19:10:09.006 INFO org.apache.spark.storage.BlockManagerInfo:54 Removed input-0-1498129808200 on slave2:50830 in memory (size: 245.0 B, free: 983.0 MB)
19:10:09.006 INFO org.apache.spark.storage.BlockManagerInfo:54 Removed input-0-1498129808200 on slave1:41063 in memory (size: 245.0 B, free: 983.1 MB)
</code>```

executor 1
key word in log

Found block input-0-1498129808200 locally

  key=170622191007573

```<code>19:10:07.506 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3053
19:10:07.506 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3052
19:10:08.005 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3057
19:10:08.006 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3056
19:10:08.006 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3055
19:10:08.402 INFO org.apache.spark.storage.memory.MemoryStore:54 Block input-0-1498129808200 stored as bytes in memory (estimated size 245.0 B, free 983.0 MB)
19:10:08.416 INFO org.apache.spark.streaming.receiver.BlockGenerator:54 Pushed block input-0-1498129808200
19:10:08.511 INFO org.apache.spark.executor.CoarseGrainedExecutorBackend:54 Got assigned task 83
19:10:08.512 INFO org.apache.spark.executor.Executor:54 Running task 0.0 in stage 15.0 (TID 83)
19:10:08.513 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Started reading broadcast variable 15
19:10:08.515 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_15_piece0 stored as bytes in memory (estimated size 2.2 KB, free 983.0 MB)
19:10:08.518 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Reading broadcast variable 15 took 5 ms
19:10:08.520 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_15 stored as values in memory (estimated size 3.4 KB, free 983.0 MB)
19:10:08.523 INFO org.apache.spark.storage.BlockManager:54 Found block input-0-1498129808200 locally
19:10:08.525 INFO org.apache.spark.storage.memory.MemoryStore:54 Block rdd_3061_0 stored as bytes in memory (estimated size 245.0 B, free 983.0 MB)
19:10:08.528 DEBUG example.spark.streaming.KafkaStreaming$FlatMapFunctionImpl:284 key=170622191007573
19:10:08.549 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3060
19:10:08.549 INFO org.apache.spark.streaming.receiver.ReceiverSupervisorImpl:54 Received a new rate limit: 100.
19:10:08.549 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3059
19:10:08.549 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3058
</code>```

executor2

key word in log were print two times

Found block rdd_3061_0 remotely

  key=170622191007573

```<code>19:10:07.506 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3053
19:10:07.506 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3052
19:10:08.005 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3057
19:10:08.006 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3056
19:10:08.006 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3055
19:10:08.407 INFO org.apache.spark.storage.memory.MemoryStore:54 Block input-0-1498129808200 stored as bytes in memory (estimated size 245.0 B, free 983.1 MB)
19:10:08.519 INFO org.apache.spark.executor.CoarseGrainedExecutorBackend:54 Got assigned task 84
19:10:08.520 INFO org.apache.spark.executor.Executor:54 Running task 0.0 in stage 16.0 (TID 84)
19:10:08.521 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Started reading broadcast variable 16
19:10:08.526 INFO org.apache.spark.executor.CoarseGrainedExecutorBackend:54 Got assigned task 85
19:10:08.527 INFO org.apache.spark.executor.Executor:54 Running task 0.0 in stage 17.0 (TID 85)
19:10:08.528 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_16_piece0 stored as bytes in memory (estimated size 2.0 KB, free 983.1 MB)
19:10:08.530 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Reading broadcast variable 16 took 9 ms
19:10:08.532 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_16 stored as values in memory (estimated size 3.0 KB, free 983.1 MB)
19:10:08.532 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Started reading broadcast variable 17
19:10:08.534 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_17_piece0 stored as bytes in memory (estimated size 2.1 KB, free 983.1 MB)
19:10:08.536 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Reading broadcast variable 17 took 4 ms
19:10:08.536 INFO org.apache.spark.storage.BlockManager:54 Found block rdd_3061_0 remotely
19:10:08.536 DEBUG example.spark.streaming.KafkaStreaming$FlatMapFunctionImpl:284 key=170622191007573
19:10:08.537 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_17 stored as values in memory (estimated size 3.2 KB, free 983.1 MB)
19:10:08.541 INFO org.apache.spark.storage.BlockManager:54 Found block rdd_3061_0 remotely
19:10:08.542 DEBUG example.spark.streaming.KafkaStreaming$FlatMapFunctionImpl:284 key=170622191007573
19:10:08.547 INFO org.apache.spark.executor.Executor:54 Finished task 0.0 in stage 17.0 (TID 85). 1963 bytes result sent to driver
19:10:08.550 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3060
19:10:08.550 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3059
19:10:08.552 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3058
</code>```

答: since you read data from kafka, the stream will be listen by spark. So the job of dealing stream will re-running as the the stream read from kafka. wish the answer could help you.</p>

Body:
I build yarn cluster(docker) to run java base SparkStreaming

I don't know why spark re-run the same function mapPartitions at KafkaStreaming.

executor1 transfer in locally.

and I found executor 2 transfer data from remotely twice.

do I need to config something let spark don't re-run same function?

```</p>

<pre><code>JavaPairInputDStream<String, String> inputDStream = KafkaUtils.createStream(jssc,String.class,String.class,StringDecoder.class,StringDecoder.class,kafkaConfig,topic,StorageLevel.MEMORY_ONLY_SER_2());
...
JavaDStream<Data> mapPartitions = inputDStream.mapPartitions(new FlatMapFunction<Iterator<Tuple2<String, String>>, Data>() {
                private static final long serialVersionUID = -640088436146512943L;

                @Override
                public Iterator<Data> call(Iterator<Tuple2<String, String>> t) throws Exception {
                    List<Data> result = new ArrayList<>();
                    Logger log = Logger.getLogger(this.getClass());
                    while (t.hasNext()) {
                        Tuple2<String,String> tuple = t.next();
                        log.info("key="+tuple._1())
                        Data d = new Data();
                        String[] arr =tuple._2().split(",");
                        d.setKey(tuple._1());
                        d.setUser(arr[0]);
                    ......//do somthing
                        result.add(data);
                    }
                    return result.iterator();

                }

            });
</code></pre>

<p>```

And I found print the same stderr log in different Executor
,that mean run not only one times

driver log can find block key word

"input-0-1498129808200"

19:10:08.004 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3057
19:10:08.004 INFO org.apache.spark.rdd.MapPartitionsRDD:54 Removing RDD 3056 from persistence list
19:10:08.004 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3056
19:10:08.004 INFO org.apache.spark.rdd.BlockRDD:54 Removing RDD 3055 from persistence list
19:10:08.004 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3055
19:10:08.004 INFO org.apache.spark.streaming.kafka.KafkaInputDStream:54 Removing blocks of RDD BlockRDD[3055] at createStream at KafkaStreaming.java:146 of time 1498129808000 ms
19:10:08.005 INFO org.apache.spark.streaming.scheduler.ReceivedBlockTracker:54 Deleting batches: 1498129807000 ms
19:10:08.005 INFO org.apache.spark.streaming.scheduler.InputInfoTracker:54 remove old batch metadata: 1498129807000 ms
19:10:08.403 INFO org.apache.spark.storage.BlockManagerInfo:54 Added input-0-1498129808200 in memory on slave2:50830 (size: 245.0 B, free: 983.0 MB)
19:10:08.414 INFO org.apache.spark.storage.BlockManagerInfo:54 Added input-0-1498129808200 in memory on slave1:41063 (size: 245.0 B, free: 983.1 MB)
19:10:08.501 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Added jobs for time 1498129808500 ms
19:10:08.501 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129808500 ms.0 from job set of time 1498129808500 ms
19:10:08.502 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129808500 ms.0 from job set of time 1498129808500 ms
19:10:08.502 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129808500 ms.1 from job set of time 1498129808500 ms
19:10:08.502 DEBUG example.spark.streaming.KafkaStreaming$VoidFunctionImpl:201 run foreachMapPartitionsRDD[3062] at mapPartitions at KafkaStreaming.java:170
19:10:08.502 INFO org.apache.spark.scheduler.DAGScheduler:54 Got job 2044 (foreachPartitionAsync at KafkaStreaming.java:239) with 1 output partitions
19:10:08.503 INFO org.apache.spark.scheduler.DAGScheduler:54 Final stage: ResultStage 15 (foreachPartitionAsync at KafkaStreaming.java:239)
19:10:08.503 INFO org.apache.spark.scheduler.DAGScheduler:54 Parents of final stage: List()
19:10:08.503 INFO org.apache.spark.scheduler.DAGScheduler:54 Missing parents: List()
19:10:08.503 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting ResultStage 15 (MapPartitionsRDD[3063] at mapPartitions at KafkaStreaming.java:172), which has no missing parents
19:10:08.503 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129808500 ms.1 from job set of time 1498129808500 ms
19:10:08.503 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129808500 ms.2 from job set of time 1498129808500 ms
19:10:08.505 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_15 stored as values in memory (estimated size 3.4 KB, free 1105.8 MB)
19:10:08.506 INFO org.apache.spark.SparkContext:54 Starting job: print at KafkaStreaming.java:177
19:10:08.508 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_15_piece0 stored as bytes in memory (estimated size 2.2 KB, free 1105.8 MB)
19:10:08.508 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_15_piece0 in memory on slave2:53474 (size: 2.2 KB, free: 1105.9 MB)
19:10:08.508 INFO org.apache.spark.SparkContext:54 Created broadcast 15 from broadcast at DAGScheduler.scala:996
19:10:08.509 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting 1 missing tasks from ResultStage 15 (MapPartitionsRDD[3063] at mapPartitions at KafkaStreaming.java:172)
19:10:08.509 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Adding task set 15.0 with 1 tasks
19:10:08.509 INFO org.apache.spark.scheduler.FairSchedulableBuilder:54 Added task set TaskSet_15.0 tasks to pool default
19:10:08.510 INFO org.apache.spark.scheduler.DAGScheduler:54 Got job 2045 (foreachPartitionAsync at KafkaStreaming.java:202) with 1 output partitions
19:10:08.510 INFO org.apache.spark.scheduler.DAGScheduler:54 Final stage: ResultStage 16 (foreachPartitionAsync at KafkaStreaming.java:202)
19:10:08.510 INFO org.apache.spark.scheduler.DAGScheduler:54 Parents of final stage: List()
19:10:08.510 INFO org.apache.spark.scheduler.TaskSetManager:54 Starting task 0.0 in stage 15.0 (TID 83, slave2, executor 1, partition 0, NODE_LOCAL, 6301 bytes)
19:10:08.510 INFO org.apache.spark.scheduler.DAGScheduler:54 Missing parents: List()
19:10:08.510 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting ResultStage 16 (MapPartitionsRDD[3062] at mapPartitions at KafkaStreaming.java:170), which has no missing parents
19:10:08.511 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_16 stored as values in memory (estimated size 3.0 KB, free 1105.8 MB)
19:10:08.514 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_16_piece0 stored as bytes in memory (estimated size 2.0 KB, free 1105.8 MB)
19:10:08.514 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_16_piece0 in memory on slave2:53474 (size: 2.0 KB, free: 1105.9 MB)
19:10:08.515 INFO org.apache.spark.SparkContext:54 Created broadcast 16 from broadcast at DAGScheduler.scala:996
19:10:08.515 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting 1 missing tasks from ResultStage 16 (MapPartitionsRDD[3062] at mapPartitions at KafkaStreaming.java:170)
19:10:08.515 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Adding task set 16.0 with 1 tasks
19:10:08.515 INFO org.apache.spark.scheduler.FairSchedulableBuilder:54 Added task set TaskSet_16.0 tasks to pool default
19:10:08.516 INFO org.apache.spark.scheduler.DAGScheduler:54 Got job 2046 (print at KafkaStreaming.java:177) with 1 output partitions
19:10:08.516 INFO org.apache.spark.scheduler.DAGScheduler:54 Final stage: ResultStage 17 (print at KafkaStreaming.java:177)
19:10:08.517 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_15_piece0 in memory on slave2:50830 (size: 2.2 KB, free: 983.0 MB)
19:10:08.516 INFO org.apache.spark.scheduler.TaskSetManager:54 Starting task 0.0 in stage 16.0 (TID 84, slave2, executor 2, partition 0, NODE_LOCAL, 6301 bytes)
19:10:08.517 INFO org.apache.spark.scheduler.DAGScheduler:54 Parents of final stage: List()
19:10:08.518 INFO org.apache.spark.scheduler.DAGScheduler:54 Missing parents: List()
19:10:08.518 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting ResultStage 17 (MapPartitionsRDD[3063] at mapPartitions at KafkaStreaming.java:172), which has no missing parents
19:10:08.519 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_17 stored as values in memory (estimated size 3.2 KB, free 1105.8 MB)
19:10:08.522 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_17_piece0 stored as bytes in memory (estimated size 2.1 KB, free 1105.8 MB)
19:10:08.522 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_17_piece0 in memory on slave2:53474 (size: 2.1 KB, free: 1105.9 MB)
19:10:08.523 INFO org.apache.spark.SparkContext:54 Created broadcast 17 from broadcast at DAGScheduler.scala:996
19:10:08.523 INFO org.apache.spark.scheduler.DAGScheduler:54 Submitting 1 missing tasks from ResultStage 17 (MapPartitionsRDD[3063] at mapPartitions at KafkaStreaming.java:172)
19:10:08.523 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Adding task set 17.0 with 1 tasks
19:10:08.523 INFO org.apache.spark.scheduler.FairSchedulableBuilder:54 Added task set TaskSet_17.0 tasks to pool default
19:10:08.524 INFO org.apache.spark.scheduler.TaskSetManager:54 Starting task 0.0 in stage 17.0 (TID 85, slave2, executor 2, partition 0, NODE_LOCAL, 6904 bytes)
19:10:08.526 INFO org.apache.spark.storage.BlockManagerInfo:54 Added rdd_3061_0 in memory on slave2:50830 (size: 245.0 B, free: 983.0 MB)
19:10:08.528 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_16_piece0 in memory on slave1:41063 (size: 2.0 KB, free: 983.1 MB)
19:10:08.534 INFO org.apache.spark.storage.BlockManagerInfo:54 Added broadcast_17_piece0 in memory on slave1:41063 (size: 2.1 KB, free: 983.1 MB)
19:10:08.547 INFO org.apache.spark.scheduler.TaskSetManager:54 Finished task 0.0 in stage 17.0 (TID 85) in 23 ms on slave2 (executor 2) (1/1)
19:10:08.547 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Removed TaskSet 17.0, whose tasks have all completed, from pool default
19:10:08.547 INFO org.apache.spark.scheduler.DAGScheduler:54 ResultStage 17 (print at KafkaStreaming.java:177) finished in 0.023 s
19:10:08.547 INFO org.apache.spark.scheduler.DAGScheduler:54 Job 2046 finished: print at KafkaStreaming.java:177, took 0.041731 s
19:10:08.548 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129808500 ms.2 from job set of time 1498129808500 ms
19:10:08.548 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Total delay: 0.048 s for time 1498129808500 ms (execution: 0.047 s)
19:10:08.548 INFO org.apache.spark.rdd.MapPartitionsRDD:54 Removing RDD 3060 from persistence list
19:10:08.548 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3060
19:10:08.549 INFO org.apache.spark.rdd.MapPartitionsRDD:54 Removing RDD 3059 from persistence list
19:10:08.549 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3059
19:10:08.549 INFO org.apache.spark.rdd.BlockRDD:54 Removing RDD 3058 from persistence list
19:10:08.549 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3058
19:10:08.549 INFO org.apache.spark.streaming.kafka.KafkaInputDStream:54 Removing blocks of RDD BlockRDD[3058] at createStream at KafkaStreaming.java:146 of time 1498129808500 ms
19:10:08.550 INFO org.apache.spark.streaming.scheduler.ReceivedBlockTracker:54 Deleting batches: 1498129807500 ms
19:10:08.550 INFO org.apache.spark.streaming.scheduler.InputInfoTracker:54 remove old batch metadata: 1498129807500 ms
19:10:08.588 INFO org.apache.spark.scheduler.TaskSetManager:54 Finished task 0.0 in stage 16.0 (TID 84) in 72 ms on slave1 (executor 2) (1/1)
19:10:08.588 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Removed TaskSet 16.0, whose tasks have all completed, from pool default
19:10:08.588 INFO org.apache.spark.scheduler.DAGScheduler:54 ResultStage 16 (foreachPartitionAsync at KafkaStreaming.java:202) finished in 0.073 s
19:10:08.620 INFO org.apache.spark.scheduler.TaskSetManager:54 Finished task 0.0 in stage 15.0 (TID 83) in 110 ms on slave2 (executor 1) (1/1)
19:10:08.620 INFO org.apache.spark.scheduler.cluster.YarnClusterScheduler:54 Removed TaskSet 15.0, whose tasks have all completed, from pool default
19:10:08.620 INFO org.apache.spark.scheduler.DAGScheduler:54 ResultStage 15 (foreachPartitionAsync at KafkaStreaming.java:239) finished in 0.111 s
19:10:09.002 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Added jobs for time 1498129809000 ms
19:10:09.002 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129809000 ms.0 from job set of time 1498129809000 ms
19:10:09.003 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129809000 ms.0 from job set of time 1498129809000 ms
19:10:09.003 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129809000 ms.1 from job set of time 1498129809000 ms
19:10:09.003 DEBUG example.spark.streaming.KafkaStreaming$VoidFunctionImpl:201 run foreachMapPartitionsRDD[3065] at mapPartitions at KafkaStreaming.java:170
19:10:09.003 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129809000 ms.1 from job set of time 1498129809000 ms
19:10:09.004 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Starting job streaming job 1498129809000 ms.2 from job set of time 1498129809000 ms
19:10:09.004 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Finished job streaming job 1498129809000 ms.2 from job set of time 1498129809000 ms
19:10:09.004 INFO org.apache.spark.rdd.MapPartitionsRDD:54 Removing RDD 3063 from persistence list
19:10:09.004 INFO org.apache.spark.streaming.scheduler.JobScheduler:54 Total delay: 0.004 s for time 1498129809000 ms (execution: 0.002 s)
19:10:09.004 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3063
19:10:09.004 INFO org.apache.spark.rdd.MapPartitionsRDD:54 Removing RDD 3062 from persistence list
19:10:09.004 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3062
19:10:09.004 INFO org.apache.spark.rdd.BlockRDD:54 Removing RDD 3061 from persistence list
19:10:09.005 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3061
19:10:09.005 INFO org.apache.spark.streaming.kafka.KafkaInputDStream:54 Removing blocks of RDD BlockRDD[3061] at createStream at KafkaStreaming.java:146 of time 1498129809000 ms
19:10:09.005 INFO org.apache.spark.streaming.scheduler.ReceivedBlockTracker:54 Deleting batches: 1498129808000 ms
19:10:09.005 INFO org.apache.spark.streaming.scheduler.InputInfoTracker:54 remove old batch metadata: 1498129808000 ms
19:10:09.006 INFO org.apache.spark.storage.BlockManagerInfo:54 Removed input-0-1498129808200 on slave2:50830 in memory (size: 245.0 B, free: 983.0 MB)
19:10:09.006 INFO org.apache.spark.storage.BlockManagerInfo:54 Removed input-0-1498129808200 on slave1:41063 in memory (size: 245.0 B, free: 983.1 MB)

executor 1
key word in log

Found block input-0-1498129808200 locally

  key=170622191007573

19:10:07.506 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3053
19:10:07.506 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3052
19:10:08.005 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3057
19:10:08.006 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3056
19:10:08.006 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3055
19:10:08.402 INFO org.apache.spark.storage.memory.MemoryStore:54 Block input-0-1498129808200 stored as bytes in memory (estimated size 245.0 B, free 983.0 MB)
19:10:08.416 INFO org.apache.spark.streaming.receiver.BlockGenerator:54 Pushed block input-0-1498129808200
19:10:08.511 INFO org.apache.spark.executor.CoarseGrainedExecutorBackend:54 Got assigned task 83
19:10:08.512 INFO org.apache.spark.executor.Executor:54 Running task 0.0 in stage 15.0 (TID 83)
19:10:08.513 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Started reading broadcast variable 15
19:10:08.515 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_15_piece0 stored as bytes in memory (estimated size 2.2 KB, free 983.0 MB)
19:10:08.518 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Reading broadcast variable 15 took 5 ms
19:10:08.520 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_15 stored as values in memory (estimated size 3.4 KB, free 983.0 MB)
19:10:08.523 INFO org.apache.spark.storage.BlockManager:54 Found block input-0-1498129808200 locally
19:10:08.525 INFO org.apache.spark.storage.memory.MemoryStore:54 Block rdd_3061_0 stored as bytes in memory (estimated size 245.0 B, free 983.0 MB)
19:10:08.528 DEBUG example.spark.streaming.KafkaStreaming$FlatMapFunctionImpl:284 key=170622191007573
19:10:08.549 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3060
19:10:08.549 INFO org.apache.spark.streaming.receiver.ReceiverSupervisorImpl:54 Received a new rate limit: 100.
19:10:08.549 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3059
19:10:08.549 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3058

executor2

key word in log were print two times

Found block rdd_3061_0 remotely

  key=170622191007573

19:10:07.506 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3053
19:10:07.506 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3052
19:10:08.005 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3057
19:10:08.006 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3056
19:10:08.006 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3055
19:10:08.407 INFO org.apache.spark.storage.memory.MemoryStore:54 Block input-0-1498129808200 stored as bytes in memory (estimated size 245.0 B, free 983.1 MB)
19:10:08.519 INFO org.apache.spark.executor.CoarseGrainedExecutorBackend:54 Got assigned task 84
19:10:08.520 INFO org.apache.spark.executor.Executor:54 Running task 0.0 in stage 16.0 (TID 84)
19:10:08.521 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Started reading broadcast variable 16
19:10:08.526 INFO org.apache.spark.executor.CoarseGrainedExecutorBackend:54 Got assigned task 85
19:10:08.527 INFO org.apache.spark.executor.Executor:54 Running task 0.0 in stage 17.0 (TID 85)
19:10:08.528 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_16_piece0 stored as bytes in memory (estimated size 2.0 KB, free 983.1 MB)
19:10:08.530 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Reading broadcast variable 16 took 9 ms
19:10:08.532 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_16 stored as values in memory (estimated size 3.0 KB, free 983.1 MB)
19:10:08.532 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Started reading broadcast variable 17
19:10:08.534 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_17_piece0 stored as bytes in memory (estimated size 2.1 KB, free 983.1 MB)
19:10:08.536 INFO org.apache.spark.broadcast.TorrentBroadcast:54 Reading broadcast variable 17 took 4 ms
19:10:08.536 INFO org.apache.spark.storage.BlockManager:54 Found block rdd_3061_0 remotely
19:10:08.536 DEBUG example.spark.streaming.KafkaStreaming$FlatMapFunctionImpl:284 key=170622191007573
19:10:08.537 INFO org.apache.spark.storage.memory.MemoryStore:54 Block broadcast_17 stored as values in memory (estimated size 3.2 KB, free 983.1 MB)
19:10:08.541 INFO org.apache.spark.storage.BlockManager:54 Found block rdd_3061_0 remotely
19:10:08.542 DEBUG example.spark.streaming.KafkaStreaming$FlatMapFunctionImpl:284 key=170622191007573
19:10:08.547 INFO org.apache.spark.executor.Executor:54 Finished task 0.0 in stage 17.0 (TID 85). 1963 bytes result sent to driver
19:10:08.550 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3060
19:10:08.550 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3059
19:10:08.552 INFO org.apache.spark.storage.BlockManager:54 Removing RDD 3058


来源: stackexchange

问:
Route is not matched
I can't figure out why this is not matching my route for the CompanyDetailContainer.  The route for Interview container works fine

```<code>      <IndexRoute component={HomePageContainer} />
      <Route component={InterviewContainer} name="interview" path="interviews/companies/:companyId" />
      <Route component={CompanyDetailContainer} name="companydetail" path="interviews/companies/:companyId/details" />
</code>```

so http://localhost:8080/interviews/companies/10 hits the interview route fine but http://localhost:8080/interviews/companies/501/details does not hit the companydetail route

UPDATE:

I'm using:

```<code>"react-router": "^3.0.0",
"react-router-dom": "^4.2.2",
</code>```

original code:

```<code>import { IndexRoute, Router, Route, browserHistory } from 'react-router';

  <Router history={browserHistory} onUpdate={onUpdate}>
    <Route path="/">
      <IndexRoute component={HomePageContainer} />
      <Switch>
        <Route exact component={InterviewContainer} name="interview" path="interviews/companies/:companyId" />
        <Route exact component={CompanyDetailContainer} name="companydetail" path="interviews/companies/:companyId/details" />
      </Switch>
      <Route component={About} name="about" path="about"  />
      <Route component={JobList} name="jobs" path="jobs"  />
    </Route>
    <Route component={Container} path="/"  />
    <Route component={NotFound} path="*"  />
  </Router>
</code>```

adding just exact to what I had didn't work:

```<code>import { IndexRoute, Router, Route, browserHistory } from 'react-router';

  <Router history={browserHistory} onUpdate={onUpdate}>
      <Route path="/" component={HomePageContainer}>
        <Route component={InterviewContainer} exact name="interview" path="interviews/companies/:companyId" />
        <Route component={CompanyDetailContainer} exact name="companydetail" path="interviews/companies/:companyId/details" />
        <Route component={About} name="about" path="about" />
        <Route component={JobList} name="jobs" path="jobs" />
        <Route component={Container} path="/"  />
        <Route component={NotFound} path="*"  />
      </Route>

  </Router>
</code>```

Then I tried to add switch around it:

```<code>import { Router, Route, Switch, browserHistory } from 'react-router';

  <Router history={browserHistory} onUpdate={onUpdate}>
    <Switch>
      <Route path="/" component={HomePageContainer}>
        <Route component={InterviewContainer} exact name="interview" path="interviews/companies/:companyId" />
        <Route component={CompanyDetailContainer} exact name="companydetail" path="interviews/companies/:companyId/details" />
        <Route component={About} name="about" path="about" />
        <Route component={JobList} name="jobs" path="jobs" />
        <Route component={Container} path="/"  />
        <Route component={NotFound} path="*"  />
      </Route>
    </Switch>
  </Router>
</code>```

And now I get this error: Cannot read property 'createRouteFromReactElement' of undefined.  I noticed my import for Switch is not resolving but that's how you import Switch right?

Also not sure if all those routes should be sub routes of <Route path="/" component={HomePageContainer}>?  Note that I removed the <IndexRoute /> per suggestions too.

答:
Reverse the two routes with a wrapping with Switch : </p>

```<code>import {Switch} from 'react-router';

<IndexRoute component={HomePageContainer} />
<Switch>
  <Route component={CompanyDetailContainer} name="companydetail" path="interviews/companies/:companyId/details" />
  <Route component={InterviewContainer} name="interview" path="interviews/companies/:companyId" />
</Switch>
</code>```

ContentLicense: CC BY-SA 3.0

Title: Route is not matched

Body:
I can't figure out why this is not matching my route for the CompanyDetailContainer.  The route for Interview container works fine

      <IndexRoute component={HomePageContainer} />
      <Route component={InterviewContainer} name="interview" path="interviews/companies/:companyId" />
      <Route component={CompanyDetailContainer} name="companydetail" path="interviews/companies/:companyId/details" />

so http://localhost:8080/interviews/companies/10 hits the interview route fine but http://localhost:8080/interviews/companies/501/details does not hit the companydetail route

UPDATE:

I'm using:

"react-router": "^3.0.0",
"react-router-dom": "^4.2.2",

original code:

import { IndexRoute, Router, Route, browserHistory } from 'react-router';

  <Router history={browserHistory} onUpdate={onUpdate}>
    <Route path="/">
      <IndexRoute component={HomePageContainer} />
      <Switch>
        <Route exact component={InterviewContainer} name="interview" path="interviews/companies/:companyId" />
        <Route exact component={CompanyDetailContainer} name="companydetail" path="interviews/companies/:companyId/details" />
      </Switch>
      <Route component={About} name="about" path="about"  />
      <Route component={JobList} name="jobs" path="jobs"  />
    </Route>
    <Route component={Container} path="/"  />
    <Route component={NotFound} path="*"  />
  </Router>

adding just exact to what I had didn't work:

import { IndexRoute, Router, Route, browserHistory } from 'react-router';

  <Router history={browserHistory} onUpdate={onUpdate}>
      <Route path="/" component={HomePageContainer}>
        <Route component={InterviewContainer} exact name="interview" path="interviews/companies/:companyId" />
        <Route component={CompanyDetailContainer} exact name="companydetail" path="interviews/companies/:companyId/details" />
        <Route component={About} name="about" path="about" />
        <Route component={JobList} name="jobs" path="jobs" />
        <Route component={Container} path="/"  />
        <Route component={NotFound} path="*"  />
      </Route>

  </Router>

Then I tried to add switch around it:

import { Router, Route, Switch, browserHistory } from 'react-router';

  <Router history={browserHistory} onUpdate={onUpdate}>
    <Switch>
      <Route path="/" component={HomePageContainer}>
        <Route component={InterviewContainer} exact name="interview" path="interviews/companies/:companyId" />
        <Route component={CompanyDetailContainer} exact name="companydetail" path="interviews/companies/:companyId/details" />
        <Route component={About} name="about" path="about" />
        <Route component={JobList} name="jobs" path="jobs" />
        <Route component={Container} path="/"  />
        <Route component={NotFound} path="*"  />
      </Route>
    </Switch>
  </Router>

And now I get this error: Cannot read property 'createRouteFromReactElement' of undefined.  I noticed my import for Switch is not resolving but that's how you import Switch right?

Also not sure if all those routes should be sub routes of <Route path="/" component={HomePageContainer}>?  Note that I removed the <IndexRoute /> per suggestions too.

Body:
Reverse the two routes with a wrapping with Switch :

import {Switch} from 'react-router';

<IndexRoute component={HomePageContainer} />
<Switch>
  <Route component={CompanyDetailContainer} name="companydetail" path="interviews/companies/:companyId/details" />
  <Route component={InterviewContainer} name="interview" path="interviews/companies/:companyId" />
</Switch>


问:
Converting a result of Integer to String or Word in C
so i have a problem here. I am working on my class assignment which is create a calculator but every result must be in a word, example :

```<code>int a,b,c;
printf("Input first number:");
scanf("%d", &a);
printf("Input second number:"):
scanf("%d", &b);
c=a+b;
printf("The result are: %d", c);
printf("If in words, it is  = ");
switch(c){
case 0:printf("abcdef");break;
case 1:printf("bc");break;
case 2:printf("abged");break;
case 3:printf("abgcd");break;
case 4:printf("fbgc");break;
case 5:printf("afgod");break;
case 6:printf("fgcde");break;
case 7:printf("abc");break;
case 8:printf("abcdefg");break;
case 9:printf("abcdfg");break;
default :printf("error");break;
</code>```

So the result from this when im running it is :

Input first number : 12

input second number : 12

The result are: 24

If in words, it is = error

so what I'm confused here is how I did print the c result as a word? so what i want from my output is

Input first number : 12

input second number : 12

The result are : 24

If in words, it is = abged fbcg

so far I'm searching for answers but I cannot find it. If anyone here can help me, please do.

Thanks in advance

*edited

答:
The first problem here, you missed to use the break statement after each case statement.

Hence, yours is a fall-through switch case, which is not what you want. It will jump to the case matching in switch statement and then fall-thorough all other available case statements.

Once you have solved that problem, one of the possible the approach to target the next problem is to explain it properly, with the current description, it's not very clear.

Body:
so i have a problem here. I am working on my class assignment which is create a calculator but every result must be in a word, example :

int a,b,c;
printf("Input first number:");
scanf("%d", &a);
printf("Input second number:"):
scanf("%d", &b);
c=a+b;
printf("The result are: %d", c);
printf("If in words, it is  = ");
switch(c){
case 0:printf("abcdef");break;
case 1:printf("bc");break;
case 2:printf("abged");break;
case 3:printf("abgcd");break;
case 4:printf("fbgc");break;
case 5:printf("afgod");break;
case 6:printf("fgcde");break;
case 7:printf("abc");break;
case 8:printf("abcdefg");break;
case 9:printf("abcdfg");break;
default :printf("error");break;

So the result from this when im running it is :

Input first number : 12

input second number : 12

The result are: 24

If in words, it is = error

so what I'm confused here is how I did print the c result as a word? so what i want from my output is

Input first number : 12

input second number : 12

The result are : 24

If in words, it is = abged fbcg

so far I'm searching for answers but I cannot find it. If anyone here can help me, please do.

Thanks in advance

*edited


问:
Using ng-messages with dynamic field names
I have a list of fields which are displayed using ng-repeat. The name of the input field is dynamic. How do you get ng-messages to work when using dynamic names? Below is what I've tried, but this doesn't work:</p>

```<code><form id="userForm" name="userForm" ng-submit="userForm.$valid && submit()" novalidate>
    <div ng-repeat="uniqueField in uniqueFields">
        <div>
            <label>{{uniqueField.form_field_label}}</label>
            <input required="{{uniqueField.isMandatory}}" name="text_{{uniqueField.form_field_id}}" ng-model="uniqueField.form_field_value" type="text">
            <div ng-messages="userForm.{{uniqueField.form_field_id}}.$error" ng-if="userForm.$submitted && uniqueField.isMandatory == true">
                <div ng-message="required">Please enter a {{uniqueField.form_field_label}}.</div>
            </div>

        </div>
    </div>
</form>
</code>```

答:
I have modified trollr's answer, and its working.
I added the attr, ng-show="userForm[uniqueField.form_field_id].$error.required"

Here is the solution HTML:

```<code><div ng-app="demoApp" ng-controller="MainCtrl as ctrl">
<code>{{userForm[uniqueField.form_field_id].$error}}</code>
  <form id="userForm" name="userForm" `enter code here`ng-submit="userForm.$valid && ctrl.submit()" novalidate>
    <div ng-repeat="uniqueField in ctrl.uniqueFields">
        <div>
            <label>{{uniqueField.form_field_label}}</label>
            <input required="{{uniqueField.isMandatory}}" name="{{uniqueField.form_field_id}}" ng-model="uniqueField.form_field_value" type="text">
            <div ng-messages="userForm[uniqueField.form_field_id].$error">
                <div class="error" ng-show="userForm[uniqueField.form_field_id].$error.required" ng-message="required">Please enter a {{uniqueField.form_field_label}}.</div>
            </div>
        </div>
    </div>
    <button type="submit">Submit
    </button>
</form>
</div>
</code>```

And the Controller:

```<code>angular.module('demoApp', [])
    .controller('MainCtrl', MainCtrl);

function MainCtrl($log) {
    var ctrl = this;

    function activate() {
        ctrl.uniqueFields = [
      {
        form_field_label: 'Name',
        form_field_id: 'name',
        form_field_value: '',
        isMandatory: true
      }
    ]
    }

    activate();

  ctrl.submit = function() {
    $log.debug('form submitted');
  }
}
</code>```

Or you can use ng-form instead of form tag.

Working fiddle: http://jsfiddle.net/Q386jmnw/

Body:
I have a list of fields which are displayed using ng-repeat. The name of the input field is dynamic. How do you get ng-messages to work when using dynamic names? Below is what I've tried, but this doesn't work:

<form id="userForm" name="userForm" ng-submit="userForm.$valid && submit()" novalidate>

            {{uniqueField.form_field_label}}
            <input required="{{uniqueField.isMandatory}}" name="text_{{uniqueField.form_field_id}}" ng-model="uniqueField.form_field_value" type="text">

Please enter a {{uniqueField.form_field_label}}.

</form>

Body:
I have modified trollr's answer, and its working.
I added the attr, ng-show="userForm[uniqueField.form_field_id].$error.required"

Here is the solution HTML:

<div ng-app="demoApp" ng-controller="MainCtrl as ctrl">
<code>{{userForm[uniqueField.form_field_id].$error}}</code>
  <form id="userForm" name="userForm" `enter code here`ng-submit="userForm.$valid && ctrl.submit()" novalidate>
    <div ng-repeat="uniqueField in ctrl.uniqueFields">
        <div>
            <label>{{uniqueField.form_field_label}}</label>
            <input required="{{uniqueField.isMandatory}}" name="{{uniqueField.form_field_id}}" ng-model="uniqueField.form_field_value" type="text">
            <div ng-messages="userForm[uniqueField.form_field_id].$error">
                <div class="error" ng-show="userForm[uniqueField.form_field_id].$error.required" ng-message="required">Please enter a {{uniqueField.form_field_label}}.</div>
            </div>
        </div>
    </div>
    <button type="submit">Submit
    </button>
</form>
</div>

And the Controller:

angular.module('demoApp', [])
    .controller('MainCtrl', MainCtrl);

function MainCtrl($log) {
    var ctrl = this;

    function activate() {
        ctrl.uniqueFields = [
      {
        form_field_label: 'Name',
        form_field_id: 'name',
        form_field_value: '',
        isMandatory: true
      }
    ]
    }

    activate();

  ctrl.submit = function() {
    $log.debug('form submitted');
  }
}

Or you can use ng-form instead of form tag.

Working fiddle: http://jsfiddle.net/Q386jmnw/


问:
Writing to a serial port in C in linux: differences between canonical and non-canonical methods
Is there difference in code for writing to a serial port in C using canonical or non-canonical method?

答:
yes, there is a major difference.

The parameters of the communication port need to be modified to be transferring 'raw' or 'cooked' characters.

'raw' transfers every char, exactly as it is received.

'cooked' makes the I/O module handle control characters, back space, etc

Suggest starting by reading the MAN page for tcgetattr() and reading about (and understanding) all the related functions.

The functions are all part of the termios family of functions.


问:
I want to read from text file that displays which character appears most or least often (keyboard or text file) ? :)
Here's my code:

```<code>include <stdio.h>

int main()
{
   char str[1000], ch;
   int i, frequency = 0;

   printf("Enter a string: ");
   gets(str);

   printf("Enter a character to find the frequency: ");
   scanf("%c",&ch);

   for(i = 0; str[i] != '\0'; ++i)
   {
       if(ch == str[i])
           ++frequency;
   }

   printf("Frequency of %c = %d", ch, frequency);

   return 0;
</code>```

I figured that the frequency of characters code I came up with is similar. How to implement the character which appears more / less often in standard input or text file?

Also, should I use StreamReader sr = new StreamReader("example.txt") for reading normal text files for this code?

EDIT: Have to use Switch /M for most often and /L for least often.

答:
That's a good start...</p>

```<code>include <stdio.h>

int main()
{
   char str[1000], ch,lookup_Chars[256];
   int i, frequency = 0;
   char counter;
   printf("Enter a string: ");
   gets(str);

   printf("Enter a character to find the frequency: ");
   scanf("%c",&ch);

   for(i = 0; str[i] != '\0'; ++i)
   {
       lookup_Chars[str[i]]++;
   }
  for(counter = 0; counter<sizeof(lookup_Chars); counter++)
   {
        printf("Frequency of %c = %d", counter, lookup_Chars[counter]);
   }

   return 0;
</code>```

Body:
Here's my code:

include <stdio.h>

int main()
{
   char str[1000], ch;
   int i, frequency = 0;

   printf("Enter a string: ");
   gets(str);

   printf("Enter a character to find the frequency: ");
   scanf("%c",&ch);

   for(i = 0; str[i] != '\0'; ++i)
   {
       if(ch == str[i])
           ++frequency;
   }

   printf("Frequency of %c = %d", ch, frequency);

   return 0;

I figured that the frequency of characters code I came up with is similar. How to implement the character which appears more / less often in standard input or text file?

Also, should I use StreamReader sr = new StreamReader("example.txt") for reading normal text files for this code?

EDIT: Have to use Switch /M for most often and /L for least often.

Body:
That's a good start...

include <stdio.h>

int main()
{
   char str[1000], ch,lookup_Chars[256];
   int i, frequency = 0;
   char counter;
   printf("Enter a string: ");
   gets(str);

   printf("Enter a character to find the frequency: ");
   scanf("%c",&ch);

   for(i = 0; str[i] != '\0'; ++i)
   {
       lookup_Chars[str[i]]++;
   }
  for(counter = 0; counter<sizeof(lookup_Chars); counter++)
   {
        printf("Frequency of %c = %d", counter, lookup_Chars[counter]);
   }

   return 0;


答:
It's caused by the CodePush task is executing the command code-push release-cordova under the default working directory $(Build.SourcesDirectory).

Since your cordova app is not in the root of the build repo, the task failed to execute code-push release-cordova command in the default working directory.

I add an issue Can not specity the directory to execute the command code-push release-cordova, you can follow up.

For Now, you can use any of below work around to build your cordova app.

Work around 1: still use CodePush task by adding a variable Build.SourceDirectory

CodePush task also can parse the variable Build.SourceDirectory, so you can define this variable with the value  $(Build.SourcesDirectory)\path\to\cordova\app in VAriables Tab (below is an example).

When you build this task, it find the value for the variable Build.SourcesDirectory firstly (if the value is empty, then find the value in Build.SourcesDirectory).

Work around 2: Use Command Line task instead the CodePush task

Settings for the Command Line task as below:

Tool: cd

Arguments: path/to/your/cordova/app & code-push login <token> & code-push release-cordova AppName OS

Below is an example settings:

Note: you should use private agent which install the code-push. If you want to use Hosted agent, you should install code-push firstly by npm install -g code-push-cli.

For TFVC repo, you should use the relative path instead of $\VisitReport_Br\Client Components\Main\Source\vr9-11.

Assume the cordova app is located in the relative path Client Components\Main\Source\vr9-11 for your TFVC repo $\VisitReport_Br as below:

```<code>TFVC Root
    |____Client Components
                |____Main
                       |____Source
                               |____vr9-11
</code>```

IN the Get source step, if you leave the local map path empty:

You should specify the variable Build.SourceDirectory with value $(Build.SourcesDirectory)\Client Components\Main\Source\vr9-11.

IN the Get source step, if you specified local map path (as the test in below example):

You should specify the variable Build.SourceDirectory with value $(Build.SourcesDirectory)\test\Client Components\Main\Source\vr9-11.

Note: Build.SourceDirectory is user defined variable, and Build.SourcesDirectory (different from Build.SourceDirectory, has s) is predefined variable.

Title: code push release cordova gives error in Visual studio team services

Body:
The code push release step in my build definition gives the following error
I am getting an error in code push release step in my build definition.
I am executing the release step right afteer cordova build. Cordova build is successfully completed but release step fails.

2017-11-10T05:42:40.8101798Z ##[debug]Evaluating condition for step: 'Release update to Staging (Syngenta_Visit_Report1)'

2017-11-10T05:42:40.8101798Z ##[debug]Evaluating: succeeded()

2017-11-10T05:42:40.8101798Z ##[debug]Evaluating succeeded:

2017-11-10T05:42:40.8101798Z ##[debug]=> (Boolean) True

2017-11-10T05:42:40.8101798Z ##[debug]Expanded: True

2017-11-10T05:42:40.8101798Z ##[debug]Result: True

2017-11-10T05:42:40.8101798Z ##[section]Starting: Release update to Staging (Syngenta_Visit_Report1)

2017-11-10T05:42:40.8111795Z ==============================================================================

2017-11-10T05:42:40.8111795Z Task : CodePush - Release (Cordova)

2017-11-10T05:42:40.8111795Z Description : Release a Cordova app update to the CodePush service

2017-11-10T05:42:40.8111795Z Version : 1.0.5

2017-11-10T05:42:40.8111795Z Author : Microsoft Corporation

2017-11-10T05:42:40.8111795Z Help :

2017-11-10T05:42:40.8111795Z ==============================================================================

2017-11-10T05:42:41.1157912Z ##[debug]BUILD_SOURCEDIRECTORY=undefined

2017-11-10T05:42:41.1177902Z ##[debug]BUILD_SOURCESDIRECTORY=d:\a\1\s

2017-11-10T05:42:41.1177902Z ##[debug]Swapping to working directory: d:\a\1\s

2017-11-10T05:42:41.1177902Z ##[debug]authType=AccessKey

2017-11-10T05:42:41.1177902Z ##[debug]accessKey=8e9a1f3c6fa9b7b572d472469017d265de1c7236

2017-11-10T05:42:41.1177902Z ##[debug]appName=Syngenta_Visit_Report1

2017-11-10T05:42:41.1187880Z ##[debug]deploymentName=Staging

2017-11-10T05:42:41.1187880Z ##[debug]platform=android

2017-11-10T05:42:41.1187880Z ##[debug]shouldBuild=true

2017-11-10T05:42:41.1187880Z ##[debug]appStoreVersion=autodetect

2017-11-10T05:42:41.1187880Z ##[debug]rollout=100%

2017-11-10T05:42:41.1187880Z ##[debug]description=

2017-11-10T05:42:41.1187880Z ##[debug]isMandatory=false

2017-11-10T05:42:41.1187880Z ##[debug]isDisabled=false

2017-11-10T05:42:41.1187880Z ##[debug]Finished Building Command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli logout

2017-11-10T05:42:42.0207706Z ##[debug]Finished Building Command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli login --accessKey "8e9a1f3c6fa9b7b572d472469017d265de1c7236"

2017-11-10T05:42:42.0207706Z ##[debug]Attempting execution of command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli login --accessKey "8e9a1f3c6fa9b7b572d472469017d265de1c7236"

2017-11-10T05:42:44.1898862Z

2017-11-10T05:42:44.1998845Z Successfully logged-in. Your session file was written to C:\Users\buildguest\AppData\Local\.code-push.config. You can run the code-push logout command at any time to delete this file and terminate your session.

2017-11-10T05:42:44.1998845Z

2017-11-10T05:42:44.2038856Z Installing local cordova cli...

2017-11-10T05:43:09.8899025Z npm WARN deprecated node-uuid@1.4.8: Use uuid module instead

2017-11-10T05:43:40.5326001Z d:\a\1\s

2017-11-10T05:43:40.5326001Z `-- cordova@7.1.0

2017-11-10T05:43:40.5326001Z +-- configstore@2.1.0

2017-11-10T05:43:40.5326001Z | +-- dot-prop@3.0.0

2017-11-10T05:43:40.5326001Z | | `-- is-obj@1.0.1

2017-11-10T05:43:40.5326001Z | +-- graceful-fs@4.1.11

2017-11-10T05:43:40.5326001Z | +-- mkdirp@0.5.1

2017-11-10T05:43:40.5326001Z | | `-- minimist@0.0.8

2017-11-10T05:43:40.5385996Z | | | +-- path-to-regexp@0.1.7

2017-11-10T05:43:40.5385996Z | | | +-- proxy-addr@2.0.2

2017-11-10T05:43:40.5385996Z | | | | +-- forwarded@0.1.2

2017-11-10T05:43:40.5385996Z | | | | `-- ipaddr.js@1.5.2

2017-11-10T05:43:40.5385996Z | | | +-- qs@6.5.1

2017-11-10T05:43:40.5395991Z | | | +-- range-parser@1.2.0

2017-11-10T05:43:40.5395991Z | | | +-- send@0.16.1

2017-11-10T05:43:40.5395991Z | | | | +-- destroy@1.0.4

2017-11-10T05:43:40.5395991Z | | | | `-- mime@1.4.1

2017-11-10T05:43:40.5395991Z | | | +-- serve-static@1.13.1

2017-11-10T05:43:40.5395991Z | | | +-- setprototypeof@1.1.0

2017-11-10T05:43:40.5395991Z | | | +-- statuses@1.3.1

2017-11-10T05:43:40.5395991Z | | | +-- type-is@1.6.15

2017-11-10T05:43:40.5395991Z | | | | `-- media-typer@0.3.0

2017-11-10T05:43:40.5395991Z | | | `-- utils-merge@1.0.1

2017-11-10T05:43:40.5395991Z | | `-- open@0.0.5

2017-11-10T05:43:40.5395991Z | +-- dep-graph@1.1.0

2017-11-10T05:43:40.5395991Z | | `-- underscore@1.2.1

2017-11-10T05:43:40.5395991Z | +-- glob@7.1.1

2017-11-10T05:43:40.5395991Z | | `-- fs.realpath@1.0.0

2017-11-10T05:43:40.5395991Z | +-- init-package-json@1.10.1

2017-11-10T05:43:40.5395991Z | | +-- glob@7.1.2

2017-11-10T05:43:40.5395991Z | | +-- npm-package-arg@5.1.2

2017-11-10T05:43:40.5395991Z | | | `-- hosted-git-info@2.5.0

2017-11-10T05:43:40.5395991Z | | +-- promzard@0.3.0

2017-11-10T05:43:40.5395991Z | | +-- read@1.0.7

2017-11-10T05:43:40.5395991Z | | | `-- mute-stream@0.0.7

2017-11-10T05:43:40.5395991Z | | +-- read-package-json@2.0.12

2017-11-10T05:43:40.5395991Z | | | +-- glob@7.1.2

2017-11-10T05:43:40.5405995Z | | +-- ansistyles@0.1.3

2017-11-10T05:43:40.5405995Z | | +-- archy@1.0.0

2017-11-10T05:43:40.5405995Z | | +-- async-some@1.0.2

2017-11-10T05:43:40.5405995Z | | +-- block-stream@0.0.9

2017-11-10T05:43:40.5405995Z | | +-- char-spinner@1.0.1

2017-11-10T05:43:40.5405995Z | | +-- chmodr@1.0.2

2017-11-10T05:43:40.5405995Z | | +-- chownr@1.0.1

2017-11-10T05:43:40.5405995Z | | +-- cmd-shim@2.0.2

2017-11-10T05:43:40.5405995Z | | +-- columnify@1.5.4

2017-11-10T05:43:40.5405995Z | | | `-- wcwidth@1.0.0

2017-11-10T05:43:40.5405995Z | | | `-- defaults@1.0.3

2017-11-10T05:43:40.5405995Z | | | `-- clone@1.0.2

2017-11-10T05:43:40.5405995Z | | +-- config-chain@1.1.10

2017-11-10T05:43:40.5405995Z | | | `-- proto-list@1.2.4

2017-11-10T05:43:40.5405995Z | | +-- dezalgo@1.0.3

2017-11-10T05:43:40.5405995Z | | | `-- asap@2.0.3

2017-11-10T05:43:40.5405995Z | | +-- editor@1.0.0

2017-11-10T05:43:40.5405995Z | | +-- fs-vacuum@1.2.9

2017-11-10T05:43:40.5405995Z | | +-- fs-write-stream-atomic@1.0.8

2017-11-10T05:43:40.5405995Z | | | `-- iferr@0.1.5

2017-11-10T05:43:40.5405995Z | | +-- fstream@1.0.10

2017-11-10T05:43:40.5405995Z | | +-- fstream-npm@1.1.1

2017-11-10T05:43:40.5405995Z | | | `-- fstream-ignore@1.0.5

2017-11-10T05:43:40.5405995Z | | +-- github-url-from-git@1.4.0

2017-11-10T05:43:40.5405995Z | | +-- github-url-from-username-repo@1.0.2

2017-11-10T05:43:40.5405995Z | | +-- glob@7.0.6

2017-11-10T05:43:40.5405995Z | | | +-- fs.realpath@1.0.0

2017-11-10T05:43:40.5415994Z | | | `-- path-is-absolute@1.0.0

2017-11-10T05:43:40.5415994Z | | +-- graceful-fs@4.1.6

2017-11-10T05:43:40.5415994Z | | +-- hosted-git-info@2.1.5

2017-11-10T05:43:40.5415994Z | | +-- imurmurhash@0.1.4

2017-11-10T05:43:40.5415994Z | | +-- inflight@1.0.5

2017-11-10T05:43:40.5415994Z | | +-- inherits@2.0.3

2017-11-10T05:43:40.5415994Z | | +-- ini@1.3.4

2017-11-10T05:43:40.5415994Z | | +-- init-package-json@1.9.4

2017-11-10T05:43:40.5415994Z | | | +-- glob@6.0.4

2017-11-10T05:43:40.5415994Z | | | | `-- path-is-absolute@1.0.0

2017-11-10T05:43:40.5415994Z | | | `-- promzard@0.3.0

2017-11-10T05:43:40.5415994Z | | +-- lockfile@1.0.1

2017-11-10T05:43:40.5415994Z | | +-- lru-cache@4.0.1

2017-11-10T05:43:40.5415994Z | | | +-- pseudomap@1.0.2

2017-11-10T05:43:40.5415994Z | | | `-- yallist@2.0.0

2017-11-10T05:43:40.5415994Z | | +-- minimatch@3.0.3

2017-11-10T05:43:40.5415994Z | | | `-- brace-expansion@1.1.6

2017-11-10T05:43:40.5415994Z | | | +-- balanced-match@0.4.2

2017-11-10T05:43:40.5415994Z | | | `-- concat-map@0.0.1

2017-11-10T05:43:40.5415994Z | | +-- mkdirp@0.5.1

2017-11-10T05:43:40.5415994Z | | | `-- minimist@0.0.8

2017-11-10T05:43:40.5415994Z | | +-- node-gyp@3.6.0

2017-11-10T05:43:40.5415994Z | | | `-- semver@5.3.0

2017-11-10T05:43:40.5415994Z | | +-- nopt@3.0.6

2017-11-10T05:43:40.5415994Z | | +-- normalize-git-url@3.0.2

2017-11-10T05:43:40.5415994Z | | +-- normalize-package-data@2.3.5

2017-11-10T05:43:40.5415994Z | | | `-- is-builtin-module@1.0.0

2017-11-10T05:43:40.5415994Z | | | `-- builtin-modules@1.1.0

2017-11-10T05:43:40.5415994Z | | +-- npm-cache-filename@1.0.2

2017-11-10T05:43:40.5415994Z | | +-- npm-install-checks@1.0.7

2017-11-10T05:43:40.5415994Z | | +-- npm-package-arg@4.1.0

2017-11-10T05:43:40.5415994Z | | +-- npm-registry-client@7.2.1

2017-11-10T05:43:40.5415994Z | | | +-- concat-stream@1.5.2

2017-11-10T05:43:40.5415994Z | | | | +-- readable-stream@2.0.6

2017-11-10T05:43:40.5415994Z | | | | | +-- core-util-is@1.0.2

2017-11-10T05:43:40.5415994Z | | | | | +-- isarray@1.0.0

2017-11-10T05:43:40.5425994Z | | | | | +-- process-nextick-args@1.0.7

2017-11-10T05:43:40.5425994Z | | | | | +-- string_decoder@0.10.31

2017-11-10T05:43:40.5425994Z | | | | | `-- util-deprecate@1.0.2

2017-11-10T05:43:40.5425994Z | | | | `-- typedarray@0.0.6

2017-11-10T05:43:40.5425994Z | | | `-- retry@0.10.0

2017-11-10T05:43:40.5425994Z | | +-- npm-user-validate@0.1.5

2017-11-10T05:43:40.5425994Z | | +-- npmlog@2.0.4

2017-11-10T05:43:40.5425994Z | | | +-- are-we-there-yet@1.1.2

2017-11-10T05:43:40.5425994Z | | | | `-- delegates@1.0.0

2017-11-10T05:43:40.5425994Z | | | `-- gauge@1.2.7

2017-11-10T05:43:40.5425994Z | | | +-- has-unicode@2.0.0

2017-11-10T05:43:40.5425994Z | | | +-- lodash.pad@4.4.0

2017-11-10T05:43:40.5425994Z | | | | +-- lodash._baseslice@4.0.0

2017-11-10T05:43:40.5425994Z | | | | +-- lodash._basetostring@4.12.0

2017-11-10T05:43:40.5425994Z | | | | `-- lodash.tostring@4.1.4

2017-11-10T05:43:40.5425994Z | | | +-- lodash.padend@4.5.0

2017-11-10T05:43:40.5425994Z | | | `-- lodash.padstart@4.5.0

2017-11-10T05:43:40.5425994Z | | +-- once@1.4.0

2017-11-10T05:43:40.5425994Z | | +-- opener@1.4.1

2017-11-10T05:43:40.5425994Z | | +-- osenv@0.1.3

2017-11-10T05:43:40.5425994Z | | | +-- os-homedir@1.0.0

2017-11-10T05:43:40.5425994Z | | | `-- os-tmpdir@1.0.1

2017-11-10T05:43:40.5425994Z | | +-- path-is-inside@1.0.1

2017-11-10T05:43:40.5425994Z | | +-- read@1.0.7

2017-11-10T05:43:40.5425994Z | | | `-- mute-stream@0.0.5

2017-11-10T05:43:40.5425994Z | | +-- read-installed@4.0.3

2017-11-10T05:43:40.5425994Z | | | +-- debuglog@1.0.1

2017-11-10T05:43:40.5425994Z | | | +-- readdir-scoped-modules@1.0.2

2017-11-10T05:43:40.5425994Z | | | `-- util-extend@1.0.1

2017-11-10T05:43:40.5425994Z | | +-- read-package-json@2.0.4

2017-11-10T05:43:40.5425994Z | | | +-- glob@6.0.4

2017-11-10T05:43:40.5425994Z | | | | `-- path-is-absolute@1.0.0

2017-11-10T05:43:40.5425994Z | | | `-- json-parse-helpfulerror@1.0.3

2017-11-10T05:43:40.5425994Z | | | `-- jju@1.3.0

2017-11-10T05:43:40.5436021Z | | +-- readable-stream@2.1.5

2017-11-10T05:43:40.5436021Z | | | +-- buffer-shims@1.0.0

2017-11-10T05:43:40.5436021Z | | | +-- core-util-is@1.0.2

2017-11-10T05:43:40.5436021Z | | | +-- isarray@1.0.0

2017-11-10T05:43:40.5436021Z | | | +-- process-nextick-args@1.0.7

2017-11-10T05:43:40.5436021Z | | | +-- string_decoder@0.10.31

2017-11-10T05:43:40.5436021Z | | | `-- util-deprecate@1.0.2

2017-11-10T05:43:40.5436021Z | | +-- realize-package-specifier@3.0.1

2017-11-10T05:43:40.5436021Z | | +-- request@2.74.0

2017-11-10T05:43:40.5436021Z | | | +-- aws-sign2@0.6.0

2017-11-10T05:43:40.5436021Z | | | +-- aws4@1.4.1

2017-11-10T05:43:40.5436021Z | | | +-- bl@1.1.2

2017-11-10T05:43:40.5436021Z | | | | `-- readable-stream@2.0.6

2017-11-10T05:43:40.5436021Z | | | | +-- core-util-is@1.0.2

2017-11-10T05:43:40.5436021Z | | | | +-- isarray@1.0.0

2017-11-10T05:43:40.5436021Z | | | | +-- process-nextick-args@1.0.7

2017-11-10T05:43:40.5436021Z | | | | +-- string_decoder@0.10.31

2017-11-10T05:43:40.5436021Z | | | | `-- util-deprecate@1.0.2

2017-11-10T05:43:40.5436021Z | | | +-- caseless@0.11.0

2017-11-10T05:43:40.5436021Z | | | +-- combined-stream@1.0.5

2017-11-10T05:43:40.5436021Z | | | | `-- delayed-stream@1.0.0

2017-11-10T05:43:40.5436021Z | | | +-- extend@3.0.0

2017-11-10T05:43:40.5436021Z | | | +-- forever-agent@0.6.1

2017-11-10T05:43:40.5436021Z | | | +-- form-data@1.0.0-rc4

2017-11-10T05:43:40.5436021Z | | | | `-- async@1.5.2

2017-11-10T05:43:40.5436021Z | | | +-- har-validator@2.0.6

2017-11-10T05:43:40.5436021Z | | | | +-- chalk@1.1.3

2017-11-10T05:43:40.5436021Z | | | | | +-- ansi-styles@2.2.1

2017-11-10T05:43:40.5436021Z | | | | | +-- escape-string-regexp@1.0.5

2017-11-10T05:43:40.5436021Z | | | | | +-- has-ansi@2.0.0

2017-11-10T05:43:40.5446008Z | | | | | `-- supports-color@2.0.0

2017-11-10T05:43:40.5446008Z | | | | +-- commander@2.9.0

2017-11-10T05:43:40.5446008Z | | | | | `-- graceful-readlink@1.0.1

2017-11-10T05:43:40.5446008Z | | | | +-- is-my-json-valid@2.13.1

2017-11-10T05:43:40.5446008Z | | | | | +-- generate-function@2.0.0

2017-11-10T05:43:40.5446008Z | | | | | +-- generate-object-property@1.2.0

2017-11-10T05:43:40.5446008Z | | | | | | `-- is-property@1.0.2

2017-11-10T05:43:40.5456012Z | | | | | +-- jsonpointer@2.0.0

2017-11-10T05:43:40.5456012Z | | | | | `-- xtend@4.0.1

2017-11-10T05:43:40.5456012Z | | | | `-- pinkie-promise@2.0.1

2017-11-10T05:43:40.5456012Z | | | | `-- pinkie@2.0.4

2017-11-10T05:43:40.5456012Z | | | +-- hawk@3.1.3

2017-11-10T05:43:40.5456012Z | | | | +-- boom@2.10.1

2017-11-10T05:43:40.5456012Z | | | | +-- cryptiles@2.0.5

2017-11-10T05:43:40.5456012Z npm WARN enoent ENOENT: no such file or directory, open 'd:\a\1\s\package.json'

2017-11-10T05:43:40.5456012Z | | | | +-- hoek@2.16.3

2017-11-10T05:43:40.5466017Z npm WARN s No description

2017-11-10T05:43:40.5466017Z | | | | `-- sntp@1.0.9

2017-11-10T05:43:40.5466017Z | | | +-- http-signature@1.1.1

2017-11-10T05:43:40.5466017Z | | | | +-- assert-plus@0.2.0

2017-11-10T05:43:40.5466017Z | | | | +-- jsprim@1.3.0

2017-11-10T05:43:40.5466017Z | | | | | +-- extsprintf@1.0.2

2017-11-10T05:43:40.5466017Z | | | | | +-- json-schema@0.2.2

2017-11-10T05:43:40.5466017Z | | | | | `-- verror@1.3.6

2017-11-10T05:43:40.5466017Z | | | | `-- sshpk@1.9.2

2017-11-10T05:43:40.5466017Z | | | | +-- asn1@0.2.3

2017-11-10T05:43:40.5466017Z | | | | +-- assert-plus@1.0.0

2017-11-10T05:43:40.5466017Z | | | | +-- dashdash@1.14.0

2017-11-10T05:43:40.5466017Z | | | | +-- ecc-jsbn@0.1.1

2017-11-10T05:43:40.5466017Z | | | | +-- getpass@0.1.6

2017-11-10T05:43:40.5466017Z | | | | +-- jodid25519@1.0.2

2017-11-10T05:43:40.5466017Z | | | | +-- jsbn@0.1.0

2017-11-10T05:43:40.5466017Z | | | | `-- tweetnacl@0.13.3

2017-11-10T05:43:40.5466017Z | | | +-- is-typedarray@1.0.0

2017-11-10T05:43:40.5466017Z | | | +-- isstream@0.1.2

2017-11-10T05:43:40.5466017Z | | | +-- json-stringify-safe@5.0.1

2017-11-10T05:43:40.5466017Z | | | +-- mime-types@2.1.11

2017-11-10T05:43:40.5466017Z | | | | `-- mime-db@1.23.0

2017-11-10T05:43:40.5466017Z | | | +-- node-uuid@1.4.7

2017-11-10T05:43:40.5466017Z | | | +-- oauth-sign@0.8.2

2017-11-10T05:43:40.5466017Z | | | +-- qs@6.2.1

2017-11-10T05:43:40.5466017Z | | | +-- stringstream@0.0.5

2017-11-10T05:43:40.5466017Z | | | +-- tough-cookie@2.3.1

2017-11-10T05:43:40.5466017Z | | | `-- tunnel-agent@0.4.3

2017-11-10T05:43:40.5466017Z | | +-- retry@0.10.0

2017-11-10T05:43:40.5466017Z | | +-- rimraf@2.5.4

2017-11-10T05:43:40.5466017Z | | +-- semver@5.1.0

2017-11-10T05:43:40.5466017Z | | +-- sha@2.0.1

2017-11-10T05:43:40.5466017Z | | | `-- readable-stream@2.0.2

2017-11-10T05:43:40.5466017Z | | | +-- core-util-is@1.0.1

2017-11-10T05:43:40.5466017Z | | | +-- isarray@0.0.1

2017-11-10T05:43:40.5476016Z | | | +-- process-nextick-args@1.0.3

2017-11-10T05:43:40.5476016Z | | | +-- string_decoder@0.10.31

2017-11-10T05:43:40.5476016Z | | | `-- util-deprecate@1.0.1

2017-11-10T05:43:40.5476016Z | | +-- slide@1.1.6

2017-11-10T05:43:40.5476016Z | | +-- sorted-object@2.0.0

2017-11-10T05:43:40.5476016Z | | +-- spdx-license-ids@1.2.2

2017-11-10T05:43:40.5476016Z | | +-- strip-ansi@3.0.1

2017-11-10T05:43:40.5476016Z | | +-- tar@2.2.1

2017-11-10T05:43:40.5476016Z | | +-- text-table@0.2.0

2017-11-10T05:43:40.5476016Z | | +-- uid-number@0.0.6

2017-11-10T05:43:40.5476016Z | | +-- umask@1.1.0

2017-11-10T05:43:40.5476016Z | | +-- validate-npm-package-license@3.0.1

2017-11-10T05:43:40.5476016Z | | | +-- spdx-correct@1.0.2

2017-11-10T05:43:40.5476016Z | | | `-- spdx-expression-parse@1.0.2

2017-11-10T05:43:40.5476016Z | | | `-- spdx-exceptions@1.0.4

2017-11-10T05:43:40.5476016Z | | +-- validate-npm-package-name@2.2.2

2017-11-10T05:43:40.5476016Z | | | `-- builtins@0.0.7

2017-11-10T05:43:40.5476016Z | | +-- which@1.2.11

2017-11-10T05:43:40.5476016Z | | | `-- isexe@1.1.2

2017-11-10T05:43:40.5476016Z | | +-- wrappy@1.0.2

2017-11-10T05:43:40.5476016Z | | `-- write-file-atomic@1.1.4

2017-11-10T05:43:40.5476016Z | +-- opener@1.4.2

2017-11-10T05:43:40.5476016Z | +-- plist@2.0.1

2017-11-10T05:43:40.5476016Z | | +-- base64-js@1.1.2

2017-11-10T05:43:40.5476016Z | | `-- xmlbuilder@8.2.2

2017-11-10T05:43:40.5476016Z | +-- properties-parser@0.3.1

2017-11-10T05:43:40.5476016Z | | `-- string.prototype.codepointat@0.2.0

2017-11-10T05:43:40.5476016Z | +-- request@2.79.0

2017-11-10T05:43:40.5476016Z | | +-- aws-sign2@0.6.0

2017-11-10T05:43:40.5476016Z | | +-- aws4@1.6.0

2017-11-10T05:43:40.5476016Z | | +-- caseless@0.11.0

2017-11-10T05:43:40.5476016Z | | +-- combined-stream@1.0.5

2017-11-10T05:43:40.5476016Z | | | `-- delayed-stream@1.0.0

2017-11-10T05:43:40.5476016Z | | +-- extend@3.0.1

2017-11-10T05:43:40.5476016Z | | +-- forever-agent@0.6.1

2017-11-10T05:43:40.5476016Z | | +-- form-data@2.1.4

2017-11-10T05:43:40.5476016Z | | | `-- asynckit@0.4.0

2017-11-10T05:43:40.5476016Z | | +-- har-validator@2.0.6

2017-11-10T05:43:40.5476016Z | | | +-- commander@2.11.0

2017-11-10T05:43:40.5476016Z | | | +-- is-my-json-valid@2.16.1

2017-11-10T05:43:40.5476016Z | | | | +-- generate-function@2.0.0

2017-11-10T05:43:40.5486013Z | | | | +-- generate-object-property@1.2.0

2017-11-10T05:43:40.5486013Z | | | | | `-- is-property@1.0.2

2017-11-10T05:43:40.5486013Z | | | | `-- jsonpointer@4.0.1

2017-11-10T05:43:40.5486013Z | | | `-- pinkie-promise@2.0.1

2017-11-10T05:43:40.5486013Z | | | `-- pinkie@2.0.4

2017-11-10T05:43:40.5486013Z | | +-- hawk@3.1.3

2017-11-10T05:43:40.5486013Z | | | +-- boom@2.10.1

2017-11-10T05:43:40.5486013Z | | | +-- cryptiles@2.0.5

2017-11-10T05:43:40.5486013Z | | | +-- hoek@2.16.3

2017-11-10T05:43:40.5486013Z | | | `-- sntp@1.0.9

2017-11-10T05:43:40.5486013Z | | +-- http-signature@1.1.1

2017-11-10T05:43:40.5506015Z +-- semver-diff@2.1.0

2017-11-10T05:43:40.5506015Z `-- string-length@1.0.1

2017-11-10T05:43:40.5506015Z

2017-11-10T05:43:40.5506015Z npm WARN s No repository field.

2017-11-10T05:43:40.5516012Z npm WARN s No README data

2017-11-10T05:43:40.5516012Z npm WARN s No license field.

2017-11-10T05:43:40.6136014Z ##[debug]Finished Building Command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli release-cordova "Syngenta_Visit_Report1"
 "android" --deploymentName "Staging" --rollout "100%" --build

2017-11-10T05:43:40.6136014Z ##[debug]Attempting execution of command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli release-cordova "Syngenta_Visit_Report1"
 "android" --deploymentName "Staging" --rollout "100%" --build

2017-11-10T05:43:41.5175965Z Running "cordova build" command:

2017-11-10T05:43:41.5175965Z

2017-11-10T05:43:43.1816076Z

2017-11-10T05:43:43.1816076Z You have been opted out of telemetry. To change this, run: cordova telemetry on.

2017-11-10T05:43:43.2035832Z Error: Current working directory is not a Cordova-based project.

2017-11-10T05:43:43.2186045Z [Error] Unable to build project. Please ensure that this is a Cordova project and that platform "android" was added with "cordova platform add android"

2017-11-10T05:43:43.2275838Z ##[debug]Finished Building Command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli logout

2017-11-10T05:43:44.1973890Z ##[debug]task result: Failed

2017-11-10T05:43:44.1973890Z ##[debug]Processed: ##vso[task.complete result=Failed;]Command failed: release-cordova

2017-11-10T05:43:44.1973890Z Command failed: release-cordova

2017-11-10T05:43:44.2023858Z ##[section]Finishing: Release update to Staging (Syngenta_Visit_Report1)

I am unable to resolve it.Can anyone help?

2017-11-17T06:11:01.9461272Z ##[debug]Evaluating succeeded:
2017-11-17T06:11:01.9461272Z ##[debug]=> (Boolean) True
2017-11-17T06:11:01.9471275Z ##[debug]Expanded: True
2017-11-17T06:11:01.9471275Z ##[debug]Result: True
2017-11-17T06:11:01.9471275Z ##[section]Starting: Release update to Staging (Syngenta_Visit_Report1)
2017-11-17T06:11:01.9471275Z ==============================================================================
2017-11-17T06:11:01.9471275Z Task         : CodePush - Release (Cordova)
2017-11-17T06:11:01.9471275Z Description  : Release a Cordova app update to the CodePush service
2017-11-17T06:11:01.9471275Z Version      : 1.0.5
2017-11-17T06:11:01.9471275Z Author       : Microsoft Corporation
2017-11-17T06:11:01.9471275Z Help         :
2017-11-17T06:11:01.9471275Z ==============================================================================
2017-11-17T06:11:02.2201481Z ##[debug]BUILD_SOURCEDIRECTORY=$(Build.SourceDirectory)\$\VisitReport_Br\Client Components\Main\Source\vr9-11
2017-11-17T06:11:02.2211309Z ##[debug]Swapping to working directory: $(Build.SourceDirectory)\$\VisitReport_Br\Client Components\Main\Source\vr9-11
2017-11-17T06:11:02.2221312Z ##[debug]load strings from: d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\vsts-task-lib\lib.json
2017-11-17T06:11:02.2231307Z ##[debug]load loc strings from: d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\vsts-task-lib\Strings\resources.resjson\en-US\resources.resjson
2017-11-17T06:11:02.2241434Z ##[debug]task result: Failed
2017-11-17T06:11:02.2271313Z ##[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: ENOENT: no such file or directory, uv_chdir
2017-11-17T06:11:02.2271313Z Unhandled: ENOENT: no such file or directory, uv_chdir
2017-11-17T06:11:02.2321330Z ##[section]Finishing: Release update to Staging (Syngenta_Visit_Report1)

Error after keeping local path under(build.sourcedirectory) section empty

2017-11-17T09:13:07.6795222Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
2017-11-17T09:13:07.6795222Z ZUMOAPPNAME@1.0.0 d:\a\3\s
2017-11-17T09:13:07.6795222Z `-- (empty)
2017-11-17T09:13:07.6795222Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
2017-11-17T09:13:07.6795222Z
2017-11-17T09:13:07.6835014Z npm WARN ZUMOAPPNAME@1.0.0 No description
2017-11-17T09:13:07.8445206Z npm WARN ZUMOAPPNAME@1.0.0 No license field.
2017-11-17T09:13:07.8465194Z npm ERR! Windows_NT 10.0.14393
2017-11-17T09:13:07.8475041Z npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "cordova"
2017-11-17T09:13:07.8475041Z npm ERR! node v6.10.0
2017-11-17T09:13:07.8475041Z npm ERR! npm  v3.10.10
2017-11-17T09:13:07.8475041Z npm ERR! path d:\a\3\s\node_modules\cordova\node_modules\.bin\acorn.cmd
2017-11-17T09:13:07.8475041Z npm ERR! code EEXIST
2017-11-17T09:13:07.8475041Z
2017-11-17T09:13:07.8475041Z npm ERR! Refusing to delete d:\a\3\s\node_modules\cordova\node_modules\.bin\acorn.cmd: ..\acorn\bin\acorn symlink target is not controlled by npm d:\a\3\s\node_modules\cordova\node_modules\acorn
2017-11-17T09:13:07.8475041Z npm ERR! File exists: d:\a\3\s\node_modules\cordova\node_modules\.bin\acorn.cmd
2017-11-17T09:13:07.8475041Z npm ERR! Move it away, and try again.
2017-11-17T09:13:07.8475041Z
2017-11-17T09:13:07.8475041Z npm ERR! Please include the following file with any support request:
2017-11-17T09:13:07.8475041Z npm ERR!     d:\a\3\s\Client Components\Main\Source\vr9-11\npm-debug.log
2017-11-17T09:13:07.8475041Z npm ERR! code 1
2017-11-17T09:13:07.9305055Z ##[debug]load strings from: d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\vsts-task-lib\lib.json
2017-11-17T09:13:07.9325060Z Unhandled: Command failed: npm install cordova
2017-11-17T09:13:07.9325060Z ##[debug]load loc strings from: d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\vsts-task-lib\Strings\resources.resjson\en-US\resources.resjson
2017-11-17T09:13:07.9325060Z ##[debug]task result: Failed
2017-11-17T09:13:07.9365053Z ##[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: Command failed: npm install cordova
2017-11-17T09:13:07.9415050Z ##[section]Finishing: Release update to Staging (Syngenta_Visit_Report1)

Full log here

Body:
It's caused by the CodePush task is executing the command code-push release-cordova under the default working directory $(Build.SourcesDirectory).

Since your cordova app is not in the root of the build repo, the task failed to execute code-push release-cordova command in the default working directory.

I add an issue Can not specity the directory to execute the command code-push release-cordova, you can follow up.

For Now, you can use any of below work around to build your cordova app.

Work around 1: still use CodePush task by adding a variable Build.SourceDirectory

CodePush task also can parse the variable Build.SourceDirectory, so you can define this variable with the value  $(Build.SourcesDirectory)\path\to\cordova\app in VAriables Tab (below is an example).

When you build this task, it find the value for the variable Build.SourcesDirectory firstly (if the value is empty, then find the value in Build.SourcesDirectory).

Work around 2: Use Command Line task instead the CodePush task

Settings for the Command Line task as below:

Tool: cd

Arguments: path/to/your/cordova/app & code-push login <token> & code-push release-cordova AppName OS

Below is an example settings:

Note: you should use private agent which install the code-push. If you want to use Hosted agent, you should install code-push firstly by npm install -g code-push-cli.

For TFVC repo, you should use the relative path instead of $\VisitReport_Br\Client Components\Main\Source\vr9-11.

Assume the cordova app is located in the relative path Client Components\Main\Source\vr9-11 for your TFVC repo $\VisitReport_Br as below:

TFVC Root
    |____Client Components
                |____Main
                       |____Source
                               |____vr9-11

IN the Get source step, if you leave the local map path empty:

You should specify the variable Build.SourceDirectory with value $(Build.SourcesDirectory)\Client Components\Main\Source\vr9-11.

IN the Get source step, if you specified local map path (as the test in below example):

You should specify the variable Build.SourceDirectory with value $(Build.SourcesDirectory)\test\Client Components\Main\Source\vr9-11.

Note: Build.SourceDirectory is user defined variable, and Build.SourcesDirectory (different from Build.SourceDirectory, has s) is predefined variable.


问:
Moodle setting permission has no effect
I configured REST webservice on Moodle 3.0.5 to use function core_course_get_courses which is supposed to return a response containing basic info about all available courses.

This is the URL I've been using:

```<code>https://example.com/webservice/rest/server.php?wstoken=713898e3fcaf9ead2218eb7565993230&wsfunction=core_course_get_courses&moodlewsrestformat=json
</code>```

And, this is what I get:

```<code>{
  "exception": "required_capability_exception",
  "errorcode": "nopermissions",
  "message": "Sorry, but you do not currently have permissions to do that (View courses without participation)"
}
</code>```

The permission in question has been set from the start, that is:

```<code>moodle/course:view
</code>```

It does not have any effect. I even allowed everything, some few hundred permissions just to see if it would work, but still no effect.

I used another function with the same service, it does work!:

```<code>core_enrol_get_enrolled_users
</code>```

Another important fact is that the core_course_get_courses function works on a local, development machine with fresh installation of Moodle. The production environment has 50 additional plugins installed.
The debugging, "extra Moodle debug messages for developers" has been enabled but there are no errors shown.

What could be the cause for this?

P.S. Dev. machine is Ubuntu 14.04

答:
Please check the required capabilities for this function and then go to
site Adminitration->users->permission->define

moodle/admin/roles/manage.php
a role then show the listing of roles

moodle/admin/roles/define.php?action=edit&roleid=9

allow the capabilities

Title: Moodle setting permission has no effect

Body:
I configured REST webservice on Moodle 3.0.5 to use function core_course_get_courses which is supposed to return a response containing basic info about all available courses.

This is the URL I've been using:

https://example.com/webservice/rest/server.php?wstoken=713898e3fcaf9ead2218eb7565993230&wsfunction=core_course_get_courses&moodlewsrestformat=json

And, this is what I get:

{
  "exception": "required_capability_exception",
  "errorcode": "nopermissions",
  "message": "Sorry, but you do not currently have permissions to do that (View courses without participation)"
}

The permission in question has been set from the start, that is:

moodle/course:view

It does not have any effect. I even allowed everything, some few hundred permissions just to see if it would work, but still no effect.

I used another function with the same service, it does work!:

core_enrol_get_enrolled_users

Another important fact is that the core_course_get_courses function works on a local, development machine with fresh installation of Moodle. The production environment has 50 additional plugins installed.
The debugging, "extra Moodle debug messages for developers" has been enabled but there are no errors shown.

What could be the cause for this?

P.S. Dev. machine is Ubuntu 14.04


问:
How to prevent a database search from running on an empty string?
With my current code when I enter an empty string or a string of one space in the search input field I get every item in the database as a result. How can i make it so that the search doesn't run when an empty string is entered?</p>

```<code>    <form action="search.php" method="POST">
        <input type="text" name="search" placeholder="search site">
        <button type="submit" name="submit-search"><img src="../assets/search icon-05.png"></button>
    </form>

    <?php
        if (isset($_POST['submit-search'])){
            $search = mysqli_real_escape_string($conn, $_POST['search']);
            $sql = "SELECT * FROM articles WHERE title LIKE '%$search%' OR abstract LIKE '%$search%' OR keywords LIKE '%$search%'";
            $result = mysqli_query($conn, $sql);
            $queryResult = mysqli_num_rows($result);

            if ($queryResult > 0){
                echo $queryResult . " results found";

                while ($row = mysqli_fetch_assoc($result)){
                    echo "<div class='articleItem'>
                        <h2>".$row['title']."</h2>
                        <p>".$row['abstract']."</p>
                        <a href=".$row['link']." target='_blank'>".$row['link']."</a>
                    </div>";
                }
            }
            else {
                echo "There are no results matching your search.";
            }
        }
    ?>
</code>```

答:
Use the below function to get the query string </p>

```<code><?php
$arr_with_index['title'] = $_POST['search'];
$search_qry = getLikeSearchQuery($arr_with_index)
// Add this $search_qry in your query string. This help you to searc N number of values

// For Array and Equal values
 function getSearchQuery($arr_with_index) {
  $search_qry = "";
        if(isset($arr_with_index)){
              foreach(@$arr_with_index as $index => $value) {
                    if(is_array($value)) {
                          if( implode("",$value) != '' ) {
                                if($index && $value) { $search_qry .= " and $index IN ('".implode("','",$value)."') "; }
                          }
                    } else {
                          $value = trim($value);
                          if($index && $value) { $search_qry .= " and "; $search_qry .= " $index = \"$value\" "; }
                    }
              }
        }
  return $search_qry;
}
// For String
function getLikeSearchQuery($arr_with_index) {
  $search_qry = "";

  foreach($arr_with_index as $index => $value) {
        $inner_flag = false;
        if($index && $value) {
              $field_arr = explode(",", $index);
              foreach($field_arr as $field_index => $field_value) {
                    if(!$inner_flag) { $search_qry .= " and ( "; } else { $search_qry .= " or "; }
                    $value = trim($value);
                    $search_qry .= " $field_value like "; $search_qry .= "  \"%$value%\" ";
                    $inner_flag = true;
              }
        }
        if($inner_flag) { $search_qry .= " ) "; }
  }

  return $search_qry;
}

?>
</code>```

Body:
With my current code when I enter an empty string or a string of one space in the search input field I get every item in the database as a result. How can i make it so that the search doesn't run when an empty string is entered?

    <form action="search.php" method="POST">
        <input type="text" name="search" placeholder="search site">
        <button type="submit" name="submit-search"></button>
    </form>

    <?php
        if (isset($_POST['submit-search'])){
            $search = mysqli_real_escape_string($conn, $_POST['search']);
            $sql = "SELECT * FROM articles WHERE title LIKE '%$search%' OR abstract LIKE '%$search%' OR keywords LIKE '%$search%'";
            $result = mysqli_query($conn, $sql);
            $queryResult = mysqli_num_rows($result);

            if ($queryResult > 0){
                echo $queryResult . " results found";

                while ($row = mysqli_fetch_assoc($result)){
                    echo "

".$row['title']."

".$row['abstract']."

                        ".$row['link']."

";
                }
            }
            else {
                echo "There are no results matching your search.";
            }
        }
    ?>

Body:
Use the below function to get the query string

<?php
$arr_with_index['title'] = $_POST['search'];
$search_qry = getLikeSearchQuery($arr_with_index)
// Add this $search_qry in your query string. This help you to searc N number of values

// For Array and Equal values
 function getSearchQuery($arr_with_index) {
  $search_qry = "";
        if(isset($arr_with_index)){
              foreach(@$arr_with_index as $index => $value) {
                    if(is_array($value)) {
                          if( implode("",$value) != '' ) {
                                if($index && $value) { $search_qry .= " and $index IN ('".implode("','",$value)."') "; }
                          }
                    } else {
                          $value = trim($value);
                          if($index && $value) { $search_qry .= " and "; $search_qry .= " $index = \"$value\" "; }
                    }
              }
        }
  return $search_qry;
}
// For String
function getLikeSearchQuery($arr_with_index) {
  $search_qry = "";

  foreach($arr_with_index as $index => $value) {
        $inner_flag = false;
        if($index && $value) {
              $field_arr = explode(",", $index);
              foreach($field_arr as $field_index => $field_value) {
                    if(!$inner_flag) { $search_qry .= " and ( "; } else { $search_qry .= " or "; }
                    $value = trim($value);
                    $search_qry .= " $field_value like "; $search_qry .= "  \"%$value%\" ";
                    $inner_flag = true;
              }
        }
        if($inner_flag) { $search_qry .= " ) "; }
  }

  return $search_qry;
}

?>


问:
Access the SD card files from Android application
I have the following requirements:

When the user clicks on the button , the SD card should be accessible to the user.

The user clicks on a specific image & I need to save the SD card path of the image selected

I need to resize the image before displaying that to the user within the Android application

Kindly provide me any blog/article link from where I can get the sample code for the same.
Thanks in advance.

答:
You can use standard file APIs to access "/sdcard", or more safely:

```<code>Environment.getExternalStorageDirectory()
</code>```

Also, you can scale images easily using

```<code>Bitmap.createScaledBitmap()
</code>```

Body:
You can use standard file APIs to access "/sdcard", or more safely:

Environment.getExternalStorageDirectory()

Also, you can scale images easily using

Bitmap.createScaledBitmap()

ContentLicense: CC BY-SA 2.5