问:
Unable to find artifact "copy-protoc:generate-sources"
I'm using Google's Protocol Buffers in a project. We use Maven to compile the protobufs automatically ( based on http://vlkan.com/blog/post/2015/11/27/maven-protobuf/ )

Maven gave us tree errors which we were able to solve by installing Maven Plugins on our Eclipse installation. But there is one error we can't solve :

```<code>org.apache.maven.plugins:maven-dependency-plugin:2.9:copy:copy-protoc:generate-sources
</code>```

This error comes and goes apparently "randomly" and it doesn't break the compilation: everything works perfectly fine.
Here is the maven plugin configuration responsible for this problem:

```<code>    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.9</version>
        <executions>
ERROR HERE - <execution>
                <id>copy-protoc</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>copy</goal>
                </goals>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>com.google.protobuf</groupId>
                            <artifactId>protoc</artifactId>
                            <version>3.0.0-beta-3</version>
                            <classifier>${os.detected.classifier}</classifier>
                            <type>exe</type>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                        </artifactItem>
                    </artifactItems>
                </configuration>
            </execution>
        </executions>
    </plugin>
</code>```

I tried deleting the .m2 folder or looking for more plugins to no avail.

How to remove that error from Eclipse? Thanks

Edit 1 , the whole stacktrace:

```<code>Unable to find artifact. (org.apache.maven.plugins:maven-dependency-plugin:2.9:copy:copy-protoc:generate-sources)

org.apache.maven.plugin.MojoExecutionException: Unable to find artifact.
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getArtifact(AbstractFromConfigurationMojo.java:265)
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getProcessedArtifactItems(AbstractFromConfigurationMojo.java:171)
    at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.doExecute(CopyMojo.java:105)
    at org.apache.maven.plugin.dependency.AbstractDependencyMojo.execute(AbstractDependencyMojo.java:167)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360)
    at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52)
    at com.ianbrandt.tools.m2e.mdp.core.MdpBuildParticipant.executeMojo(MdpBuildParticipant.java:133)
    at com.ianbrandt.tools.m2e.mdp.core.MdpBuildParticipant.build(MdpBuildParticipant.java:67)
    at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Failure to find com.google.protobuf:protoc:exe:3.0.0-beta-3 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.0.0-beta-3 -Dpackaging=exe -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.0.0-beta-3 -Dpackaging=exe -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  com.google.protobuf:protoc:exe:3.0.0-beta-3

from the specified remote repositories:
  central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)

    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:218)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:154)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:545)
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getArtifact(AbstractFromConfigurationMojo.java:257)
    ... 37 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find com.google.protobuf:protoc:exe:3.0.0-beta-3 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:212)
    ... 40 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find com.google.protobuf:protoc:exe:3.0.0-beta-3 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:231)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:585)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:503)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
    ... 44 more
</code>```

Edit 2 , The Effective POM:

```<code>Effective POMs, after inheritance, interpolation, and profiles are applied:

<!-- ====================================================================== -->
<!--                                                                        -->
<!-- Generated by Maven Help Plugin on 2016-06-01T01:19:06                  -->
<!-- See: http://maven.apache.org/plugins/maven-help-plugin/                -->
<!--                                                                        -->
<!-- ====================================================================== -->

<!-- ====================================================================== -->
<!--                                                                        -->
<!-- Effective POM for project 'com.GroupName:ProjectName:jar:1.0-SNAPSHOT'  -->
<!--                                                                        -->
<!-- ====================================================================== -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.GroupName</groupId>
  <artifactId>ProjectName</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>ProjectName</name>
  <url>http://maven.apache.org</url>
  <properties>
    <build-helper-maven-plugin.version>1.9.1</build-helper-maven-plugin.version>
    <java.version>1.8</java.version>
    <junit.version>4.12</junit.version>
    <maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
    <maven-dependency-plugin.version>2.9</maven-dependency-plugin.version>
    <maven-shade-plugin.version>2.4.3</maven-shade-plugin.version>
    <os-maven-plugin.version>1.5.0.Final</os-maven-plugin.version>
    <os.detected.arch>x86_64</os.detected.arch>
    <os.detected.classifier>windows-x86_64</os.detected.classifier>
    <os.detected.name>windows</os.detected.name>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <protobuf-java-format.version>1.2</protobuf-java-format.version>
    <protobuf.input.directory>E:\Development\GroupName\ProjectFolder/proto</protobuf.input.directory>
    <protobuf.output.directory.cpp>E:\Development\GroupName\ProjectFolder\target/libcpp</protobuf.output.directory.cpp>
    <protobuf.output.directory.java>E:\Development\GroupName\ProjectFolder\target/generated-sources</protobuf.output.directory.java>
    <protobuf.version>3.0.0-beta-3</protobuf.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>3.0.0-beta-3</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.googlecode.protobuf-java-format</groupId>
      <artifactId>protobuf-java-format</artifactId>
      <version>1.2</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <sourceDirectory>E:\Development\GroupName\ProjectFolder\src\main\java</sourceDirectory>
    <scriptSourceDirectory>E:\Development\GroupName\ProjectFolder\src\main\scripts</scriptSourceDirectory>
    <testSourceDirectory>E:\Development\GroupName\ProjectFolder\src\test\java</testSourceDirectory>
    <outputDirectory>E:\Development\GroupName\ProjectFolder\target\classes</outputDirectory>
    <testOutputDirectory>E:\Development\GroupName\ProjectFolder\target\test-classes</testOutputDirectory>
    <extensions>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.5.0.Final</version>
      </extension>
    </extensions>
    <resources>
      <resource>
        <directory>E:\Development\GroupName\ProjectFolder\src\main\resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>E:\Development\GroupName\ProjectFolder\src\test\resources</directory>
      </testResource>
    </testResources>
    <directory>E:\Development\GroupName\ProjectFolder\target</directory>
    <finalName>ProjectName</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.2-beta-5</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.8</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.3.2</version>
        </plugin>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <versionRange>[1.7,)</versionRange>
                    <goals>
                      <goal>run</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                    <execute>
                      <runOnConfiguration>true</runOnConfiguration>
                      <runOnIncremental>true</runOnIncremental>
                    </execute>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <encoding>UTF-8</encoding>
            </configuration>
          </execution>
          <execution>
            <id>default-testCompile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <encoding>UTF-8</encoding>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>default-testResources</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>testResources</goal>
            </goals>
            <configuration>
              <encoding>UTF-8</encoding>
            </configuration>
          </execution>
          <execution>
            <id>default-resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
            <configuration>
              <encoding>UTF-8</encoding>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.9</version>
        <executions>
          <execution>
            <id>copy-protoc</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.google.protobuf</groupId>
                  <artifactId>protoc</artifactId>
                  <version>3.0.0-beta-3</version>
                  <classifier>${os.detected.classifier}</classifier>
                  <type>exe</type>
                  <outputDirectory>E:\Development\GroupName\ProjectFolder\target</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>exec-protoc</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <property name="protoc.filename" value="protoc-3.0.0-beta-3-${os.detected.classifier}.exe" />
                <property name="protoc.filepath" value="E:\Development\GroupName\ProjectFolder\target/${protoc.filename}" />
                <chmod file="${protoc.filepath}" perm="ugo+rx" />
                <mkdir dir="E:\Development\GroupName\ProjectFolder\target/generated-sources" />
                <mkdir dir="E:\Development\GroupName\ProjectFolder\target/libcpp" />
                <path id="protobuf.input.filepaths.path">
                  <fileset dir="E:\Development\GroupName\ProjectFolder/proto">
                    <include name="**/*.proto" />
                  </fileset>
                </path>
                <pathconvert property="protobuf.input.filepaths" pathsep=" " refid="protobuf.input.filepaths.path" />
                <exec failonerror="true" executable="${protoc.filepath}">
                  <arg value="-I" />
                  <arg value="E:\Development\GroupName\ProjectFolder/proto" />
                  <arg value="--java_out" />
                  <arg value="E:\Development\GroupName\ProjectFolder\target/generated-sources" />
                  <arg value="--cpp_out" />
                  <arg value="E:\Development\GroupName\ProjectFolder\target/libcpp" />
                  <arg line="${protobuf.input.filepaths}" />
                </exec>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.9.1</version>
        <executions>
          <execution>
            <id>add-classes</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>E:\Development\GroupName\ProjectFolder\target/generated-sources</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.5</version>
        <executions>
          <execution>
            <id>default-clean</id>
            <phase>clean</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>default-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12.4</version>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>default-install</id>
            <phase>install</phase>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>default-deploy</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.3</version>
        <executions>
          <execution>
            <id>default-site</id>
            <phase>site</phase>
            <goals>
              <goal>site</goal>
            </goals>
            <configuration>
              <outputDirectory>E:\Development\GroupName\ProjectFolder\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
          <execution>
            <id>default-deploy</id>
            <phase>site-deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <outputDirectory>E:\Development\GroupName\ProjectFolder\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <outputDirectory>E:\Development\GroupName\ProjectFolder\target\site</outputDirectory>
          <reportPlugins>
            <reportPlugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
            </reportPlugin>
          </reportPlugins>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <reporting>
    <outputDirectory>E:\Development\GroupName\ProjectFolder\target\site</outputDirectory>
  </reporting>
</project>
</code>```

答:
Thanks for posting this question. I was facing a similar issues in my pom.
It got resolved once I changed maven dependency plugin version to 3.0.0

Another thing that I wasn't sure about was the maven-dependency plugin's os detected classifier, so I gave it manually. I see that you have also defined it manually so updating the dependency plugin itself should resolve this issue.

Body:
I'm using Google's Protocol Buffers in a project. We use Maven to compile the protobufs automatically ( based on http://vlkan.com/blog/post/2015/11/27/maven-protobuf/ )

Maven gave us tree errors which we were able to solve by installing Maven Plugins on our Eclipse installation. But there is one error we can't solve :

org.apache.maven.plugins:maven-dependency-plugin:2.9:copy:copy-protoc:generate-sources

This error comes and goes apparently "randomly" and it doesn't break the compilation: everything works perfectly fine.
Here is the maven plugin configuration responsible for this problem:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.9</version>
        <executions>
ERROR HERE - <execution>
                <id>copy-protoc</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>copy</goal>
                </goals>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>com.google.protobuf</groupId>
                            <artifactId>protoc</artifactId>
                            <version>3.0.0-beta-3</version>
                            <classifier>${os.detected.classifier}</classifier>
                            <type>exe</type>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                        </artifactItem>
                    </artifactItems>
                </configuration>
            </execution>
        </executions>
    </plugin>

I tried deleting the .m2 folder or looking for more plugins to no avail.

How to remove that error from Eclipse? Thanks

Edit 1 , the whole stacktrace:

Unable to find artifact. (org.apache.maven.plugins:maven-dependency-plugin:2.9:copy:copy-protoc:generate-sources)

org.apache.maven.plugin.MojoExecutionException: Unable to find artifact.
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getArtifact(AbstractFromConfigurationMojo.java:265)
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getProcessedArtifactItems(AbstractFromConfigurationMojo.java:171)
    at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.doExecute(CopyMojo.java:105)
    at org.apache.maven.plugin.dependency.AbstractDependencyMojo.execute(AbstractDependencyMojo.java:167)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360)
    at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52)
    at com.ianbrandt.tools.m2e.mdp.core.MdpBuildParticipant.executeMojo(MdpBuildParticipant.java:133)
    at com.ianbrandt.tools.m2e.mdp.core.MdpBuildParticipant.build(MdpBuildParticipant.java:67)
    at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Failure to find com.google.protobuf:protoc:exe:3.0.0-beta-3 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.0.0-beta-3 -Dpackaging=exe -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.0.0-beta-3 -Dpackaging=exe -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  com.google.protobuf:protoc:exe:3.0.0-beta-3

from the specified remote repositories:
  central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)

    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:218)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:154)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:545)
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getArtifact(AbstractFromConfigurationMojo.java:257)
    ... 37 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find com.google.protobuf:protoc:exe:3.0.0-beta-3 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:212)
    ... 40 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find com.google.protobuf:protoc:exe:3.0.0-beta-3 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:231)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:585)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:503)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
    ... 44 more

Edit 2 , The Effective POM:

Effective POMs, after inheritance, interpolation, and profiles are applied:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.GroupName</groupId>
  <artifactId>ProjectName</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>ProjectName</name>
  <url>http://maven.apache.org</url>
  <properties>
    <build-helper-maven-plugin.version>1.9.1</build-helper-maven-plugin.version>
    <java.version>1.8</java.version>
    <junit.version>4.12</junit.version>
    <maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
    <maven-dependency-plugin.version>2.9</maven-dependency-plugin.version>
    <maven-shade-plugin.version>2.4.3</maven-shade-plugin.version>
    <os-maven-plugin.version>1.5.0.Final</os-maven-plugin.version>
    <os.detected.arch>x86_64</os.detected.arch>
    <os.detected.classifier>windows-x86_64</os.detected.classifier>
    <os.detected.name>windows</os.detected.name>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <protobuf-java-format.version>1.2</protobuf-java-format.version>
    <protobuf.input.directory>E:\Development\GroupName\ProjectFolder/proto</protobuf.input.directory>
    <protobuf.output.directory.cpp>E:\Development\GroupName\ProjectFolder\target/libcpp</protobuf.output.directory.cpp>
    <protobuf.output.directory.java>E:\Development\GroupName\ProjectFolder\target/generated-sources</protobuf.output.directory.java>
    <protobuf.version>3.0.0-beta-3</protobuf.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>3.0.0-beta-3</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.googlecode.protobuf-java-format</groupId>
      <artifactId>protobuf-java-format</artifactId>
      <version>1.2</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <sourceDirectory>E:\Development\GroupName\ProjectFolder\src\main\java</sourceDirectory>

    <testSourceDirectory>E:\Development\GroupName\ProjectFolder\src\test\java</testSourceDirectory>
    <outputDirectory>E:\Development\GroupName\ProjectFolder\target\classes</outputDirectory>
    <testOutputDirectory>E:\Development\GroupName\ProjectFolder\target\test-classes</testOutputDirectory>
    <extensions>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.5.0.Final</version>
      </extension>
    </extensions>
    <resources>
      <resource>
        <directory>E:\Development\GroupName\ProjectFolder\src\main\resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>E:\Development\GroupName\ProjectFolder\src\test\resources</directory>
      </testResource>
    </testResources>
    <directory>E:\Development\GroupName\ProjectFolder\target</directory>
    <finalName>ProjectName</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.2-beta-5</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.8</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.3.2</version>
        </plugin>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <versionRange>[1.7,)</versionRange>
                    <goals>
                      <goal>run</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                    <execute>
                      <runOnConfiguration>true</runOnConfiguration>
                      <runOnIncremental>true</runOnIncremental>
                    </execute>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <encoding>UTF-8</encoding>
            </configuration>
          </execution>
          <execution>
            <id>default-testCompile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <encoding>UTF-8</encoding>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>default-testResources</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>testResources</goal>
            </goals>
            <configuration>
              <encoding>UTF-8</encoding>
            </configuration>
          </execution>
          <execution>
            <id>default-resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
            <configuration>
              <encoding>UTF-8</encoding>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.9</version>
        <executions>
          <execution>
            <id>copy-protoc</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.google.protobuf</groupId>
                  <artifactId>protoc</artifactId>
                  <version>3.0.0-beta-3</version>
                  <classifier>${os.detected.classifier}</classifier>
                  <type>exe</type>
                  <outputDirectory>E:\Development\GroupName\ProjectFolder\target</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>exec-protoc</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <property name="protoc.filename" value="protoc-3.0.0-beta-3-${os.detected.classifier}.exe" />
                <property name="protoc.filepath" value="E:\Development\GroupName\ProjectFolder\target/${protoc.filename}" />
                <chmod file="${protoc.filepath}" perm="ugo+rx" />
                <mkdir dir="E:\Development\GroupName\ProjectFolder\target/generated-sources" />
                <mkdir dir="E:\Development\GroupName\ProjectFolder\target/libcpp" />
                <path id="protobuf.input.filepaths.path">
                  <fileset dir="E:\Development\GroupName\ProjectFolder/proto">
                    <include name="**/*.proto" />
                  </fileset>
                </path>
                <pathconvert property="protobuf.input.filepaths" pathsep=" " refid="protobuf.input.filepaths.path" />
                <exec failonerror="true" executable="${protoc.filepath}">
                  <arg value="-I" />
                  <arg value="E:\Development\GroupName\ProjectFolder/proto" />
                  <arg value="--java_out" />
                  <arg value="E:\Development\GroupName\ProjectFolder\target/generated-sources" />
                  <arg value="--cpp_out" />
                  <arg value="E:\Development\GroupName\ProjectFolder\target/libcpp" />
                  <arg line="${protobuf.input.filepaths}" />
                </exec>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.9.1</version>
        <executions>
          <execution>
            <id>add-classes</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>E:\Development\GroupName\ProjectFolder\target/generated-sources</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.5</version>
        <executions>
          <execution>
            <id>default-clean</id>
            <phase>clean</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>default-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12.4</version>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>default-install</id>
            <phase>install</phase>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>default-deploy</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.3</version>
        <executions>
          <execution>
            <id>default-site</id>
            <phase>site</phase>
            <goals>
              <goal>site</goal>
            </goals>
            <configuration>
              <outputDirectory>E:\Development\GroupName\ProjectFolder\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
          <execution>
            <id>default-deploy</id>
            <phase>site-deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <outputDirectory>E:\Development\GroupName\ProjectFolder\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <outputDirectory>E:\Development\GroupName\ProjectFolder\target\site</outputDirectory>
          <reportPlugins>
            <reportPlugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
            </reportPlugin>
          </reportPlugins>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <reporting>
    <outputDirectory>E:\Development\GroupName\ProjectFolder\target\site</outputDirectory>
  </reporting>
</project>


来源: stackexchange

问:
Apache is not running from XAMPP Control Panel ( Error: Apache shutdown unexpectedly. This may be due to a blocked port)
I have installed XAMPP (xampp-win32-1.8.2-0-VC9-installer.exe) on Windows 7 successfully. But unfortunately, the following error was found during running Apache from XAMPP Control Panel:

```<code>5:38:38 PM  [Apache]    Error: Apache shutdown unexpectedly.
5:38:38 PM  [Apache]    This may be due to a blocked port, missing dependencies,
5:38:38 PM  [Apache]    improper privileges, a crash, or a shutdown by another method.
5:38:38 PM  [Apache]    Press the Logs button to view error logs and check
5:38:38 PM  [Apache]    the Windows Event Viewer for more clues
5:38:38 PM  [Apache]    If you need more help, copy and post this
5:38:38 PM  [Apache]    entire log window on the forums
</code>```

答:
The Best way to do so:

The other methods explained above will get you stuck at a lot of places
Don't go for changing the port

2 Step Process

1) Open Command Prompt as Administrator

2) type net stop http  (If it says it doesn't identify the keyword, then it is only because your Environmental Variable's PATH doesn't contain path to Program Files/System32 you can search on how to do it )
press Y at every place it asks you to, don't worry you are not stopping any important process just some process which took your port. And that process will again take over your port once you are not working.

ContentLicense: CC BY-SA 3.0

Body:
I have installed XAMPP (xampp-win32-1.8.2-0-VC9-installer.exe) on Windows 7 successfully. But unfortunately, the following error was found during running Apache from XAMPP Control Panel:

5:38:38 PM  [Apache]    Error: Apache shutdown unexpectedly.
5:38:38 PM  [Apache]    This may be due to a blocked port, missing dependencies,
5:38:38 PM  [Apache]    improper privileges, a crash, or a shutdown by another method.
5:38:38 PM  [Apache]    Press the Logs button to view error logs and check
5:38:38 PM  [Apache]    the Windows Event Viewer for more clues
5:38:38 PM  [Apache]    If you need more help, copy and post this
5:38:38 PM  [Apache]    entire log window on the forums


问:
(JavaScript) Import external <object> svg from File or FileReader Object
I'm using Two.js, I want to allow the user to import an svg file and display it on my scene.

Two.interpret() can take any dom of  tag that has SVG data in it, so I've created this function to simulate  tag from a file:

```<code>this.m_Two.interpretFromFile = function (two, fname) {
        //Create an object and load an svg from 'fname'
        var object = document.createElement("object");
        //Set the id to the filename without path or extension
        object.id = fname;
        object.id = object.id.replace(/\\/g, '/');
        object.id = object.id.substring(object.id.lastIndexOf('/')+1, object.id.lastIndexOf('.'));
        console.log("Importing " + object.id);
        object.data = fname; //HTML takes care of the rest
        object.type = "image/svg+xml";
        object.width = 64; //Import from file maybe?
        object.height = 64;
        object.style = "visibility:hidden;position:absolute;left:0px;top:0px;";
        document.body.appendChild(object); //Add it to the body (invis) that way it loads
        //When it loads, finish up
        object.onload = function () {
            if (!object.contentDocument || object.contentDocument.getElementsByTagName("svg").length < 1) return;
            var svgObj = object.contentDocument.getElementsByTagName('svg')[0];
            var ret = two.interpret(svgObj);
            document.body.removeChild(object); //Remove it. Use path.clone to duplicate stuff..
            return ret; //Return our new svg path
        }
    };
</code>```

This function takes a Two instance, and a file url, and returns a two.path.

This all works fine and dandy when use the console with
twoInstance.interpretFromFile (twoInstance, "images/Test.svg");

However, I am running these files locally for testing, and I certainly don't expect anyone to go into their browser's console and use the function, already knowing the file's exact path, and also know to type "file://" before that path... Yeesh

```<code>    document.getElementById("dWorkSpace").ondrop = function(e) {
            e.preventDefault(); //Default event loads the file itself.. KILL IT WITH FIRE.

            if (!e.dataTransfer || !e.dataTransfer.items.length > 0 || !e.dataTransfer.files[0]) return;

            var file = e.dataTransfer.files[0];

            twoInstance.interpretFromFile(twoInstance, "file://" + file.name);
    }
</code>```

'file.name' only gives the file, not the path (yes, I know this is a securety thing in browsers. I've already looked at all of the other questions about that..)

So NOW, I could use a FileReader to read the svg file itself, but how do I get that data into an  tag? I need it in this format at some point:

```<code>            <object data="Test.svg" type="image/svg+xml"></object>
</code>```

Because Two.js seems to not like 'svg' tag.. Just 'object' tag..

I am SO sorry for the enlongated question.. I'm pretty deep down this rabbit hole, as you can see. I tried to only use relevant code, but honestly the whole thing is monstrously large, and I'd hate to post it all.

答:
What a quick answer.. @guest271314 (I'll link this if I can figure it out later).

This worked for me:

```<code>document.getElementById("dWorkSpace").ondrop = function(e) {
    e.preventDefault(); //Default event loads the file itself.. KILL IT WITH FIRE.

    if (!e.dataTransfer || !e.dataTransfer.items.length > 0 || !e.dataTransfer.files[0]) return;

    var file = e.dataTransfer.files[0];

    var reader = new FileReader(); //Make a reader

    reader.onloadend = function (evt) { //When the file is actually loaded
        Application.m_Two.interpretFromFile(Application.m_Two, reader.result);
    }
    reader.readAsDataURL(file);
}
</code>```

The changed bit is with the FileReader object, and I used readAsDataUrl like
guest271314 was talking about in the first comment. Can you tell that I'm new? xD

Demonstration: http://jonathancrowder.com/AnimatorProject/Application.html
-- Drag an SVG file onto the page to try it out.

Body:
I'm using Two.js, I want to allow the user to import an svg file and display it on my scene.

Two.interpret() can take any dom of  tag that has SVG data in it, so I've created this function to simulate  tag from a file:

this.m_Two.interpretFromFile = function (two, fname) {
        //Create an object and load an svg from 'fname'
        var object = document.createElement("object");
        //Set the id to the filename without path or extension
        object.id = fname;
        object.id = object.id.replace(/\\/g, '/');
        object.id = object.id.substring(object.id.lastIndexOf('/')+1, object.id.lastIndexOf('.'));
        console.log("Importing " + object.id);
        object.data = fname; //HTML takes care of the rest
        object.type = "image/svg+xml";
        object.width = 64; //Import from file maybe?
        object.height = 64;
        object.style = "visibility:hidden;position:absolute;left:0px;top:0px;";
        document.body.appendChild(object); //Add it to the body (invis) that way it loads
        //When it loads, finish up
        object.onload = function () {
            if (!object.contentDocument || object.contentDocument.getElementsByTagName("svg").length < 1) return;
            var svgObj = object.contentDocument.getElementsByTagName('svg')[0];
            var ret = two.interpret(svgObj);
            document.body.removeChild(object); //Remove it. Use path.clone to duplicate stuff..
            return ret; //Return our new svg path
        }
    };

This function takes a Two instance, and a file url, and returns a two.path.

This all works fine and dandy when use the console with
twoInstance.interpretFromFile (twoInstance, "images/Test.svg");

However, I am running these files locally for testing, and I certainly don't expect anyone to go into their browser's console and use the function, already knowing the file's exact path, and also know to type "file://" before that path... Yeesh

    document.getElementById("dWorkSpace").ondrop = function(e) {
            e.preventDefault(); //Default event loads the file itself.. KILL IT WITH FIRE.

            if (!e.dataTransfer || !e.dataTransfer.items.length > 0 || !e.dataTransfer.files[0]) return;

            var file = e.dataTransfer.files[0];

            twoInstance.interpretFromFile(twoInstance, "file://" + file.name);
    }

'file.name' only gives the file, not the path (yes, I know this is a securety thing in browsers. I've already looked at all of the other questions about that..)

So NOW, I could use a FileReader to read the svg file itself, but how do I get that data into an  tag? I need it in this format at some point:

            <object data="Test.svg" type="image/svg+xml"></object>

Because Two.js seems to not like 'svg' tag.. Just 'object' tag..

I am SO sorry for the enlongated question.. I'm pretty deep down this rabbit hole, as you can see. I tried to only use relevant code, but honestly the whole thing is monstrously large, and I'd hate to post it all.

Body:
What a quick answer.. @guest271314 (I'll link this if I can figure it out later).

This worked for me:

document.getElementById("dWorkSpace").ondrop = function(e) {
    e.preventDefault(); //Default event loads the file itself.. KILL IT WITH FIRE.

    if (!e.dataTransfer || !e.dataTransfer.items.length > 0 || !e.dataTransfer.files[0]) return;

    var file = e.dataTransfer.files[0];

    var reader = new FileReader(); //Make a reader

    reader.onloadend = function (evt) { //When the file is actually loaded
        Application.m_Two.interpretFromFile(Application.m_Two, reader.result);
    }
    reader.readAsDataURL(file);
}

The changed bit is with the FileReader object, and I used readAsDataUrl like
guest271314 was talking about in the first comment. Can you tell that I'm new? xD

Demonstration: http://jonathancrowder.com/AnimatorProject/Application.html
-- Drag an SVG file onto the page to try it out.


问:
SQL Server: Group By based on one column and get columns based on other column
My data:

```<code>ColumnA                 Column B            ColumnC
A                          Hi                  Yes
A                          Hello               NULL
B                          Hola                Yes
B                          Hola                Yes
B                          Hi                  NULL
C                          ABCD                Yes
</code>```

My SQL should be able to do following:

Group by Column A

Select only those groups of A that contain Yes and Null both in the result of a

Expected Result is:

```<code>ColumnA                 Column B            ColumnC
A                          Hi                  Yes
A                          Hello               NULL
B                          Hola                Yes
B                          Hola                Yes
B                          Hi                  NULL
</code>```

How do I select all values that satisfy above rule?

答:
```<code>select t1.*
from t t1
inner join
    (select sum(case when t3.colc is null then 1  when t3.colc = 'Yes' then 1 else 0 end) as cnt,
     t3.cola
     from t t3
     group by cola) t2 on t1.cola = t2.cola
     where t2.cnt >= 2;
</code>```

Body:
My data:

ColumnA                 Column B            ColumnC
A                          Hi                  Yes
A                          Hello               NULL
B                          Hola                Yes
B                          Hola                Yes
B                          Hi                  NULL
C                          ABCD                Yes

My SQL should be able to do following:

Group by Column A

Select only those groups of A that contain Yes and Null both in the result of a

Expected Result is:

ColumnA                 Column B            ColumnC
A                          Hi                  Yes
A                          Hello               NULL
B                          Hola                Yes
B                          Hola                Yes
B                          Hi                  NULL

How do I select all values that satisfy above rule?


问:
Xamarin Forms, MS Azure Crashes not working on iOS
I followed this link and added Analytics and Crashes correctly to Android but in iOS only Analytics added correctly. for checking if Crashes is working on iOS, I created some crashes like so:

1.

```<code>int a = 0;
int b = 2 / a;
</code>```

2.

```<code>throw new Exception("jiiiiz");
</code>```

3.

```<code>Crashes.GenerateTestCrash();
</code>```

but non of them are reported to azure crashes panel, I also check if an error happen in next session app is opened but it's always false:

```<code>    protected override async void OnAppearing()
    {
        base.OnAppearing();
        var a = Crashes.HasCrashedInLastSession;
        Debug.WriteLine($"Crashed?? {a}"); // is always false
    }
</code>```

答:
As  Mobile Center Crashes documentation mentioned about Troubleshooting:

Right now crash reports are only visible if they can be symbolicated. For that to happen the proper symbols (dSYM) need to be uploaded. There will be a UI available later that shows which symbols are missing and how to find them.

Make sure the app doesn't crash on startup, as the SDK wouldn't have time to send the crash report. This is a limitation for any 3rd party crash reporting service.

For how to provide symbols for your app, you could refer to Uploading symbols.

Body:
I followed this link and added Analytics and Crashes correctly to Android but in iOS only Analytics added correctly. for checking if Crashes is working on iOS, I created some crashes like so:

1.

int a = 0;
int b = 2 / a;

2.

throw new Exception("jiiiiz");

3.

Crashes.GenerateTestCrash();

but non of them are reported to azure crashes panel, I also check if an error happen in next session app is opened but it's always false:

    protected override async void OnAppearing()
    {
        base.OnAppearing();
        var a = Crashes.HasCrashedInLastSession;
        Debug.WriteLine($"Crashed?? {a}"); // is always false
    }


问:
Travis CI. Show results of SonarQube execution on Github
I've created GitHub repository, added Travis CI into it, added an icon with Travis CI build information (it works fine).

Also, I've added SonarQube via Travis CI. It also runs, but I didn't know how to show information from SonarQube execution in my Github README.rst.

Any ideas?

It will be amazing to show somehow all the data (technical debts, code smells, etc.)

答:
You can look at one of our sample projects: in the README file, you will see how to integrate a badge that shows if your project passed the quality gate or not:

The URL to get the badge itself:

https://sonarqube.com/api/badges/gate?key=your_project_key

The URL that points to your project:

https://sonarqube.com/dashboard/index/your_project_key


问:
SQLSTATE[IMSSP]: Tried to bind parameter number 2101. SQL Server supports a maximum of 2100 parameters
I am trying to run this query

```<code>$claims = Claim::wherein('policy_id', $userPolicyIds)->where('claim_settlement_status', 'Accepted')->wherebetween('intimation_date', [$startDate, $endDate])->get();
</code>```

Here, $userPolicyIds can have thousands of policy ids. Is there any way I can increase the maximum number of parameters in SQL server? If not, could anyone help me find a way to solve this issue?

答:
I solved this problem by running this raw query

```<code>SELECT claims.*, policies.* FROM claims INNER JOIN policies ON claims.policy_id = policies.id
                    WHERE policy_id IN $userPolicyIds AND claim_settlement_status = 'Accepted' AND intimation_date BETWEEN '$startDate' AND '$endDate';
</code>```

Here, $userPolicyIds is a string like this ('123456','654321','456789'). This query is a bit slow, I'll admit that. But the number of policy ids is always going to a very big number and I wanted a quick fix.

Body:
I am trying to run this query

$claims = Claim::wherein('policy_id', $userPolicyIds)->where('claim_settlement_status', 'Accepted')->wherebetween('intimation_date', [$startDate, $endDate])->get();

Here, $userPolicyIds can have thousands of policy ids. Is there any way I can increase the maximum number of parameters in SQL server? If not, could anyone help me find a way to solve this issue?

Body:
I solved this problem by running this raw query

SELECT claims.*, policies.* FROM claims INNER JOIN policies ON claims.policy_id = policies.id
                    WHERE policy_id IN $userPolicyIds AND claim_settlement_status = 'Accepted' AND intimation_date BETWEEN '$startDate' AND '$endDate';

Here, $userPolicyIds is a string like this ('123456','654321','456789'). This query is a bit slow, I'll admit that. But the number of policy ids is always going to a very big number and I wanted a quick fix.


问:
JComboBox actions
Is there a way to distinguish between a JComboBox's index being changed programatically using setSelectedBoundValue and by clicking on the JComboBox?</p>

答:
setSelectedBoundValue

Never heard of that method?

Is there a way to distinguish between a JComboBox's index being changed programatically

Not really. You can remove the listener:

```<code>comboBox.removeActionListener(...);
comboBox.setSelectedItem(...);
comboBox.addActionListener(...);
</code>```

You can set your own class variable.

```<code>manualSelection = true;
comboBox.setSelectedIndex(...);
manualSelection = false;
</code>```

ContentLicense: CC BY-SA 2.5

Title: JComboBox actions

Body:
setSelectedBoundValue

Never heard of that method?

Is there a way to distinguish between a JComboBox's index being changed programatically

Not really. You can remove the listener:

comboBox.removeActionListener(...);
comboBox.setSelectedItem(...);
comboBox.addActionListener(...);

You can set your own class variable.

manualSelection = true;
comboBox.setSelectedIndex(...);
manualSelection = false;


问:
how to Check Difference between data on Ignite Cache Key and Data on HBase Row-Key?
I am using Ignite as Cache Layer for HBase. I have Just Started to Integrate Apache Ignite And Apache HBase. But now I have a question that suppose I have load Initially some data i.e. A data on HBase Row-key and I do not use write Through and but using read through so when I insert some extra column on the same Rowkey in HBase at and want to get that data trough ignite then how can i get updated data in ignite Cache?</p>

答: You need update mappings in JdbcType and restart grid, otherwise Ignite wouldn't be aware of schema changes in the underlying database.</p>


问:
Correct way to update a python dict dynamically
I have a python dict containing data about a table.

```<code>table_dict = {'0': {'column_metadata': '...',
                    'cells':[[cell1_url],[cell2_url]]
                   },
              '1': {'column_metadata': '...',
                    'cells':[[cell1_url],[cell2_url]]
                   }
             }
</code>```

Here keys are column position ie 0 means first column, 1 is second so on
each column has a inner dict with a key cells which is list of list.

I am iterating over this dict to get cell value from url and then appending it back to same list.

```<code>for key, column in table_dict:
    for cell in column['cells']:
        cell_value = get_cell_data(cell1_url)
        column['cells'].append(cell_value)
</code>```

with this code I get final dict as

```<code>table_dict = {'0': {'column_metadata': '...',
                    'cells':[[cell1_url, cell1_data],
                             [cell2_url, cell2_data]
                            ]
                   },
              '1': {'column_metadata': '...',
                    'cells':[[cell1_url, cell1_data],
                             [cell2_url, cell2_data]
                            ]
</code>```

I will not delete any keys just add data to dict.

Is this the correct method. Iterating over dict and then append to same.

Is there any better way to approach this problem ?

答:
From your description I assume, you does not want to append something to column['cells'] but to the lists inside this list:

```<code>for column in table_dict.values():
    for cell in column['cells']:
        cell_url = cell[0]
        cell.append(get_cell_data(cell_url))
</code>```

Body:
I have a python dict containing data about a table.

table_dict = {'0': {'column_metadata': '...',
                    'cells':[[cell1_url],[cell2_url]]
                   },
              '1': {'column_metadata': '...',
                    'cells':[[cell1_url],[cell2_url]]
                   }
             }

Here keys are column position ie 0 means first column, 1 is second so on
each column has a inner dict with a key cells which is list of list.

I am iterating over this dict to get cell value from url and then appending it back to same list.

for key, column in table_dict:
    for cell in column['cells']:
        cell_value = get_cell_data(cell1_url)
        column['cells'].append(cell_value)

with this code I get final dict as

table_dict = {'0': {'column_metadata': '...',
                    'cells':[[cell1_url, cell1_data],
                             [cell2_url, cell2_data]
                            ]
                   },
              '1': {'column_metadata': '...',
                    'cells':[[cell1_url, cell1_data],
                             [cell2_url, cell2_data]
                            ]

I will not delete any keys just add data to dict.

Is this the correct method. Iterating over dict and then append to same.

Is there any better way to approach this problem ?

Body:
From your description I assume, you does not want to append something to column['cells'] but to the lists inside this list:

for column in table_dict.values():
    for cell in column['cells']:
        cell_url = cell[0]
        cell.append(get_cell_data(cell_url))


问:
getting an NSException not sure why
so my app is crashing on launch and i am getting this in the console when i run and debug:

```<code>[Session started at 2010-12-08 20:46:52 -0500.]
2010-12-08 20:46:53.921 WotT-Codename_Savior[64325:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<WotT_Codename_SaviorViewController 0x4b0b380> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key CreateCharacter.'
2010-12-08 20:46:53.924 WotT-Codename_Savior[64325:207] Stack: (
    42190928,
    43348780,
    42190817,
    209120,
    208670,
    5050527,
    41679989,
    5044964,
    5053145,
    3542950,
    3534896,
    3534602,
    10353,
    2918724,
    2922831,
    2948414,
    2929911,
    2961880,
    51183996,
    41470108,
    41466024,
    2920993,
    2954098,
    10244,
    10098
)
terminate called after throwing an instance of 'NSException'
</code>```

i'm kinda new to obj-c and cocoa touch so i don't really know why it's throwing the exception can anyone help decipher this for me?also if you need more code just let me know...i wasn't sure what to post here

答:
It might be a broken connection in interface builder.

Try opening the XIB for WotT_Codename_SaviorViewController and finding something linked to CreateCharacter and I'll bet that's your problem.

Title: getting an NSException not sure why

Body:
so my app is crashing on launch and i am getting this in the console when i run and debug:

[Session started at 2010-12-08 20:46:52 -0500.]
2010-12-08 20:46:53.921 WotT-Codename_Savior[64325:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<WotT_Codename_SaviorViewController 0x4b0b380> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key CreateCharacter.'
2010-12-08 20:46:53.924 WotT-Codename_Savior[64325:207] Stack: (
    42190928,
    43348780,
    42190817,
    209120,
    208670,
    5050527,
    41679989,
    5044964,
    5053145,
    3542950,
    3534896,
    3534602,
    10353,
    2918724,
    2922831,
    2948414,
    2929911,
    2961880,
    51183996,
    41470108,
    41466024,
    2920993,
    2954098,
    10244,
    10098
)
terminate called after throwing an instance of 'NSException'

i'm kinda new to obj-c and cocoa touch so i don't really know why it's throwing the exception can anyone help decipher this for me?also if you need more code just let me know...i wasn't sure what to post here


问:
strtotime on incorrect dates
I found something odd about strtotime().

On dates that do not exist it returns the day after.

```<code>$d30= strtotime("2017-06-30");
Echo $d30 ."\n";
Echo date("Y-m-d", $d30)."\n\n";  // 2017-06-30

$d31= strtotime("2017-06-31");
Echo $d31 ."\n";
Echo date("Y-m-d", $d31)."\n\n";  // 2017-07-01

$d32= strtotime("2017-06-32");
Echo $d32 ."\n";
Echo date("Y-m-d", $d32);         // 1970-01-01
</code>```

https://3v4l.org/AjMAE

I understand the last one. It returns nothing as it's an error.

But why does the second one return first of July?

Is it a meant to be functional, in case you make a mistake it will "correct you"? Or is it a true bug in strtotime()?

答:
If you look at the docs for strtotime() you will see the first parameter is:

time

  A date/time string. Valid formats are explained in Date and Time Formats.

If you follow the link for the date and time formats and go to Date Formats you will see:

Thus for the date format (I.e. DD), 01-31 is valid    (since a 3 can only be followed by a 0 or 1) despite the month. Depending on the supplied month and date value the date will be adjusted.

Also found in the notes on that same page:

Note:

  It is possible to over- and underflow the dd and DD format. Day 0 means the last day of previous month, whereas overflows count into the next month. This makes "2008-08-00" equivalent to "2008-07-31" and "2008-06-31" equivalent to "2008-07-01" (June only has 30 days).1

Hence 06-31 is valid while 06-32 is invalid.

Additionally, in the User Contributed Notes section, the note by Mirek at 2015-04-01 01:14 might be useful/interesting:

Note: the day (dd or DD) is first checked for range 0..31 and only if it fits, the overflow and underflow mechanism may apply. If not, strtotime() simply returns false.
  If you need unlimited over/underflow for date calculations (for example 2015-01-40 to 2015-02-09), use mktime() instead.2

1http://php.net/manual/en/datetime.formats.date.php

2http://php.net/manual/en/datetime.formats.date.php#Hcom117014

Title: strtotime on incorrect dates

Body:
I found something odd about strtotime().

On dates that do not exist it returns the day after.

$d30= strtotime("2017-06-30");
Echo $d30 ."\n";
Echo date("Y-m-d", $d30)."\n\n";  // 2017-06-30

$d31= strtotime("2017-06-31");
Echo $d31 ."\n";
Echo date("Y-m-d", $d31)."\n\n";  // 2017-07-01

$d32= strtotime("2017-06-32");
Echo $d32 ."\n";
Echo date("Y-m-d", $d32);         // 1970-01-01

https://3v4l.org/AjMAE

I understand the last one. It returns nothing as it's an error.

But why does the second one return first of July?

Is it a meant to be functional, in case you make a mistake it will "correct you"? Or is it a true bug in strtotime()?


问:
jquery click, toggle one or more div block
I am trying to build a jQuery when clicked on div #toggle, span inside div will show and when set to toggle mode, but when I use two or more div blocks, it only shows the first span. please help.

$(document).ready(function() {
  $("div#toggle").click(function() {
    $("#show").toggle();
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='toggle'>this clicked
  <span id='show'><p>Show this</p></span>
</div>
<div id='toggle'>
  <span id='show'><p>fhslkjklsfjl</p></span>
</div></code>```

答:
You cannot have same id for both spans. Try using different id's for span.
For eg:

$(document).ready(function() {
  $("div#toggle").click(function() {
    $("#show").toggle();
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='toggle'>this clicked
  <span id='show'><p>Show this</p></span>
</div>
<div id='toggle'>
  <span id='show1'><p>fhslkjklsfjl</p></span>
</div></code>```

Body:
I am trying to build a jQuery when clicked on div #toggle, span inside div will show and when set to toggle mode, but when I use two or more div blocks, it only shows the first span. please help.

$(document).ready(function() {
  $("div#toggle").click(function() {
    $("#show").toggle();
  });
});

this clicked

Show this

fhslkjklsfjl

Body:
You cannot have same id for both spans. Try using different id's for span.
For eg:

$(document).ready(function() {
  $("div#toggle").click(function() {
    $("#show").toggle();
  });
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='toggle'>this clicked
  <span id='show'><p>Show this</p></span>
</div>
<div id='toggle'>
  <span id='show1'><p>fhslkjklsfjl</p></span>
</div>


问:
Deployable Spring Boot Wars OAuth2 Denied Exception
I have three spring boot applications, one is a derby spring boot and the other two have OAuth2 (org.springframework.security.oauth2) one has the OAuth2 client and the other the OAuth2 server. I have converted them to deployable wars and deploy them to a tomcat, they seems to be running fine. Except for the OAuth2, it seems to be failing in the deployable wars. I'm seeing this error:

```<code>org.springframework.security.oauth2.client.resource.OAuth2AccessDeniedException: Error requesting access token.
at org.springframework.security.oauth2.client.token.OAuth2AccessTokenSupport.retrieveToken(OAuth2AccessTokenSupport.java:145)
at org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsAccessTokenProvider.obtainAccessToken(ClientCredentialsAccessTokenProvider.java:44)
at org.springframework.security.oauth2.client.token.AccessTokenProviderChain.obtainNewAccessTokenInternal(AccessTokenProviderChain.java:148)
at org.springframework.security.oauth2.client.token.AccessTokenProviderChain.obtainAccessToken(AccessTokenProviderChain.java:121)
at org.springframework.security.oauth2.client.OAuth2RestTemplate.acquireAccessToken(OAuth2RestTemplate.java:221)
at org.springframework.security.oauth2.client.OAuth2RestTemplate.getAccessToken(OAuth2RestTemplate.java:173)
at org.springframework.security.oauth2.client.OAuth2RestTemplate.createRequest(OAuth2RestTemplate.java:105)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:648)
at org.springframework.security.oauth2.client.OAuth2RestTemplate.doExecute(OAuth2RestTemplate.java:128)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613)
at org.springframework.web.client.RestTemplate.headForHeaders(RestTemplate.java:336)
</code>```

I have debug both executable and deployable and the only thing I have found is that in the executable wars the OAuth2AccessToken has a value but in the deploy wars in tomcat the OAuth2AccessToken is null.

I'm able to get the token with curl and I have check that the url is correct in the application.

I've also try to deploy the derby spring boot in a separate tomcat and that makes the OAuth2 to start working, not sure why.

I'm not sure why this is happening since the wars are the same. Am I missing some configuration in tomcat?

Or maybe some conflict with the classes deployed in tomcat? Or the tomcat classpath?

答: I once faced similar issue. I deployed my Spring Boot application on AWS and I was getting the same error. I was deploying the .war file and running the Tomcat separately on AWS. I fixed the error by deploying the .jar file which itself includes the tomcat server. Not sure if the scenario is same. </p>

Body:
I have three spring boot applications, one is a derby spring boot and the other two have OAuth2 (org.springframework.security.oauth2) one has the OAuth2 client and the other the OAuth2 server. I have converted them to deployable wars and deploy them to a tomcat, they seems to be running fine. Except for the OAuth2, it seems to be failing in the deployable wars. I'm seeing this error:

org.springframework.security.oauth2.client.resource.OAuth2AccessDeniedException: Error requesting access token.
at org.springframework.security.oauth2.client.token.OAuth2AccessTokenSupport.retrieveToken(OAuth2AccessTokenSupport.java:145)
at org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsAccessTokenProvider.obtainAccessToken(ClientCredentialsAccessTokenProvider.java:44)
at org.springframework.security.oauth2.client.token.AccessTokenProviderChain.obtainNewAccessTokenInternal(AccessTokenProviderChain.java:148)
at org.springframework.security.oauth2.client.token.AccessTokenProviderChain.obtainAccessToken(AccessTokenProviderChain.java:121)
at org.springframework.security.oauth2.client.OAuth2RestTemplate.acquireAccessToken(OAuth2RestTemplate.java:221)
at org.springframework.security.oauth2.client.OAuth2RestTemplate.getAccessToken(OAuth2RestTemplate.java:173)
at org.springframework.security.oauth2.client.OAuth2RestTemplate.createRequest(OAuth2RestTemplate.java:105)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:648)
at org.springframework.security.oauth2.client.OAuth2RestTemplate.doExecute(OAuth2RestTemplate.java:128)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613)
at org.springframework.web.client.RestTemplate.headForHeaders(RestTemplate.java:336)

I have debug both executable and deployable and the only thing I have found is that in the executable wars the OAuth2AccessToken has a value but in the deploy wars in tomcat the OAuth2AccessToken is null.

I'm able to get the token with curl and I have check that the url is correct in the application.

I've also try to deploy the derby spring boot in a separate tomcat and that makes the OAuth2 to start working, not sure why.

I'm not sure why this is happening since the wars are the same. Am I missing some configuration in tomcat?

Or maybe some conflict with the classes deployed in tomcat? Or the tomcat classpath?


问:
Explanation - Copying data VBA code using PasteSpecial
I have these two workbooks.

I want to transfer data of some columns in the first workbook to a given sheet in workbook 2.

I am getting an error of runtime (1004).
Method 'Range of object' worksheet failed

I am getting error on this line in the code

``` SummarySheet.Range(columnaddress & "8:" & columnaddress & lastrow).Copy ```

Here's the complete code .

```<code>Sub RectangleRoundedCorners1_Click()

  Application.ScreenUpdating = False

  Dim MacroBook As Workbook, SummaryBook As Workbook, BSSBook As Workbook, _
    SummarySheet As Worksheet, TwoGonlyER As Worksheet, threeGswapRoll As Worksheet, _
    threeGswapER As Worksheet, fourGprData As Worksheet, threeGpRData As Worksheet
  Dim onlyER As Range, rolloutER As Range, swapER As Range, prData As Range, _
    gPRdata As Range, FolderPathForSummary As String, lastrow As Integer

  Set MacroBook = ThisWorkbook

  'Summary Book Open
  FolderPathForSummary = MacroBook.Worksheets("Tool").Range("D8")

  FolderPath = MacroBook.Worksheets("Tool").Range("D11")

  If Dir(FolderPath, vbDirectory) = "" Then
    MsgBox "Please enter a valid folder path to save the file!"
    Exit Sub
  End If

  If Not Dir(FolderPathForSummary) <> "" Then
    MsgBox " Summary file doesn't exist in your mentioned address. Please   check again!  "
    Exit Sub
  End If

  Set SummaryBook = Workbooks.Open(FolderPathForSummary)
  Set SummarySheet = SummaryBook.Worksheets("Summary Data")

  lastrow = SummarySheet.Cells(Rows.Count, "A").End(xlUp).Row

  'BSS Tracker Open
  Set BSSBook = Workbooks.Add
  BSSBook.SaveAs (FolderPath & "BSS Tracker " & Format(CStr(Now), "ddmmmyyyyhhmmss") & ".xlsx")

  MacroBook.Worksheets("2G Only ER").Copy before:=BSSBook.Sheets(1)
  Set TwoGonlyER = BSSBook.Worksheets("2G Only ER")

  MacroBook.Worksheets("3G Swap & 4G ROllout ER").Copy before:=BSSBook.Sheets(1)
  Set threeGswapRoll = BSSBook.Worksheets("3G Swap & 4G ROllout ER")

  MacroBook.Worksheets("3G & 4G Swap ER").Copy before:=BSSBook.Sheets(1)
  Set threeGswapER = BSSBook.Worksheets("3G & 4G Swap ER")

  MacroBook.Worksheets("4G PR Data").Copy before:=BSSBook.Sheets(1)
  Set fourGprData = BSSBook.Worksheets("4G PR Data")

  MacroBook.Worksheets("3G PR Data").Copy before:=BSSBook.Sheets(1)

  Set threeGpRData = BSSBook.Worksheets("3G PR Data")
  Set swapER = threeGswapER.Range("A3:P3")

  For Each entry In swapER

    columnaddress = entry.Value

    SummarySheet.Range(columnaddress & "8:" & columnaddress & lastrow).Copy
    entry.PasteSpecial

  Next entry

  BSSBook.Save
  BSSBook.Close

  SummaryBook.Save
  SummaryBook.Close

  MsgBox "BSS Tracker successfully generated!"

End Sub
</code>```

答:
As per your code, columnaddress should be string variable which should hold the column letter. Like

```<code>Dim columnaddress As String
columnaddress = "A"
</code>```

There are also other variables like SummarySheet which refers to the source sheet and entry sheet which refers to the destination sheet.

The variable lastrow should be a long variable which refers to the last row with data.

So if lastrow is say 25 and columnaddress is "A" then as per the following line

```<code>SummarySheet.Range(columnaddress & "8:" & columnaddress & lastrow).Copy
</code>```

Then Range A8:A25 from the SummarySheet is copied and paste on entry sheet.

Body:
I have these two workbooks.

I want to transfer data of some columns in the first workbook to a given sheet in workbook 2.

I am getting an error of runtime (1004).
Method 'Range of object' worksheet failed

I am getting error on this line in the code

 SummarySheet.Range(columnaddress & "8:" & columnaddress & lastrow).Copy

Here's the complete code .

Sub RectangleRoundedCorners1_Click()

  Application.ScreenUpdating = False

  Dim MacroBook As Workbook, SummaryBook As Workbook, BSSBook As Workbook, _
    SummarySheet As Worksheet, TwoGonlyER As Worksheet, threeGswapRoll As Worksheet, _
    threeGswapER As Worksheet, fourGprData As Worksheet, threeGpRData As Worksheet
  Dim onlyER As Range, rolloutER As Range, swapER As Range, prData As Range, _
    gPRdata As Range, FolderPathForSummary As String, lastrow As Integer

  Set MacroBook = ThisWorkbook

  'Summary Book Open
  FolderPathForSummary = MacroBook.Worksheets("Tool").Range("D8")

  FolderPath = MacroBook.Worksheets("Tool").Range("D11")

  If Dir(FolderPath, vbDirectory) = "" Then
    MsgBox "Please enter a valid folder path to save the file!"
    Exit Sub
  End If

  If Not Dir(FolderPathForSummary) <> "" Then
    MsgBox " Summary file doesn't exist in your mentioned address. Please   check again!  "
    Exit Sub
  End If

  Set SummaryBook = Workbooks.Open(FolderPathForSummary)
  Set SummarySheet = SummaryBook.Worksheets("Summary Data")

  lastrow = SummarySheet.Cells(Rows.Count, "A").End(xlUp).Row

  'BSS Tracker Open
  Set BSSBook = Workbooks.Add
  BSSBook.SaveAs (FolderPath & "BSS Tracker " & Format(CStr(Now), "ddmmmyyyyhhmmss") & ".xlsx")

  MacroBook.Worksheets("2G Only ER").Copy before:=BSSBook.Sheets(1)
  Set TwoGonlyER = BSSBook.Worksheets("2G Only ER")

  MacroBook.Worksheets("3G Swap & 4G ROllout ER").Copy before:=BSSBook.Sheets(1)
  Set threeGswapRoll = BSSBook.Worksheets("3G Swap & 4G ROllout ER")

  MacroBook.Worksheets("3G & 4G Swap ER").Copy before:=BSSBook.Sheets(1)
  Set threeGswapER = BSSBook.Worksheets("3G & 4G Swap ER")

  MacroBook.Worksheets("4G PR Data").Copy before:=BSSBook.Sheets(1)
  Set fourGprData = BSSBook.Worksheets("4G PR Data")

  MacroBook.Worksheets("3G PR Data").Copy before:=BSSBook.Sheets(1)

  Set threeGpRData = BSSBook.Worksheets("3G PR Data")
  Set swapER = threeGswapER.Range("A3:P3")

  For Each entry In swapER

    columnaddress = entry.Value

    SummarySheet.Range(columnaddress & "8:" & columnaddress & lastrow).Copy
    entry.PasteSpecial

  Next entry

  BSSBook.Save
  BSSBook.Close

  SummaryBook.Save
  SummaryBook.Close

  MsgBox "BSS Tracker successfully generated!"

End Sub

Body:
As per your code, columnaddress should be string variable which should hold the column letter. Like

Dim columnaddress As String
columnaddress = "A"

There are also other variables like SummarySheet which refers to the source sheet and entry sheet which refers to the destination sheet.

The variable lastrow should be a long variable which refers to the last row with data.

So if lastrow is say 25 and columnaddress is "A" then as per the following line

SummarySheet.Range(columnaddress & "8:" & columnaddress & lastrow).Copy

Then Range A8:A25 from the SummarySheet is copied and paste on entry sheet.


问:
reactjs charts implementation
I'm trying to implement a Line chart in my react app. I found this when searching for charts.

https://github.com/reactjs/react-chartjs

I have used this piece of code but it isn't clear how to use chartData and chartOptions

```<code>var LineChart = require("react-chartjs").Line;

var MyComponent = React.createClass({
  render: function() {
    return <LineChart data={chartData} options={chartOptions} width="600" height="250"/>
  }
});
</code>```

How can i declare the chartData and chartOptions inorder to get my Linechart work?

答:
You need to define chartData and chartOptions as objects in your React Component. A sample chartData will look like

For a line Chart

```<code>var chartOptions: {
      // Boolean - If we should show the scale at all
    showScale: true,
    // Boolean - Whether to show a dot for each point
    pointDot: true,
    showLines: false,
    title: {
        display: true,
        text: 'Chart.js Bar Chart'
    },
    legend: {
        display: true,
        labels: {
           boxWidth: 50,
           fontSize: 10,
           fontColor: '#bbb',
           padding: 5,
        }
    }

var chartData = {
    labels: [['Sunday', 'Monday'], ['Sunday', 'Tuesday']],
    datasets: [
        {
            color: "#4D5360",
            highlight: "#616774",
            borderColor: "rgba(179,181,198,1)",
            pointBackgroundColor: "rgba(179,181,198,1)",
            pointBorderColor: "#fff",
            pointHoverBackgroundColor: "#fff",
            pointHoverBorderColor: "rgba(179,181,198,1)",
            label: 'Current lag',
            fill: false,
            lineTension: 0.1,
            fillColor: "rgba(151,187,205,0.2)",
            strokeColor: "rgba(151,187,205,1)",
            pointColor: "rgba(151,187,205,1)",
            pointStrokeColor: "#fff",
            scaleOverride: true, scaleStartValue: 0, scaleStepWidth: 1, scaleSteps: 30,
            data: [[5, 8], [3, 11]]
        }
    ]
}
</code>```

For a barChart

```<code>var chartData = {
        labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
        datasets: [{
            label: '# of Votes',
            data: [12, 19, 3, 5, 2, 3],
            backgroundColor: [
                'rgba(255, 99, 132, 0.2)',
                'rgba(54, 162, 235, 0.2)',
                'rgba(255, 206, 86, 0.2)',
                'rgba(75, 192, 192, 0.2)',
                'rgba(153, 102, 255, 0.2)',
                'rgba(255, 159, 64, 0.2)'
            ],
            borderColor: [
                'rgba(255,99,132,1)',
                'rgba(54, 162, 235, 1)',
                'rgba(255, 206, 86, 1)',
                'rgba(75, 192, 192, 1)',
                'rgba(153, 102, 255, 1)',
                'rgba(255, 159, 64, 1)'
            ],
            borderWidth: 1
        }]
    },

var chartOptions =  {
        scales: {
            yAxes: [{
                ticks: {
                    beginAtZero:true
                }
            }]
        }
    }
</code>```

See the docs here for more information on the object properties:

Title: reactjs charts implementation

Body:
I'm trying to implement a Line chart in my react app. I found this when searching for charts.

https://github.com/reactjs/react-chartjs

I have used this piece of code but it isn't clear how to use chartData and chartOptions

var LineChart = require("react-chartjs").Line;

var MyComponent = React.createClass({
  render: function() {
    return <LineChart data={chartData} options={chartOptions} width="600" height="250"/>
  }
});

How can i declare the chartData and chartOptions inorder to get my Linechart work?

Body:
You need to define chartData and chartOptions as objects in your React Component. A sample chartData will look like

For a line Chart

var chartOptions: {
      // Boolean - If we should show the scale at all
    showScale: true,
    // Boolean - Whether to show a dot for each point
    pointDot: true,
    showLines: false,
    title: {
        display: true,
        text: 'Chart.js Bar Chart'
    },
    legend: {
        display: true,
        labels: {
           boxWidth: 50,
           fontSize: 10,
           fontColor: '#bbb',
           padding: 5,
        }
    }

var chartData = {
    labels: [['Sunday', 'Monday'], ['Sunday', 'Tuesday']],
    datasets: [
        {
            color: "#4D5360",
            highlight: "#616774",
            borderColor: "rgba(179,181,198,1)",
            pointBackgroundColor: "rgba(179,181,198,1)",
            pointBorderColor: "#fff",
            pointHoverBackgroundColor: "#fff",
            pointHoverBorderColor: "rgba(179,181,198,1)",
            label: 'Current lag',
            fill: false,
            lineTension: 0.1,
            fillColor: "rgba(151,187,205,0.2)",
            strokeColor: "rgba(151,187,205,1)",
            pointColor: "rgba(151,187,205,1)",
            pointStrokeColor: "#fff",
            scaleOverride: true, scaleStartValue: 0, scaleStepWidth: 1, scaleSteps: 30,
            data: [[5, 8], [3, 11]]
        }
    ]
}

For a barChart

var chartData = {
        labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
        datasets: [{
            label: '# of Votes',
            data: [12, 19, 3, 5, 2, 3],
            backgroundColor: [
                'rgba(255, 99, 132, 0.2)',
                'rgba(54, 162, 235, 0.2)',
                'rgba(255, 206, 86, 0.2)',
                'rgba(75, 192, 192, 0.2)',
                'rgba(153, 102, 255, 0.2)',
                'rgba(255, 159, 64, 0.2)'
            ],
            borderColor: [
                'rgba(255,99,132,1)',
                'rgba(54, 162, 235, 1)',
                'rgba(255, 206, 86, 1)',
                'rgba(75, 192, 192, 1)',
                'rgba(153, 102, 255, 1)',
                'rgba(255, 159, 64, 1)'
            ],
            borderWidth: 1
        }]
    },

var chartOptions =  {
        scales: {
            yAxes: [{
                ticks: {
                    beginAtZero:true
                }
            }]
        }
    }

See the docs here for more information on the object properties:


问:
Laravel HTTP vs HTTPS requests
My Laravel website is deployed on Heroku. For example, when I type http://example.herokuapp.com -> the UI stays intact. However, when I use https, the UI jumbles up and breaks.

How can I fix this?

答:
You are having an issue with mixed content, you can learn more about it here.

Mixed Content

Mixed content occurs when initial HTML is loaded over a secure HTTPS connection, but other resources (such as images, videos, stylesheets, scripts) are loaded over an insecure HTTP connection.

Solution

To solve the issue, simply reference all your scripts, stylesheets, etc. using // instead of defining a specific protocol. In this case the resources will always be loaded using the same protocol as the page itself.

Old:

New:

Title: Laravel HTTP vs HTTPS requests

Body:
You are having an issue with mixed content, you can learn more about it here.

Mixed Content

Mixed content occurs when initial HTML is loaded over a secure HTTPS connection, but other resources (such as images, videos, stylesheets, scripts) are loaded over an insecure HTTP connection.

Solution

To solve the issue, simply reference all your scripts, stylesheets, etc. using // instead of defining a specific protocol. In this case the resources will always be loaded using the same protocol as the page itself.

Old: <img src="http://example.com/picture.jpg">

New: <img src="//example.com/picture.jpg">


问:
PHP: Explode data from string based on other string
I am trying to get the value of Split Parts.

My code is:

```<code><?php
$password = "03,10,05,07,17,23";

$string = "::3:8:1::5::2:9::::6:::4::::::0:";

$string = explode(':', $string);
</code>```

How to do print $string by order of $password

$string[03],$string[10],$string[05],$string[07],$string[17],$string[23]

Result Need : 391540

答:
Here you goes  Live demo</p>

```<code>$password = "03,10,05,07,17,23";

$string = "::3:8:1::5::2:9::::6:::4::::::0:";

$pass = explode(',', $password);
$code = explode(':', $string);

$result = '';
foreach ($pass as $pos) {
    $pos = ((int)$pos)-1;
    $result .= $code[$pos];
}

echo $result;
</code>```

Body:
I am trying to get the value of Split Parts.

My code is:

<?php
$password = "03,10,05,07,17,23";

$string = "::3:8:1::5::2:9::::6:::4::::::0:";

$string = explode(':', $string);

How to do print $string by order of $password

$string[03],$string[10],$string[05],$string[07],$string[17],$string[23]

Result Need : 391540

Body:
Here you goes  Live demo

$password = "03,10,05,07,17,23";

$string = "::3:8:1::5::2:9::::6:::4::::::0:";

$pass = explode(',', $password);
$code = explode(':', $string);

$result = '';
foreach ($pass as $pos) {
    $pos = ((int)$pos)-1;
    $result .= $code[$pos];
}

echo $result;


问:
QtCharts in Qt 5.6
I want to use QtCharts inside Qt 5.6. (I have no plans to install Qt 5.7/5.8 in the next months). Although I've found a Blog on the Qt site where Qt Charts add-in for At 5.6 is presented I did not find a download link. Has anyone any idea how to download Qt Charts lib and how to embed it inside Qt 5.6?</p>

答:
Kuba Ober's answer might help you, but beware of the licensing problem:

... the Qt Add-ons licensing will be changed so that the Qt Charts module
  becomes available under both GPLv3 and commercial license terms.
  http://blog.qt.io/blog/2016/01/18/qt-charts-2-1-0-release/

So why not use Qwt instead? With Qwt you have at least as much freedom as LGPL admits.

ContentLicense: CC BY-SA 4.0

Title: QtCharts in Qt 5.6