-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
922 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,3 +138,6 @@ crawler/common | |
|
||
# for other | ||
*/winn/* | ||
*/goland/bin/ | ||
*/goland/pkg/ | ||
*/goland/src/github.com/ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
# export GOPATH=`pwd` | ||
export GOPATH=/Users/wxnacy/PycharmProjects/study/goland | ||
SOURCE_DIR=image_conver | ||
# BIN=lu | ||
|
||
# CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install $SOURCE_DIR | ||
# CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go install $SOURCE_DIR | ||
# CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go install $SOURCE_DIR | ||
go install $SOURCE_DIR | ||
|
||
# test -d bin || mkdir bin | ||
# test -d bin/linux_amd64 || mkdir bin/linux_amd64 | ||
# test -d bin/windows_amd64 || mkdir bin/windows_amd64 | ||
# test -d bin/darwin_amd64 || mkdir bin/darwin_amd64 | ||
|
||
# cp ${GOPATH}/bin/linux_amd64/$BIN bin/linux_amd64 | ||
# cp ${GOPATH}/bin/windows_amd64/$BIN.exe bin/windows_amd64 | ||
# cp ${GOPATH}/bin/$BIN bin/darwin_amd64 | ||
|
||
echo 'Install Finshed' |
Binary file not shown.
Binary file not shown.
Submodule resize
added at
83c6a9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
fmt.Println("Hello World") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
com.wxnacy.spring:SpringBoot-HelloWorld:jar:1.0-SNAPSHOT | ||
\- org.springframework.boot:spring-boot-starter-web:jar:1.5.9.RELEASE:compile | ||
+- org.springframework.boot:spring-boot-starter:jar:1.5.9.RELEASE:compile | ||
| +- org.springframework.boot:spring-boot:jar:1.5.9.RELEASE:compile | ||
| +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.9.RELEASE:compile | ||
| +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.9.RELEASE:compile | ||
| | +- ch.qos.logback:logback-classic:jar:1.1.11:compile | ||
| | | +- ch.qos.logback:logback-core:jar:1.1.11:compile | ||
| | | \- org.slf4j:slf4j-api:jar:1.7.25:compile | ||
| | +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile | ||
| | +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile | ||
| | \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile | ||
| +- org.springframework:spring-core:jar:4.3.13.RELEASE:compile | ||
| \- org.yaml:snakeyaml:jar:1.17:runtime | ||
+- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.9.RELEASE:compile | ||
| +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.23:compile | ||
| | \- org.apache.tomcat:tomcat-annotations-api:jar:8.5.23:compile | ||
| +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.23:compile | ||
| \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.23:compile | ||
+- org.hibernate:hibernate-validator:jar:5.3.6.Final:compile | ||
| +- javax.validation:validation-api:jar:1.1.0.Final:compile | ||
| +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile | ||
| \- com.fasterxml:classmate:jar:1.3.4:compile | ||
+- com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile | ||
| +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile | ||
| \- com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile | ||
+- org.springframework:spring-web:jar:4.3.13.RELEASE:compile | ||
| +- org.springframework:spring-aop:jar:4.3.13.RELEASE:compile | ||
| +- org.springframework:spring-beans:jar:4.3.13.RELEASE:compile | ||
| \- org.springframework:spring-context:jar:4.3.13.RELEASE:compile | ||
\- org.springframework:spring-webmvc:jar:4.3.13.RELEASE:compile | ||
\- org.springframework:spring-expression:jar:4.3.13.RELEASE:compile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,5 @@ $ ./run.sh | |
子类 √ × √ √ | ||
外部类 √ × × × | ||
``` | ||
|
||
更多文章:https://wxnacy.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import java.util.Arrays; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
public class ArrayLoop { | ||
|
||
public static void main(String[] args){ | ||
|
||
List<String> list = Arrays.asList("wxnacy", "wxn", "wen", "li"); | ||
for(String l : list){ | ||
System.out.println(l); | ||
} | ||
|
||
for(int i = 0; i < list.size(); i++){ | ||
System.out.println(list.get(i)); | ||
} | ||
|
||
Iterator<String> iter = list.iterator(); | ||
while(iter.hasNext()) { | ||
System.out.println(iter.next()); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import java.util.List; | ||
import java.util.ArrayList; | ||
import java.util.Enumeration; | ||
import java.util.jar.JarEntry; | ||
import java.util.jar.JarFile; | ||
|
||
/** | ||
* Created by wxnacy | ||
*/ | ||
public class ClassList { | ||
|
||
public static void main(String args[]) { | ||
|
||
ClassList cl = new ClassList(); | ||
String path = "/Users/wxnacy/.m2/repository/com/alibaba/fastjson/1.1.34/fastjson-1.1.34.jar"; | ||
List<String> classList = cl.getClassList(path); | ||
} | ||
|
||
public List<String> getClassList(String path) { | ||
List<String> list = new ArrayList<String>(); | ||
try { | ||
JarFile jarFile = new JarFile(path); | ||
Enumeration enu = jarFile.entries(); | ||
while (enu.hasMoreElements()) { | ||
JarEntry jarEntry = (JarEntry) enu.nextElement(); | ||
String name = jarEntry.getName(); | ||
if (name.endsWith(".class") && name.indexOf("$") == -1 ) { | ||
name = name.substring(0, name.indexOf(".class")); | ||
name = name.replaceAll("/", "."); | ||
System.out.println(name); | ||
list.add(name); | ||
} | ||
|
||
} | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
return list; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import java.net.http.*; | ||
|
||
public class HttpClient{ | ||
public static String URL = "http://ip-api.com/json"; | ||
public static void main(String args[]){ | ||
System.out.println("Hello World"); | ||
get(); | ||
} | ||
|
||
public static void get() { | ||
HttpClient client = HttpClient.newHttpClient(); | ||
HttpRequest request = HttpRequest.newBuilder() | ||
.uri(URI.create(URL)) | ||
.build(); | ||
client.sendAsync(request, BodyHandlers.ofString()) | ||
.thenApply(HttpResponse::body) | ||
.thenAccept(System.out::println) | ||
.join(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
public class Json{ | ||
public static void main(String[] args){ | ||
System.out.println("Hello World"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
import java.io.File; | ||
import javax.xml.parsers.DocumentBuilder; | ||
import javax.xml.parsers.DocumentBuilderFactory; | ||
import org.w3c.dom.Document; | ||
import org.w3c.dom.Element; | ||
import org.w3c.dom.Node; | ||
import org.w3c.dom.NodeList; | ||
|
||
public class PomParser { | ||
|
||
private String path; | ||
private Document doc; | ||
private String name; | ||
private String packageing; | ||
private String modelVersion; | ||
private String groupId; | ||
private String artifactId; | ||
private String version; | ||
private String url; | ||
private Model parent; | ||
|
||
private PomParser(String path) { | ||
this.path = path; | ||
} | ||
|
||
public static PomParser parse(String path) { | ||
PomParser pp = new PomParser(path); | ||
pp.init(); | ||
return pp; | ||
} | ||
|
||
private void initDoc() { | ||
try { | ||
|
||
File stocks = new File(this.path); | ||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); | ||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); | ||
Document doc = dBuilder.parse(stocks); | ||
doc.getDocumentElement().normalize(); | ||
this.doc = doc; | ||
} catch (Exception ex) { | ||
ex.printStackTrace(); | ||
} | ||
} | ||
|
||
private String getValueByDoc(String tag) { | ||
String val = null; | ||
NodeList nodes = this.doc.getElementsByTagName(tag); | ||
if( nodes.getLength() > 0 ){ | ||
NodeList cns = nodes.item(0).getChildNodes(); | ||
if( cns.getLength() > 0 ){ | ||
val = cns.item(0).getNodeValue(); | ||
} | ||
} | ||
return val; | ||
} | ||
|
||
private String getValueByEle(Element ele, String tag) { | ||
String val = null; | ||
NodeList nodes = ele.getElementsByTagName(tag); | ||
if( nodes.getLength() > 0 ){ | ||
NodeList cns = nodes.item(0).getChildNodes(); | ||
if( cns.getLength() > 0 ){ | ||
val = cns.item(0).getNodeValue(); | ||
} | ||
} | ||
return val; | ||
} | ||
|
||
private String getValueByTag(String parentTag, String tag) { | ||
String val = null; | ||
NodeList parentNodes = this.doc.getElementsByTagName(parentTag); | ||
if( parentNodes.getLength() > 0 ){ | ||
Element parentEle = (Element) parentNodes.item(0); | ||
System.out.println(this.getValueByEle(parentEle, tag)); | ||
} | ||
return val; | ||
} | ||
|
||
private void init() { | ||
this.initDoc(); | ||
|
||
this.name = this.getValueByDoc("name"); | ||
this.packageing = this.getValueByDoc("packageing"); | ||
this.modelVersion = this.getValueByDoc("modelVersion"); | ||
this.groupId = this.getValueByDoc("groupId"); | ||
this.artifactId = this.getValueByDoc("artifactId"); | ||
this.version = this.getValueByDoc("version"); | ||
this.url = this.getValueByDoc("url"); | ||
|
||
NodeList parentNodes = this.doc.getElementsByTagName("parent"); | ||
if( parentNodes.getLength() > 0 ){ | ||
Element parentEle = (Element) parentNodes.item(0); | ||
System.out.println(this.getValueByEle(parentEle, "groupId")); | ||
} | ||
|
||
String parentGroupId = this.getValueByTag("parent", "groupId"); | ||
String parentArtifactId = this.getValueByTag("parent", "artifactId"); | ||
String parentVersion = this.getValueByTag("parent", "version"); | ||
this.parent = new Model(parentGroupId, parentArtifactId, parentVersion); | ||
|
||
try { | ||
|
||
File stocks = new File(this.path); | ||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); | ||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); | ||
Document doc = dBuilder.parse(stocks); | ||
doc.getDocumentElement().normalize(); | ||
|
||
// verEle = doc.getElementsByTagName("modelVersion").item(0); | ||
// System.out.println(" ver" + verEle.getNodeValue()); | ||
System.out.println(doc.getElementsByTagName("version").item(0).getChildNodes().item(0).getNodeValue()); | ||
|
||
System.out.println("root of xml file " + doc.getDocumentElement().getNodeName()); | ||
NodeList nodes = doc.getElementsByTagName("stock"); | ||
System.out.println("=========================="); | ||
|
||
for (int i = 0; i < nodes.getLength(); i++) { | ||
Node node = nodes.item(i); | ||
|
||
if (node.getNodeType() == Node.ELEMENT_NODE) { | ||
Element element = (Element) node; | ||
System.out.println("Stock Symbol: " + getValue("symbol", element)); | ||
System.out.println("Stock Price: " + getValue("price", element)); | ||
System.out.println("Stock Quantity: " + getValue("quantity", element)); | ||
} | ||
} | ||
} catch (Exception ex) { | ||
ex.printStackTrace(); | ||
} | ||
} | ||
|
||
public static void main(String args[]) { | ||
PomParser pp = PomParser.parse("pom.xml"); | ||
// try { | ||
|
||
// File stocks = new File("Stocks.xml"); | ||
// DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); | ||
// DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); | ||
// Document doc = dBuilder.parse(stocks); | ||
// doc.getDocumentElement().normalize(); | ||
// // Document doc = parseXml("Stocks.xml"); | ||
|
||
// System.out.println("root of xml file " + doc.getDocumentElement().getNodeName()); | ||
// NodeList nodes = doc.getElementsByTagName("stock"); | ||
// System.out.println("=========================="); | ||
|
||
// for (int i = 0; i < nodes.getLength(); i++) { | ||
// Node node = nodes.item(i); | ||
|
||
// if (node.getNodeType() == Node.ELEMENT_NODE) { | ||
// Element element = (Element) node; | ||
// System.out.println("Stock Symbol: " + getValue("symbol", element)); | ||
// System.out.println("Stock Price: " + getValue("price", element)); | ||
// System.out.println("Stock Quantity: " + getValue("quantity", element)); | ||
// } | ||
// } | ||
// } catch (Exception ex) { | ||
// ex.printStackTrace(); | ||
// } | ||
} | ||
|
||
private static String getValue(String tag, Element element) { | ||
NodeList nodes = element.getElementsByTagName(tag).item(0).getChildNodes(); | ||
Node node = (Node) nodes.item(0); | ||
return node.getNodeValue(); | ||
} | ||
} | ||
class Model{ | ||
private String groupId; | ||
private String artifactId; | ||
private String version; | ||
|
||
public Model(String groupId, String artifactId, String version) { | ||
this.groupId = groupId; | ||
this.artifactId = artifactId; | ||
this.version = version; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<stocks> | ||
<stock> | ||
<symbol>Citibank</symbol> | ||
<price>100</price> | ||
<quantity>1000</quantity> | ||
</stock> | ||
<stock> | ||
<symbol>Axis bank</symbol> | ||
<price>90</price> | ||
<quantity>2000</quantity> | ||
</stock> | ||
</stocks> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.