问:
Integrating external library into OSGI
I have been trying to fix this issue for several days now, but i seem stuck somehow. I want to develop a OSGi bundle, and my implementation requires an external library (that has some more dependencies). The situation is as follows: My project is using gradle and i got a simple code snippet to compile, but it crashes at runtime when the bundle is launched ( i am using apache felix), giving me an exception complaining about unmet dependencies. But all libraries are present in the jar bundle, and i added them into the classpath. The missing package org.ethereum.facade is listed within Private-Packages.
I read a lot of questions with similar problems, but none of the silutions proposed seems to solve my problem.

I am posting my gradle.build files

```<code>// ETHEREUM NODE
configurations.create('embed')
repositories {
  mavenLocal()
    mavenCentral()
    maven {
        url "http://dl.bintray.com/ethereum/maven"
     }
}
dependencies {
 // This will compile the openMuc Framework and place the result into the build classpath:
 compile project(':openmuc-core-api')
// This will place the etherum libraries into the classpath
    compile ("org.ethereum:ethereumj-core:latest.release")
    embed ("org.ethereum:ethereumj-core:latest.release")
}
jar {
    manifest {
        name = 'OpenMUC App - EthereumNode'
         instruction 'Bundle-ClassPath', 'lib/ethereumj-core-1.4.2-RELEASE.jar,.'
}
 into('lib') {
    from configurations.embed
  }
}
</code>```

The resulting jar:

```<code>[MANIFEST openmuc-app-ethereumNode-0.16.0.jar]
Bnd-LastModified                         1490003658351
Bundle-ClassPath                         lib/ethereumj-core-1.4.2-RELEASE.jar,.
Bundle-ManifestVersion                   2
Bundle-Name                              OpenMUC App - EthereumNode
Bundle-SymbolicName                      org.openmuc.framework.openmuc-app-ethereumNode
Bundle-Version                           0.16.0
Created-By                               1.8.0_25 (Oracle Corporation)
Export-Package                           org.openmuc.framework.app.ethereumNode;version="0.16.0";uses:="javax.xml.bind,org.osgi.service.component"
Import-Package                           javax.xml.bind,org.osgi.service.component;version="[1.2,2)",org.slf4j;version="[1.7,2)",org.ethereum.facade
Manifest-Version                         1.0
Private-Package                          genesis,org.ethereum,org.ethereum.cli,org.ethereum.config,org.ethereum.config.blockchain,org.ethereum.config.net,org.ethereum.core,org.ethereum.core.genesis,org.ethereum.crypto,org.ethereum.crypto.cryptohash,org.ethereum.crypto.jce,org.ethereum.datasource,org.ethereum.datasource.inmem,org.ethereum.datasource.leveldb,org.ethereum.datasource.mapdb,org.ethereum.db,org.ethereum.db.index,org.ethereum.facade,org.ethereum.json,org.ethereum.jsonrpc,org.ethereum.listener,org.ethereum.manager,org.ethereum.mine,org.ethereum.net,org.ethereum.net.client,org.ethereum.net.dht,org.ethereum.net.eth,org.ethereum.net.eth.handler,org.ethereum.net.eth.message,org.ethereum.net.message,org.ethereum.net.p2p,org.ethereum.net.rlpx,org.ethereum.net.rlpx.discover,org.ethereum.net.rlpx.discover.table,org.ethereum.net.server,org.ethereum.net.shh,org.ethereum.net.submit,org.ethereum.net.swarm,org.ethereum.net.swarm.bzz,org.ethereum.samples,org.ethereum.solidity,org.ethereum.solidity.compiler,org.ethereum.sync,org.ethereum.trie,org.ethereum.util,org.ethereum.util.blockchain,org.ethereum.validator,org.ethereum.vm,org.ethereum.vm.program,org.ethereum.vm.program.invoke,org.ethereum.vm.program.listener,org.ethereum.vm.trace,lib
Require-Capability                       osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.7))"
Service-Component                        OSGI-INF/org.openmuc.framework.app.ethereumNode.EthereumNode.xml
Tool                                     Bnd-3.0.0.201509101326

[IMPEXP]
Import-Package
  javax.xml.bind
  org.ethereum.facade
  org.osgi.service.component             {version=[1.2,2)}
  org.slf4j                              {version=[1.7,2)}
Export-Package
  org.openmuc.framework.app.ethereumNode {version=0.16.0}

[USES]
org.openmuc.framework.app.ethereumNode   java.lang
                                         javax.xml.bind
                                         org.ethereum.facade
                                         org.osgi.service.component
                                         org.slf4j

[USEDBY]
java.lang                                org.openmuc.framework.app.ethereumNode
javax.xml.bind                           org.openmuc.framework.app.ethereumNode
org.ethereum.facade                      org.openmuc.framework.app.ethereumNode
org.osgi.service.component               org.openmuc.framework.app.ethereumNode
org.slf4j                                org.openmuc.framework.app.ethereumNode

[COMPONENTS]
OSGI-INF/org.openmuc.framework.app.ethereumNode.EthereumNode.xml
<?xml version="1.0" encoding="UTF-8"?>
<component name="org.openmuc.framework.app.ethereumNode.EthereumNode">
  <implementation class="org.openmuc.framework.app.ethereumNode.EthereumNode"/>
</component>

[LIST]
META-INF
  MANIFEST.MF extra='\uFFFD\uFFFD\u0000\u0000'
OSGI-INF
  org.openmuc.framework.app.ethereumNode.EthereumNode.xml
lib
  aopalliance-1.0.jar
  commons-codec-1.10.jar
  commons-collections4-4.0.jar
  commons-lang3-3.4.jar
  commons-logging-1.2.jar
  config-1.2.1.jar
  core-1.53.0.0.jar
  ethereumj-core-1.4.2-RELEASE.jar
  guava-16.0.1.jar
  jackson-annotations-2.5.0.jar
  jackson-core-2.5.1.jar
  jackson-core-asl-1.9.13.jar
  jackson-databind-2.5.1.jar
  jackson-mapper-asl-1.9.13.jar
  java-util-1.8.0.jar
  javassist-3.15.0-GA.jar
  json-io-2.4.1.jar
  json-simple-1.1.1.jar
  jsr305-3.0.0.jar
  leveldb-0.7.jar
  leveldb-api-0.7.jar
  leveldbjni-all-1.18.3.jar
  logback-classic-1.1.7.jar
  logback-core-1.1.7.jar
  mapdb-2.0-beta12.jar
  netty-all-4.0.30.Final.jar
  prov-1.53.0.0.jar
  slf4j-api-1.7.20.jar
  solcJ-all-0.4.8.jar
  spring-aop-4.2.0.RELEASE.jar
  spring-beans-4.2.0.RELEASE.jar
  spring-context-4.2.0.RELEASE.jar
  spring-core-4.2.0.RELEASE.jar
  spring-expression-4.2.0.RELEASE.jar
  spring-jdbc-4.2.0.RELEASE.jar
  spring-orm-4.2.0.RELEASE.jar
  spring-tx-4.2.0.RELEASE.jar
org
org/openmuc
org/openmuc/framework
org/openmuc/framework/app
org/openmuc/framework/app/ethereumNode
  EthereumNode.class
</code>```

The exception i encounter when the bundle is loaded:

```<code>ERROR: Bundle org.openmuc.framework.openmuc-app-ethereumNode [3] Error starting file:/Volumes/UserData/Documents/FH/MasterThesis_MatthiasPosch/java/openmuc/framework/bundle/openmuc-app-ethereumNode-0.16.0.jar (org.osgi.framework.BundleException: Unable to resolve org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0): missing requirement [org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0)] osgi.wiring.package; (osgi.wiring.package=org.ethereum.facade) Unresolved requirements: [[org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0)] osgi.wiring.package; (osgi.wiring.package=org.ethereum.facade)])
org.osgi.framework.BundleException: Unable to resolve org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0): missing requirement [org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0)] osgi.wiring.package; (osgi.wiring.package=org.ethereum.facade) Unresolved requirements: [[org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0)] osgi.wiring.package; (osgi.wiring.package=org.ethereum.facade)]
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4112)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2118)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1372)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
    at java.lang.Thread.run(Thread.java:745)
</code>```

So it seems all libraries are in place in the lib folder, but still the bundle does not work. I tried to play with the code, but any reference to the included libraries (eg. spring) will lead to a similar exception. Why?

答: My solution was to use the osgi-run plugin for gradle instead of the original osgi plugin. Declaring my dependencies as SystemLibrary systemLib ("org.ethereum:ethereumj-core:1.2.0-RELEASE") resolved the issues and i am able to use the library without exceptions and errors.

Title: Integrating external library into OSGI

Body:
I have been trying to fix this issue for several days now, but i seem stuck somehow. I want to develop a OSGi bundle, and my implementation requires an external library (that has some more dependencies). The situation is as follows: My project is using gradle and i got a simple code snippet to compile, but it crashes at runtime when the bundle is launched ( i am using apache felix), giving me an exception complaining about unmet dependencies. But all libraries are present in the jar bundle, and i added them into the classpath. The missing package org.ethereum.facade is listed within Private-Packages.
I read a lot of questions with similar problems, but none of the silutions proposed seems to solve my problem.

I am posting my gradle.build files

// ETHEREUM NODE
configurations.create('embed')
repositories {
  mavenLocal()
    mavenCentral()
    maven {
        url "http://dl.bintray.com/ethereum/maven"
     }
}
dependencies {
 // This will compile the openMuc Framework and place the result into the build classpath:
 compile project(':openmuc-core-api')
// This will place the etherum libraries into the classpath
    compile ("org.ethereum:ethereumj-core:latest.release")
    embed ("org.ethereum:ethereumj-core:latest.release")
}
jar {
    manifest {
        name = 'OpenMUC App - EthereumNode'
         instruction 'Bundle-ClassPath', 'lib/ethereumj-core-1.4.2-RELEASE.jar,.'
}
 into('lib') {
    from configurations.embed
  }
}

The resulting jar:

[MANIFEST openmuc-app-ethereumNode-0.16.0.jar]
Bnd-LastModified                         1490003658351
Bundle-ClassPath                         lib/ethereumj-core-1.4.2-RELEASE.jar,.
Bundle-ManifestVersion                   2
Bundle-Name                              OpenMUC App - EthereumNode
Bundle-SymbolicName                      org.openmuc.framework.openmuc-app-ethereumNode
Bundle-Version                           0.16.0
Created-By                               1.8.0_25 (Oracle Corporation)
Export-Package                           org.openmuc.framework.app.ethereumNode;version="0.16.0";uses:="javax.xml.bind,org.osgi.service.component"
Import-Package                           javax.xml.bind,org.osgi.service.component;version="[1.2,2)",org.slf4j;version="[1.7,2)",org.ethereum.facade
Manifest-Version                         1.0
Private-Package                          genesis,org.ethereum,org.ethereum.cli,org.ethereum.config,org.ethereum.config.blockchain,org.ethereum.config.net,org.ethereum.core,org.ethereum.core.genesis,org.ethereum.crypto,org.ethereum.crypto.cryptohash,org.ethereum.crypto.jce,org.ethereum.datasource,org.ethereum.datasource.inmem,org.ethereum.datasource.leveldb,org.ethereum.datasource.mapdb,org.ethereum.db,org.ethereum.db.index,org.ethereum.facade,org.ethereum.json,org.ethereum.jsonrpc,org.ethereum.listener,org.ethereum.manager,org.ethereum.mine,org.ethereum.net,org.ethereum.net.client,org.ethereum.net.dht,org.ethereum.net.eth,org.ethereum.net.eth.handler,org.ethereum.net.eth.message,org.ethereum.net.message,org.ethereum.net.p2p,org.ethereum.net.rlpx,org.ethereum.net.rlpx.discover,org.ethereum.net.rlpx.discover.table,org.ethereum.net.server,org.ethereum.net.shh,org.ethereum.net.submit,org.ethereum.net.swarm,org.ethereum.net.swarm.bzz,org.ethereum.samples,org.ethereum.solidity,org.ethereum.solidity.compiler,org.ethereum.sync,org.ethereum.trie,org.ethereum.util,org.ethereum.util.blockchain,org.ethereum.validator,org.ethereum.vm,org.ethereum.vm.program,org.ethereum.vm.program.invoke,org.ethereum.vm.program.listener,org.ethereum.vm.trace,lib
Require-Capability                       osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.7))"
Service-Component                        OSGI-INF/org.openmuc.framework.app.ethereumNode.EthereumNode.xml
Tool                                     Bnd-3.0.0.201509101326

[IMPEXP]
Import-Package
  javax.xml.bind
  org.ethereum.facade
  org.osgi.service.component             {version=[1.2,2)}
  org.slf4j                              {version=[1.7,2)}
Export-Package
  org.openmuc.framework.app.ethereumNode {version=0.16.0}

[USES]
org.openmuc.framework.app.ethereumNode   java.lang
                                         javax.xml.bind
                                         org.ethereum.facade
                                         org.osgi.service.component
                                         org.slf4j

[USEDBY]
java.lang                                org.openmuc.framework.app.ethereumNode
javax.xml.bind                           org.openmuc.framework.app.ethereumNode
org.ethereum.facade                      org.openmuc.framework.app.ethereumNode
org.osgi.service.component               org.openmuc.framework.app.ethereumNode
org.slf4j                                org.openmuc.framework.app.ethereumNode

[COMPONENTS]
OSGI-INF/org.openmuc.framework.app.ethereumNode.EthereumNode.xml
<?xml version="1.0" encoding="UTF-8"?>
<component name="org.openmuc.framework.app.ethereumNode.EthereumNode">
  <implementation class="org.openmuc.framework.app.ethereumNode.EthereumNode"/>
</component>

[LIST]
META-INF
  MANIFEST.MF extra='\uFFFD\uFFFD\u0000\u0000'
OSGI-INF
  org.openmuc.framework.app.ethereumNode.EthereumNode.xml
lib
  aopalliance-1.0.jar
  commons-codec-1.10.jar
  commons-collections4-4.0.jar
  commons-lang3-3.4.jar
  commons-logging-1.2.jar
  config-1.2.1.jar
  core-1.53.0.0.jar
  ethereumj-core-1.4.2-RELEASE.jar
  guava-16.0.1.jar
  jackson-annotations-2.5.0.jar
  jackson-core-2.5.1.jar
  jackson-core-asl-1.9.13.jar
  jackson-databind-2.5.1.jar
  jackson-mapper-asl-1.9.13.jar
  java-util-1.8.0.jar
  javassist-3.15.0-GA.jar
  json-io-2.4.1.jar
  json-simple-1.1.1.jar
  jsr305-3.0.0.jar
  leveldb-0.7.jar
  leveldb-api-0.7.jar
  leveldbjni-all-1.18.3.jar
  logback-classic-1.1.7.jar
  logback-core-1.1.7.jar
  mapdb-2.0-beta12.jar
  netty-all-4.0.30.Final.jar
  prov-1.53.0.0.jar
  slf4j-api-1.7.20.jar
  solcJ-all-0.4.8.jar
  spring-aop-4.2.0.RELEASE.jar
  spring-beans-4.2.0.RELEASE.jar
  spring-context-4.2.0.RELEASE.jar
  spring-core-4.2.0.RELEASE.jar
  spring-expression-4.2.0.RELEASE.jar
  spring-jdbc-4.2.0.RELEASE.jar
  spring-orm-4.2.0.RELEASE.jar
  spring-tx-4.2.0.RELEASE.jar
org
org/openmuc
org/openmuc/framework
org/openmuc/framework/app
org/openmuc/framework/app/ethereumNode
  EthereumNode.class

The exception i encounter when the bundle is loaded:

ERROR: Bundle org.openmuc.framework.openmuc-app-ethereumNode [3] Error starting file:/Volumes/UserData/Documents/FH/MasterThesis_MatthiasPosch/java/openmuc/framework/bundle/openmuc-app-ethereumNode-0.16.0.jar (org.osgi.framework.BundleException: Unable to resolve org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0): missing requirement [org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0)] osgi.wiring.package; (osgi.wiring.package=org.ethereum.facade) Unresolved requirements: [[org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0)] osgi.wiring.package; (osgi.wiring.package=org.ethereum.facade)])
org.osgi.framework.BundleException: Unable to resolve org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0): missing requirement [org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0)] osgi.wiring.package; (osgi.wiring.package=org.ethereum.facade) Unresolved requirements: [[org.openmuc.framework.openmuc-app-ethereumNode [3](R 3.0)] osgi.wiring.package; (osgi.wiring.package=org.ethereum.facade)]
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4112)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2118)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1372)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
    at java.lang.Thread.run(Thread.java:745)

So it seems all libraries are in place in the lib folder, but still the bundle does not work. I tried to play with the code, but any reference to the included libraries (eg. spring) will lead to a similar exception. Why?


来源: stackexchange

问:
VS2017 will not connect to TFS2012
When attempting to set up a connection to TFS:

It finds the correct server; however, the connect button is grayed out:

What am I doing wrong? Is VS2017 not compatible with TFS2012?

I am able to connect to it with VS2013 without any issues.

答:
Visual Studio 2017 works with TFS 2013 or newer.  You have 2 options upgrade your TFS or use VS 2015.

https://www.visualstudio.com/en-us/docs/connect/connect-team-projects

https://www.visualstudio.com/team-services/tfs-pricing/

ContentLicense: CC BY-SA 3.0

Title: VS2017 will not connect to TFS2012


问:
Cannot pull APK from Android device with adb
I'm trying to get the APK of an installed application from my device. I'm following the instructions in this answer but when pulling it, adb says the APK doesn't exist. This are the exact steps:

```<code>$ adb shell pm list packages
...
(whole list of packages)
...

$ adb shell pm path com.google.android.apps.books
package:/data/app/com.google.android.apps.books-1/base.apk

$ adb pull /data/app/com.google.android.apps.books-1/base.apk
adb: error: remote object '/data/app/com.google.android.apps.books-1/base.apk' does not exist
</code>```

How can I pull this file to my local drive?

答:
Try this:

```<code>$ adb shell cp /data/app/com.google.android.apps.books-1/base.apk /storage/emulated/0/Download/base.apk
</code>```

then

```<code>$ adb pull /storage/emulated/0/Download/base.apk
</code>```

Body:
I'm trying to get the APK of an installed application from my device. I'm following the instructions in this answer but when pulling it, adb says the APK doesn't exist. This are the exact steps:

$ adb shell pm list packages
...
(whole list of packages)
...

$ adb shell pm path com.google.android.apps.books
package:/data/app/com.google.android.apps.books-1/base.apk

$ adb pull /data/app/com.google.android.apps.books-1/base.apk
adb: error: remote object '/data/app/com.google.android.apps.books-1/base.apk' does not exist

How can I pull this file to my local drive?

Body:
Try this:

$ adb shell cp /data/app/com.google.android.apps.books-1/base.apk /storage/emulated/0/Download/base.apk

then

$ adb pull /storage/emulated/0/Download/base.apk


问:
Can SVN show information relating to a partial checkout?
If a Subversion working copy is a partial check-out from a repository, using --depth and/or --set-depth (perhaps with exclude), is there a way to reveal the nodes that are 'missing' (either recursively, or non-recursively)? I don't mean missing in the sense of svn status and ! where a node was checked out but deleted locally without telling SVN. Rather, I mean a node in the repository that was not been checked out from the repository originally, or has been excluded later.

svn info can be used to show the depth of a node.

ls or dir might be compared with svn ls. (ls -r BASE doesn't bahave as I'd expect to get a working copy listing.)

svnversion will indicate that the WC is partial with a 'P'.

(There seems to be no --dry-run option to use in conjunction with --set-depth for svn update. Likewise svn diff -rBASE:HEAD --depth=immediates does not produce the information I seek either.)

Is there some direct method? It would be nice to have a list of 'eligible' nodes available for checkout or update.

Thanks.

答:
If we had this repository path,

```<code>ROOT
  |--trunk
  |   |-- index.php
  |   `-- app
  |--tags
  `--branches
</code>```

This command would show you which files (or directory) are children of your ROOT node.

```<code>svn ls --depth immediates URL/to/ROOT/
</code>```

Output:

```<code>trunk/
tags/
branches/
</code>```

using the output, you could update each node using

```<code>svn update --set-depth=infinity trunk/
</code>```

ContentLicense: CC BY-SA 2.5

Body:
If we had this repository path,

ROOT
  |--trunk
  |   |-- index.php
  |   `-- app
  |--tags
  `--branches

This command would show you which files (or directory) are children of your ROOT node.

svn ls --depth immediates URL/to/ROOT/

Output:

trunk/
tags/
branches/

using the output, you could update each node using

svn update --set-depth=infinity trunk/


问:
Java 8 Streams: List to Map with mapped values
I'm trying to create a Map from a List using Streams.

The key should be the name of the original item,

The value should be some derived data.

After .map() the stream consists of Integers and at the time of .collect() I can't access "foo" from the previous lambda. How do I get the original item in .toMap()?

Can this be done with Streams or do I need .forEach()?

(The code below is only for demonstration, the real code is of course much more complex and I can't make doSomething() a method of Foo).

```<code>import java.util.ArrayList;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public class StreamTest {

    public class Foo {
        public String getName() {
            return "FOO";
        }

        public Integer getValue() {
            return 42;
        }
    }

    public Integer doSomething(Foo foo) {
        return foo.getValue() + 23;
    }

    public Map<String, Integer> run() {
        return new ArrayList<Foo>().stream().map(foo -> doSomething(foo)).collect(Collectors.toMap(foo.getName, Function.identity()));
    }

    public static void main(String[] args) {
        StreamTest streamTest = new StreamTest();
        streamTest.run();
    }
}
</code>```

答:
It appears to me it’s not that complicated. Am I missing something?

```<code>    return Stream.of(new Foo())
            .collect(Collectors.toMap(Foo::getName, this::doSomething));
</code>```

I’m rather much into method references. If you prefer the -> notation, use

```<code>    return Stream.of(new Foo())
            .collect(Collectors.toMap(foo -> foo.getName(), foo -> doSomething(foo)));
</code>```

Either will break (throw an exception) if there’s more than one Foo with the same name in your stream.

Body:
I'm trying to create a Map from a List using Streams.

The key should be the name of the original item,

The value should be some derived data.

After .map() the stream consists of Integers and at the time of .collect() I can't access "foo" from the previous lambda. How do I get the original item in .toMap()?

Can this be done with Streams or do I need .forEach()?

(The code below is only for demonstration, the real code is of course much more complex and I can't make doSomething() a method of Foo).

import java.util.ArrayList;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public class StreamTest {

    public class Foo {
        public String getName() {
            return "FOO";
        }

        public Integer getValue() {
            return 42;
        }
    }

    public Integer doSomething(Foo foo) {
        return foo.getValue() + 23;
    }

    public Map<String, Integer> run() {
        return new ArrayList<Foo>().stream().map(foo -> doSomething(foo)).collect(Collectors.toMap(foo.getName, Function.identity()));
    }

    public static void main(String[] args) {
        StreamTest streamTest = new StreamTest();
        streamTest.run();
    }
}

Body:
It appears to me it’s not that complicated. Am I missing something?

    return Stream.of(new Foo())
            .collect(Collectors.toMap(Foo::getName, this::doSomething));

I’m rather much into method references. If you prefer the -> notation, use

    return Stream.of(new Foo())
            .collect(Collectors.toMap(foo -> foo.getName(), foo -> doSomething(foo)));

Either will break (throw an exception) if there’s more than one Foo with the same name in your stream.


问:
Using AIR and AS3 to Launch VLC on Android
I'm working on an app for a client that is a one stop shop for their latest product videos. It will download the latest videos posted online, organize them into categories, and then allows the user to select videos to add to a VLC playlist. This is all working perfectly. However, the last piece of the puzzle is opening the VLC playlist using Adobe AIR directly. Here is my code:

```<code>var fs:FileStream=new FileStream();   // Creates a new filestream
var path:String=File.userDirectory.resolvePath($fle).nativePath;  // Creates the playlist path
var file:File=new File(path);         // Creates the file
try{fs.open(file,FileMode.WRITE);}    // Opens the file to write the data
catch(error:Error){}
fs.writeUTFBytes(outputStr);          // Writes the data
fs.close();                           // Closes the filestream
//file.openWithDefaultApplication();  // I found out this doesn't work with Android systems
var url:String = ("intent:#Intent;" +
              "action=android.intent.action.MAIN;" +
              "category=android.intent.category.LAUNCHER;" +
              "component=org.videolan.vlc/.AppEntry;" +
              "end");                 // The intent string
navigateToURL(new URLRequest(url));   // Navigates to the app
</code>```

The only caveat is that I don't know how to get the proper component information for VLC or how to get the playlist to start playing. The original code for the intent section directed towards the Settings screen, which worked, but I can't get it to launch any other app.

UPDATE:
I've been able to launch VLC, playing the last video played using this page as reference:
https://wiki.videolan.org/Android_Player_Intents/

Here's the updated url request string:

```<code>var url:String = ("intent:#Intent;" +
                  "action=android.intent.action.MAIN;" +
                  "category=android.intent.category.LAUNCHER;" +
                  "component=org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity;" +
                  "end");
</code>```

That launches VLC and plays the last played video. However, I want it to play a specified playlist.

答:
a nice practice would be ANE, air native extension,
ANE let you executing Native (android or ios or ...) codes
so you have more options for running VLC and accessing its properties

also read it

if you have any problem with ane development, let me know to improve this answer, i think you have no issue with java side programing

Body:
I'm working on an app for a client that is a one stop shop for their latest product videos. It will download the latest videos posted online, organize them into categories, and then allows the user to select videos to add to a VLC playlist. This is all working perfectly. However, the last piece of the puzzle is opening the VLC playlist using Adobe AIR directly. Here is my code:

var fs:FileStream=new FileStream();   // Creates a new filestream
var path:String=File.userDirectory.resolvePath($fle).nativePath;  // Creates the playlist path
var file:File=new File(path);         // Creates the file
try{fs.open(file,FileMode.WRITE);}    // Opens the file to write the data
catch(error:Error){}
fs.writeUTFBytes(outputStr);          // Writes the data
fs.close();                           // Closes the filestream
//file.openWithDefaultApplication();  // I found out this doesn't work with Android systems
var url:String = ("intent:#Intent;" +
              "action=android.intent.action.MAIN;" +
              "category=android.intent.category.LAUNCHER;" +
              "component=org.videolan.vlc/.AppEntry;" +
              "end");                 // The intent string
navigateToURL(new URLRequest(url));   // Navigates to the app

The only caveat is that I don't know how to get the proper component information for VLC or how to get the playlist to start playing. The original code for the intent section directed towards the Settings screen, which worked, but I can't get it to launch any other app.

UPDATE:
I've been able to launch VLC, playing the last video played using this page as reference:
https://wiki.videolan.org/Android_Player_Intents/

Here's the updated url request string:

var url:String = ("intent:#Intent;" +
                  "action=android.intent.action.MAIN;" +
                  "category=android.intent.category.LAUNCHER;" +
                  "component=org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity;" +
                  "end");

That launches VLC and plays the last played video. However, I want it to play a specified playlist.


问:
Crash in tableView with CABasicAnimation, textColor when the TableViewCell is not visible
The application is a satisfaction survey that all the fields must be filled by people. I used a tableView and I would like, when a field is not filled, that it scrolls automatically to the field, that it put the tableviewcell in red, and that it shake the tableviewcell. I found all that but the problem is that it seems that it crash when the cell is not on the screen (may be because of the fact that the cell is not visible on the screen).

May be I have to do something to wait for the cell is visible first. How can I do that ?

```<code>    let cellPb = self.tableView.cellForRowAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))

    self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Top, animated: false)
    //color
    cellPb!.textLabel!.textColor = UIColor.redColor()

    //shake the cell
    let shake = CABasicAnimation(keyPath: "position")
    shake.duration = 0.1
    shake.repeatCount = 3
    shake.autoreverses = true
    shake.fromValue = NSValue(CGPoint: CGPointMake(cellPb!.center.x - 5, cellPb!.center.y))
    shake.toValue = NSValue(CGPoint: CGPointMake(cellPb!.center.x + 5, cellPb!.center.y))
    cellPb!.layer.addAnimation(shake, forKey: "position")

 UIAlertView(title: "Please, fill the blank field.", message: nil, delegate: nil, cancelButtonTitle: "Ok").show()
</code>```

答:
Try the other way round, first scroll then get the cell:

```<code>let indexPath = NSIndexPath(forRow: 1, inSection: 0)
self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Top, animated: false)
let cellPb = self.tableView.cellForRowAtIndexPath(indexPath)
</code>```

Body:
The application is a satisfaction survey that all the fields must be filled by people. I used a tableView and I would like, when a field is not filled, that it scrolls automatically to the field, that it put the tableviewcell in red, and that it shake the tableviewcell. I found all that but the problem is that it seems that it crash when the cell is not on the screen (may be because of the fact that the cell is not visible on the screen).

May be I have to do something to wait for the cell is visible first. How can I do that ?

    let cellPb = self.tableView.cellForRowAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))

    self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Top, animated: false)
    //color
    cellPb!.textLabel!.textColor = UIColor.redColor()

    //shake the cell
    let shake = CABasicAnimation(keyPath: "position")
    shake.duration = 0.1
    shake.repeatCount = 3
    shake.autoreverses = true
    shake.fromValue = NSValue(CGPoint: CGPointMake(cellPb!.center.x - 5, cellPb!.center.y))
    shake.toValue = NSValue(CGPoint: CGPointMake(cellPb!.center.x + 5, cellPb!.center.y))
    cellPb!.layer.addAnimation(shake, forKey: "position")

 UIAlertView(title: "Please, fill the blank field.", message: nil, delegate: nil, cancelButtonTitle: "Ok").show()

Body:
Try the other way round, first scroll then get the cell:

let indexPath = NSIndexPath(forRow: 1, inSection: 0)
self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Top, animated: false)
let cellPb = self.tableView.cellForRowAtIndexPath(indexPath)


问:
no target device found android studio 2.1.1
i'm using android studio 2.1.1 in ubuntu 14.04.Now my question is,i want to run the program through my phone without emulator. so i chose the target as usb device but whenever i run this,below mentioned error is rasing.

Error running app : No target device found.

i checked my device by using adb devices command in terminal.
adithya@adithya-Lenovo-B460e:~$ adb devices
List of devices attached
59V8I7HEJJWGGMK7    device

i also tried with selecting of MTP & PTP.but nothing worked out.
kindly anyone help me to solve this problem..

答:
go to "Run>edit configuration>" and select "Open select deployment target dialog" from deployment target option then run your app
it will show you a dialog box you can choose your target device from there,
enjoy it. </p>


问:
Edit Distance in Python
I'm programming a spellcheck program in Python. I have a list of valid words (the dictionary) and I need to output a list of words from this dictionary that have an edit distance of 2 from a given invalid word.

I know I need to start by generating a list with an edit distance of one from the invalid word(and then run that again on all the generated words). I have three methods, inserts(...), deletions(...) and changes(...) that should output a list of words with an edit distance of 1, where inserts outputs all valid words with one more letter than the given word, deletions outputs all valid words with one less letter, and changes outputs all valid words with one different letter.

I've checked a bunch of places but I can't seem to find an algorithm that describes this process. All the ideas I've come up with involve looping through the dictionary list multiple times, which would be extremely time consuming. If anyone could offer some insight, I'd be extremely grateful.

答:
Instead of going with Levenshtein distance algo use BK tree or TRIE, as these algorithms have less complexity then edit distance. A good browse over these topic will give a detailed description.

This link will help you more about spell checking.

Title: Edit Distance in Python


问:
Should I index a bit field in SQL Server?
I remember reading at one point that indexing a field with low cardinality (a low number of distinct values) is not really worth doing.  I admit I don't know enough about how indexes work to understand why that is.

So what if I have a table with 100 million rows in it, and I am selecting records where a bit field is 1? And let's say that at any point in time, there are only a handful of records where the bit field is 1 (as opposed to 0).  Is it worth indexing that bit field or not? Why?

Of course I can just test it and check the execution plan, and I will do that, but I'm also curious about the theory behind it.  When does cardinality matter and when does it not?

答: You need to be smart here to query, you must know the load value on your column if the load of true is more in your system and you want to check all the true values writ  your query to check not false.. it will help alot, it just trick.</p>

OwnerDisplayName: Jeremy McCollum

LastEditorDisplayName: Jeremy McCollum


问:
Bitmap loading very slow
I'm using this method for loading albumArt in list

```<code> long thisAlbum = musicCursor.getLong(albumColumn);

          Bitmap artWork = null;

            Uri sArtworkUri = Uri
                    .parse("content://media/external/audio/albumart");
            Uri albumArtUri = ContentUris.withAppendedId(sArtworkUri, thisAlbum);

            try {
                artWork = MediaStore.Images.Media.getBitmap(
                        musicResolver, albumArtUri);
                artWork = Bitmap.createScaledBitmap(artWork, 150, 150, true);

            } catch (FileNotFoundException exception) {
                exception.printStackTrace();
                artWork = BitmapFactory.decodeResource(getResources(),
                        R.drawable.no_cover);
            } catch (IOException e) {
                e.printStackTrace();
            }

            songsList.add(new Songs(thisId, thisTitle, thisArtist, artWork));
        }
</code>```

everything is working fine but when i open my activity it takes more then 10 seconds to load the activity and when i remove this bunch of code activity open as normally ,can anyone tell me please why it is happening and please tell me also what to do or any update for code

答:
You are trying to make the bitmap from the images from your phone.

I think the images in your phone are too large.

You can use Glide to make Bitmap for your local image.

```<code>Glide.with(mContext)
.load(new File(pictureUri.getPath())) // Uri of the picture
.asBitmap().
    into(100, 100). // Width and height
    get();
</code>```

Remember to run this code within AsyncTask or Thread.

Hope it will helpfull to you.

Title: Bitmap loading very slow

Body:
I'm using this method for loading albumArt in list

 long thisAlbum = musicCursor.getLong(albumColumn);

          Bitmap artWork = null;

            Uri sArtworkUri = Uri
                    .parse("content://media/external/audio/albumart");
            Uri albumArtUri = ContentUris.withAppendedId(sArtworkUri, thisAlbum);

            try {
                artWork = MediaStore.Images.Media.getBitmap(
                        musicResolver, albumArtUri);
                artWork = Bitmap.createScaledBitmap(artWork, 150, 150, true);

            } catch (FileNotFoundException exception) {
                exception.printStackTrace();
                artWork = BitmapFactory.decodeResource(getResources(),
                        R.drawable.no_cover);
            } catch (IOException e) {
                e.printStackTrace();
            }

            songsList.add(new Songs(thisId, thisTitle, thisArtist, artWork));
        }

everything is working fine but when i open my activity it takes more then 10 seconds to load the activity and when i remove this bunch of code activity open as normally ,can anyone tell me please why it is happening and please tell me also what to do or any update for code

Body:
You are trying to make the bitmap from the images from your phone.

I think the images in your phone are too large.

You can use Glide to make Bitmap for your local image.

Glide.with(mContext)
.load(new File(pictureUri.getPath())) // Uri of the picture
.asBitmap().
    into(100, 100). // Width and height
    get();

Remember to run this code within AsyncTask or Thread.

Hope it will helpfull to you.


答:
```<code>svn ls --depth immediates .
</code>```

will show the child files and folders of the current folder even if they have not been checked out.

Diffing that with the output of ls -1 yields the list of not-checked-out files/folders:

```<code>svn ls --depth immediates . > immediates.txt
ls -1 > checkedout.txt
diff immediates.txt checkedout.txt
</code>```

Title: Can SVN show information relating to a partial checkout?

Body:
If a Subversion working copy is a partial check-out from a repository, using --depth and/or --set-depth (perhaps with exclude), is there a way to reveal the nodes that are 'missing' (either recursively, or non-recursively)? I don't mean missing in the sense of svn status and ! where a node was checked out but deleted locally without telling SVN. Rather, I mean a node in the repository that was not been checked out from the repository originally, or has been excluded later.

svn info can be used to show the depth of a node.

ls or dir might be compared with svn ls. (ls -r BASE doesn't bahave as I'd expect to get a working copy listing.)

svnversion will indicate that the WC is partial with a 'P'.

(There seems to be no --dry-run option to use in conjunction with --set-depth for svn update. Likewise svn diff -rBASE:HEAD --depth=immediates does not produce the information I seek either.)

Is there some direct method? It would be nice to have a list of 'eligible' nodes available for checkout or update.

Thanks.

Body:
svn ls --depth immediates .

will show the child files and folders of the current folder even if they have not been checked out.

Diffing that with the output of ls -1 yields the list of not-checked-out files/folders:

svn ls --depth immediates . > immediates.txt
ls -1 > checkedout.txt
diff immediates.txt checkedout.txt


问:
How to change Action Bar/Title Bar font?
Not sure if this is called the action bar or the title bar but I need to change the font to a font I have in my assets folder. How do I do this?

答:
In java code

```<code> ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#2B1C27")));

LayoutInflater inflater = LayoutInflater.from(this);
View v = inflater.inflate(R.layout.titleview_2, null);

TextView actionbar_title = (TextView)v.findViewById(R.id.actionbar_title);
actionbar_title.setTypeface(you can set your font here also.);

actionBar.setCustomView(v);
</code>```

in XML file

```<code>      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_gravity="center"
     android:id="@+id/actionBar"
     android:paddingTop="7dp"
     android:orientation="horizontal"
     android:background="#9B66AB">

    <TextView
    android:id="@+id/actionbar_title"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|center_vertical"
    android:gravity="center_horizontal|center_vertical"
    android:padding="8dp"
    android:text="@string/appTitle"
    android:textSize="20sp"
    android:textColor="#FFFFFF"
    android:layout_centerVertical="true"
   />

    </RelativeLayout>
</code>```

It will work.

EDITED

```<code>getSupportActionBar().setTitle((Html.fromHtml("<font face=\"Times New Roman\">" + getString(R.string.title) + "</font>")));
</code>```

Body:
In java code

 ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#2B1C27")));

LayoutInflater inflater = LayoutInflater.from(this);
View v = inflater.inflate(R.layout.titleview_2, null);

TextView actionbar_title = (TextView)v.findViewById(R.id.actionbar_title);
actionbar_title.setTypeface(you can set your font here also.);

actionBar.setCustomView(v);

in XML file

      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_gravity="center"
     android:id="@+id/actionBar"
     android:paddingTop="7dp"
     android:orientation="horizontal"
     android:background="#9B66AB">

    <TextView
    android:id="@+id/actionbar_title"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|center_vertical"
    android:gravity="center_horizontal|center_vertical"
    android:padding="8dp"
    android:text="@string/appTitle"
    android:textSize="20sp"
    android:textColor="#FFFFFF"
    android:layout_centerVertical="true"
   />

    </RelativeLayout>

It will work.

EDITED

getSupportActionBar().setTitle((Html.fromHtml("<font face=\"Times New Roman\">" + getString(R.string.title) + "</font>")));


问:
How to store data type of each of the columns in a dataframe into a new column of a new dataframe
Let's use German credit card data.

```<code>url <- 'https://onlinecourses.science.psu.edu/stat857/sites/onlinecourses.science.psu.edu.stat857/files/german_credit.csv'
credit <- read.csv(url, header = TRUE, sep = ',')
</code>```

I just did one thing: store the names of the columns in a new dataframe:

```<code>CreditNames <- as.data.frame(names(credit))
View(CreditNames)
</code>```

How can I store the datatype using typeof(credit) into a new column?

Something I am trying:

```<code>for (i in 1:length(GermanCreditCardData)) {
CreditNames[i] <- as.data.frame(names(credit)[i])
}
</code>```

But this is throwing an error.

答:
If I understood you completely then you can use the following:
Using sapply to loopover across all the variables. Check for ?sapply on R terminal.
Not sure why do you want to do it, there is str command which can tell you the structure of data, you can also look for glimpse in dplyr package.
?str and ?glimpse for more help. Thanks to "Imo" for the suggested update.

```<code>url <- 'https://onlinecourses.science.psu.edu/stat857/sites/onlinecourses.science.psu.edu.stat857/files/german_credit.csv'
credit <- read.csv(url, header = TRUE, sep = ',',stringsAsFactors = F)
dat <- data.frame(type = sapply(credit,typeof))
dat$varname <- rownames(dat)
rownames(dat)  <- NULL
dat <- dat[,c(2,1)]
dat

> dat
                             varname    type
1                      Creditability integer
2                    Account.Balance integer
3         Duration.of.Credit..month. integer
4  Payment.Status.of.Previous.Credit integer
5                            Purpose integer
6                      Credit.Amount integer
7               Value.Savings.Stocks integer
8       Length.of.current.employment integer
9                Instalment.per.cent integer
10              Sex...Marital.Status integer
11                        Guarantors integer
12       Duration.in.Current.address integer
13     Most.valuable.available.asset integer
14                       Age..years. integer
15                Concurrent.Credits integer
16                 Type.of.apartment integer
17        No.of.Credits.at.this.Bank integer
18                        Occupation integer
19                  No.of.dependents integer
20                         Telephone integer
21                    Foreign.Worker integer
</code>```

Body:
Let's use German credit card data.

url <- 'https://onlinecourses.science.psu.edu/stat857/sites/onlinecourses.science.psu.edu.stat857/files/german_credit.csv'
credit <- read.csv(url, header = TRUE, sep = ',')

I just did one thing: store the names of the columns in a new dataframe:

CreditNames <- as.data.frame(names(credit))
View(CreditNames)

How can I store the datatype using typeof(credit) into a new column?

Something I am trying:

for (i in 1:length(GermanCreditCardData)) {
CreditNames[i] <- as.data.frame(names(credit)[i])
}

But this is throwing an error.

Body:
If I understood you completely then you can use the following:
Using sapply to loopover across all the variables. Check for ?sapply on R terminal.
Not sure why do you want to do it, there is str command which can tell you the structure of data, you can also look for glimpse in dplyr package.
?str and ?glimpse for more help. Thanks to "Imo" for the suggested update.

url <- 'https://onlinecourses.science.psu.edu/stat857/sites/onlinecourses.science.psu.edu.stat857/files/german_credit.csv'
credit <- read.csv(url, header = TRUE, sep = ',',stringsAsFactors = F)
dat <- data.frame(type = sapply(credit,typeof))
dat$varname <- rownames(dat)
rownames(dat)  <- NULL
dat <- dat[,c(2,1)]
dat

> dat
                             varname    type
1                      Creditability integer
2                    Account.Balance integer
3         Duration.of.Credit..month. integer
4  Payment.Status.of.Previous.Credit integer
5                            Purpose integer
6                      Credit.Amount integer
7               Value.Savings.Stocks integer
8       Length.of.current.employment integer
9                Instalment.per.cent integer
10              Sex...Marital.Status integer
11                        Guarantors integer
12       Duration.in.Current.address integer
13     Most.valuable.available.asset integer
14                       Age..years. integer
15                Concurrent.Credits integer
16                 Type.of.apartment integer
17        No.of.Credits.at.this.Bank integer
18                        Occupation integer
19                  No.of.dependents integer
20                         Telephone integer
21                    Foreign.Worker integer


问:
Query to update the content of a cell using
I have a table with the following format:

```<code>column1   column2
   40       blue
   20       red
</code>```

I have I would like to update the contain of my column based on a value entered a TextBox and a comboBox, for example if I select red from my comboBox and enter the value 30 in my TextBox , I would like my table to be updated as follow

```<code>column1   column2
   40       blue
   50       red
</code>```

I thought of something like this:

```<code>update tablename set column1=....+TextBox.Text where column2=ComboBox.Text
</code>```

My question how do I get the current content of that row? do I need a query to do that?

答:
To add to the other responses, you should also be using parameterized query:</p>

```<code>connection.Open();
SqlCommand command = new SqlCommand("UPDATE table SET column1 = column1 + @column1 WHERE column2 = @column2", connection);
SqlDataAdapter adp = new SqlDataAdapter();
adp.UpdateCommand = command;
adp.UpdateCommand.Parameters.Add(new SqlParameter("@column1", SqlDbType.Int));
adp.UpdateCommand.Parameters.Add(new SqlParameter("@column2", SqlDbType.VarChar));
adp.UpdateCommand.Parameters["@column1"].Value = Convert.ToInt32(TextBox.Text);
adp.UpdateCommand.Parameters["@column2"].Value = ComboBox.Text;
try
{
    adp.UpdateCommand.ExecuteNonQuery();
}
catch (SqlException ex)
{
    MessageBox.Show(ex.ToString());
}
finally
{
    connection.Close();
}
</code>```

Body:
I have a table with the following format:

column1   column2
   40       blue
   20       red

I have I would like to update the contain of my column based on a value entered a TextBox and a comboBox, for example if I select red from my comboBox and enter the value 30 in my TextBox , I would like my table to be updated as follow

column1   column2
   40       blue
   50       red

I thought of something like this:

update tablename set column1=....+TextBox.Text where column2=ComboBox.Text

My question how do I get the current content of that row? do I need a query to do that?

Body:
To add to the other responses, you should also be using parameterized query:

connection.Open();
SqlCommand command = new SqlCommand("UPDATE table SET column1 = column1 + @column1 WHERE column2 = @column2", connection);
SqlDataAdapter adp = new SqlDataAdapter();
adp.UpdateCommand = command;
adp.UpdateCommand.Parameters.Add(new SqlParameter("@column1", SqlDbType.Int));
adp.UpdateCommand.Parameters.Add(new SqlParameter("@column2", SqlDbType.VarChar));
adp.UpdateCommand.Parameters["@column1"].Value = Convert.ToInt32(TextBox.Text);
adp.UpdateCommand.Parameters["@column2"].Value = ComboBox.Text;
try
{
    adp.UpdateCommand.ExecuteNonQuery();
}
catch (SqlException ex)
{
    MessageBox.Show(ex.ToString());
}
finally
{
    connection.Close();
}


问:
i can't get the foreign key with hql
I have two classes: Person and Computer I want to get the list of computers that belongs to a person p

```<code>@Entity
public class Person implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id_pperson;
    private String name;
    private String last_name;
    @OneToMany(mappedBy = "Person", fetch = FetchType.LAZY)
    private Collection<Computer> pc;
    public void setPc(Collection<Computer> pc) {
        this.pc = pc;
    }
    public Collection<Computer> getPc() {
        return pc;
    }
}
@Entity
public class Computer implements Serializable {
    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
        private String brand;
    @ManyToOne
    @JoinColumn(name="id_owner", referencedColumnName = "id_person", insertable = true)
    private Person Person;
    public long getid_owner()
    {
        return Person.getId_person();
    }
}
</code>```

so I added a method in ComputerRepository to fetch the computers by the foreign key id_owner

```<code>public interface ComputerRepository extends JpaRepository<FinancementExt, Long>{

@Query("select c from Computer c where c.id_owner = :id")
public Page <FinancementExt> findAllByIdOwner(@Param("id")long id_owner,Pageable pageable);}
</code>```

this is the service

```<code>public interface ComputerService { public Page<Computer> listFEByComputer(long id_owner,int page, int size);       }

    @Service public class ComputerServiceImp implements ComputerService {
       @Autowired
       ComputerRepository CRepository;
       @Override
        public Page<Computer> listFEByComputer(long id_owner, int page, int size) {
         return CRepository.findAllByIdOwner(id_owner, new PageRequest(page, size));
      }
</code>```

}

and here is the rest controller:

```<code>@RestController  public class ComputerRestService {
@Autowired
private ComputerService computerService ;
@RequestMapping(value="/listcomputersByperson",method=RequestMethod.GET)
public Page<Computer> listFEByComputer(long id_owner,int page, int size) {
    return ComputerService.listFEByComputer(id_owner,page, size);
}
</code>```

}

these are the excpetions that i get:

```<code>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ComputerServiceImp ': Unsatisfied dependency expressed through field 'CompuerRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CompuerRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract org.springframework.data.domain.Page com.projet.dao.CompuerRepository.findAllByIdOwner(long,org.springframework.data.domain.Pageable)!
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at com.projet.SuiviProjetApplication.main(SuiviProjetApplication.java:17) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_111]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_111]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.1.RELEASE.jar:1.5.1.RELEASE]
</code>```

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CompuerRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract org.springframework.data.domain.Page com.projet.dao.CompuerRepository.findAllByIdOwner(long,org.springframework.data.domain.Pageable)!
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    ... 24 common frames omitted
    Caused by: org.hibernate.QueryException: could not resolve property: id_prj of: com.projet.entities.FinancementExt
    at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:62) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:56) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1764) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.FromElementType.getPropertyType(FromElementType.java:393) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.FromElement.getPropertyType(FromElement.java:505) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.DotNode.getDataType(DotNode.java:660) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.DotNode.prepareLhs(DotNode.java:264) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.DotNode.resolve(DotNode.java:204) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:109) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:104) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:942) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1283) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4696) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:4166) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2131) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:810) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:605) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:309) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:257) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:262) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:190) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    ... 62 common frames omitted

答:
```<code>@Query("select c from Computer c where c.id_owner = :id")
public Page <FinancementExt> findAllByIdOwner(@Param("id")long id_owner,Pageable pageable);
</code>```

First, the query selects computers, but the method returns a Page<FinancementExt>. That makes no sense.

Second, there is no persistent field named id_owner in the Computer class. The query should be

```<code>select c from Computer c where c.person.id = :id
</code>```

and the field Person should be named person. Respect the basic Java naming conventions.

Title: i can't get the foreign key with hql

Body:
I have two classes: Person and Computer I want to get the list of computers that belongs to a person p

@Entity
public class Person implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id_pperson;
    private String name;
    private String last_name;
    @OneToMany(mappedBy = "Person", fetch = FetchType.LAZY)
    private Collection<Computer> pc;
    public void setPc(Collection<Computer> pc) {
        this.pc = pc;
    }
    public Collection<Computer> getPc() {
        return pc;
    }
}
@Entity
public class Computer implements Serializable {
    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
        private String brand;
    @ManyToOne
    @JoinColumn(name="id_owner", referencedColumnName = "id_person", insertable = true)
    private Person Person;
    public long getid_owner()
    {
        return Person.getId_person();
    }
}

so I added a method in ComputerRepository to fetch the computers by the foreign key id_owner

public interface ComputerRepository extends JpaRepository<FinancementExt, Long>{

@Query("select c from Computer c where c.id_owner = :id")
public Page <FinancementExt> findAllByIdOwner(@Param("id")long id_owner,Pageable pageable);}

this is the service

public interface ComputerService { public Page<Computer> listFEByComputer(long id_owner,int page, int size);       }

    @Service public class ComputerServiceImp implements ComputerService {
       @Autowired
       ComputerRepository CRepository;
       @Override
        public Page<Computer> listFEByComputer(long id_owner, int page, int size) {
         return CRepository.findAllByIdOwner(id_owner, new PageRequest(page, size));
      }

}

and here is the rest controller:

@RestController  public class ComputerRestService {
@Autowired
private ComputerService computerService ;
@RequestMapping(value="/listcomputersByperson",method=RequestMethod.GET)
public Page<Computer> listFEByComputer(long id_owner,int page, int size) {
    return ComputerService.listFEByComputer(id_owner,page, size);
}

}

these are the excpetions that i get:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ComputerServiceImp ': Unsatisfied dependency expressed through field 'CompuerRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CompuerRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract org.springframework.data.domain.Page com.projet.dao.CompuerRepository.findAllByIdOwner(long,org.springframework.data.domain.Pageable)!
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at com.projet.SuiviProjetApplication.main(SuiviProjetApplication.java:17) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_111]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_111]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.1.RELEASE.jar:1.5.1.RELEASE]

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CompuerRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract org.springframework.data.domain.Page com.projet.dao.CompuerRepository.findAllByIdOwner(long,org.springframework.data.domain.Pageable)!
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    ... 24 common frames omitted
    Caused by: org.hibernate.QueryException: could not resolve property: id_prj of: com.projet.entities.FinancementExt
    at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:62) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:56) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1764) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.FromElementType.getPropertyType(FromElementType.java:393) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.FromElement.getPropertyType(FromElement.java:505) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.DotNode.getDataType(DotNode.java:660) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.DotNode.prepareLhs(DotNode.java:264) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.DotNode.resolve(DotNode.java:204) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:109) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:104) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:942) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1283) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4696) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:4166) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2131) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:810) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:605) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:309) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:257) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:262) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:190) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    ... 62 common frames omitted

Body:
@Query("select c from Computer c where c.id_owner = :id")
public Page <FinancementExt> findAllByIdOwner(@Param("id")long id_owner,Pageable pageable);

First, the query selects computers, but the method returns a Page<FinancementExt>. That makes no sense.

Second, there is no persistent field named id_owner in the Computer class. The query should be

select c from Computer c where c.person.id = :id

and the field Person should be named person. Respect the basic Java naming conventions.


问:
Show navigation after hide in android
I hide the navigation bar.
With the following code:

```<code>            View v = activity.getWindow().getDecorView();
        v.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                                | View.SYSTEM_UI_FLAG_FULLSCREEN
                                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                );
</code>```

Now I want to return Navigation Bar
How can I do?

答:
Just use code from official docs Immersive</p>

```<code>// This snippet hides the system bars.
private void hideSystemUI() {
  // Set the IMMERSIVE flag.
  // Set the content to appear under the system bars so that the content
  // doesn't resize when the system bars hide and show.
  mDecorView.setSystemUiVisibility(
        View.SYSTEM_UI_FLAG_LAYOUT_STABLE
        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
        | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
        | View.SYSTEM_UI_FLAG_IMMERSIVE);
}

// This snippet shows the system bars. It does this by removing all the flags
// except for the ones that make the content appear under the system bars.
private void showSystemUI() {
  mDecorView.setSystemUiVisibility(
        View.SYSTEM_UI_FLAG_LAYOUT_STABLE
        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
</code>```

Title: Show navigation after hide in android

Body:
I hide the navigation bar.
With the following code:

            View v = activity.getWindow().getDecorView();
        v.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                                | View.SYSTEM_UI_FLAG_FULLSCREEN
                                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                );

Now I want to return Navigation Bar
How can I do?

Body:
Just use code from official docs Immersive

// This snippet hides the system bars.
private void hideSystemUI() {
  // Set the IMMERSIVE flag.
  // Set the content to appear under the system bars so that the content
  // doesn't resize when the system bars hide and show.
  mDecorView.setSystemUiVisibility(
        View.SYSTEM_UI_FLAG_LAYOUT_STABLE
        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
        | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
        | View.SYSTEM_UI_FLAG_IMMERSIVE);
}

// This snippet shows the system bars. It does this by removing all the flags
// except for the ones that make the content appear under the system bars.
private void showSystemUI() {
  mDecorView.setSystemUiVisibility(
        View.SYSTEM_UI_FLAG_LAYOUT_STABLE
        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}


问:
How do I pass variable inside find and bash -c?
I have issues with passing variable to %exe part of the code.

Here is my working code that I use inside bash script:

```<code>## Function
targz() {
  find $1 -type f -name "*.$2" -exec \
    bash -c 'old=$(basename {}); new=${old/%exe/tar\.gz}; \
      tar -zcvf $new $old; ' \;
}

## Function Call
## targz [directory] [extension]
targz . 'exe';
</code>```

and yes I've tried using it some thing like this:

```<code>new=${old/%$2/tar\.gz};
</code>```

but it generates filenames like: file.exetar.gz .

答:
Use env to set an environment variable for bash:

```<code>targz() {
  find "$1" -type f -name "*.$2" -exec \
    env ext="$2" bash -c 'old=$(basename "{}"); new=${old/%$ext/tar\.gz}; \
      tar -zcvf "$new" "$old"; ' \;
}
</code>```

I added some quoting to protect against spaces in filenames.

ContentLicense: CC BY-SA 4.0

Body:
I have issues with passing variable to %exe part of the code.

Here is my working code that I use inside bash script:

## Function
targz() {
  find $1 -type f -name "*.$2" -exec \
    bash -c 'old=$(basename {}); new=${old/%exe/tar\.gz}; \
      tar -zcvf $new $old; ' \;
}

## Function Call
## targz [directory] [extension]
targz . 'exe';

and yes I've tried using it some thing like this:

new=${old/%$2/tar\.gz};

but it generates filenames like: file.exetar.gz .

Body:
Use env to set an environment variable for bash:

targz() {
  find "$1" -type f -name "*.$2" -exec \
    env ext="$2" bash -c 'old=$(basename "{}"); new=${old/%$ext/tar\.gz}; \
      tar -zcvf "$new" "$old"; ' \;
}

I added some quoting to protect against spaces in filenames.


问:
Pythonic way to sort the records with multiple columns
Let's say we have a lot of records in a file in the following fashion.

10.10.10.10(tcp/443) : Some SSL Vulnerability : Medium : Patched

10.10.10.11(tcp/888) : Some RCE Vulnerability : High : Not Patched

These records have the 3rd column with values Critical, High, Medium, Low.

What's the best possible pythonic way to sort these records in this manner :
1. Critical, 2.High, 3.Medium 4. Low ?

答:
Here's a pure Python solution, using a dictionary to convert the Critical, High, Medium, Low strings to their numeric values; that numeric value is used as the sorting key function argument to list.sort. My key function also uses the first field of each record as a secondary sorting key so that in each of the sections sorted by grade the entries are also sorted by that first field.

Since your question only includes 2 lines of sample data I've constructed some simple fake data.

```<code>data = '''\
00 : abc : Low
01 : def : High
02 : ghi : Low
03 : jkl : Medium
04 : mno : High
05 : pqr : Medium
06 : stu : High
07 : vwx : Medium
08 : yza : High
09 : bcd : High
10 : efg : High
11 : hij : Critical
12 : klm : Critical
13 : nop : Medium
14 : qrs : High
15 : tuv : Critical
'''.splitlines()
data = [row.split(' : ') for row in data]

grades = {'Critical': 1, 'High': 2, 'Medium': 3, 'Low': 4}

data.sort(key=lambda t: (grades[t[2]], t[0]))
for row in data:
    print(' : '.join(row))
</code>```

output

```<code>11 : hij : Critical
12 : klm : Critical
15 : tuv : Critical
01 : def : High
04 : mno : High
06 : stu : High
08 : yza : High
09 : bcd : High
10 : efg : High
14 : qrs : High
03 : jkl : Medium
05 : pqr : Medium
07 : vwx : Medium
13 : nop : Medium
00 : abc : Low
02 : ghi : Low
</code>```

Body:
Here's a pure Python solution, using a dictionary to convert the Critical, High, Medium, Low strings to their numeric values; that numeric value is used as the sorting key function argument to list.sort. My key function also uses the first field of each record as a secondary sorting key so that in each of the sections sorted by grade the entries are also sorted by that first field.

Since your question only includes 2 lines of sample data I've constructed some simple fake data.

data = '''\
00 : abc : Low
01 : def : High
02 : ghi : Low
03 : jkl : Medium
04 : mno : High
05 : pqr : Medium
06 : stu : High
07 : vwx : Medium
08 : yza : High
09 : bcd : High
10 : efg : High
11 : hij : Critical
12 : klm : Critical
13 : nop : Medium
14 : qrs : High
15 : tuv : Critical
'''.splitlines()
data = [row.split(' : ') for row in data]

grades = {'Critical': 1, 'High': 2, 'Medium': 3, 'Low': 4}

data.sort(key=lambda t: (grades[t[2]], t[0]))
for row in data:
    print(' : '.join(row))

output

11 : hij : Critical
12 : klm : Critical
15 : tuv : Critical
01 : def : High
04 : mno : High
06 : stu : High
08 : yza : High
09 : bcd : High
10 : efg : High
14 : qrs : High
03 : jkl : Medium
05 : pqr : Medium
07 : vwx : Medium
13 : nop : Medium
00 : abc : Low
02 : ghi : Low


问:
Can't deserialize Protobuf (2.6.1) data using elephant-bird and Hive in AWS
I am not able to deserialize the protobuf data that has repeated string in it using elephant-bird 4.14 with Hive. This seems to be because repeated string feature is available only with Protobuf 2.6 and not in Protobuf 2.5. While running my hive queries in AWS EMR cluster, it uses Protobuf 2.5 that is bundled with AWS Hive. Even after adding Protobuf 2.6 jar explicitly, i am not able to get rid of this error. I want to know how can i make hive to use Protobuf 2.6 jar that i add explicitly.

Below are the hive queries used:

```<code>    add jar s3://gam.test/hive-jars/protobuf-java-2.6.1.jar;
    add jar s3://gam.test/hive-jars/GAMDataModel-1.0.jar;
    add jar s3://gam.test/hive-jars/GAMCoreModel-1.0.jar;
    add jar s3://gam.test/hive-jars/GAMAccessLayer-1.1.jar;
    add jar s3://gam.test/hive-jars/RodbHiveStorageHandler-0.12.0-jarjar-final.jar;
    add jar s3://gam.test/hive-jars/elephant-bird-core-4.14.jar;
    add jar s3://gam.test/hive-jars/elephant-bird-hive-4.14.jar;
    add jar s3://gam.test/hive-jars/elephant-bird-hadoop-compat-4.14.jar;
    add jar s3://gam.test/hive-jars/protobuf-java-2.6.1.jar;
    add jar s3://gam.test/hive-jars/GamProtoBufHiveDeserializer-1.0-jarjar.jar;
    drop table GamRelationRodb;

    CREATE EXTERNAL TABLE GamRelationRodb
    row format serde "com.amazon.hive.serde.GamProtobufDeserializer"
    with serdeproperties("serialization.class"=
 "com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper")
    STORED BY 'com.amazon.rodb.hadoop.hive.RodbHiveStorageHandler' TBLPROPERTIES
    ("file.name" = 'GAM_Relationship',"file.path" ='s3://pathtofile/');

    select * from GamRelationRodb limit 10;
</code>```

Below is the format of the Protobuf file:

```<code>message RepeatedRelationshipWrapper {
    repeated relationship.Relationship relationships = 1;
}

message Relationship {
    required RelationshipType type = 1;
    repeated string ids = 2;
}

enum RelationshipType {
    UKNOWN_RELATIONSHIP_TYPE = 0;
    PARENT = 1;
    CHILD = 2;
}
</code>```

Below is the runtime exception thrown while running the query:

```<code>Exception in thread "main" java.lang.NoSuchMethodError: com.google.protobuf.LazyStringList.getUnmodifiableView()Lcom/google/protobuf/LazyStringList;
    at com.amazon.gam.model.RelationshipProto$Relationship.<init>(RelationshipProto.java:215)
    at com.amazon.gam.model.RelationshipProto$Relationship.<init>(RelationshipProto.java:137)
    at com.amazon.gam.model.RelationshipProto$Relationship$1.parsePartialFrom(RelationshipProto.java:239)
    at com.amazon.gam.model.RelationshipProto$Relationship$1.parsePartialFrom(RelationshipProto.java:234)
    at com.google.protobuf.CodedInputStream.readMessage(CodedInputStream.java:309)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper.<init>(RepeatedRelationshipWrapperProto.java:126)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper.<init>(RepeatedRelationshipWrapperProto.java:72)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper$1.parsePartialFrom(RepeatedRelationshipWrapperProto.java:162)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper$1.parsePartialFrom(RepeatedRelationshipWrapperProto.java:157)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper$Builder.mergeFrom(RepeatedRelationshipWrapperProto.java:495)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper$Builder.mergeFrom(RepeatedRelationshipWrapperProto.java:355)
    at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:337)
    at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:267)
    at com.google.protobuf.AbstractMessageLite$Builder.mergeFrom(AbstractMessageLite.java:170)
    at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:882)
    at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:267)
    at com.twitter.elephantbird.mapreduce.io.ProtobufConverter.fromBytes(ProtobufConverter.java:66)
    at com.twitter.elephantbird.hive.serde.ProtobufDeserializer.deserialize(ProtobufDeserializer.java:59)
    at com.amazon.hive.serde.GamProtobufDeserializer.deserialize(GamProtobufDeserializer.java:63)
    at org.apache.hadoop.hive.ql.exec.FetchOperator.getNextRow(FetchOperator.java:502)
    at org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:428)
    at org.apache.hadoop.hive.ql.exec.FetchTask.fetch(FetchTask.java:146)
    at org.apache.hadoop.hive.ql.Driver.getResults(Driver.java:2098)
    at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:252)
    at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:183)
    at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:399)
    at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:776)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:714)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
</code>```

答:
Protobuf is brittle library. It may be wire-format compatible across versions 2.x, but the classes generated by protoc will only link against the protobuf JAR of exactly the same version as that of the protoc compiler.

This means, fundamentally, that you cannot update protobuf except by choreographing this across all dependencies. The Great Protobuf upgrade in 2013 was when Hadoop, Hbase, Hive &c upgrade, and after that: everyone has frozen at v 2.5, probably for the entire life of the Hadoop 2.x codeline, unless it all gets shaded away or Java 9 hides the problem.

We are more scared of protobuf updates than upgrades to Guava and Jackson, as the latter only breaks every single library, not the wire format.

Watch HADOOP-13363 for the topic of a 2.x upgrade, and HDFS-11010 on the question of a move up to protobuf 3 in hadoop trunk. That's messy as it does change wire format, the protobuf-json marshalling breaks and other things.

It's best just to conclude, "binary compatibility of protobuf code has been found lacking", and stick to protobuf 2.5. Sorry.

You could take the entire stack of libraries you want to use, rebuild them with an updated protoc compiler, matching protobuf.jor, with any other patches you need applied. I would only recommend that to the bold —but am curious about the outcome. If you do try this, let us know how it worked out

Further reading fear of dependencies

Body:
I am not able to deserialize the protobuf data that has repeated string in it using elephant-bird 4.14 with Hive. This seems to be because repeated string feature is available only with Protobuf 2.6 and not in Protobuf 2.5. While running my hive queries in AWS EMR cluster, it uses Protobuf 2.5 that is bundled with AWS Hive. Even after adding Protobuf 2.6 jar explicitly, i am not able to get rid of this error. I want to know how can i make hive to use Protobuf 2.6 jar that i add explicitly.

Below are the hive queries used:

    add jar s3://gam.test/hive-jars/protobuf-java-2.6.1.jar;
    add jar s3://gam.test/hive-jars/GAMDataModel-1.0.jar;
    add jar s3://gam.test/hive-jars/GAMCoreModel-1.0.jar;
    add jar s3://gam.test/hive-jars/GAMAccessLayer-1.1.jar;
    add jar s3://gam.test/hive-jars/RodbHiveStorageHandler-0.12.0-jarjar-final.jar;
    add jar s3://gam.test/hive-jars/elephant-bird-core-4.14.jar;
    add jar s3://gam.test/hive-jars/elephant-bird-hive-4.14.jar;
    add jar s3://gam.test/hive-jars/elephant-bird-hadoop-compat-4.14.jar;
    add jar s3://gam.test/hive-jars/protobuf-java-2.6.1.jar;
    add jar s3://gam.test/hive-jars/GamProtoBufHiveDeserializer-1.0-jarjar.jar;
    drop table GamRelationRodb;

    CREATE EXTERNAL TABLE GamRelationRodb
    row format serde "com.amazon.hive.serde.GamProtobufDeserializer"
    with serdeproperties("serialization.class"=
 "com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper")
    STORED BY 'com.amazon.rodb.hadoop.hive.RodbHiveStorageHandler' TBLPROPERTIES
    ("file.name" = 'GAM_Relationship',"file.path" ='s3://pathtofile/');

    select * from GamRelationRodb limit 10;

Below is the format of the Protobuf file:

message RepeatedRelationshipWrapper {
    repeated relationship.Relationship relationships = 1;
}

message Relationship {
    required RelationshipType type = 1;
    repeated string ids = 2;
}

enum RelationshipType {
    UKNOWN_RELATIONSHIP_TYPE = 0;
    PARENT = 1;
    CHILD = 2;
}

Below is the runtime exception thrown while running the query:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.protobuf.LazyStringList.getUnmodifiableView()Lcom/google/protobuf/LazyStringList;
    at com.amazon.gam.model.RelationshipProto$Relationship.<init>(RelationshipProto.java:215)
    at com.amazon.gam.model.RelationshipProto$Relationship.<init>(RelationshipProto.java:137)
    at com.amazon.gam.model.RelationshipProto$Relationship$1.parsePartialFrom(RelationshipProto.java:239)
    at com.amazon.gam.model.RelationshipProto$Relationship$1.parsePartialFrom(RelationshipProto.java:234)
    at com.google.protobuf.CodedInputStream.readMessage(CodedInputStream.java:309)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper.<init>(RepeatedRelationshipWrapperProto.java:126)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper.<init>(RepeatedRelationshipWrapperProto.java:72)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper$1.parsePartialFrom(RepeatedRelationshipWrapperProto.java:162)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper$1.parsePartialFrom(RepeatedRelationshipWrapperProto.java:157)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper$Builder.mergeFrom(RepeatedRelationshipWrapperProto.java:495)
    at com.amazon.gam.rodb.model.RepeatedRelationshipWrapperProto$RepeatedRelationshipWrapper$Builder.mergeFrom(RepeatedRelationshipWrapperProto.java:355)
    at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:337)
    at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:267)
    at com.google.protobuf.AbstractMessageLite$Builder.mergeFrom(AbstractMessageLite.java:170)
    at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:882)
    at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:267)
    at com.twitter.elephantbird.mapreduce.io.ProtobufConverter.fromBytes(ProtobufConverter.java:66)
    at com.twitter.elephantbird.hive.serde.ProtobufDeserializer.deserialize(ProtobufDeserializer.java:59)
    at com.amazon.hive.serde.GamProtobufDeserializer.deserialize(GamProtobufDeserializer.java:63)
    at org.apache.hadoop.hive.ql.exec.FetchOperator.getNextRow(FetchOperator.java:502)
    at org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:428)
    at org.apache.hadoop.hive.ql.exec.FetchTask.fetch(FetchTask.java:146)
    at org.apache.hadoop.hive.ql.Driver.getResults(Driver.java:2098)
    at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:252)
    at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:183)
    at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:399)
    at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:776)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:714)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)