How to test a proxy autoconfiguration file

Due to the existence of [Greal Firewall](en.wikipedia.org/wiki/Golden_Shield_Project), I have a terribly long `proxy.pac` file. Apparently, how to maintain that becomes a problem. Regularly, I use [git](http://git-scm.com) to keep a “stable” version and make updates on it.

Recently I just found the script stop working for no good reason, because the proxy server I’m using is working, and I tried manually choose a proxy server (by entering its address and port into my browser directly) it also worked, so apparently there is something wrong with the script.

However, it has been a while since I last commit my changes to this script back to git. So there are some changes I wish to keep and I don’t want to do a binary search to find out the problem (Yep, I’m a lazy guy).

A few googling got me a tool called [pactester](http://code.google.com/p/pactester/), which turned out to be very useful. Basically it’s a Perl wrap of [SpiderMonkey](http://www.mozilla.org/js/spidermonkey) JavaScript engine. Since the proxy autoconfiguration script is just a subset of plain JavaScript, it can safely executes that with SpiderMonkey and find out where is the problem.

So I installed it and did one test:

$ pactester -p ~/Documents/Miscs/proxy.pac -u ‘http://blog.iphone-dev.org’
Use of uninitialized value in numeric ne (!=) at pactester line 137.
Error: SyntaxError: missing ) after condition at line 98:
if (dnsDomainIs(host, “cubes.fr”) return “SOCKS 127.0.0.1:7777”;

So that’s the problem. Fixed it, everything is back to normal again!

That’s a small tip on debugging a complex pac script, hope it helps.

Why I’m such a fan of Robert Heinlein

A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects.

— Robert A. Heinlein, Time Enough for Love

The Pixar Story: 一部纵向的历史

纪录片里,艺术与技术的混合 (blending) 总是一个吸引我的题材,加上 [Pixar](http://www.pixar.com) 这样炫目的名字,[这部片子](http://www.imdb.com/title/tt1059955/)就更是非看不可了。

The Pixar Story

片子大概是 07 年初拍的,有 [Ratatouille](http://www.imdb.com/title/tt0382932/) 的镜头,但是很少,也没介绍。不过估计其中大多数采访还要更早一些,比如里面[胖胖的 Steve Jobs](http://s.wsj.net/public/resources/images/HC-GG913_Jobs_20060311120024.gif),看起来像 05、06 年的样子。

这是一部纵向的历史,点选得很好,[John Lasseter](http://en.wikipedia.org/wiki/John_Lasseter) 作为整个 Pixar 精神领袖,奠定基业;Steve Jobs 慧眼识珠;[Andrew Stanton](http://en.wikipedia.org/wiki/Andrew_Stanton), [Brad Bird](http://en.wikipedia.org/wiki/Brad_Bird) 锐意进取;以及 [George Lucas](http://en.wikipedia.org/wiki/George_Lucas), [Tom Hanks](http://en.wikipedia.org/wiki/Tom_Hanks) 这些从另一个角度给出的看法,都弥足珍贵。

这样的一部纪录片,有着一种激动人心的力量,不疾不徐,但是潜移默化,当你看到 John Lasseter 说:“别人问我为什么总能得到最好的车位,我告诉他,因为我三天前就把车停在这里了,这几天我一直睡在公司”,看到 Pixar 草创之际每年亏损好几百万 Steve Jobs 仍然坚持投资……回过头来看,你会觉得这都是值得的,能够亲自推动 3D 动画电影的革命,能够创造这样一个历史,这都是值得的。

唯一的遗憾是,横向的比较只是突出了 3D 动画与传统的 2D 动画在时代更迭之际的矛盾,作为引出 Disney 收购 Pixar 的铺垫,所以略有不足,Pixar 在这场 3D 动画的革命中并非独行,DreamWorks、Bluesky 等同样也有贡献,这方面的介绍未能在本片中出现。

此外作为一个技术人员,没能看到 Pixar 内部的工作流程,包括 [RenderMan](https://renderman.pixar.com/) 这样重要的软件是如何开发出来的,也略有遗憾。

A closer look at Classics.app

A Screenshot of Classics

“[Classics](http://www.classicsapp.com/)” is a great product, it shows us iPhone developers what an *elegant* ebook reader can be, so I bought it almost instantly after it’s released. I’ve been chatting with my friends about this app for a while, now I’d like to give a more closer examination to it from the perspective of a typographer and a programmer. Especially its weaknesses.

Illustrated by my favorite graphic designer, [David Lanham](http://dlanham.com), Classics tries its best to provide a traditional book reading experience (that’s why it’s called “Classics”). It contains the following books, even I’ve read most of them in Chinese long time ago, thanks to Classics, it’s still a fascinating experience to read them again in English:

* *[20,000 Leagues Under the Sea](http://en.wikipedia.org/wiki/Twenty_Thousand_Leagues_Under_the_Sea)* by [Jules Verne](http://en.wikipedia.org/wiki/Jules_Verne)
* *[A Christmas Carol](http://en.wikipedia.org/wiki/A_Christmas_Carol)* by [Charles Dickens](http://en.wikipedia.org/wiki/Charles_Dickens) [Added in version 1.1]
* *[Alice in Wonderland](http://en.wikipedia.org/wiki/Alice_in_Wonderland)* by [Lewis Carroll](http://en.wikipedia.org/wiki/Lewis_Carroll)
* *[Flatland](http://en.wikipedia.org/wiki/Flatland)* by [Edwin Abbott Abbott](http://en.wikipedia.org/wiki/Edwin_Abbott_Abbott)
* *[Gulliver’s Travels](http://en.wikipedia.org/wiki/Gulliver%27s_Travels)* by [Jonathan Swift](http://en.wikipedia.org/wiki/Jonathan_Swift)
* *[The Hound of the Baskervilles](http://en.wikipedia.org/wiki/Hound_of_the_Baskervilles)* by Sir [Arthur Conan Doyle](http://en.wikipedia.org/wiki/Arthur_Conan_Doyle)
* *[Adventures of Huckleberry Finn](http://en.wikipedia.org/wiki/Adventures_of_Huckleberry_Finn)* by [Mark Twain](http://en.wikipedia.org/wiki/Mark_Twain)
* *[Paradise Lost](http://en.wikipedia.org/wiki/Paradise_Lost)* by [John Milton](http://en.wikipedia.org/wiki/John_Milton)
* *[Robinson Crusoe](http://en.wikipedia.org/wiki/Robinson_Crusoe)* by [Daniel Defoe](http://en.wikipedia.org/wiki/Daniel_Defoe)
* *[The Call of the Wild](http://en.wikipedia.org/wiki/The_Call_Of_The_Wild)* by [Jack London](http://en.wikipedia.org/wiki/Jack_London)
* *[The Jungle Book](http://en.wikipedia.org/wiki/The_Jungle_Book)* by [Rudyard Kipling](http://en.wikipedia.org/wiki/Rudyard_Kipling)
* *[The Metamorphosis](http://en.wikipedia.org/wiki/The_Metamorphosis)* by [Franz Kafka](http://en.wikipedia.org/wiki/Franz_Kafka)
* *[The Time Machine](http://en.wikipedia.org/wiki/The_Time_Machine)* by [H. G. Wells](http://en.wikipedia.org/wiki/H._G._Wells)

However, there are still some details to be improved.
Continue reading “A closer look at Classics.app”

links for 2008-11-29