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 org.xkit.android.demo; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import android.content.Context; | |
import android.database.Cursor; | |
import android.database.sqlite.SQLiteDatabase; |
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
#!/usr/bin/python | |
#encoding: utf8 | |
from flup.server.fcgi import WSGIServer | |
def myapp(environ, start_response): | |
start_response('200 OK', [('Content-Type', 'text/plain')]) | |
return ['Hello World!\n你好,世界!'] | |
if __name__ == '__main__': |
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 java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Random; | |
public class RecursionMethodDemo { | |
public static void main(String[] args) { | |
List<String> list = new ArrayList<String>(); |
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
CREATE TABLE `str_test` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(50) DEFAULT NULL, | |
`ats` text, | |
`dor` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 | |
delimiter $$ |
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 java.sql.CallableStatement; | |
import java.sql.Connection; | |
import java.sql.PreparedStatement; | |
import java.sql.SQLException; | |
import java.sql.Types; | |
import com.mchange.v2.c3p0.ComboPooledDataSource; | |
public class InsertingDataWithPS { |
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
#!/bin/sh | |
PROC_HOME=$(cd "$(dirname "$0")"; pwd) | |
PID_FILE=$PROC_HOME/hello.pid | |
function alive() { | |
if [ -f ${PID_FILE} ] && ((`ps awux | grep -v grep | grep -c chrome`)); then | |
echo "the process is running" | |
exit 1 | |
fi |
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 org.xkit.mail.demo; | |
import java.io.UnsupportedEncodingException; | |
import java.net.URLDecoder; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class MailAttachmentFilenameDemo { | |
public static void main(String[] args) { |
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 java.util.concurrent.CountDownLatch; | |
import org.apache.commons.lang.math.RandomUtils; | |
public class MultipleThreadCalSum { | |
public static void main(String[] args) { | |
final int M = 10000000; // 10万个元素 | |
final int N = 100; // 100个线程 |
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
public class ThreadWaitSleepDemo { | |
public static void main(String[] args) { | |
// wait,notify,notifyAll三个方法都有共同点 | |
// The current thread must own this object's monitor. | |
ThreadWaitSleepDemo obj = new ThreadWaitSleepDemo(); | |
new S(obj).start(); | |
try { |
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
/** | |
* 将数组分三块,中间一块是pivot[就一个元素],左边一块是所有元素都小于pivot,右边一块是所有元素都大于pivot<br /> | |
* 快速排序的基础,简单易懂,居家旅行面试必备 | |
*/ | |
public class ArrayPartition { | |
public static void main(String[] args) { | |
int[] arr = { 4, 5, 3, 22, 1, 3 }; | |
printArray(arr, "init"); | |
System.out.println("pivot idx " + sort(arr, 0, arr.length - 1)); | |
printArray(arr, "result"); |
OlderNewer