08 2016 档案

摘要:最近在看Java并发包的源码,发现了神奇的Unsafe类,仔细研究了一下,在这里跟大家分享一下。 Unsafe类是在sun.misc包下,不属于Java标准。但是很多Java的基础类库,包括一些被广泛使用的高性能开发库都是基于Unsafe类开发的,比如Netty、Cassandra、Hadoop、K 阅读全文
posted @ 2016-08-22 20:26 pkufork 阅读(40328) 评论(9) 推荐(11)
摘要:首先需要下载jdk: 由于oracle上的下载页面有跳转,直接用wget下载下来的只是html页面。可以用下面的命令: wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle 阅读全文
posted @ 2016-08-19 00:17 pkufork 阅读(3053) 评论(0) 推荐(0)
摘要:原题如下: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique 阅读全文
posted @ 2016-08-15 17:42 pkufork 阅读(417) 评论(0) 推荐(0)
摘要:面试的时候经常会问到Java的单例模式,这道题能很好的考察候选人对知识点的理解程度。单例模式要求在系统运行时,只存在唯一的一个实例对象。 下面我们来详细剖析一下其中的关键知识点,并介绍五种实现方法,以及它们的优缺点。 一、最简单的方法是在类加载的时候初始化这个单独的实例。 首先,定义单例类(没有特别 阅读全文
posted @ 2016-08-14 14:00 pkufork 阅读(9112) 评论(2) 推荐(0)
摘要:Java的final关键字在日常工作中经常会用到,比如定义常量的时候。如果是C++程序员出身的话,可能会类比C++语言中的define或者const关键字,但其实它们在语义上差距还是挺大的。 在Java中,final可以用来修饰类、方法和变量(包括成员变量和局部变量)。我们先来简单介绍一下final 阅读全文
posted @ 2016-08-09 17:56 pkufork 阅读(1460) 评论(1) 推荐(1)
摘要:原题如下: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complex 阅读全文
posted @ 2016-08-09 17:27 pkufork 阅读(536) 评论(0) 推荐(0)
摘要:原题如下: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which th 阅读全文
posted @ 2016-08-01 23:22 pkufork 阅读(367) 评论(0) 推荐(0)
摘要:近日,听闻著名漏洞报告平台乌云网(http://www.wooyun.org/)被迫停摆,多名高管被抓,网站也贴出“服务升级”公告,暂时无法访问。我与乌云网的几位创始人也有过几次接触,也算从事过互联网安全行业,虽然仍是个门外汉,也希望能够借此聊一下我对互联网安全行业的一些思考和观感。 我真正开始接触 阅读全文
posted @ 2016-08-01 09:42 pkufork 阅读(4365) 评论(0) 推荐(0)