2014年11月27日
摘要: 没有光盘和优盘启动盘,可以在win7下安装easybcd,添加一个启动选项为linux grub2,启动后进入ubutnu,执行如下:sudo -i //取得root权限fdisk -l //查看分区信息,找出你的linux的分区,比如我的是sda9mount /dev/sda9 /mnt//挂载你... 阅读全文
posted @ 2014-11-27 09:55 Zaiping 阅读(144) 评论(0) 推荐(0) 编辑
  2014年11月18日
摘要: locatechrome-extension_dgpdioedihjhncjafcpgbbjdpbbkikmi_0.localstorage, copy it to you want, everything is done.Win:C:/Users//AppData/Local/Google/Chr... 阅读全文
posted @ 2014-11-18 13:53 Zaiping 阅读(230) 评论(0) 推荐(0) 编辑
  2013年9月5日
摘要: Linux ubuntu 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux一开始只是试用了export http_proxy=http://ip:port,然后执行sudo -E pip install requests的时候总是报 Cannot fetch index base URL http://pypi.python.org/simple/的错误,各种无奈,最后突然想到可能是http重定向到https的问题。再次exporthttps_proxy=http: 阅读全文
posted @ 2013-09-05 12:33 Zaiping 阅读(26139) 评论(3) 推荐(0) 编辑
  2013年8月19日
摘要: 网上流传的export http_proxy=http://yourproxyaddress:proxyport是行不通的,虽然改了之后wget一类的可以用。当然去改.bashrc也不会有效果。真正的解决方法如下:新建文件 apt_proxy_conf(文件名任意)内容如下:Acquire::http::proxy "http://127.0.0.1:8000/";Acquire::ftp::proxy "ftp://127.0.0.1:8000/";Acquire::https::proxy "https://127.0.0.1:8000/& 阅读全文
posted @ 2013-08-19 18:18 Zaiping 阅读(14810) 评论(0) 推荐(1) 编辑
  2012年12月27日
摘要: 在stackexchange上看到了一个关于vim的很有意思的问题。详情可见如下链接。http://unix.stackexchange.com/questions/58880/how-does-vim-steal-root-owned-files?newsletter=1&nlcode=102660%7c320e首先使用user用户新建一个目录,然后在新建目录下,sudo touch一个文件tempfile,则tempfile属于root并且具有644权限。接下来使用vim编辑tempfile,写点东西进去,保存之后,在用ls -li来查看信息,发现该文件已经属于user了,虽然还是 阅读全文
posted @ 2012-12-27 16:52 Zaiping 阅读(7560) 评论(0) 推荐(0) 编辑
  2012年12月26日
摘要: 1 vi /etc/network/interfacesChange#iface eth0 inet dhcptoiface eth0 inet staticaddress 192.168.95.132netmask 255.255.255.0gateway 192.168.95.12/etc/init.d/networking restart 阅读全文
posted @ 2012-12-26 09:38 Zaiping 阅读(189) 评论(0) 推荐(0) 编辑
  2012年10月18日
摘要: 程序员的自我修养里有这么一段程序,作者认为这里的双重if可以使lock的调用开销最小。volatile T* p=0;T*GetInstance(){if(p==NULL){ lock(); if(p==NULL) p=new T; unlock();}return p;}第一个if显然是必要的,但对于第二个if,到底有没有必要,第一反应确实是有些奇怪。经过google发现原因如下:假设有两个线程A和B,当A调用GetInstance执行到第一个if时,P为空,在执行lock之前,A有可能被CPU临时挂起,假如没有第二个if,则进程B运行到同样位置之后,会lock并且创建对象,然后unl... 阅读全文
posted @ 2012-10-18 20:23 Zaiping 阅读(493) 评论(0) 推荐(0) 编辑
摘要: inline function内联函数macro宏You should use an inline function when you wish to optimize function calls. You may consider an inline function as a macro that copies the function contents (inline) to code segment where the function is called. However, inline function is very different from a macro (google 阅读全文
posted @ 2012-10-18 16:40 Zaiping 阅读(275) 评论(0) 推荐(0) 编辑
  2012年10月10日
摘要: Learn fromstackexchangeHighlight the three last updated files in ls outputgrep --color -E --"$(ls -rtl | tail -n3)|$"<(ls -l)orls -l|grep --color -E "$(ls -rtl | tail -n3)|$"It uses grep with highlight on inputls -land uses a regular expression to search for either of the inpu 阅读全文
posted @ 2012-10-10 14:02 Zaiping 阅读(161) 评论(0) 推荐(0) 编辑
  2012年9月21日
摘要: 在一些系统调用中需要指定时间是用CLOCK_MONOTONIC还是CLOCK_REALTIME,以前总是搞不太清楚它们之间的差别,现在终于有所理解了。 CLOCK_MONOTONIC是monotonic time,而CLOCK_REALTIME是wall time。 monotonic time字面意思是单调时间,实际上它指的是系统启动以后流逝的时间,这是由变量jiffies来记录的。系统每次启动时jiffies初始化为0,每来一个timer interrupt,jiffies加1,也就是说它代表系统启动后流逝的tick数。jiffies一定是单调递增的,因为时间不够逆嘛! wall time 阅读全文
posted @ 2012-09-21 13:50 Zaiping 阅读(653) 评论(2) 推荐(0) 编辑