Posts

Showing posts from October 16, 2011

Photo: Ganges River

Image

Emacs Lisp: Loop Thru a List with dolist

Emacs Lisp: Loop Thru a ListLearned 2 elisp functions: {“dolist”, “number-sequence”}.“dolist” lets you loop over a list with a variable. Here's sample usage: (dolist (x '(1 2 3)) (insert (number-to-string x))) ; inserts "123" “number-sequence” just generates a list of numbers: (number-sequence 3 8) ; ⇒ (3 4 5 6 7 8) Both are parts of emacs 23, but they are implemented as lisp macros. (Call “describe-function” to see their doc and source code.)Normally, you can loop with a “while”, but the “dolist” syntax is leaner.I learned them from jcs's blog. See:Multiplication Table In Emacs Lisp (2011-10-20) By Jon Snader. @ Source irreal.orgJon is a expert in Common Lisp, Scheme Lisp, and C. He often give useful tips about emacs. Very well written.

梨花淚 (Tears of Pear Blossom)

Image
Perm url with updates: http://xahlee.org/music/blossom_tears.html梨花淚 (Tears of Pear Blossom)Xah Lee, 2011-10-19A beautiful song. 梨花淚, originally sung by 于櫻櫻 (b1954) in 1977. The song is written by 于文. Title: 梨花淚 Date: 1977 Singer: 于櫻櫻 Lyrics: 于文 Music: 于文 English translation: 李杀 (Xah Lee) 梨花淚 愛上你永遠不後悔 除了你知心又有誰 細雨就像梨花淚 點點滴滴都可貴 相聚時滿懷甜滋味 分手時美夢難追回 細雨就像梨花淚 盼望那梨花吐新蕊 tears of pear blossom loving you i could never regret who else better understands me the rain drizzles like the falling of pear blossoms every petal is precious when together the sweetness fills me in separation a beautiful dream is gone the rain drizzles like the falling of pear blossoms hoping it will bud again 淚TranslateWiktionaryhistoryTranslateWiktionaryhistoryTranslateWiktionaryhistory “姚蘇蓉-梨花淚”, 1978“于櫻櫻-梨花淚”, 1977“林淑蓉-梨花泪”pear blossoms. img srcThe flower of the pear tree is very small, having a diameter of ~3 cm. When windy, they fall like rain.Pear tree img src初恋女 (Maiden Love)痴痴的等周璇 - 诉衷…

Why X11 Color Names Are Fuckedup

Quote from Wikipedia X11 color names:In computing, on the X Window System, X11 color names are represented in a simple text file, which maps certain strings to RGB color values. It is shipped with every X11 installation, hence the name, and is usually located in ‹X11root›/lib/X11/rgb.txt.It is not known who originally compiled the list. The list shows a continuity neither in selected color values nor in color names, and many color triplets have multiple names. Despite this, graphic designers and others got used to them, making it practically impossible to introduce a more stringent and logical alias list.Why it's like that? Because it's the unix philosophy!Time to reread: The X-Windows Disaster.The Unix PestilenceThe Nature of the Unix Philosophy

Qi lisp functional language new home page

The lisp derived functional language Qi, now has a home page at shenlanguage.org.Why Qi Lisp Fails and Clojure SucceedsQi Lisp Language Logo

the Death of Dennis Ritchie

Perm url with updates: http://xahlee.org/comp/Death_of_Dennis_Ritchie.htmlSlightly annoyed by the so many eulogies of Dennis Ritchie from programing geeks (and then the one thousand SEO fucking sites trying to make a buck out of it (such as TechCrunch, SearchEngineLand — am nice guy and respect all — scumbags)).So, am about to badmouth this idiot who just died — your hero, who you consider did great contribution to mankind. Are you gonna be offended?Let me give you this perspective. Let's say it's someone you hate, is someone you consider a criminal of mankind, who did massive harm to society in a indirect way. Say, it's George W Bush, or the Catholic Pope, or Bill Gates.Can you see the perspective now?I hate unix. It is unix and its people, that did the computing world massive harm. It is unix, that introduced sloppy hack to the programing industry, brought about the entire security/hacking scene to the computing world. Well i exaggerated a bit, but you know i hate unix, …

emacs lisp update: replace-digits-by-subscript

Thanks to Jon Snader (aka jcs)'s solution on last week's problem and some discussion, now updated: Emacs Lisp Exercise: replace-digits-by-subscript.

Emacs Cygwin gunzip Problem

Perm url with updates: http://xahlee.org/comp/emacs_cygwin_gunzip_problem.htmlEmacs Cygwin gunzip ProblemXah Lee, 2011-10-18If you are on Windows and using Cygwin and emacs, there's a problem with gunzip.ProblemWhen in dired, when you press Z on a gzipped file, emacs will give this error: apply: Searching for program: no such file or directory, gunzip SolutionThe solution is to add a file at 〔c:/cygwin/bin/gunzip.bat〕. The file content should be this: @echo off gzip -d %1 DetailHere's some detail about this problem i wrote in 2009. From: Xah Lee Date: Nov 4 2009, 9:32 am Subject: gunzip problem on Windows To: gnu.emacs.help, comp.emacs when using emacs on Windows, when in dired, when i press Z on a file that's gzip compressed, emacs tells me: 'gunzip' is not recognized as an internal or external command, the problem is apparently that emacs won't recognize the gunzip shell script without the exe suffix. (the gunzip is in the same dir as gzip.exe) But if i r…