- 浏览: 12550 次
- 性别:
- 来自: 南京
最新评论
文章列表
Your Code Sucks
- 博客分类:
- 他山之玉
A very good friend of mine is in the midst of an avalanche of work. He has a lot of open contracts, and has been abandoned by a fellow developer that was helping him with his workload. So, with three huge clients breathing down his neck he has been working non stop for weeks now.
...
Why Good Programmers Are Lazy and Dumb
I realized that, paradoxically enough, good programmers need to be both lazy and dumb .
Lazy , because only lazy programmers will want to write the kind of tools that might replace them in the end. Lazy, because only a lazy programmer will avoid writing monot ...
web-common_3_0.xsd
- 博客分类:
- web
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://java.sun.com/xml/ns/javaee"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xmlns:x ...
web-app_3_0.xsd
- 博客分类:
- web
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://java.sun.com/xml/ns/javaee"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xmlns:xs ...
HttpSession 是什么时候产生的?
- 博客分类:
- web
本文用实验来证明session在servlet和jsp技术是如何应用的。大家都知道session由容器产生和管理,那么是什么时候产生的呢?不用多说了,用代码来证明一切吧。
首先,我们创建一个sessionlistener 来跟踪每个session的轨迹。
public class MySessionListener implements HttpSessionListener {
@Override
public void sessionCreated(HttpSessionEvent arg0) {
String id = arg0.getSession( ...
碰到一个问题时,观察分析其中的规律,将这些重复的步骤总结出来,并设好终止条件, 然后用程序语言表达出来,就成了一种解决方案。
小题目: 回子型遍历矩阵, 示例:A B C K M N J H G D E F
A B C K
D E F M
G H J N
可以用程序模拟来模拟这个过程,打印出访问顺序。
从左到右: A B C K 上边界下移
从上到下: M N 右边界左移
从右到左: J H G 下边界上移
从下到上: G D 左边界右移
从左到右: E F ...
Java 序列化
- 博客分类:
- Task-Oriented Java
TestSrl t = new TestSrl();
System.out.println(t);
ByteArrayOutputStream bs = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(bs);
os.writeObject(t);
os.writeObject(t);
ObjectInputStream in1 = new ObjectInputStream(new ByteArrayInputStream(
bs.toB ...
public class Base {
private String s1 = "Base string";
static int k = 0;
static {
System.out.println("Base static block before constructor");
System.out.println("Base k=" + k);
k++;
}
{
System.out.println("Base instance block before constructor ...
Json JSONP
- 博客分类:
- 他山之玉
- Javascript
一篇好文:
由于Sencha Touch 2这种开发模式的特性,基本决定了它原生的数据交互行为几乎只能通过AJAX来实现。
当然了,通过调用强大的PhoneGap插件然后打包,你可以实现100%的
Socket通讯和本地数据库功能,又或者通过HTML5 ...
public static void main(String[] args) throws IOException,
InterruptedException {
ProcessBuilder pb = new ProcessBuilder("CMD /C dir".split(" "));
pb.redirectErrorStream(true);//so no need to start another thread to purge error stream
final Process p = pb.start();
...
BufferedInputStream bi = new BufferedInputStream(new FileInputStream(
"kk"));
try {
byte[] data = new byte[bi.available()];
bi.read(data);
return data;
} finally {
bi.close();
}
java下载文件
- 博客分类:
- Task-Oriented Java
*Stream ----- byte oriented
*der ----- char oriented
Buffered*----- add buffer
Print* ----- format
URL url = new URL(
"http://docs.oracle.com/javase/tutorial/networking/sockets/examples/KnockKnockServer.java");
URLConnection uc = url.openConnection();
InputStre ...
Cookies
Cookies were originally invented by Netscape to give 'memory' to web servers and browsers. The HTTP
protocol, which arranges for the transfer of web pages to your browser and browser requests for
pages to servers, is state-less
, which means that once the server has sent a page to a bro ...
本文通过解决一个问题,引出javascript的概况
问题: 有两种不同的视图,界面上有个按钮供点击来实现视图间的切换
最直观也简单的想法:
var cur = 1;
function view1(){}
function view2(){}
function control(){
window['view' + cur]();
...