Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wxnacy committed Jan 19, 2019
1 parent 5ef3209 commit 14661d3
Show file tree
Hide file tree
Showing 37 changed files with 922 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,6 @@ crawler/common

# for other
*/winn/*
*/goland/bin/
*/goland/pkg/
*/goland/src/github.com/
Binary file added goland/bin/image_conver
Binary file not shown.
22 changes: 22 additions & 0 deletions goland/install_ic
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 added goland/pkg/darwin_amd64/github.com/nfnt/resize.a
Binary file not shown.
Binary file added goland/pkg/darwin_amd64/image_conver.a
Binary file not shown.
1 change: 1 addition & 0 deletions goland/src/github.com/nfnt/resize
Submodule resize added at 83c6a9
9 changes: 9 additions & 0 deletions goland/src/image_conver/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import (
"fmt"
)

func main() {
fmt.Println("Hello World")
}
32 changes: 32 additions & 0 deletions java/SpringBoot-HelloWorld/tree.txt
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
2 changes: 2 additions & 0 deletions java/modification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ $ ./run.sh
子类 √ × √ √
外部类 √ × × ×
```

更多文章:https://wxnacy.com/
24 changes: 24 additions & 0 deletions java/simple/ArrayLoop.java
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());
}

}
}
41 changes: 41 additions & 0 deletions java/simple/ClassList.java
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;
}

}
1 change: 0 additions & 1 deletion java/simple/HelloWorld.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package simple;
public class HelloWorld{
public static void main(String args[]){
System.out.println("Hello World");
Expand Down
21 changes: 21 additions & 0 deletions java/simple/HttpClients.java
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();

}
}
1 change: 0 additions & 1 deletion java/simple/Java8Lambda.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package simple;
public class Java8Lambda {
public static void main(String args[]){
Java8Lambda jl = new Java8Lambda();
Expand Down
5 changes: 5 additions & 0 deletions java/simple/JsonBean.java
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");
}
}
179 changes: 179 additions & 0 deletions java/simple/PomParser.java
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;
}
}
15 changes: 15 additions & 0 deletions java/simple/Stocks.xml
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>


6 changes: 6 additions & 0 deletions java/simple/Test.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import java.util.Arrays;

public class Test1{
public static void main(String args[]){
System.out.println("Hello World");
var name = "wxnacy";
var array = Arrays.asList("wxnacy");
System.out.println(array);
System.out.println(name);
Test2.main(new String());
}
}
Expand Down
Loading

0 comments on commit 14661d3

Please sign in to comment.