Mac OS X: decoder jpeg not available

When you are using PIL to resize a JPEG image file, you will probably have a “decoder jpeg not available” error,this means that PIL doesn’t have JPEG support.

Here is the solution:

  1. Download and install MacPorts.
  2. sudo port install jpeg, this will install libjpeg.
  3. sudo port install py25-pil

That’s it.

Simple HTTP Server in Python

Python has an embedded HTTP server that can serve the current directory from a given port.

python -m SimpleHTTPServer 8000

You and me

你不坚强时候有我在,我不坚强时候有你在,这就够了。

2010 FIFA World Cup South Africa

2010 FIFA World Cup Aouth Africa

世界杯来啦。看好西班牙。

离职

辞职申请已经提交上去了。接下来就是工作交接一下,然后进行相关手续办理。

这是我离开校门的第一份工作,去年 7 月到现在,差不多一年的时间。老大刚才说:你走了,我少了一员干将。感动。

这一年来最大的收获就是工作态度,认真,能静下心沉得住气。这让现在的我比刚出校门的那个毛头小子成熟不少,办事稳当不少。

感谢老大这一年对我的信任,能让我有信心去独立项目完成。感谢组里的几个兄弟的支持帮助。

下一步,新的一步,加油!

帝都我来了

跟一个以技术为新的团队做最新潮的东西,多么畅快的事!

@Appwill rocks!

Firefox Tips:Render pages faster

To improve page rendering, enter about:config in the address bar (accept the warning that comes up) and perform the following:

Create a new integer value named content.notify.backoffcount and set the value to 5

Create a value named nglayout.initialpaint.delay and set its value to 0

The first line stops Firefox waiting for the entire page to download before rendering. The second improves speed rendering further by making sure Firefox does not wait for the page layout information to be fully downloaded before displaying the page.

via Firefox Tips:Tips 2

现在的智能机

今天老张拉着我扯了半天的手机,他想换个手机,在各种纠结。纠结于 BB9700 还是 Android 系列,啰嗦两句现在智能机我的看法。

现在手机在用的是 BB8705,06 年的黑莓老机子,没有 Wifi、内存卡、摄像头、GPS,我依然玩的是不亦乐乎,每天都让丫头训我回到家只会玩手机。如果现在再买智能机还会考虑黑莓吗?会,黑莓的多任务是现在智能机做的最好的,全键盘自然不必说,黑莓第二没人敢称第一。倒是黑莓稳定性安全性第一的原则让一些应用程序不是很方便,比如点讯输入法,只能是外挂形式。黑莓是拿来用的手机。

Android 系现在是井喷啊,不过还没有一个完美的机子,我自己的看法:MileStone > Nexus One > HTC Desire > Hero,不过过于山寨的方向键和没有独立数字键让 MS 略感不完美。期待 Droid 2。A 系现在有点混乱,自己跟自己打架。

iPhone 4 是现在我最期待的手机了,iOS 4 合理的多任务加上三四年的良性稳定发展加上丰富的 Apps,机皇。就是价高,攒钱吧。

UnicodeEncodeError: 'ascii' codec can't encode characters

Problems with non-ASCII characters.

import sys
default_encoding = 'utf-8'
if sys.getdefaultencoding() != default_encoding:
    reload(sys)
    sys.setdefaultencoding(default_encoding)

via

PHP 中 require() 和 include() 的区别

require() 和 include() 的功能都是包含并运行指定文件。寻找包含文件的顺序先是在当前工作目录的相对的 include_path 下寻找,然后是当前运行脚本所在目录相对的 include_path 下寻找。

两者的不同之处只有如何处理包含、运行文件失败:include() 产生一个警告,而 require() 会导致一个致命的错误。如果想在遇到丢失文件时停止处理页面就用 require()。