摘要:
How to installGITon OS-X in under 5 minutes:Git should be installed on your OS-X now, which you can verify by issuing:git --versioncommand in Terminal. However, it's a good idea to also pre-configure the default username and e-mail for your Git installation:I personally, also like to set: 阅读全文
摘要:
BASH学习笔记以前没有系统学习过Shell,虽然写Shell脚本有两年了。整理一下学习笔记~1./etc/shells可以看到所有可以用来登陆的Shell。2.#echo $SHELL看到当前Shell3.程序在Shell中运行,Shel中可以运行子Shell。exit退出子shell4.#help 可以获得一些常用命令5.ls -lh看文件占用空间最方便。6.setuid这个位的作用是拥有这个... 阅读全文
摘要:
目录体会1:static不能称霸全宇宙。体会2:逻辑上单一的对象应该应用单例模式。体会3:多线程与单例。体会4:单例串行化/串流化的关系。体会5:单例模式子类化的问题。体会1:static不能称霸全宇宙。很多人以为,static无敌。错的,static有时无敌,什么时候呢?如果是public static final N CONSTANT=xxx;那么这是非常好的一种代码风格,因为这代表了一系列该... 阅读全文
摘要:
我们知道,在Java中设置变量值的操作,除了long和double类型的变量外都是原子操作,也就是说,对于变量值的简单读写操作没有必要进行同步。 这在JVM 1.2之前,Java的内存模型实现总是从主存读取变量,是不需要进行特别的注意的。而随着JVM的成熟和优化,现在在多线程环境下volatile关键字的使用变得非常重要。 在当前的Java内存模型下,线程可以把变量保存在本地内存(比如机器的寄存器... 阅读全文
摘要:
There are already several instructions out there on how to installMySQL on Mac OS X, but most of them are either outdated or morecomplicated than they need to be. Here you will find an easy tutorialsh... 阅读全文
摘要:
xxx: n. (青少年禁看的)X级片或内容 num. 罗马数字 30first:Mysql must reside in /usr/local/mysql/bin/.second:try on the command line;PATH=$PATH:/usr/local/mysql/bin/ export PATHThird:mysqldump -hlocalhost -uroot --opt ... 阅读全文
摘要:
看到了吧,我们写的那个getFileLock 是由AWT-EventQueue-0 线程执行,看右下角调用关系, EventDispathThread 启动 Run方法, 然后pumpEvents 取事件,然后从EventQueue取到InvocationEvent 执行Dispath Dispath调用的就是我们在getFileLock写的run() 方法, JDK代码如下:Code highl... 阅读全文
摘要:
7.3 Using invokeLater( ) and invokeAndWait( )In the CharacterDisplayCanvas class, we were able to work aroundSwing's threading restrictions because all the callsthat manipulated Swing objects could go... 阅读全文
摘要:
volatile: ['vɔlətail] adj. 反复无常的, 挥发性的, 稍纵即逝的, 脾气火爆的 n. 挥发性物质volatile ---- 字面意思是易挥发的。 实际的意义,简单来说,用volatile确定义的一个变量与普通变量不同之处在于,在多线程的环境下,每个独立的线程都有自己的一块内存空间,为了提高速度,JAVA的线程会把共有的变量映射到自己的内存空间(共有的变量就是可以为多... 阅读全文
摘要:
I've been reading a little about the difference between using asingleton pattern vs using a static class (ie all methods are static,ctor is private, state is in static vars).A lot of blogs show that t... 阅读全文