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
/** | |
In Java: What is the difference between: | |
Object o1= .... | |
o1.getClass().getSimpleName(); | |
o1.getClass().getName(); | |
o1.getClass().getCanonicalName(); | |
**/ | |
@Test | |
public void testNames() throws Exception { | |
//primative |
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 utility provides methods to either convert an IPv4 address to its long format or a 32bit dotted format. | |
* | |
* @author Aion | |
* Created on 22/11/12 | |
*/ | |
public static class IPv4 { | |
/** | |
* Returns the long format of the provided IP address. |
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
import org.dom4j.Document; | |
import org.dom4j.DocumentHelper; | |
import org.dom4j.Element; | |
import org.dom4j.io.OutputFormat; | |
import org.dom4j.io.XMLWriter; | |
import java.io.IOException; | |
import java.io.StringWriter; |
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
local _M = { | |
_VERSION = '0.1' | |
} | |
local connect = function() | |
local redis = require "resty.redis" | |
local red = redis:new() | |
red:set_timeout(1000) -- 1 sec | |
local ok, err = red:connect("127.0.0.1", 6379) | |
if not ok then |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
<html> | |
<body> | |
</body> | |
<script> | |
(function tryLoadImages(index) { | |
var img = document.createElement('img'); | |
img.src = "http://127.0.0.1:7001/" + index + ".jpg"; | |
img.onload = function() { | |
document.body.appendChild(img); |
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
import org.apache.commons.httpclient.HttpClient; | |
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; | |
import org.apache.commons.httpclient.methods.GetMethod; | |
import org.apache.commons.httpclient.params.HttpClientParams; | |
import org.apache.commons.httpclient.params.HttpConnectionManagerParams; | |
import org.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.runner.Runner; | |
import org.openjdk.jmh.runner.RunnerException; | |
import org.openjdk.jmh.runner.options.Options; | |
import org.openjdk.jmh.runner.options.OptionsBuilder; |
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
[root@iZ25p1jt074Z ~]# df -m|awk 'NR==1{for(i=1;i<=NF;i++){ix[i]=$i}} (NR>1){for(i=1;i<=NF-1;i++){printf "%s:%s,",ix[i],$i} printf "%s:%s\n",ix[NF],$NF}' | |
Filesystem:/dev/xvda1,1M-blocks:20158,Used:12464,Available:6671,Use%:66%,Mounted:/ | |
Filesystem:tmpfs,1M-blocks:4096,Used:0,Available:4096,Use%:0%,Mounted:/dev/shm | |
Filesystem:/dev/xvdb1,1M-blocks:201581,Used:9433,Available:181909,Use%:5%,Mounted:/mnt | |
[root@iZ25p1jt074Z ~]# |
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
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
// more to see https://github.com/golang/go/wiki/CommonMistakes | |
func main() { | |
m := []string{"a", "b", "c", "d"} |
OlderNewer