代码改变世界

阅读排行榜

volatile

2012-09-20 20:24 by 康杜, 1276 阅读, 收藏,
摘要: volatile是什么对于volatile, <The Java Language Specification Third Edition>是这样描述的“A field may be declared volatile, in which case the Java memory model ensures that all threads see a consistent value for the variable.”意思是,如果一个变量声明为volatile, Java 内存模型保证所有的线程看到这个变量的值是一致的。“… the volatile modifier guar 阅读全文

PriorityQueue和Huffman编码

2012-12-14 15:47 by 康杜, 1188 阅读, 收藏,
摘要: 前言本文不描述Huffman编码的算法和理论知识。Huffman编码算法的描述请看酷壳上的文章《Huffman压缩算法》。本文只考虑Huffman编码的Java实现,代码中有些地方没有做性能优化。PriorityQueuePriorityQueue是一个排序的队列,是构建Huffman树的基础。package art.programming.huffman;//Frequency用来抽象每个字符出现频率public class Frequency implements Comparable<Frequency>{ private int frequency; private Cha 阅读全文

意大利面代码

2012-01-09 11:52 by 康杜, 1079 阅读, 收藏,
摘要: Spaghetti code是一个反模式(见《A Big Ball of Mud》)。在这个模式中,代码交织在一起,导致可读性、可维护性很差。 从编程语言上来看,goto是Spaghetti code的一个显著例子。在运用goto语句的程序中,程序执行指令能够调整到程序中的任何地方。但是这种灵活性会带来复杂性(可读性差,可维护性差)。后来,人们提出了“结构化编程”。 是不是“结构化编... 阅读全文

通过inode来操作文件

2012-09-13 19:37 by 康杜, 978 阅读, 收藏,
摘要: 在unix或linux上,有时候我们会遇到一些文件名是乱码。这时候我们不能通过文件名来操作文件。这种情况下,我们可以考虑通过find加上文件唯一的inode来操作。$ cd /tmp$ touch Заглавная_страница$ ls通过ls -il 找到这个文件的inode numberalex@ubuntu:/tmp$ ls -iltotal 7106512 drwxrwxrwt 2 lightdm lightdm 1024 9月 13 08:26 at-spi2106530 drwx------ 2 alex alex 1024 9月 13 17:21 CRX_7... 阅读全文

分层(Layers)

2012-03-02 16:47 by 康杜, 962 阅读, 收藏,
摘要: 在软件架构中,往往会涉及到分层这个概念。而每个架构师、开发人员心中,层的名称和含义也不相同。不仅仅是我们如此,就是业界的大师们也是如此。这不,在Martin Flower的《Patterns of Enterprise Application Architecture 》也列出这些不同分层。BrownCore J2EEMicrosoft DNAMarinescuNilssonPresentationClientPresentationPresentationConsumerController/mediatorPresentationBusinessApplicationConsumer he 阅读全文
上一页 1 2 3 4 5 6 7 ··· 10 下一页