Skip to content

Instantly share code, notes, and snippets.

@turbotree
turbotree / 省市表
Created March 20, 2014 08:51
中国省市表(mysql版)
DROP TABLE IF EXISTS `province`;
CREATE TABLE `province` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=gbk;
-- ----------------------------
-- Records of province
-- ----------------------------
INSERT INTO `province` VALUES ('1', '北京市');
@turbotree
turbotree / youjian.html
Created November 29, 2013 14:43
自定义右键行为(通过事件对象获得鼠标的坐标(x,y))
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>demo</title>
<style type="text/css">
html{
@turbotree
turbotree / DownImages
Created November 4, 2013 01:53
利用jsoup获取网页图片链接并下载到本地
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
@turbotree
turbotree / 两种重写equals的方法
Created October 30, 2013 01:54
两种重写equals的方法
public class User {
private String name;
private String code;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@turbotree
turbotree / Account
Last active December 25, 2015 14:29 — forked from KingSirLee/Account
数组版Atm系统
public class Account {
private String username;
private String password;
private double money;
private boolean enable;
public String getUsername() {
return username;
}
@turbotree
turbotree / DBHelp.java
Last active December 25, 2015 14:29 — forked from fanker/DBHelp.java
图书管理系统2
package com.jdbc.librarysystem.util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@turbotree
turbotree / Admin.java
Last active December 25, 2015 14:29 — forked from fanker/Admin.java
图书管理系统1
package com.jdbc.librarysystem.entity;
public class Admin {
private int id;
private String username;
private String password;
public int getId() {
return id;
}
@turbotree
turbotree / Test.java
Last active December 25, 2015 01:49 — forked from fankay/Test.java
两个数字互换
public class Test {
public static void main(String[] args) {
java.util.Scanner input = new java.util.Scanner(System.in);
System.out.println("请输入数字A:");
int numA = input.nextInt();
@turbotree
turbotree / 详情
Created September 9, 2014 02:43
汉字所占字节与编码方式有关
public static void main(String []args) throws UnsupportedEncodingException {
// 运行结果:2
System.out.println("柳峰".getBytes("ISO8859-1").length);
// 运行结果:4
System.out.println("柳峰".getBytes("GB2312").length);
// 运行结果:4
System.out.println("柳峰".getBytes("GBK").length);
// 运行结果:6
System.out.println("柳峰".getBytes("UTF-8").length);
}
@turbotree
turbotree / 垂直居中
Created September 5, 2014 03:48
CSS垂直水平完全居中手册
它是一行的吗?
  有时侯元素可以表现像垂直居中,只是因为它们有相等的上下padding
  
  
  .link {
padding-top: 30px;
padding-bottom: 30px;
}