问:
Hive execute "insert into ... values ..." very slow
I build a hadoop & hive cluster and try to do some test. But it's really slow.

table

table value_count

```<code>+--------------------------------------------------------------+--+
|                        createtab_stmt                        |
+--------------------------------------------------------------+--+
| CREATE TABLE `value_count`(                                  |
|   `key` int,                                                 |
|   `count` int,                                               |
|   `create_date` date COMMENT '????')                         |
| COMMENT 'This is a group table'                              |
| ROW FORMAT SERDE                                             |
|   'org.apache.hadoop.hive.ql.io.orc.OrcSerde'                |
| STORED AS INPUTFORMAT                                        |
|   'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'          |
| OUTPUTFORMAT                                                 |
|   'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'         |
| LOCATION                                                     |
|   'hdfs://avatarcluster/hive/warehouse/test.db/value_count'  |
| TBLPROPERTIES (                                              |
|   'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}',      |
|   'numFiles'='7',                                            |
|   'numRows'='7',                                             |
|   'rawDataSize'='448',                                       |
|   'totalSize'='2297',                                        |
|   'transient_lastDdlTime'='1496217645')                      |
+--------------------------------------------------------------+--+
</code>```

sql execution

```<code>insert into value_count values (5, 1, '2017-05-06');
</code>```

I've execute this sql for several times, each takes about 4 or 5 mins

hadoop container log

```<code>2017-05-31 16:00:45,041 [INFO] [Dispatcher thread {Central}] |app.DAGAppMaster|: Central Dispatcher queue size after DAG completion, before cleanup: 0
2017-05-31 16:00:45,041 [INFO] [Dispatcher thread {Central}] |app.DAGAppMaster|: Waiting for next DAG to be submitted.
2017-05-31 16:00:45,042 [INFO] [Dispatcher thread {Central}] |app.DAGAppMaster|: Cleaning up DAG: name=insert into value_count valu...'2017-05-06')(Stage-1), with id=dag_1490688643958_53401_1
2017-05-31 16:00:45,042 [INFO] [Dispatcher thread {Central}] |container.AMContainerMap|: Cleaned up completed containers on dagComplete. Removed=0, Remaining=1
2017-05-31 16:00:45,044 [INFO] [Dispatcher thread {Central}] |app.DAGAppMaster|: Completed cleanup for DAG: name=insert into value_count valu...'2017-05-06')(Stage-1), with id=dag_1490688643958_53401_1
2017-05-31 16:00:50,749 [INFO] [DelayedContainerManager] |rm.YarnTaskSchedulerService|: No taskRequests. Container's idle timeout delay expired or is new. Releasing container, containerId=container_1490688643958_53401_01_000002, containerExpiryTime=1496217650577, idleTimeout=5000, taskRequestsCount=0, heldContainers=1, delayedContainers=0, isNew=false
2017-05-31 16:00:50,752 [INFO] [Dispatcher thread {Central}] |history.HistoryEventHandler|: [HISTORY][DAG:dag_1490688643958_53401_1][Event:CONTAINER_STOPPED]: containerId=container_1490688643958_53401_01_000002, stoppedTime=1496217650751, exitStatus=0
2017-05-31 16:00:50,753 [INFO] [ContainerLauncher #1] |launcher.TezContainerLauncherImpl|: Stopping container_1490688643958_53401_01_000002
2017-05-31 16:00:50,753 [INFO] [ContainerLauncher #1] |impl.ContainerManagementProtocolProxy|: Opening proxy : app08.hp.sp.tst.bmsre.com:51640
2017-05-31 16:00:51,628 [INFO] [Dispatcher thread {Central}] |container.AMContainerImpl|: Container container_1490688643958_53401_01_000002 exited with diagnostics set to Container failed, exitCode=-105. Container killed by the ApplicationMaster.
Container killed on request. Exit code is 143
Container exited with a non-zero exit code 143

2017-05-31 16:01:29,678 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 51 lastPreemptionHeartbeat: 50
2017-05-31 16:02:19,740 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 101 lastPreemptionHeartbeat: 100
2017-05-31 16:03:09,801 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 151 lastPreemptionHeartbeat: 150
2017-05-31 16:03:59,858 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 201 lastPreemptionHeartbeat: 200
2017-05-31 16:04:49,915 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 251 lastPreemptionHeartbeat: 250
2017-05-31 16:05:39,971 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 301 lastPreemptionHeartbeat: 300
2017-05-31 16:06:09,581 [INFO] [DAGSubmissionTimer] |rm.TaskSchedulerManager|: TaskScheduler notified that it should unregister from RM
2017-05-31 16:06:09,581 [INFO] [DAGSubmissionTimer] |app.DAGAppMaster|: No current running DAG, shutting down the AM
2017-05-31 16:06:09,581 [INFO] [DAGSubmissionTimer] |app.DAGAppMaster|: DAGAppMasterShutdownHandler invoked
2017-05-31 16:06:09,581 [INFO] [DAGSubmissionTimer] |app.DAGAppMaster|: Handling DAGAppMaster shutdown
2017-05-31 16:06:09,582 [INFO] [AMShutdownThread] |app.DAGAppMaster|: Sleeping for 5 seconds before shutting down
2017-05-31 16:06:14,582 [INFO] [AMShutdownThread] |app.DAGAppMaster|: Calling stop for all the services
2017-05-31 16:06:14,582 [INFO] [AMShutdownThread] |rm.YarnTaskSchedulerService|: Initiating stop of YarnTaskScheduler
2017-05-31 16:06:14,582 [INFO] [AMShutdownThread] |rm.YarnTaskSchedulerService|: Releasing held containers
2017-05-31 16:06:14,583 [INFO] [AMShutdownThread] |rm.YarnTaskSchedulerService|: Removing all pending taskRequests
2017-05-31 16:06:14,583 [INFO] [AMShutdownThread] |history.HistoryEventHandler|: Stopping HistoryEventHandler
2017-05-31 16:06:14,583 [INFO] [AMShutdownThread] |recovery.RecoveryService|: Stopping RecoveryService
2017-05-31 16:06:14,583 [INFO] [AMShutdownThread] |recovery.RecoveryService|: Handle the remaining events in queue, queue size=0
2017-05-31 16:06:14,584 [INFO] [RecoveryEventHandlingThread] |recovery.RecoveryService|: EventQueue take interrupted. Returning
2017-05-31 16:06:14,584 [INFO] [AMShutdownThread] |recovery.RecoveryService|: Closing Summary Stream
2017-05-31 16:06:14,611 [INFO] [AMShutdownThread] |impl.SimpleHistoryLoggingService|: Stopping SimpleHistoryLoggingService, eventQueueBacklog=0
2017-05-31 16:06:14,611 [INFO] [HistoryEventHandlingThread] |impl.SimpleHistoryLoggingService|: EventQueue take interrupted. Returning
2017-05-31 16:06:14,613 [INFO] [DelayedContainerManager] |rm.YarnTaskSchedulerService|: AllocatedContainerManager Thread interrupted
2017-05-31 16:06:14,615 [INFO] [AMShutdownThread] |rm.YarnTaskSchedulerService|: Unregistering application from RM, exitStatus=SUCCEEDED, exitMessage=Session stats:submittedDAGs=0, successfulDAGs=1, failedDAGs=0, killedDAGs=0
, trackingURL=
2017-05-31 16:06:14,620 [INFO] [AMShutdownThread] |impl.AMRMClientImpl|: Waiting for application to be successfully unregistered.
2017-05-31 16:06:14,720 [INFO] [AMShutdownThread] |rm.YarnTaskSchedulerService|: Successfully unregistered application from RM
2017-05-31 16:06:14,721 [INFO] [AMShutdownThread] |rm.TaskSchedulerManager|: Shutting down AppCallbackExecutor
2017-05-31 16:06:14,721 [INFO] [AMRM Callback Handler Thread] |impl.AMRMClientAsyncImpl|: Interrupted while waiting for queue
java.lang.InterruptedException
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2014)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2048)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
    at org.apache.hadoop.yarn.client.api.async.impl.AMRMClientAsyncImpl$CallbackHandlerThread.run(AMRMClientAsyncImpl.java:274)
2017-05-31 16:06:14,726 [INFO] [AMShutdownThread] |mortbay.log|: Stopped HttpServer2$SelectChannelConnectorWithSafeStartup@0.0.0.0:0
2017-05-31 16:06:14,826 [INFO] [AMShutdownThread] |ipc.Server|: Stopping server on 49703
2017-05-31 16:06:14,827 [INFO] [IPC Server listener on 49703] |ipc.Server|: Stopping IPC Server listener on 49703
2017-05-31 16:06:14,827 [INFO] [AMShutdownThread] |ipc.Server|: Stopping server on 43709
2017-05-31 16:06:14,827 [INFO] [IPC Server Responder] |ipc.Server|: Stopping IPC Server Responder
2017-05-31 16:06:14,827 [INFO] [IPC Server listener on 43709] |ipc.Server|: Stopping IPC Server listener on 43709
2017-05-31 16:06:14,827 [INFO] [IPC Server Responder] |ipc.Server|: Stopping IPC Server Responder
2017-05-31 16:06:14,830 [INFO] [Thread-2] |app.DAGAppMaster|: DAGAppMasterShutdownHook invoked
2017-05-31 16:06:14,830 [INFO] [Thread-2] |app.DAGAppMaster|: The shutdown handler is still running, waiting for it to complete
2017-05-31 16:06:14,844 [INFO] [AMShutdownThread] |app.DAGAppMaster|: Completed deletion of tez scratch data dir, path=hdfs://avatarcluster/tmp/hive/hadoop/_tez_session_dir/46c45420-9bdf-40a5-83a5-c8d1d496abb8/.tez/application_1490688643958_53401
2017-05-31 16:06:14,844 [INFO] [AMShutdownThread] |app.DAGAppMaster|: Exiting DAGAppMaster..GoodBye!
2017-05-31 16:06:14,844 [INFO] [Thread-2] |app.DAGAppMaster|: The shutdown handler has completed
</code>```

hadoop cluster schema

```<code>app05: NameNode/ResourceManager/JournalNode
app10: NameNode(Standby)/JournalNode
app08: DataNode/NodeManager/JournalNode
app09: DataNode/NodeManager
</code>```

while app05/08/09/10 is my beta machine, each has 32 vcore and 48GB ram.

hadoop configuration

core-site.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://avatarcluster</value>
    </property>
    <property>
        <name>io.file.buffer.size</name>
        <value>131072</value>
    </property>
    <property>
        <name>hadoop.proxyuser.hadoop.hosts</name>
        <value>*</value>
    </property>
    <property>
        <name>hadoop.proxyuser.hadoop.groups</name>
        <value>*</value>
    </property>
    <property>
        <name>hadoop.tmp.dir</name>
        <value>/home/hadoop/hadoop-data/</value>
    </property>
    <property>
        <name>ha.zookeeper.quorum</name>
        <value>app02.hp.sp.tst.bmsre.com:2181</value>
    </property>
<property>
    <name>io.compression.codecs</name>
    <value>org.apache.hadoop.io.compress.SnappyCodec</value>
</property>
</configuration>
</code>```

hdfs-site.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>dfs.nameservices</name>
        <value>avatarcluster</value>
    </property>
    <property>
        <name>dfs.ha.namenodes.avatarcluster</name>
        <value>nn1,nn2</value>
    </property>
    <property>
        <name>dfs.namenode.rpc-address.avatarcluster.nn1</name>
        <value>app05.hp.sp.tst.bmsre.com:8020</value>
    </property>
    <property>
        <name>dfs.namenode.rpc-address.avatarcluster.nn2</name>
        <value>app10.hp.sp.tst.bmsre.com:8020</value>
    </property>
    <property>
        <name>dfs.namenode.http-address.avatarcluster.nn1</name>
        <value>app05.hp.sp.tst.bmsre.com:50070</value>
    </property>
    <property>
        <name>dfs.namenode.http-address.avatarcluster.nn2</name>
        <value>app10.hp.sp.tst.bmsre.com:50070</value>
    </property>
    <property>
        <name>dfs.namenode.shared.edits.dir</name>
        <value>qjournal://app05.hp.sp.tst.bmsre.com:8485;app10.hp.sp.tst.bmsre.com:8485;app08.hp.sp.tst.bmsre.com:8485/avatarcluster
        </value>
    </property>
    <property>
        <name>dfs.client.failover.proxy.provider.avatarcluster</name>
        <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
    </property>
    <property>
        <name>dfs.ha.fencing.methods</name>
        <value>sshfence</value>
    </property>
    <property>
        <name>dfs.ha.fencing.ssh.private-key-files</name>
        <value>/home/hadoop/.ssh/id_rsa</value>
    </property>
    <property>
        <name>dfs.journalnode.edits.dir</name>
        <value>/home/hadoop/hadoop/journal-data</value>
    </property>
    <property>
        <name>dfs.ha.automatic-failover.enabled</name>
        <value>true</value>
    </property>
    <property>
        <name>dfs.namenode.name.dir</name>
        <value>/home/hadoop/hadoop/namenode</value>
    </property>
    <property>
        <name>dfs.blocksize</name>
        <value>134217728</value>
    </property>
    <property>
        <name>dfs.namenode.handler.count</name>
        <value>100</value>
    </property>
    <property>
        <name>dfs.replication</name>
        <value>2</value>
    </property>
</configuration>
</code>```

maprd-site.xml

```<code><?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.address</name>
        <value>app05.hp.sp.tst.bmsre.com:10020</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.webapp.address</name>
        <value>app05.hp.sp.tst.bmsre.com:19888</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.intermediate-done-dir</name>
        <value>/mr-history/tmp</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.done-dir</name>
        <value>/mr-history/done</value>
    </property>
    <property>
        <name>mapred.output.compress</name>
        <value>true</value>
    </property>
    <property>
        <name>mapred.output.compression.codec</name>
        <value>org.apache.hadoop.io.compress.SnappyCodec</value>
    </property>
    <property>
        <name>mapred.compress.map.output</name>
        <value>true</value>
    </property>
    <property>
        <name>mapreduce.map.memory.mb</name>
        <value>3048</value>
    </property>
    <property>
        <name>mapreduce.reduce.memory.mb</name>
        <value>3048</value>
    </property>
    <property>
        <name>mapreduce.map.java.opts</name>
        <value>-Xmx2024m</value>
    </property>
    <property>
        <name>mapreduce.reduce.java.opts</name>
        <value>-Xmx2024m</value>
    </property>
</configuration>
</code>```

tez-site.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
    <property>
        <name>tez.lib.uris</name>
        <value>${fs.defaultFS}/apps/tez-0.8.5.tar.gz</value>
    </property>
    <property>
        <name>tez.am.resource.memory.mb</name>
        <value>2048</value>
    </property>
    <property>
        <name>tez.task.resource.memory.mb</name>
        <value>2048</value>
    </property>
</configuration>
</code>```

yarn-site.xml

```<code><?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>yarn.admin.acl</name>
        <value>*</value>
    </property>
    <property>
        <name>yarn.resourcemanager.address</name>
        <value>app05.hp.sp.tst.bmsre.com:8032</value>
    </property>
    <property>
        <name>yarn.resourcemanager.scheduler.address</name>
        <value>app05.hp.sp.tst.bmsre.com:8030</value>
    </property>
    <property>
        <name>yarn.resourcemanager.resource-tracker.address</name>
        <value>app05.hp.sp.tst.bmsre.com:8031</value>
    </property>
    <property>
        <name>yarn.resourcemanager.admin.address</name>
        <value>app05.hp.sp.tst.bmsre.com:8033</value>
    </property>
    <property>
        <name>yarn.resourcemanager.webapp.address</name>
        <value>app05.hp.sp.tst.bmsre.com:8088</value>
    </property>
    <property>
        <name>yarn.nodemanager.local-dirs</name>
        <value>/home/hadoop/hadoop/nodemanager-workdir</value>
    </property>
    <property>
        <name>yarn.nodemanager.log-dirs</name>
        <value>/home/hadoop/hadoop/nodemanager-logs</value>
    </property>
    <property>
        <name>yarn.nodemanager.log.retain-seconds</name>
        <value>3600</value>
    </property>
    <property>
        <name>yarn.nodemanager.remote-app-log-dir</name>
        <value>/home/hadoop/hadoop/nodemanager-remote-app-logs</value>
    </property>
    <property>
        <name>yarn.nodemanager.remote-app-log-dir-suffix</name>
        <value>logs</value>
    </property>
  <property>
    <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
  </property>
  <property>
    <name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name>
    <value>org.apache.hadoop.mapred.ShuffleHandler</value>
  </property>
    <property>
        <name>yarn.nodemanager.resource.memory-mb</name>
        <value>4096</value>
    </property>
    <property>
        <name>yarn.scheduler.minimum-allocation-mb</name>
        <value>1024</value>
    </property>
</configuration>
</code>```

答:
Hive can use the Apache Tez execution engine instead of the venerable Map-reduce engine. I won’t go into details about the many benefits of using Tez which are mentioned here; instead, I want to make a simple recommendation: if it’s not turned on by default in your environment, use Tez by setting to ‘true’ the following in the beginning of your Hive query:</p>

```<code>set hive.execution.engine=tez;
</code>```

Body:
I build a hadoop & hive cluster and try to do some test. But it's really slow.

table

table value_count

+--------------------------------------------------------------+--+
|                        createtab_stmt                        |
+--------------------------------------------------------------+--+
| CREATE TABLE `value_count`(                                  |
|   `key` int,                                                 |
|   `count` int,                                               |
|   `create_date` date COMMENT '????')                         |
| COMMENT 'This is a group table'                              |
| ROW FORMAT SERDE                                             |
|   'org.apache.hadoop.hive.ql.io.orc.OrcSerde'                |
| STORED AS INPUTFORMAT                                        |
|   'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'          |
| OUTPUTFORMAT                                                 |
|   'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'         |
| LOCATION                                                     |
|   'hdfs://avatarcluster/hive/warehouse/test.db/value_count'  |
| TBLPROPERTIES (                                              |
|   'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}',      |
|   'numFiles'='7',                                            |
|   'numRows'='7',                                             |
|   'rawDataSize'='448',                                       |
|   'totalSize'='2297',                                        |
|   'transient_lastDdlTime'='1496217645')                      |
+--------------------------------------------------------------+--+

sql execution

insert into value_count values (5, 1, '2017-05-06');

I've execute this sql for several times, each takes about 4 or 5 mins

hadoop container log

2017-05-31 16:00:45,041 [INFO] [Dispatcher thread {Central}] |app.DAGAppMaster|: Central Dispatcher queue size after DAG completion, before cleanup: 0
2017-05-31 16:00:45,041 [INFO] [Dispatcher thread {Central}] |app.DAGAppMaster|: Waiting for next DAG to be submitted.
2017-05-31 16:00:45,042 [INFO] [Dispatcher thread {Central}] |app.DAGAppMaster|: Cleaning up DAG: name=insert into value_count valu...'2017-05-06')(Stage-1), with id=dag_1490688643958_53401_1
2017-05-31 16:00:45,042 [INFO] [Dispatcher thread {Central}] |container.AMContainerMap|: Cleaned up completed containers on dagComplete. Removed=0, Remaining=1
2017-05-31 16:00:45,044 [INFO] [Dispatcher thread {Central}] |app.DAGAppMaster|: Completed cleanup for DAG: name=insert into value_count valu...'2017-05-06')(Stage-1), with id=dag_1490688643958_53401_1
2017-05-31 16:00:50,749 [INFO] [DelayedContainerManager] |rm.YarnTaskSchedulerService|: No taskRequests. Container's idle timeout delay expired or is new. Releasing container, containerId=container_1490688643958_53401_01_000002, containerExpiryTime=1496217650577, idleTimeout=5000, taskRequestsCount=0, heldContainers=1, delayedContainers=0, isNew=false
2017-05-31 16:00:50,752 [INFO] [Dispatcher thread {Central}] |history.HistoryEventHandler|: [HISTORY][DAG:dag_1490688643958_53401_1][Event:CONTAINER_STOPPED]: containerId=container_1490688643958_53401_01_000002, stoppedTime=1496217650751, exitStatus=0
2017-05-31 16:00:50,753 [INFO] [ContainerLauncher #1] |launcher.TezContainerLauncherImpl|: Stopping container_1490688643958_53401_01_000002
2017-05-31 16:00:50,753 [INFO] [ContainerLauncher #1] |impl.ContainerManagementProtocolProxy|: Opening proxy : app08.hp.sp.tst.bmsre.com:51640
2017-05-31 16:00:51,628 [INFO] [Dispatcher thread {Central}] |container.AMContainerImpl|: Container container_1490688643958_53401_01_000002 exited with diagnostics set to Container failed, exitCode=-105. Container killed by the ApplicationMaster.
Container killed on request. Exit code is 143
Container exited with a non-zero exit code 143

2017-05-31 16:01:29,678 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 51 lastPreemptionHeartbeat: 50
2017-05-31 16:02:19,740 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 101 lastPreemptionHeartbeat: 100
2017-05-31 16:03:09,801 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 151 lastPreemptionHeartbeat: 150
2017-05-31 16:03:59,858 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 201 lastPreemptionHeartbeat: 200
2017-05-31 16:04:49,915 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 251 lastPreemptionHeartbeat: 250
2017-05-31 16:05:39,971 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Allocated: <memory:0, vCores:0> Free: <memory:6144, vCores:1> pendingRequests: 0 delayedContainers: 0 heartbeats: 301 lastPreemptionHeartbeat: 300
2017-05-31 16:06:09,581 [INFO] [DAGSubmissionTimer] |rm.TaskSchedulerManager|: TaskScheduler notified that it should unregister from RM
2017-05-31 16:06:09,581 [INFO] [DAGSubmissionTimer] |app.DAGAppMaster|: No current running DAG, shutting down the AM
2017-05-31 16:06:09,581 [INFO] [DAGSubmissionTimer] |app.DAGAppMaster|: DAGAppMasterShutdownHandler invoked
2017-05-31 16:06:09,581 [INFO] [DAGSubmissionTimer] |app.DAGAppMaster|: Handling DAGAppMaster shutdown
2017-05-31 16:06:09,582 [INFO] [AMShutdownThread] |app.DAGAppMaster|: Sleeping for 5 seconds before shutting down
2017-05-31 16:06:14,582 [INFO] [AMShutdownThread] |app.DAGAppMaster|: Calling stop for all the services
2017-05-31 16:06:14,582 [INFO] [AMShutdownThread] |rm.YarnTaskSchedulerService|: Initiating stop of YarnTaskScheduler
2017-05-31 16:06:14,582 [INFO] [AMShutdownThread] |rm.YarnTaskSchedulerService|: Releasing held containers
2017-05-31 16:06:14,583 [INFO] [AMShutdownThread] |rm.YarnTaskSchedulerService|: Removing all pending taskRequests
2017-05-31 16:06:14,583 [INFO] [AMShutdownThread] |history.HistoryEventHandler|: Stopping HistoryEventHandler
2017-05-31 16:06:14,583 [INFO] [AMShutdownThread] |recovery.RecoveryService|: Stopping RecoveryService
2017-05-31 16:06:14,583 [INFO] [AMShutdownThread] |recovery.RecoveryService|: Handle the remaining events in queue, queue size=0
2017-05-31 16:06:14,584 [INFO] [RecoveryEventHandlingThread] |recovery.RecoveryService|: EventQueue take interrupted. Returning
2017-05-31 16:06:14,584 [INFO] [AMShutdownThread] |recovery.RecoveryService|: Closing Summary Stream
2017-05-31 16:06:14,611 [INFO] [AMShutdownThread] |impl.SimpleHistoryLoggingService|: Stopping SimpleHistoryLoggingService, eventQueueBacklog=0
2017-05-31 16:06:14,611 [INFO] [HistoryEventHandlingThread] |impl.SimpleHistoryLoggingService|: EventQueue take interrupted. Returning
2017-05-31 16:06:14,613 [INFO] [DelayedContainerManager] |rm.YarnTaskSchedulerService|: AllocatedContainerManager Thread interrupted
2017-05-31 16:06:14,615 [INFO] [AMShutdownThread] |rm.YarnTaskSchedulerService|: Unregistering application from RM, exitStatus=SUCCEEDED, exitMessage=Session stats:submittedDAGs=0, successfulDAGs=1, failedDAGs=0, killedDAGs=0
, trackingURL=
2017-05-31 16:06:14,620 [INFO] [AMShutdownThread] |impl.AMRMClientImpl|: Waiting for application to be successfully unregistered.
2017-05-31 16:06:14,720 [INFO] [AMShutdownThread] |rm.YarnTaskSchedulerService|: Successfully unregistered application from RM
2017-05-31 16:06:14,721 [INFO] [AMShutdownThread] |rm.TaskSchedulerManager|: Shutting down AppCallbackExecutor
2017-05-31 16:06:14,721 [INFO] [AMRM Callback Handler Thread] |impl.AMRMClientAsyncImpl|: Interrupted while waiting for queue
java.lang.InterruptedException
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2014)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2048)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
    at org.apache.hadoop.yarn.client.api.async.impl.AMRMClientAsyncImpl$CallbackHandlerThread.run(AMRMClientAsyncImpl.java:274)
2017-05-31 16:06:14,726 [INFO] [AMShutdownThread] |mortbay.log|: Stopped HttpServer2$SelectChannelConnectorWithSafeStartup@0.0.0.0:0
2017-05-31 16:06:14,826 [INFO] [AMShutdownThread] |ipc.Server|: Stopping server on 49703
2017-05-31 16:06:14,827 [INFO] [IPC Server listener on 49703] |ipc.Server|: Stopping IPC Server listener on 49703
2017-05-31 16:06:14,827 [INFO] [AMShutdownThread] |ipc.Server|: Stopping server on 43709
2017-05-31 16:06:14,827 [INFO] [IPC Server Responder] |ipc.Server|: Stopping IPC Server Responder
2017-05-31 16:06:14,827 [INFO] [IPC Server listener on 43709] |ipc.Server|: Stopping IPC Server listener on 43709
2017-05-31 16:06:14,827 [INFO] [IPC Server Responder] |ipc.Server|: Stopping IPC Server Responder
2017-05-31 16:06:14,830 [INFO] [Thread-2] |app.DAGAppMaster|: DAGAppMasterShutdownHook invoked
2017-05-31 16:06:14,830 [INFO] [Thread-2] |app.DAGAppMaster|: The shutdown handler is still running, waiting for it to complete
2017-05-31 16:06:14,844 [INFO] [AMShutdownThread] |app.DAGAppMaster|: Completed deletion of tez scratch data dir, path=hdfs://avatarcluster/tmp/hive/hadoop/_tez_session_dir/46c45420-9bdf-40a5-83a5-c8d1d496abb8/.tez/application_1490688643958_53401
2017-05-31 16:06:14,844 [INFO] [AMShutdownThread] |app.DAGAppMaster|: Exiting DAGAppMaster..GoodBye!
2017-05-31 16:06:14,844 [INFO] [Thread-2] |app.DAGAppMaster|: The shutdown handler has completed

hadoop cluster schema

app05: NameNode/ResourceManager/JournalNode
app10: NameNode(Standby)/JournalNode
app08: DataNode/NodeManager/JournalNode
app09: DataNode/NodeManager

while app05/08/09/10 is my beta machine, each has 32 vcore and 48GB ram.

hadoop configuration

core-site.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://avatarcluster</value>
    </property>
    <property>
        <name>io.file.buffer.size</name>
        <value>131072</value>
    </property>
    <property>
        <name>hadoop.proxyuser.hadoop.hosts</name>
        <value>*</value>
    </property>
    <property>
        <name>hadoop.proxyuser.hadoop.groups</name>
        <value>*</value>
    </property>
    <property>
        <name>hadoop.tmp.dir</name>
        <value>/home/hadoop/hadoop-data/</value>
    </property>
    <property>
        <name>ha.zookeeper.quorum</name>
        <value>app02.hp.sp.tst.bmsre.com:2181</value>
    </property>
<property>
    <name>io.compression.codecs</name>
    <value>org.apache.hadoop.io.compress.SnappyCodec</value>
</property>
</configuration>

hdfs-site.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>dfs.nameservices</name>
        <value>avatarcluster</value>
    </property>
    <property>
        <name>dfs.ha.namenodes.avatarcluster</name>
        <value>nn1,nn2</value>
    </property>
    <property>
        <name>dfs.namenode.rpc-address.avatarcluster.nn1</name>
        <value>app05.hp.sp.tst.bmsre.com:8020</value>
    </property>
    <property>
        <name>dfs.namenode.rpc-address.avatarcluster.nn2</name>
        <value>app10.hp.sp.tst.bmsre.com:8020</value>
    </property>
    <property>
        <name>dfs.namenode.http-address.avatarcluster.nn1</name>
        <value>app05.hp.sp.tst.bmsre.com:50070</value>
    </property>
    <property>
        <name>dfs.namenode.http-address.avatarcluster.nn2</name>
        <value>app10.hp.sp.tst.bmsre.com:50070</value>
    </property>
    <property>
        <name>dfs.namenode.shared.edits.dir</name>
        <value>qjournal://app05.hp.sp.tst.bmsre.com:8485;app10.hp.sp.tst.bmsre.com:8485;app08.hp.sp.tst.bmsre.com:8485/avatarcluster
        </value>
    </property>
    <property>
        <name>dfs.client.failover.proxy.provider.avatarcluster</name>
        <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
    </property>
    <property>
        <name>dfs.ha.fencing.methods</name>
        <value>sshfence</value>
    </property>
    <property>
        <name>dfs.ha.fencing.ssh.private-key-files</name>
        <value>/home/hadoop/.ssh/id_rsa</value>
    </property>
    <property>
        <name>dfs.journalnode.edits.dir</name>
        <value>/home/hadoop/hadoop/journal-data</value>
    </property>
    <property>
        <name>dfs.ha.automatic-failover.enabled</name>
        <value>true</value>
    </property>
    <property>
        <name>dfs.namenode.name.dir</name>
        <value>/home/hadoop/hadoop/namenode</value>
    </property>
    <property>
        <name>dfs.blocksize</name>
        <value>134217728</value>
    </property>
    <property>
        <name>dfs.namenode.handler.count</name>
        <value>100</value>
    </property>
    <property>
        <name>dfs.replication</name>
        <value>2</value>
    </property>
</configuration>

maprd-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.address</name>
        <value>app05.hp.sp.tst.bmsre.com:10020</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.webapp.address</name>
        <value>app05.hp.sp.tst.bmsre.com:19888</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.intermediate-done-dir</name>
        <value>/mr-history/tmp</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.done-dir</name>
        <value>/mr-history/done</value>
    </property>
    <property>
        <name>mapred.output.compress</name>
        <value>true</value>
    </property>
    <property>
        <name>mapred.output.compression.codec</name>
        <value>org.apache.hadoop.io.compress.SnappyCodec</value>
    </property>
    <property>
        <name>mapred.compress.map.output</name>
        <value>true</value>
    </property>
    <property>
        <name>mapreduce.map.memory.mb</name>
        <value>3048</value>
    </property>
    <property>
        <name>mapreduce.reduce.memory.mb</name>
        <value>3048</value>
    </property>
    <property>
        <name>mapreduce.map.java.opts</name>
        <value>-Xmx2024m</value>
    </property>
    <property>
        <name>mapreduce.reduce.java.opts</name>
        <value>-Xmx2024m</value>
    </property>
</configuration>

tez-site.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
    <property>
        <name>tez.lib.uris</name>
        <value>${fs.defaultFS}/apps/tez-0.8.5.tar.gz</value>
    </property>
    <property>
        <name>tez.am.resource.memory.mb</name>
        <value>2048</value>
    </property>
    <property>
        <name>tez.task.resource.memory.mb</name>
        <value>2048</value>
    </property>
</configuration>

yarn-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>yarn.admin.acl</name>
        <value>*</value>
    </property>
    <property>
        <name>yarn.resourcemanager.address</name>
        <value>app05.hp.sp.tst.bmsre.com:8032</value>
    </property>
    <property>
        <name>yarn.resourcemanager.scheduler.address</name>
        <value>app05.hp.sp.tst.bmsre.com:8030</value>
    </property>
    <property>
        <name>yarn.resourcemanager.resource-tracker.address</name>
        <value>app05.hp.sp.tst.bmsre.com:8031</value>
    </property>
    <property>
        <name>yarn.resourcemanager.admin.address</name>
        <value>app05.hp.sp.tst.bmsre.com:8033</value>
    </property>
    <property>
        <name>yarn.resourcemanager.webapp.address</name>
        <value>app05.hp.sp.tst.bmsre.com:8088</value>
    </property>
    <property>
        <name>yarn.nodemanager.local-dirs</name>
        <value>/home/hadoop/hadoop/nodemanager-workdir</value>
    </property>
    <property>
        <name>yarn.nodemanager.log-dirs</name>
        <value>/home/hadoop/hadoop/nodemanager-logs</value>
    </property>
    <property>
        <name>yarn.nodemanager.log.retain-seconds</name>
        <value>3600</value>
    </property>
    <property>
        <name>yarn.nodemanager.remote-app-log-dir</name>
        <value>/home/hadoop/hadoop/nodemanager-remote-app-logs</value>
    </property>
    <property>
        <name>yarn.nodemanager.remote-app-log-dir-suffix</name>
        <value>logs</value>
    </property>
  <property>
    <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
  </property>
  <property>
    <name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name>
    <value>org.apache.hadoop.mapred.ShuffleHandler</value>
  </property>
    <property>
        <name>yarn.nodemanager.resource.memory-mb</name>
        <value>4096</value>
    </property>
    <property>
        <name>yarn.scheduler.minimum-allocation-mb</name>
        <value>1024</value>
    </property>
</configuration>

Body:
Hive can use the Apache Tez execution engine instead of the venerable Map-reduce engine. I won’t go into details about the many benefits of using Tez which are mentioned here; instead, I want to make a simple recommendation: if it’s not turned on by default in your environment, use Tez by setting to ‘true’ the following in the beginning of your Hive query:

set hive.execution.engine=tez;


来源: stackexchange

问:
Bootstrap 4 Cards of same height in columns
I'm currently working on Cards from Bootstrap.

Depending on the text title I will get the different height for the cards and would like to have the same height as the tallest one.

I don't mind using JS I actually think is probably the best way to approach the problem.

I have tried using different solutions from the CSS like using flexbox.

The rendered HTML as it is rendered dynamically here's a simple example:

.card {
  float: left;
  width: 100%;
  padding: .75rem;
  margin-bottom: 2rem;
  border: 0;
  box-shadow: 0px 0px 8px 0.3px rgba(0, 0, 0, 1);
}

.card>img {
  margin-bottom: .75rem;
  display: block;
  width: 80%;
  height: auto;
  margin-left: auto;
  margin-right: auto;
}

.card-text {
  font-size: 85%;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>SMITE FR</title>
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/album.css" rel="stylesheet">
  <link href="css/ie10-viewport-bug-workaround.min.css" rel="stylesheet">
  <script src="https://www.w3schools.com/lib/w3data.js"></script>
  <link rel="import" href="navigation.html">
</head>

<body>
  <div class="container">
    <div class="row">
      <div class="card-deck">
        <div class="col-md-4 col-sm-6 col-12">
          <div class="card">
            <img src="images/dieux/Agni.jpg" alt="BeatsX">
            <h1 class="card-title">BeatsX</h1>
            <div class="text-center">
              <p>1188.0000</p>
              <p>2017-06-09 10:00:00</p>
              Voir la Fiche
            </div>
          </div>
        </div>
        <div class="col-md-4 col-sm-6 col-12">
          <div class="card">
            <img src="images/dieux/Agni.jpg" alt="Nitendo Switch">
            <h1 class="card-title">Nitendo Switch</h1>
            <div class="text-center">
              <p>2899.0000</p>
              <p>2017-06-10 10:00:00</p>
              Voir la Fiche
            </div>
          </div>
        </div>
        <div class="col-md-4 col-sm-6 col-12">
          <div class="card">
            <img src="images/dieux/Agni.jpg" alt="iPhone 7 128GB (Jet Blakc)">
            <h1 class="card-title">iPhone 7 128GB (Jet Blakc)</h1>
            <div class="text-center">
              <p>6388.0000</p>
              <p>2017-06-06 10:00:00</p>
              Voir la Fiche
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>

</html></code>```

答:
Try giving height to card see this fiddle</p>

```<code>.card {
    float: left;
    width: 100%;
    padding: .75rem;
    height:80vh;
    margin-bottom: 2rem;
    border: 0;
    box-shadow: 0px 0px 8px 0.3px rgba(0,0,0,1);
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I'm currently working on Cards from Bootstrap.

Depending on the text title I will get the different height for the cards and would like to have the same height as the tallest one.

I don't mind using JS I actually think is probably the best way to approach the problem.

I have tried using different solutions from the CSS like using flexbox.

The rendered HTML as it is rendered dynamically here's a simple example:

.card {
  float: left;
  width: 100%;
  padding: .75rem;
  margin-bottom: 2rem;
  border: 0;
  box-shadow: 0px 0px 8px 0.3px rgba(0, 0, 0, 1);
}

.card>img {
  margin-bottom: .75rem;
  display: block;
  width: 80%;
  height: auto;
  margin-left: auto;
  margin-right: auto;
}

.card-text {
  font-size: 85%;
}

<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>SMITE FR</title>
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/album.css" rel="stylesheet">
  <link href="css/ie10-viewport-bug-workaround.min.css" rel="stylesheet">

  <link rel="import" href="navigation.html">

BeatsX

1188.0000

2017-06-09 10:00:00

              Voir la Fiche

Nitendo Switch

2899.0000

2017-06-10 10:00:00

              Voir la Fiche

iPhone 7 128GB (Jet Blakc)

6388.0000

2017-06-06 10:00:00

              Voir la Fiche

Body:
Try giving height to card see this fiddle

.card {
    float: left;
    width: 100%;
    padding: .75rem;
    height:80vh;
    margin-bottom: 2rem;
    border: 0;
    box-shadow: 0px 0px 8px 0.3px rgba(0,0,0,1);
}

ContentLicense: CC BY-SA 3.0


问:
What would be the fastest way to concatenate three files in C#?
I need to concatenate 3 files using C#. A header file, content, and a footer file, but I want to do this as cool as it can be done.

Cool = really small code or really fast (non-assembly code).

答:
You mean 3 text files?? Does the result need to be a file again?

How about something like:

```<code>string contents1 = File.ReadAllText(filename1);
string contents2 = File.ReadAllText(filename2);
string contents3 = File.ReadAllText(filename3);

File.WriteAllText(outputFileName, contents1 + contents2 + contents3);
</code>```

Of course, with a StringBuilder and a bit of extra smarts, you could easily extend that to handle any number of input files :-)

Cheers

OwnerDisplayName: Bobby Bruckovnic

ContentLicense: CC BY-SA 2.5

LastEditorDisplayName: bdukes

Body:
You mean 3 text files?? Does the result need to be a file again?

How about something like:

string contents1 = File.ReadAllText(filename1);
string contents2 = File.ReadAllText(filename2);
string contents3 = File.ReadAllText(filename3);

File.WriteAllText(outputFileName, contents1 + contents2 + contents3);

Of course, with a StringBuilder and a bit of extra smarts, you could easily extend that to handle any number of input files :-)

Cheers


问:
JS variable issue
I have a very simple js function to toggle div visibility, here's the working version:

```<code>function Toggle(obj) {
    var state = document.getElementById(obj);
    if (state.style.display === 'block') {
        state.style.display = 'none';
    }
    else {
        state.style.display = 'block';
    }
}
</code>```

Here obj represents the id of a div. Now, I have multiple divs on page, and want when user opens a new div, to have previously opened div closed. I tried to do it by modifying my function like this:

```<code>var prev_obj = 'empty';

 function Toggle(obj) {
    var state = document.getElementById(obj);
    if (state.style.display === 'block') {
        state.style.display = 'none';
    }
    else {

                if (prev_obj !== 'empty')
                {
        var prev_state = document.getElementById(prev_obj)
        prev_state.style.display = 'none';
                }
        state.style.display = 'block';

                prev_obj = obj;
    }
}
</code>```

I guess this is self explanatory to js wizards out there, so I'll just say, when I hard-code the value for prev_obj, it works, but when I don't it doesn't, and firebug shows that it's keeping the initial value ("empty")

Help appreciated as well as any other way to do this if you have it.

答:
It is difficult to tell where your problem is from the details provided.  You should be able to develop a solution with the tutorial linked below.  Personally I'd loop over all the divs, hide them all, and then show the current one instead of holding a reference to the last div.

http://www.randomsnippets.com/2008/02/12/how-to-hide-and-show-your-div/

Title: JS variable issue

Body:
I have a very simple js function to toggle div visibility, here's the working version:

function Toggle(obj) {
    var state = document.getElementById(obj);
    if (state.style.display === 'block') {
        state.style.display = 'none';
    }
    else {
        state.style.display = 'block';
    }
}

Here obj represents the id of a div. Now, I have multiple divs on page, and want when user opens a new div, to have previously opened div closed. I tried to do it by modifying my function like this:

var prev_obj = 'empty';

 function Toggle(obj) {
    var state = document.getElementById(obj);
    if (state.style.display === 'block') {
        state.style.display = 'none';
    }
    else {

                if (prev_obj !== 'empty')
                {
        var prev_state = document.getElementById(prev_obj)
        prev_state.style.display = 'none';
                }
        state.style.display = 'block';

                prev_obj = obj;
    }
}

I guess this is self explanatory to js wizards out there, so I'll just say, when I hard-code the value for prev_obj, it works, but when I don't it doesn't, and firebug shows that it's keeping the initial value ("empty")

Help appreciated as well as any other way to do this if you have it.


问:
Unity3D - Change local scale to world scale
I´m having some troubles when trying to instantiate prefabs on Unity. My main problem comes when trying to set the scale of the prefab, which has his own scale and make it the same as another GameObject´s scale which is already on the world to make both the same size. Since their local scale is not the same,even I set ,for example, both Y´s component to 1, they dont have the same height. How can I solve this through the script code</p>

答:
When you import the models from your modeling software, you need to adjust the Scale Factor so the models match in size. This way you will get them to match in size when they match in scale.

If you want to calculate the actual size from code. you can do it by using Mesh.bounds. An example:

```<code>Bounds bounds = GetComponent<MeshFilter>().mesh.bounds;
Vector3 size = bounds.size;
</code>```

When you get the size, you can multiply the localScale to match the size of the other model.

You can find more information in documentation here and here.

Body:
When you import the models from your modeling software, you need to adjust the Scale Factor so the models match in size. This way you will get them to match in size when they match in scale.

If you want to calculate the actual size from code. you can do it by using Mesh.bounds. An example:

Bounds bounds = GetComponent<MeshFilter>().mesh.bounds;
Vector3 size = bounds.size;

When you get the size, you can multiply the localScale to match the size of the other model.

You can find more information in documentation here and here.


问:
Wrong text entered by sendkeys
I am trying to automate a webpage where i have to enter credit card details.
During manually entering CVV of the credit card I am able to move forward, but while entering value using sendkeys it throws an error.

```<code>driver.findElement(By.name("password_ccCvv")).click();
driver.findElement(By.name("password_ccCvv")).sendKeys("999");
</code>```

I tried clicking on the textbox and then entered value. This also didn't work.

While entering value through send keys, i cant see what value is being sent because its encrypted.

答:
Try this using javascriptexecuter and let me know

In Python

```<code>driver.execute_script("document.getElementById('password_ccCvv').value = '001';");
</code>```

In Java

```<code>JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.getElementById('password_ccCvv').value = '001';");
</code>```

Title: Wrong text entered by sendkeys

Body:
I am trying to automate a webpage where i have to enter credit card details.
During manually entering CVV of the credit card I am able to move forward, but while entering value using sendkeys it throws an error.

driver.findElement(By.name("password_ccCvv")).click();
driver.findElement(By.name("password_ccCvv")).sendKeys("999");

I tried clicking on the textbox and then entered value. This also didn't work.

While entering value through send keys, i cant see what value is being sent because its encrypted.

Body:
Try this using javascriptexecuter and let me know

In Python

driver.execute_script("document.getElementById('password_ccCvv').value = '001';");

In Java

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.getElementById('password_ccCvv').value = '001';");


问:
Custom logging to app insights from .net core
I'm using App Insights in a .net core web app and I can successfully see the telemetry data in the app insights logs. I would now like to be able to push up my own log events, but cannot seem to get it to work (i.e. my custom log events do not appear in app insights). My code is as follows:

```<code>public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    loggerFactory.AddApplicationInsights(app.ApplicationServices);
    loggerFactory.AddDebug();

    var logger = loggerFactory.CreateLogger<Startup>();

    logger.LogInformation("I am a log event");
</code>```

I've also tried setting the log level explicitly like:

```<code>loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Debug);
</code>```

But I never see the text "I am a log event" in app insights.

Can anyone tell me how I can fix this?

答:
You need to add an Application Insights log capture module for that. Select the appropriate package - one of:

Microsoft.ApplicationInsights.TraceListener (to capture
System.Diagnostics.Trace calls)

Microsoft.ApplicationInsights.EventSourceListener (to capture
EventSource events)

Microsoft.ApplicationInsights.EtwListener (to
capture ETW events)

Microsoft.ApplicationInsights.NLogTarget

Microsoft.ApplicationInsights.Log4NetAppender

Documentation section: Explore .NET trace logs in Application Insights

Also, you may use TelemetryClient directly. It has more options, not only TrackTrace that is used by loggers.

```<code>//TelemetryClient telemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
...
telemetryClient.TrackEvent("<EventName>");
telemetryClient.TrackMetric("<metric name>", 1);
telemetryClient.TrackTrace("message", SeverityLevel.Information);
</code>```

Documentation section: Application Insights API for custom events and metrics

For the live example, you may look into feature test int ApplicationInsights-aspnetcore repo.

Body:
I'm using App Insights in a .net core web app and I can successfully see the telemetry data in the app insights logs. I would now like to be able to push up my own log events, but cannot seem to get it to work (i.e. my custom log events do not appear in app insights). My code is as follows:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    loggerFactory.AddApplicationInsights(app.ApplicationServices);
    loggerFactory.AddDebug();

    var logger = loggerFactory.CreateLogger<Startup>();

    logger.LogInformation("I am a log event");

I've also tried setting the log level explicitly like:

loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Debug);

But I never see the text "I am a log event" in app insights.

Can anyone tell me how I can fix this?

Body:
You need to add an Application Insights log capture module for that. Select the appropriate package - one of:

Microsoft.ApplicationInsights.TraceListener (to capture
System.Diagnostics.Trace calls)

Microsoft.ApplicationInsights.EventSourceListener (to capture
EventSource events)

Microsoft.ApplicationInsights.EtwListener (to
capture ETW events)

Microsoft.ApplicationInsights.NLogTarget

Microsoft.ApplicationInsights.Log4NetAppender

Documentation section: Explore .NET trace logs in Application Insights

Also, you may use TelemetryClient directly. It has more options, not only TrackTrace that is used by loggers.

//TelemetryClient telemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
...
telemetryClient.TrackEvent("<EventName>");
telemetryClient.TrackMetric("<metric name>", 1);
telemetryClient.TrackTrace("message", SeverityLevel.Information);

Documentation section: Application Insights API for custom events and metrics

For the live example, you may look into feature test int ApplicationInsights-aspnetcore repo.


问:
Cannot call class as a function error in React Native
I am making a ListView in React Native and getting "Cannot call class as a function" error. I also tried adding "new" keyword before class but still the error was not solved. Following is my code:

```<code>import React, {Component} from 'react';
import {StyleSheet, View, AppRegistry, ListView, Text} from 'react-native';

    class listview extends Component{

    constructor(props){
    super(props);
    var ds = ListView.DataSource({rowHasChanged : (r1,r2) => r1!==r2});
    this.state = {
    dataSource: ds.cloneWithRows(['1','2','3','4'])
    }
    }

    _renderRow(rowData){
      return <Text>{rowData}</Text>;
      }

    render(){
    return(
    <ListView
    dataSource = {this.state.dataSource}
    renderRow = {this._renderRow.bind(this)}
    />
    );
    }
    }
    AppRegistry.registerComponent('listview', () => listview );
</code>```

You can see the error here. How do I solve it?

答:
```<code>constructor(props){
  super(props);
  var ds = new ListView.DataSource({rowHasChanged : (r1,r2) => r1!==r2});
  //-------^^^ you forgot to place `new` keyword here.
  this.state = {
    dataSource: ds.cloneWithRows(['1','2','3','4'])
  }
}
</code>```

Body:
I am making a ListView in React Native and getting "Cannot call class as a function" error. I also tried adding "new" keyword before class but still the error was not solved. Following is my code:

import React, {Component} from 'react';
import {StyleSheet, View, AppRegistry, ListView, Text} from 'react-native';

    class listview extends Component{

    constructor(props){
    super(props);
    var ds = ListView.DataSource({rowHasChanged : (r1,r2) => r1!==r2});
    this.state = {
    dataSource: ds.cloneWithRows(['1','2','3','4'])
    }
    }

    _renderRow(rowData){
      return <Text>{rowData}</Text>;
      }

    render(){
    return(
    <ListView
    dataSource = {this.state.dataSource}
    renderRow = {this._renderRow.bind(this)}
    />
    );
    }
    }
    AppRegistry.registerComponent('listview', () => listview );

You can see the error here. How do I solve it?


问:
How to do 'Average' in Prolog?
I'm trying to do a predicate of average in Prolog, but I'm facing some problems,

it's called average(N,X), with N is a number, and X is the result of the average from 1 to N .

I've tried to do this,  but it doesn't always work well :

```<code>       average(1,1).
       average(N,X) :- K is N-1 ,K>1 , average(K,S1) , X is /(+(S1,N),N).
       average(N,X) :- K is N-1 ,K=:=1 , average(K,S1) , X is +(S1,N).
</code>```

Some help ?

答:
just to hint how a good library(aggregate) can help:</p>

```<code>?- aggregate((sum(N),count),member(N,[4,5,6]),(S,C)),Ave is S/C.
S = 15,
C = 3,
Ave = 5.
</code>```

Title: How to do 'Average' in Prolog?

Body:
I'm trying to do a predicate of average in Prolog, but I'm facing some problems,

it's called average(N,X), with N is a number, and X is the result of the average from 1 to N .

I've tried to do this,  but it doesn't always work well :

       average(1,1).
       average(N,X) :- K is N-1 ,K>1 , average(K,S1) , X is /(+(S1,N),N).
       average(N,X) :- K is N-1 ,K=:=1 , average(K,S1) , X is +(S1,N).

Some help ?

Body:
just to hint how a good library(aggregate) can help:

?- aggregate((sum(N),count),member(N,[4,5,6]),(S,C)),Ave is S/C.
S = 15,
C = 3,
Ave = 5.


问:
How to hide a color swatch image in Magento
how can I hide a color swatch image on product details page in magento 1.9 for configurable product that doesn't have a product image.</p>

答:
To hide color swatches goto: System=>Configuration => Configurable Swatches => 'Product Attributes to Show as Swatches in Product Detail' and deselect the color swatch attributes and Save.

Refresh Cache.

http://prntscr.com/fhpapg


问:
Convert into a For Comprehension in Scala
Testing this I can see that it works:

```<code>def twoHtmlFutures = Action { request =>

  val async1 = as1.index(embed = true)(request) // Future[Result]
  val async2 = as2.index(embed = true)(request) // Future[Result]

  val async1Html = async1.flatMap(x => Pagelet.readBody(x)) // Future[Html]
  val async2Html = async2.flatMap(x => Pagelet.readBody(x)) // Future[Html]

  val source1 = Source.fromFuture(async1Html) // Source[Html, NotUsed]
  val source2 = Source.fromFuture(async2Html) // Source[Html, NotUsed]

  val merged = source1.merge(source2) // Source[Html, NotUsed]
  Ok.chunked(merged)
}
</code>```

But trying to put it into a For Comprehension is not working for me. This is what I tried:

```<code>def twoHtmlFutures2 = Action.async { request =>

  val async1 = as1.index(embed = true)(request)
  val async2 = as2.index(embed = true)(request)

  for {
    async1Res <- async1 // from Future[Result] to Result
    async2Res <- async2 // from Future[Result] to Result

    async1Html <- Pagelet.readBody(async1Res) // from Result to Html
    async2Html <- Pagelet.readBody(async2Res) // from Result to Html

  } yield {
    val source1 = single(async1Html) // from Html to Source[Html, NotUsed]
    val source2 = single(async2Html) // from Html to Source[Html, NotUsed]

    val merged = source1.merge(source2) // Source[Html, NotUsed]
    Ok.chunked(merged)
  }

}
</code>```

But this just jumps on-screen at the same time rather than at different times (streamed) as the first example does. Any helpers out there to widen my eyelids?Thanks

答:
Monads are a sequencing shape and Futures models this as causal dependence (first-this-future-completes-then-that-future-completes):

```<code>val x = Future(something).map(_ => somethingElse) or Future(something).flatMap(_ => Future(somethingElse)
</code>```

However, there's a little trick one can do in for comprehensions:

```<code>def twoHtmlFutures = Action { request =>
  Ok.chunked(
    Source.fromFutureSource(
      for { _ <- Future.unit // For Scala version <= 2.11 use Future.successful(())
        async1 = as1.index(embed = true)(request) // Future[Result]
        async2 = as2.index(embed = true)(request) // Future[Result]
        async1Html = async1.flatMap(x => Pagelet.readBody(x)) // Future[Html]
        async2Html = async2.flatMap(x => Pagelet.readBody(x)) // Future[Html]
        source1 = Source.fromFuture(async1Html) // Source[Html, NotUsed]
        source2 = Source.fromFuture(async2Html) // Source[Html, NotUsed]
       } yield source1.merge(source2) // Source[Html, NotUsed]
    )
  )
</code>```

I describe this technique in greater detail in this blogpost.

An alternate solution to your problem could be:

```<code>def twoHtmlFutures = Action { request =>
  Ok.chunked(
  Source.fromFuture(as1.index(embed = true)(request)).merge(Source.fromFuture(as2.index(embed = true)(request))).mapAsyncUnordered(2)(b => Pagelet.readBody(b))
  )
 }
</code>```

Body:
Testing this I can see that it works:

def twoHtmlFutures = Action { request =>

  val async1 = as1.index(embed = true)(request) // Future[Result]
  val async2 = as2.index(embed = true)(request) // Future[Result]

  val async1Html = async1.flatMap(x => Pagelet.readBody(x)) // Future[Html]
  val async2Html = async2.flatMap(x => Pagelet.readBody(x)) // Future[Html]

  val source1 = Source.fromFuture(async1Html) // Source[Html, NotUsed]
  val source2 = Source.fromFuture(async2Html) // Source[Html, NotUsed]

  val merged = source1.merge(source2) // Source[Html, NotUsed]
  Ok.chunked(merged)
}

But trying to put it into a For Comprehension is not working for me. This is what I tried:

def twoHtmlFutures2 = Action.async { request =>

  val async1 = as1.index(embed = true)(request)
  val async2 = as2.index(embed = true)(request)

  for {
    async1Res <- async1 // from Future[Result] to Result
    async2Res <- async2 // from Future[Result] to Result

    async1Html <- Pagelet.readBody(async1Res) // from Result to Html
    async2Html <- Pagelet.readBody(async2Res) // from Result to Html

  } yield {
    val source1 = single(async1Html) // from Html to Source[Html, NotUsed]
    val source2 = single(async2Html) // from Html to Source[Html, NotUsed]

    val merged = source1.merge(source2) // Source[Html, NotUsed]
    Ok.chunked(merged)
  }

}

But this just jumps on-screen at the same time rather than at different times (streamed) as the first example does. Any helpers out there to widen my eyelids?Thanks

Body:
Monads are a sequencing shape and Futures models this as causal dependence (first-this-future-completes-then-that-future-completes):

val x = Future(something).map(_ => somethingElse) or Future(something).flatMap(_ => Future(somethingElse)

However, there's a little trick one can do in for comprehensions:

def twoHtmlFutures = Action { request =>
  Ok.chunked(
    Source.fromFutureSource(
      for { _ <- Future.unit // For Scala version <= 2.11 use Future.successful(())
        async1 = as1.index(embed = true)(request) // Future[Result]
        async2 = as2.index(embed = true)(request) // Future[Result]
        async1Html = async1.flatMap(x => Pagelet.readBody(x)) // Future[Html]
        async2Html = async2.flatMap(x => Pagelet.readBody(x)) // Future[Html]
        source1 = Source.fromFuture(async1Html) // Source[Html, NotUsed]
        source2 = Source.fromFuture(async2Html) // Source[Html, NotUsed]
       } yield source1.merge(source2) // Source[Html, NotUsed]
    )
  )

I describe this technique in greater detail in this blogpost.

An alternate solution to your problem could be:

def twoHtmlFutures = Action { request =>
  Ok.chunked(
  Source.fromFuture(as1.index(embed = true)(request)).merge(Source.fromFuture(as2.index(embed = true)(request))).mapAsyncUnordered(2)(b => Pagelet.readBody(b))
  )
 }


问:
Static final field in a class vs Interface field in java
I need to create a 100 or more static final constants in my application and I can achieve this is following two ways as per my understanding:

Creating a simple java class and create static final field in that

Creating an interface an put all variable in that because all field in an interface is implicitly static final

I have these question in above approach:

Which one is right approach to achieve this?

Which one is memory efficient approach?

Is there any design pattern to achieve this?

答:
I would not be thinking should they be in an interface or class, but more about the constants and their meaning.

I would not recommend putting all your constants in one place for the sake of keeping them together. If for instance a constant is directly related to a class then would say put it in that class. I have worked with code where all the constants ate bundled into one class, and I don't thing it is a good approach.


问:
Mongoose schema for arrays & hashes
I am stuck here to write mongoose schema for happenings and birthdays fields. I am using mongodb/mongoose and would like to save the similar contents in events collections.

```<code>{
"_id" : ObjectId("5938fc171dfe0f225902d85d"),
"month" : 6,
"date" : 9,
"happenings" : [
    {
        "incident" : "Muhammad, the founder of Islam and unifier of Arabia, died.",
        "year" : "632"
    },
    {
        "incident" : "The Army of the Potomac defeats Confederate forces at Battle of Cross Keys, Virginia..",
        "year" : "1862"
    },
    {
        "incident" : "Israeli airplanes attack the USS Liberty, a surveillance ship, in the Mediterranean, killing 34 Navy crewmen..",
        "year" : "1967"
    },
    {
        "incident" : "Gemini astronaut Gene Cernan attempts to become the first man to orbit the Earth untethered to a space capsule, but is unable to when he exhausts himself fitting into his rocket pack.",
        "year" : "1966"
    }
],
"birthdays" : {
    "actor" : {
        "name" : "Josh Pence",
        "yob" : 1982,
        "birthplace" : "Santa Monica, CA",
        "role" : "MOVIE ACTOR",
        "image" : "josh_1982.png"
    },
    "actress" : {
        "name" : "Julianna Margulies",
        "yob" : 1966,
        "birthplace" : "Spring Valley, NY",
        "role" : "TV ACTRESS",
        "image" : "julianna_1966.png"
    },
    "player" : {
        "name" : "Julianna Margulies",
        "yob" : 1987,
        "birthplace" : "Ohio",
        "role" : "FOOT BALL",
        "image" : "julianna_1966.png"
    }
}
</code>```

}

The schema I tried

```<code>var schema = new Schema({
   day: Number,
   Month: Number,
   birthdays: Schema.Types.Mixed,
   happenings: [],
   incident:   [String],
   year:   [Number],
})

var event= mongoose.model('Event', schema);
</code>```

How should I modify the above schema??

答:
According to your document I think your schema could be like</p>

```<code>var schema = new Schema({
  day: Number,
  Month: Number,
  birthdays: Schema.Types.Mixed,
  happenings: [{
    incident: String,
    year: String,
    _id: false
  }]
});

var event= mongoose.model('Event', schema);
</code>```

Title: Mongoose schema for arrays & hashes

Body:
I am stuck here to write mongoose schema for happenings and birthdays fields. I am using mongodb/mongoose and would like to save the similar contents in events collections.

{
"_id" : ObjectId("5938fc171dfe0f225902d85d"),
"month" : 6,
"date" : 9,
"happenings" : [
    {
        "incident" : "Muhammad, the founder of Islam and unifier of Arabia, died.",
        "year" : "632"
    },
    {
        "incident" : "The Army of the Potomac defeats Confederate forces at Battle of Cross Keys, Virginia..",
        "year" : "1862"
    },
    {
        "incident" : "Israeli airplanes attack the USS Liberty, a surveillance ship, in the Mediterranean, killing 34 Navy crewmen..",
        "year" : "1967"
    },
    {
        "incident" : "Gemini astronaut Gene Cernan attempts to become the first man to orbit the Earth untethered to a space capsule, but is unable to when he exhausts himself fitting into his rocket pack.",
        "year" : "1966"
    }
],
"birthdays" : {
    "actor" : {
        "name" : "Josh Pence",
        "yob" : 1982,
        "birthplace" : "Santa Monica, CA",
        "role" : "MOVIE ACTOR",
        "image" : "josh_1982.png"
    },
    "actress" : {
        "name" : "Julianna Margulies",
        "yob" : 1966,
        "birthplace" : "Spring Valley, NY",
        "role" : "TV ACTRESS",
        "image" : "julianna_1966.png"
    },
    "player" : {
        "name" : "Julianna Margulies",
        "yob" : 1987,
        "birthplace" : "Ohio",
        "role" : "FOOT BALL",
        "image" : "julianna_1966.png"
    }
}

}

The schema I tried

var schema = new Schema({
   day: Number,
   Month: Number,
   birthdays: Schema.Types.Mixed,
   happenings: [],
   incident:   [String],
   year:   [Number],
})

var event= mongoose.model('Event', schema);

How should I modify the above schema??

Body:
According to your document I think your schema could be like

var schema = new Schema({
  day: Number,
  Month: Number,
  birthdays: Schema.Types.Mixed,
  happenings: [{
    incident: String,
    year: String,
    _id: false
  }]
});

var event= mongoose.model('Event', schema);


问:
How to omit trimming, for one field only, with CsvHelper
I am using the excellent CsvHelper libary. Now I need to explicitly add some leading and trailing spaces to a field. I do this using:

```<code>private const string Space = " ";
//....
Map(x => x.Bandwidth).Index(++indexCounter).ConvertUsing(item => Space + item + Space).Name("Bandwidth");
</code>```

This works, as long as I do not choose to generally trim using

```<code>// Default value
csv.Configuration.TrimFields = true;
</code>```

as described in the CsvHelper docs. But how can I generally use trimming, excpet for a specific field?  I am using version 2.5.0 at the moment.

Is there a way to omit trimming for one field only?

Edit:

I just found out that my approach using ConvertUsing is completely broken: See CsvHelper ConvertUsing not changing output I'm going to either delete or update this question later.

答:
I got this completely wrong, and the mapping with ConvertUsing did not work in the first place, and has nothing to do with the option TrimFields = true.

I got it to work with an explicit converter class:

```<code>public class CsvExportStringSpacingConverter : DefaultTypeConverter {
    private const string Space = " ";

    public override string ConvertToString(TypeConverterOptions options, object value) {
        return Space + value + Space;
    }
}
</code>```

Then I changed my mapping to

```<code>Map(x => x.Bandwidth)
    .Index(++indexCounter)
    .TypeConverter<CsvExportStringSpacingConverter>)
    .Name(CsvExportColumnName.Bandwidth);
</code>```

This solution now works, adding leading and trailing spaces for this field, regardless of the trim option.
Strangely though, it also automatically adds quotes to this field output, even with this option not enabled. It does not hurt however, Microsoft Excel shows the field content as expected, without quotes, but with the spaces.

Body:
I am using the excellent CsvHelper libary. Now I need to explicitly add some leading and trailing spaces to a field. I do this using:

private const string Space = " ";
//....
Map(x => x.Bandwidth).Index(++indexCounter).ConvertUsing(item => Space + item + Space).Name("Bandwidth");

This works, as long as I do not choose to generally trim using

// Default value
csv.Configuration.TrimFields = true;

as described in the CsvHelper docs. But how can I generally use trimming, excpet for a specific field?  I am using version 2.5.0 at the moment.

Is there a way to omit trimming for one field only?

Edit:

I just found out that my approach using ConvertUsing is completely broken: See CsvHelper ConvertUsing not changing output I'm going to either delete or update this question later.

Body:
I got this completely wrong, and the mapping with ConvertUsing did not work in the first place, and has nothing to do with the option TrimFields = true.

I got it to work with an explicit converter class:

public class CsvExportStringSpacingConverter : DefaultTypeConverter {
    private const string Space = " ";

    public override string ConvertToString(TypeConverterOptions options, object value) {
        return Space + value + Space;
    }
}

Then I changed my mapping to

Map(x => x.Bandwidth)
    .Index(++indexCounter)
    .TypeConverter<CsvExportStringSpacingConverter>)
    .Name(CsvExportColumnName.Bandwidth);

This solution now works, adding leading and trailing spaces for this field, regardless of the trim option.
Strangely though, it also automatically adds quotes to this field output, even with this option not enabled. It does not hurt however, Microsoft Excel shows the field content as expected, without quotes, but with the spaces.


问:
Curl request with headers - separate body a from a header
Ive got a code

```<code>    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
    $ret = curl_exec($ch);
    $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
</code>```

Now i want to extract the body from $ret without headers. Any idea how to do it?

答:
Drawing on @Geoffrey excellent answer in this thread...

Some of the other solutions offered this thread are not doing this correctly.

Splitting on \r\n\r\n is not reliable when CURLOPT_FOLLOWLOCATION is on or when the server responds with a 100 code.

Detecting the size of the headers via CURLINFO_HEADER_SIZE is also not always reliable, especially when proxies are used or in some of the same redirection scenarios.

The most reliable method of obtaining headers is using CURLOPT_HEADERFUNCTION. Then you can remove curl_setopt($ch, CURLOPT_HEADER, 1); and your body will be clean with no headers.

Here is a very clean method of performing this using PHP closures. It also converts all headers to lowercase for consistent handling across servers and HTTP versions.

```<code>$ch = curl_init();
$headers = [];
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// Run the following function for each header received
// Note: Does NOT handle multiple instances of the same header. Later one will overwrite.
//       Consider handling that scenario if you need it.
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$headers) {
    $len = strlen($header);
    $header = explode(':', $header, 2);
    if (count($header) >= 2)
        $headers[strtolower(trim($header[0]))] = trim($header[1]);
    return $len;
});

$data = curl_exec($ch);
print_r($headers);
</code>```

Body:
Ive got a code

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
    $ret = curl_exec($ch);
    $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

Now i want to extract the body from $ret without headers. Any idea how to do it?

Body:
Drawing on @Geoffrey excellent answer in this thread...

Some of the other solutions offered this thread are not doing this correctly.

Splitting on \r\n\r\n is not reliable when CURLOPT_FOLLOWLOCATION is on or when the server responds with a 100 code.

Detecting the size of the headers via CURLINFO_HEADER_SIZE is also not always reliable, especially when proxies are used or in some of the same redirection scenarios.

The most reliable method of obtaining headers is using CURLOPT_HEADERFUNCTION. Then you can remove curl_setopt($ch, CURLOPT_HEADER, 1); and your body will be clean with no headers.

Here is a very clean method of performing this using PHP closures. It also converts all headers to lowercase for consistent handling across servers and HTTP versions.

$ch = curl_init();
$headers = [];
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// Run the following function for each header received
// Note: Does NOT handle multiple instances of the same header. Later one will overwrite.
//       Consider handling that scenario if you need it.
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$headers) {
    $len = strlen($header);
    $header = explode(':', $header, 2);
    if (count($header) >= 2)
        $headers[strtolower(trim($header[0]))] = trim($header[1]);
    return $len;
});

$data = curl_exec($ch);
print_r($headers);


问:
How to add pagination on user list in Moodle?
I have more user in user list it so difficult for find user, so I want to add pagination at user list in Moodle

答: Your best bet is to use the class flexible_table or table_sql located in lib/tablelib.php. Those, while not necessarily easy to set-up initially, are very useful classes to display a list of items, with pagination, sorting, etc...


问:
python 2 get the number between Chinese characters from the urllib2 response result
I want to get the digit 805 between the html tag using urllib2 from a web page.

```<code><span class="count">(共805张)</span>
</code>```

Here is the python code I wrote to get the number:

```<code>url = "https://movie.douban.com/celebrity/1044996/photos/"
request = urllib2.Request(url,headers=headers)
response = urllib2.urlopen(request)
content = response.read().decode('utf-8')
pattern1 = re.compile(r'<span\sclass="count">(.*?)</', re.S)
result1 = re.search(pattern1, content)
total_num = result1.group(1)
total_num = total_num
</code>```

But when I print the total_num, the console shows:

```<code>u'(\u5171805\u5f20)'
</code>```

How can I get the number 805 expect using regular expression?

答:
Try changing your regex by this one:

```<code>pattern1 = re.compile(r'<span\sclass="count">[^<\d]*(\d+)[^<\d]*</', re.S)
</code>```

This way, the group will only match the number, and not the other characters around it.

Body:
I want to get the digit 805 between the html tag using urllib2 from a web page.

(共805张)

Here is the python code I wrote to get the number:

url = "https://movie.douban.com/celebrity/1044996/photos/"
request = urllib2.Request(url,headers=headers)
response = urllib2.urlopen(request)
content = response.read().decode('utf-8')
pattern1 = re.compile(r'(.*?)</', re.S)
result1 = re.search(pattern1, content)
total_num = result1.group(1)
total_num = total_num

But when I print the total_num, the console shows:

u'(\u5171805\u5f20)'

How can I get the number 805 expect using regular expression?

Body:
Try changing your regex by this one:

pattern1 = re.compile(r'<span\sclass="count">[^<\d]*(\d+)[^<\d]*</', re.S)

This way, the group will only match the number, and not the other characters around it.


问:
Call Web API protected by Azure AD from Xamarin Forms
I am hoping to find for a working sample or guidance that shows a Xamarin Forms application that authenticates against Azure AD and then uses a token to call a Web API that is secured by the same Azure AD.

Something like this but using Xamarin Forms:
http://timothelariviere.com/2017/02/13/call-an-azure-ad-protected-api-in-xamarinuwp-apps/

答:
Microsoft provides lots of code sample to integrate with Azure AD, and you can refer the link below which is developing with Xamarin Forms:

Integrate Azure AD with Xamarin apps


答:
```<code>d = {'a': 1, 'b': 2,' c': [3, 4, 5]}

temp_d = d
L = []
for key in temp_d:
  item = {}
  for key in temp_d:
      if isinstance(temp_d[key], list):
        item[key]  = temp_d[key].pop(0)
      else:
        item[key]  = temp_d[key]
  L.append(item)
</code>```

Basically, what i am doing here is:

I create a copy of the dictionary 'd' named 'temp_d';

I go through every key in the 'temp_d ' dictionary, and create an empty one;

I loop again through all the keys in the 'd' dictionary, and basically I verify if the value of the current key of the loop is a list, if it is, I add the key to the dictionary 'item' with the first value of the list, with the function pop(index) (this function removes an element from a list and returns it). If the value of the current key isn't a list, it just adds the key to the dict with the value.

After filling the dictionary 'item', I append it to 'L'.

Example in this case:

```<code>first key ('a'):
  item = {}

  first key of second loop ('a'):
     is the value of 'a' a list?
     no. adds the value.
  new item{'a': 1}

  second key of second loop ('b'):
     is the value of 'b' a list?
     no. adds the value.
  new item{'a': 1, 'b': 2}

  third key of second loop ('c'):
     is the value of 'c' a list?
     yes. adds the first element of the list, removing it from the list
     (the list was [3, 4, 5], now is [4, 5])
  new item{'a': 1, 'b': 2, 'c': 3}

  appends the item to L
  (the 'L' was [], now is [{'a': 1, 'b': 2, 'c': 3}])
</code>```

etc until the end.

Title: How does python achieve the following data format conversion?

Body:
I would like to achieve a function that deals with the following data：'d' and generate 'L'. How to achieve?

def func(**d):
   'do something'
    return [....]

source:

   d = {'a': 1, 'b': 2, 'c': [3, 4, 5]}

or

   d = {'a': 1, 'b': 2, 'c': [3, 4, 5], 'd': [6, 7]}

TO:

  L=[{'a':1,'b':2,'c':3},
   {'a':1,'b':2,'c':4},
   {'a':1,'b':2,'c':5}]

or

  L=[{'a': 1, 'b': 2, 'c': 3, 'd': 6},
    {'a': 1, 'b': 2, 'c': 3, 'd': 7},
    {'a': 1, 'b': 2, 'c': 4, 'd': 6},
    {'a': 1, 'b': 2, 'c': 4, 'd': 7},
    {'a': 1, 'b': 2, 'c': 5, 'd': 6},
    {'a': 1, 'b': 2, 'c': 5, 'd': 7}]

Body:
d = {'a': 1, 'b': 2,' c': [3, 4, 5]}

temp_d = d
L = []
for key in temp_d:
  item = {}
  for key in temp_d:
      if isinstance(temp_d[key], list):
        item[key]  = temp_d[key].pop(0)
      else:
        item[key]  = temp_d[key]
  L.append(item)

Basically, what i am doing here is:

I create a copy of the dictionary 'd' named 'temp_d';

I go through every key in the 'temp_d ' dictionary, and create an empty one;

I loop again through all the keys in the 'd' dictionary, and basically I verify if the value of the current key of the loop is a list, if it is, I add the key to the dictionary 'item' with the first value of the list, with the function pop(index) (this function removes an element from a list and returns it). If the value of the current key isn't a list, it just adds the key to the dict with the value.

After filling the dictionary 'item', I append it to 'L'.

Example in this case:

first key ('a'):
  item = {}

  first key of second loop ('a'):
     is the value of 'a' a list?
     no. adds the value.
  new item{'a': 1}

  second key of second loop ('b'):
     is the value of 'b' a list?
     no. adds the value.
  new item{'a': 1, 'b': 2}

  third key of second loop ('c'):
     is the value of 'c' a list?
     yes. adds the first element of the list, removing it from the list
     (the list was [3, 4, 5], now is [4, 5])
  new item{'a': 1, 'b': 2, 'c': 3}

  appends the item to L
  (the 'L' was [], now is [{'a': 1, 'b': 2, 'c': 3}])

etc until the end.


问:
Selenium webdriver with Dataprovider run each test with null parameter
I have created few tests by using selenium, TestNG with dataprovider.
When i run the test each time test gets executed twice one with parameter and second with null parameter  enter image description here

Please find screenshot for reference

Please let me know how to fix the issue.

Appreciate your help!!

Code:
public class AppTest_BlankOrder
    extends ReplaceBaseclass
{

```<code>CreatePageLocator pf;

public AppTest_Blankrder()
{}

/* Below code is used to open the browser....*/
@BeforeTest
public void testSetup() {

    System.setProperty("webdriver.chrome.driver", "./testdata/chromedriver.exe");
    driver= new ChromeDriver();

     driver.manage().timeouts().implicitlyWait(500, TimeUnit.SECONDS);
     driver.get("http://loginapp.group/");

}

    @Test(dataProvider="WosLoginData",dataProviderClass=CreateProvider.class,priority = 1)
    public void WOSLogintest(String user,String password)
    {

        System.out.println("Open Logintest method and pass data");

        // -----page factory code---
    CreatePageLocator pf= new CreatePageLocator(driver);

        pf.setUserName(user);

        pf.setPassword(password);

        pf.clickLogin();

    }
</code>```

//---- Data provider code----

```<code>public class CreatePageProvider {
@DataProvider(name="WosLoginData")
public Object [][] getLoginData(Method name)
{
    Object [][] data=null;
    /
    ExcelDataConfig config=new com.ExcelDataConfig("./testdata/InputData.xlsx");
    int rows=config.getRowCount(0);

                data=new  Object[rows][2];

    for(int i=1; i<rows; i++)
    {
        data[i][0]=config.getData(0, i, 0);
        data[i][1]=config.getData(0, i, 1);

    }

enter code here
    return data;
}
</code>```

答: The counter of the for loop in the dataprovider should start at 0. This is what is making the first element of data[][] to have null values.

Body:
I have created few tests by using selenium, TestNG with dataprovider.
When i run the test each time test gets executed twice one with parameter and second with null parameter  enter image description here

Please find screenshot for reference

Please let me know how to fix the issue.

Appreciate your help!!

Code:
public class AppTest_BlankOrder
    extends ReplaceBaseclass
{

CreatePageLocator pf;

public AppTest_Blankrder()
{}

/* Below code is used to open the browser....*/
@BeforeTest
public void testSetup() {

    System.setProperty("webdriver.chrome.driver", "./testdata/chromedriver.exe");
    driver= new ChromeDriver();

     driver.manage().timeouts().implicitlyWait(500, TimeUnit.SECONDS);
     driver.get("http://loginapp.group/");

}

    @Test(dataProvider="WosLoginData",dataProviderClass=CreateProvider.class,priority = 1)
    public void WOSLogintest(String user,String password)
    {

        System.out.println("Open Logintest method and pass data");

        // -----page factory code---
    CreatePageLocator pf= new CreatePageLocator(driver);

        pf.setUserName(user);

        pf.setPassword(password);

        pf.clickLogin();

    }

//---- Data provider code----

public class CreatePageProvider {
@DataProvider(name="WosLoginData")
public Object [][] getLoginData(Method name)
{
    Object [][] data=null;
    /
    ExcelDataConfig config=new com.ExcelDataConfig("./testdata/InputData.xlsx");
    int rows=config.getRowCount(0);

                data=new  Object[rows][2];

    for(int i=1; i<rows; i++)
    {
        data[i][0]=config.getData(0, i, 0);
        data[i][1]=config.getData(0, i, 1);

    }

enter code here
    return data;
}


问:
Android Event Listener Data Binding for ViewPager
Is it possible to bind a handler for setOnPageChangeListener to a ViewPager in XML file with the Android Binding functionality?

The demos show onClick events but I am curious as to how much event functionality I can implement with it. Any links on the capabilities of Data Binding would be great as well. Thanks.

Hypothetical example:

example_activity.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">

<data>
   <variable name="handlers" type="com.example.Handlers"/>
</data>

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:onPageChangeListener="@{handlers.pageChanged}" />
</layout>
</code>```

Handler.java

```<code>package com.example.viewmodels;

import android.view.View;

public class Handlers {
    public void pageChanged(View view){}
}
</code>```

The compilation error is:

Error:(62) No resource identifier found for attribute 'onPageChangeListener' in package 'android'

答:
Here is ultimate solution. Just put this class in your project.

@BindingMethods({
    @BindingMethod(type = ViewPager.class, attribute = "android:offscreenPageLimit", method = "setOffscreenPageLimit"),
    @BindingMethod(type = ViewPager.class, attribute = "android:adapter", method = "setAdapter"),
    @BindingMethod(type = ViewPager.class, attribute = "android:currentPage", method = "setCurrentItem"),
})
public final class ViewPagerBindingAdapter {

    @InverseBindingAdapter(attribute = "android:currentPage", event = "android:currentPageAttrChanged")
    public static int getCurrentPage(@NonNull final ViewPager pager) {
        return pager.getCurrentItem();
    }

    @BindingAdapter(value = {"android:onPageScrolled", "android:onPageSelected", "android:onPageScrollStateChanged",
        "android:currentPageAttrChanged"}, requireAll = false)
    public static void onSetAdapter(@NonNull final ViewPager pager, final OnPageScrolled scrolled, final OnPageSelected selected,
        final OnPageScrollStateChanged scrollStateChanged, final InverseBindingListener currentPageAttrChanged) {

        final ViewPager.OnPageChangeListener newValue;
        if (scrolled == null && selected == null && scrollStateChanged == null && currentPageAttrChanged == null) {
            newValue = null;
        } else {
            newValue = new ViewPager.OnPageChangeListener() {
                @Override
                public void onPageScrolled(final int position, final float positionOffset, final int positionOffsetPixels) {
                    if (scrolled != null) {
                        scrolled.onPageScrolled(position, positionOffset, positionOffsetPixels);
                    }
                }

                @Override
                public void onPageSelected(final int position) {
                    if (selected != null) {
                        selected.onPageSelected(position);
                    }
                    if (currentPageAttrChanged != null) {
                        currentPageAttrChanged.onChange();
                    }
                }

                @Override
                public void onPageScrollStateChanged(final int state) {
                    if (scrollStateChanged != null) {
                        scrollStateChanged.onPageScrollStateChanged(state);
                    }
                }
            };
        }
        final ViewPager.OnPageChangeListener oldValue = ListenerUtil.trackListener(pager, newValue, R.id.page_change_listener);
        if (oldValue != null) {
            pager.removeOnPageChangeListener(oldValue);
        }
        if (newValue != null) {
            pager.addOnPageChangeListener(newValue);
        }
    }

    public interface OnPageScrolled {
        void onPageScrolled(int position, float positionOffset, int positionOffsetPixels);
    }

    public interface OnPageSelected {
        void onPageSelected(int position);
    }

    public interface OnPageScrollStateChanged {
        void onPageScrollStateChanged(int state);
    }

    private ViewPagerBindingAdapter() {
        throw new UnsupportedOperationException();
    }
}
```

<p>Also add id resource in your resources.</p>

<pre class="lang-xml prettyprint-override"><code><resources>
    <item name="page_change_listener" type="id"/>
</resources>
</code>```

Then you will be able to use it in xml like:

<android.support.v4.view.ViewPager
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:currentPage="@={viewModel.currentPage}"
                android:offscreenPageLimit="@{viewModel.offscreenPageLimit}"
                android:onPageSelected="@{currentPage -> viewModel.pageSelected(currentPage)}"
                android:adapter="@{adapter}"/>
```

As you can see, currentPage has inverse binding, so your viewModel will be able to set current page and also get current page if user swipes.

Body:
Is it possible to bind a handler for setOnPageChangeListener to a ViewPager in XML file with the Android Binding functionality?

The demos show onClick events but I am curious as to how much event functionality I can implement with it. Any links on the capabilities of Data Binding would be great as well. Thanks.

Hypothetical example:

example_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">

<data>
   <variable name="handlers" type="com.example.Handlers"/>
</data>

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:onPageChangeListener="@{handlers.pageChanged}" />
</layout>

Handler.java

package com.example.viewmodels;

import android.view.View;

public class Handlers {
    public void pageChanged(View view){}
}

The compilation error is:

Error:(62) No resource identifier found for attribute 'onPageChangeListener' in package 'android'

Body:
Here is ultimate solution. Just put this class in your project.

@BindingMethods({
    @BindingMethod(type = ViewPager.class, attribute = "android:offscreenPageLimit", method = "setOffscreenPageLimit"),
    @BindingMethod(type = ViewPager.class, attribute = "android:adapter", method = "setAdapter"),
    @BindingMethod(type = ViewPager.class, attribute = "android:currentPage", method = "setCurrentItem"),
})
public final class ViewPagerBindingAdapter {

    @InverseBindingAdapter(attribute = "android:currentPage", event = "android:currentPageAttrChanged")
    public static int getCurrentPage(@NonNull final ViewPager pager) {
        return pager.getCurrentItem();
    }

    @BindingAdapter(value = {"android:onPageScrolled", "android:onPageSelected", "android:onPageScrollStateChanged",
        "android:currentPageAttrChanged"}, requireAll = false)
    public static void onSetAdapter(@NonNull final ViewPager pager, final OnPageScrolled scrolled, final OnPageSelected selected,
        final OnPageScrollStateChanged scrollStateChanged, final InverseBindingListener currentPageAttrChanged) {

        final ViewPager.OnPageChangeListener newValue;
        if (scrolled == null && selected == null && scrollStateChanged == null && currentPageAttrChanged == null) {
            newValue = null;
        } else {
            newValue = new ViewPager.OnPageChangeListener() {
                @Override
                public void onPageScrolled(final int position, final float positionOffset, final int positionOffsetPixels) {
                    if (scrolled != null) {
                        scrolled.onPageScrolled(position, positionOffset, positionOffsetPixels);
                    }
                }

                @Override
                public void onPageSelected(final int position) {
                    if (selected != null) {
                        selected.onPageSelected(position);
                    }
                    if (currentPageAttrChanged != null) {
                        currentPageAttrChanged.onChange();
                    }
                }

                @Override
                public void onPageScrollStateChanged(final int state) {
                    if (scrollStateChanged != null) {
                        scrollStateChanged.onPageScrollStateChanged(state);
                    }
                }
            };
        }
        final ViewPager.OnPageChangeListener oldValue = ListenerUtil.trackListener(pager, newValue, R.id.page_change_listener);
        if (oldValue != null) {
            pager.removeOnPageChangeListener(oldValue);
        }
        if (newValue != null) {
            pager.addOnPageChangeListener(newValue);
        }
    }

    public interface OnPageScrolled {
        void onPageScrolled(int position, float positionOffset, int positionOffsetPixels);
    }

    public interface OnPageSelected {
        void onPageSelected(int position);
    }

    public interface OnPageScrollStateChanged {
        void onPageScrollStateChanged(int state);
    }

    private ViewPagerBindingAdapter() {
        throw new UnsupportedOperationException();
    }
}

Also add id resource in your resources.

<resources>
    <item name="page_change_listener" type="id"/>
</resources>

Then you will be able to use it in xml like:

<android.support.v4.view.ViewPager
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:currentPage="@={viewModel.currentPage}"
                android:offscreenPageLimit="@{viewModel.offscreenPageLimit}"
                android:onPageSelected="@{currentPage -> viewModel.pageSelected(currentPage)}"
                android:adapter="@{adapter}"/>

As you can see, currentPage has inverse binding, so your viewModel will be able to set current page and also get current page if user swipes.


问:
How to properly handle a null variable perspective in kotlin?
My old java version method looks like:

```<code>@Override
public void closeSimpleAlertDialog() {
    if (mAlertDialog != null && mAlertDialog.isShowing()) {
        mAlertDialog.dismiss();
    }
}
</code>```

As you can tell it is checked whether the null reference link to a dialog mAlertDialog and if not null check call method isShowing(), and only then caused a method of close - dismiss(). Very simple

I faced a problem - how is still in "Kotlin-style" to perform the same operation?

My first version looks here:

```<code>if (mAlertDialog != null && mAlertDialog?.isShowing) {
        mAlertDialog?.dismiss()
}
</code>```

Next step change mAlertDialog != null && mAlertDialog?.isShowing to mAlertDialog?.isShowing ?: false and last version looks like:

```<code>if (mAlertDialog?.isShowing ?: false)
            mAlertDialog?.dismiss()
</code>```

But I don't understand. Why do I need "?" if the null checking already happened before (here: mAlertDialog?.)?

答:
If you use ? then you are allowing the null value for the variables.

Example:

```<code>var a: String = "abc"
a = null // compilation error

var b: String? = "abc"
b = null // ok

b?.length
</code>```

This returns b.length if b is not null, and null otherwise.

Body:
My old java version method looks like:

@Override
public void closeSimpleAlertDialog() {
    if (mAlertDialog != null && mAlertDialog.isShowing()) {
        mAlertDialog.dismiss();
    }
}

As you can tell it is checked whether the null reference link to a dialog mAlertDialog and if not null check call method isShowing(), and only then caused a method of close - dismiss(). Very simple

I faced a problem - how is still in "Kotlin-style" to perform the same operation?

My first version looks here:

if (mAlertDialog != null && mAlertDialog?.isShowing) {
        mAlertDialog?.dismiss()
}

Next step change mAlertDialog != null && mAlertDialog?.isShowing to mAlertDialog?.isShowing ?: false and last version looks like:

if (mAlertDialog?.isShowing ?: false)
            mAlertDialog?.dismiss()

But I don't understand. Why do I need "?" if the null checking already happened before (here: mAlertDialog?.)?

Body:
If you use ? then you are allowing the null value for the variables.

Example:

var a: String = "abc"
a = null // compilation error

var b: String? = "abc"
b = null // ok

b?.length

This returns b.length if b is not null, and null otherwise.


问:
during installation of Subversive Connector Discovery - 'problems occurred'
I'm trying to install SVN client on Eclipse Helios,
I've installed all SVN modules from Collaboration node (in updates),
now after restart I can choose a connector
'Subversive Connector Discovery' form appears.
but whatever i choose and press 'finish', i've got
'Problems occurred, while performing operation: Operation Details
See error log for details'

What happened? where is the log for this operation ?

答:
I've found log in

!ENTRY org.eclipse.team.svn.core.svnnature 4 0 2010-12-14 23:58:47.156
(...)
Contains: Missing requirement: SVNKit 1.3.3 Implementation (Optional) 2.2.2.I20101203-1700 (org.polarion.eclipse.team.svn.connector.svnkit16.feature.group 2.2.2.I20101203-1700) requires 'org.eclipse.team.svn.feature.group [0.7.9.I20101001-1700,1.0.0)' but it could not be found

I've updated this component (from incubation branch in updating service (that's why it wasn't updated automatically).
then, eclipse stopped working (it just won't start, i had to update jdk from 1.6.0_17 to 1.6.0_21
and now everything is working ;)