开篇语:上班以后,烦恼少了,至少是没有什么好烦的了,只要负责好自己的工作就可以了,因此也有更多的时间去探索自己喜欢的程序。买回来的书已经看了一半,DEMO也敲了不少,昨晚终于在这里开BLOG,记录一些读书笔记。以我自己的经验来看,写笔记、测试、体会是加深理解的利器,往往起到事半功倍的效果。这几天在看...
分类:
编程语言 时间:
2014-07-22 22:47:56
阅读次数:
304
TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given...
分类:
其他好文 时间:
2014-07-22 22:47:52
阅读次数:
230
昨天在做 Jquery DataTables 的时候,遇到的一个问题,我使用MVC,在tables上加入了一个actionlink的href。但是在运行起来的时候,报错:DataTables warning: Requested unknown parameter '3' from the dat....
分类:
Web程序 时间:
2014-07-22 22:46:15
阅读次数:
389
题目:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorte....
分类:
编程语言 时间:
2014-07-22 00:35:34
阅读次数:
290
lock 关键字将语句块标记为临界区,方法是获取给定对象的互斥锁,执行语句,然后释放该锁。lock语句根本使用的就是Monitor.Enter和Monitor.Exit,也就是说lock(this)时执行Monitor.Enter(this),大括号结束时执行Monitor.Exit(this).他...
分类:
其他好文 时间:
2014-07-22 00:31:36
阅读次数:
242
import queue,threading l=threading.Lock()class MyThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) global...
分类:
编程语言 时间:
2014-07-22 00:20:34
阅读次数:
189
bool flock ( int handle, int operation [, int &wouldblock] );flock() 操作的 handle 必须是一个已经打开的文件指针。operation 可以是以下值之一:要取得共享锁定(读取程序),将 operation 设为 LOCK_SH...
分类:
Web程序 时间:
2014-07-22 00:07:34
阅读次数:
278
LOCK_EX是表示排它锁(Exclude),是独占的,一般用于写操作,而如果换成LOCK_SH(Share)则是共享,多用于读取。有时为了保证多进程对文件的读写都是唯一的,无论读写都进行LOCK_EX的请求。 以下是一段演示程序,...
分类:
其他好文 时间:
2014-07-21 23:31:03
阅读次数:
238
Description
The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number of points ...
分类:
其他好文 时间:
2014-07-21 22:11:18
阅读次数:
289
主要区别1、Lock能完成几乎所有synchronized的功能,并有一些后者不具备的功能,如公平锁、等待可中断、锁绑定多个条件等;2、synchronized是Java
语言层面的,是内置的关键字;Lock则是JDK5中出现的一个包,在使用时,synchronized
同步的代码块可以由JVM自动释放;Lock需要程..
分类:
编程语言 时间:
2014-07-21 12:46:35
阅读次数:
254