Drake's Weblog

python

1 minute read

I start this tiny post to collect embedded python version for several major players of 3D softwares in VFX/Animation industry. It is a personal desire to build the list such that we don’t need to guess or google it while facing python version issue. Hopefully, this post can get someone’s notice and help to make it as complete as possible. Any information is welcome~
Python versoins for 3D softwares Software version Python version Autodesk Maya Maya 2011 Linux 64bit Python 2.

1 minute read

目前我覺得非常中肯且值得特別一一去了解,並且在 coding 時,時時提醒自己的 Functional Programming Paradigm,如下:
First-class function Higher-order function Lexical closure Pattern matching Single assignment Lazy evaluation Garbage collection Type inference Tail recursion List comprehension Monad 其中 Python 有提供的,有第 1, 2, 3 (部分?), 6, 7, 8 (部分?), 10, 11 (部分?),就我微薄的知識所了解後的,可能會有一些出入。
目前的感想是,與 function 有直接關係的功能,對於一個剛入門 FP,想學習怎麼做到 paradigm shift 的人來說,是最最直接,最容易感受到不一樣的地方。(其實,本來也就應該是這樣的啦,不然幹麻叫做 functional programming?)透過功能 1, 2, 3, 10 這幾點,就可以開始去體驗所謂的:
A program is some specific combination and arrangement of functions, which are also some sort of combination of other functions.

3 minute read

Peter Norvig 在他的個人網站上頭,寫了一篇 (How to Write a (Lisp) Interpreter (in Python))(註), 他寫了約莫 100 行的 python script 來小小模擬一個簡化版的 Lisp Interpreter,看了不禁拍案叫絕。 下頭這個表格截取自他的網頁,指出他這 100 行的程式碼,所實作的 syntax 只有 9 個(註)。
var, variable reference
A symbol is interpreted as a variable name; its value is the variable’s value.
Example: x
number, constant literal
A number evaluates to itself.
Examples: 12 or -3.45e+6
(quote exp), quotation
Return the exp literally; do not evaluate it.

3 minute read

我們這個地球上的人實在太多了,加上上天賦與我們的大腦又過於活躍,以致於時時可以聽聞到,又有什麼人做出了驚人之舉。
幾個禮拜前,無意間得知一個網頁:Random CG Paper Generator。每 reload 這個頁面一次,就會亂數產生一篇圖學論文的標題出來(以假亂真似地)。也許,苦於找不到研究方向的研究生,可以來這個頁面 reload, re-roll your brain,看看有沒有什麼意外的研究靈感可以借用的。
Anyway,借用一個這樣的 random stuff generator 來找點子,實在太冒險也太不明智了,況且,我還處於 non-qualified Ph.D. student,沒啥理由理會這個網站的。除非…
我想知道它是怎麼產生這些以假亂真的論文標題。
在與 Edward 來來回回,反反覆覆的 email 往來後,終於,他了解我的目的了。Ed 建議我用 Lisp 來試著解解看這個問題。一方面 Ed 最近一直在寫 Lisp program,而 Lisp 又是號稱 functional programming languages 裏頭的元老之一,很擅長處理這類 AI 相關,或是 NLP(Natural Language Processing)相關的問題;另一方面,我剛好也在鑽研 FP,想多一些小而美的例子好讓自己的手變得髒一些(黑手),從中了解一下 FP 的特色。於是就開工了。
透過 MacPorts 安裝好 SBCL (Steel Bank Common Lisp) 與 Emacs 後,自 Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp 這本書的網站上,下載了書中提到的一些程式碼。試圖用裏頭的一些函式與方法來解決,或是某種程度上“逼近“我想要處理的這個問題。非常遺憾的,PAIP 的程式碼,似乎是給老舊的 Common Lisp 用的,而 SBCL 與他沒有很合,會一直出現一堆 warnings,得一直按 continue/ignore 之類的@@

1 minute read

上上週的某個深夜,電動也玩夠了(一直輸),Erlang 也看煩了,上網查看 Python, RenderMan, Maya, Computer Graphics, Game, Animation, Lighting, Stereoscopy, … 等關鍵字的各種組合過程中,發現到一篇 2009 年的文章:What do you do with Python?。

非常有趣,把片段的內容翻譯過來:
盡可能地,在任何地方做 log,存進 SQL 資料庫裏頭,好事後做分析。舉個例子,像是 3DS Max 開啟到完整載入一個 scene file 的時間;執行自己寫的程式的各個功能的時間。從中找出可能的問題,像是執行時間太久,然後可能自動發個信給開發人員得知。 使用 wxPython 把各個工具給整合起來。這點和我有篇文章提到 Pipeline as a Glue 的想法一致。 把 Python 整合進開發工具裏頭。這點有點像是在 3DS Max 裏頭加進 MaxScript。 3DS Max 啟動時,自動執行一些事務:把一些目錄裏頭的 MaxScripts 整包建置出一個 .mcr 來;掃描整個 texture 目錄,加進 scene file 裏頭…等。 把 Perforce 裏頭的 assets rendering 所花費的時間、資源等資料,存進 SQL 資料庫。 自內部使用的 bug tracking system 裏頭抓出 tasks/tickets,然後使用 Vista Sidebar gadget 的型式秀出來給工作同仁,讓他們第一時間以最醒目的方式得知還有多少工作要做。 使用 wavelet transform 來執行 image comparison。這我猜有點像是 Perceptual Image Difference Utility (pdiff)。(注:這是個好東西) Data minging!

1 minute read

以非常…..宅…..的方式介紹 Python,整個畫面很 low, 很南方公園的 video。雖然這樣,不過裏頭出現很多 Python Community 的大頭!

1 minute read

I’ve found several very interesting and active python shells. Each has it’s own strength and the most often mentioned feature is syntax highlight, auto-complete and function attributes info.
Here they are:
IPython
bpython
DreamPie
Interactive server-side Python shell

1 minute read

TIFF is a flexible, if somewhat aged, image file format originally # defined by Aldus. Although TIFF supports a wide variety of pixel # layouts and compression methods, the name doesn’t really stand for # “thousands of incompatible file formats,” it just feels that way. thousands of incompatible file formats, 這個的確有挖苦到 TIFF 這個格式 XD

Recent posts

Categories

About

You're looking at Drake's words or statements. All opinions are my own.