Fabrice Bellard, Pi record

Fabrice Bellard, using a PC, Computed π to about 2.7 trillion places, claimed to be the latest world record. (previous records are made by super computers that costs millions.) He's home page is at http://bellard.org/, which details this among other things. A highly accomplished C programer. Probably the world's top 100 or even 10.

What's personally interesting is that he also created a Emacs-like editor: http://bellard.org/qemacs/.

His other accomplishments include: FFmpeg (for processing multimedia data (e.g. audion and video)), QEMU (cpu emulator).

so-called zen-coding

perm url with updates http://xahlee.org/js/zen-coding.html

“Zen-Coding” and “Emacs-Buddha-Coding”

Xah Lee, 2010-01-22

Discovered what's called “zen-coding”. Basically, it is a scheme for inserting html templates in text editors. For example, type “div.beauty”, press a hotkey, then it expands to:

<div class="beauty"></div>

“ul#ref>li*3” expands to:

<ul id="ref">

This template system improves html coding efficiency. It is a abbrev expansion or template system. (the latest tech geeking fashion term for this is “snippet”.) The abbreviation used to expand is based on CSS selectors. (CSS “selectors” is basically a syntax for css to match html/xml tags. For a intro, see: What's New in CSS2)

The home page for this project that provides add-ons for several editors is at: http://code.google.com/p/zen-coding/. In particular, there's a emacs one at: http://www.emacswiki.org/emacs/ZenCoding, written by Chris Done.

The gist of the usefulness of “zen-coding” is that: (1) instead of pulling a menu or command to insert a tag, and prompting you for input of tag name and attributes, you simply type them out first in your editor's main window. (2) A consistent, systematic syntax, for the abbreviation.


I've been using a similar method for inserting html tags and templates in Emacs since about 2006. I have a set of home-cooked commands in elisp that does it. For examples, when i type: “div nav”, then press a hotkey, it becomes:

<div class="nav"></div>

If i type “abc efg”, then it becomes:

<abc class="efg"></abc>

If i type a single word instead of 2 words, then “div” tag is automatically assumed. For example, “xyz”, becomes:

<div class="xyz"></div>

If i press the hotkey with the cursor on the empty line, it inserts “<p></p>”.

If i paste a file path and press a different hotkey, it becomes a image tag, with width and height attributes, and alt attribute filled. For example, if the text i pasted is “i/pre_ex_firefox.png”, the result is:

<img src="i/pre_ex_firefox.png" alt="pre ex firefox" width="565" height="109">

If i paste a youtube url, for example: “http://www.youtube.com/watch?v=qaMcImrNnOQ”, then press a hotkey, it becomes a

<object type="application/x-shockwave-flash"
data="http://www.youtube.com/v/qaMcImrNnOQ" width="480" height="385">
<param name="movie" value="http://www.youtube.com/v/qaMcImrNnOQ">

(See: How To Embed Video With Valid Html)

If i type some phrase, for example: “Bertrand Russell”, press another hotkey, it becomes a link to the Wikipedia article:

<a href="http://en.wikipedia.org/wiki/Bertrand_Russell">Bertrand Russell</a>

If i press another hotkey, lines turn into list. Another hotkey turns lines into html table. another hotkey turns a url into particularly formatted reference link for languages perl, php, elisp, python...

If i paste in some source code of perl, python, java... etc any language, and press a hotkey, they become syntax colored (wrapped with different span tags for different keywords.) For example, the page you are reading, with all html source code syntax colored, is done in emacs with my custom commands.

There are quite a lot others, all basically takes the current word, current line, current paragraph, or current text selection as input, and transform them into a link, tag, or other template. The 4 thousand html pages on my website are hand coded, in emacs, with many custom elisp functions gradually developed over the years. With my system, i can write structured document in html faster than any wiki sysetm or light weight markup, yet with more control and flexibility in the actual html, and the generated code are all Valid HTML with controlled formatting so it can be batch-text-processed later if needed. (the down side is, of course, the time spend to know elisp. Basically, it's a trade off with acquiring knowledge vs off-the-shelf generic system.)

You can see all these in my emacs init file at Xah Lee's Emacs Customization File. Most of it is covered in my Emacs Lisp Tutorial. See also: How To Define Templates In YASnippet.

I probably won't be using zen-code soon, because my custom system already does all sort of html templates that are particularly crafted for my needs. Though, the “zen-code” system has the advantage of a more coherent syntax, and one single hotkey for all expansion. Though, it can't turn paths to links or inline images, can't turn words into Wikipedia links, or words into google search links, or youtube url into embedded video links. It is a smarter system than most editor's tool that insert single dummy tags, but the system is not flexable enough for outputting dynamic results, such as inserting date time stamp, or turn a image file path into a inline img tag with width and height values, etc.

For my emacs system to be useful to others, i'll need to put them together into a coherent package, with consistent hotkeys, a public website representation, full documentation, and probably a marketing jargon, such as “emacs-buddha-coding”. LOL. The abbrev expansion systax will need to be someting systematic and well known, so CSS Selectors in zen-coding is a good start, but am not sure how can it incorporate the feature where the output needs to contain dynamic info such as timestamp. Thinking about this... it's pretty clear that zen-coding is of limited use, because first of all, vast majority of web pages are not developed by manually coded html. Things have moved to wiki systems, website generating systems, document generating systems, blog sites, using light weight markup. These are useful for vast majority of people, say 99%, of those scientists, writers, engineers, and joe bloggers, who need to publish material thru the web, and doesn't require them to understand any html/css stuff. For programers and tech-savvy who needs to code html, there are no shortage of template systems (aka snippets) that they can define and customize, in all sort of tools and editors, with result that is usually more powerful then zen-coding.

With the above in mind, i think that there's relatively little market or wide utility for my emacs-buddha-coding.

The Name “Zen-Coding”

What's with the name? Zen? another new-agish open source coding geeker's fashionable locution. Such silliness we had in the past... “defensive programing”, “eXtreme programing”, “design patterns”, “agile programing”, “unit testing”, etc. Silly jargons are particularly popular in the unix and perl community. Often these fashionable jargons are shams that do harm on the real educational needs of programers, that is mathematics (so-called “computer science”).

Though, most of these jargons also fulfill a communication need, a unique term to identify a particular practice. It is the choice of the term that is a problem. In severe cases, it is the catchiness, used for marketing purposes of sham that hides truth or reality. Once you choose a term that clearly convey what it means, many shams will no longer have much to sell.


rabbit, hare, meat

perm url with updates: http://xahlee.org/Periodic_dosage_dir/rabbits_hare.html

Rabbits, Hare, Meat

Xah Lee, 2010-01-20

Some reading notes on rabbits.

I casually looked up wikip for Hare. I want to know, what's the diff between hare and rabit. Basically hare is larger, wild animal, can run extremely fast (72 km/h), lives above ground. Rabbits, are those dumb, cute ones, you see in people's homes. Here's a interesting quote:

Normally a shy animal, the European Brown Hare changes its behaviour in spring, when hares can be seen in broad daylight chasing one another around meadows; this appears to be competition between males to attain dominance (and hence more access to breeding females). During this spring frenzy, hares can be seen "boxing"; one hare striking another with its paws (probably the origin of the term “mad as a March hare”). For a long time it had been thought that this was inter-male competition, but closer observation has revealed that it is usually a female hitting a male, either to show that she is not yet quite ready to mate, or as a test of his determination.

Also, remember that in Alice Adventures in Wonderland, there's the white rabbit, and there's the mad march hare. I never explicitly realized both are in it.

Learned the word Precocial. Hares are prococial, while rabbits are not. It's a biology term. If a animal's young is relatively mature and mobile from the moment of birth or hatching, it is called precocial. The opposite term is Altricial.

Another interesting thing is: Rabbit starvation, or called protein pisoning. Basically, when your diet is just lean meat, such as rabbits, your body cannot cope with it. This is quite interesting, because my whole life i've been infatuated with a fat-free diet, figuring that since the body can generate fat from protein and carbohydrates, and protein in general is the best (as in those protein rich diets advertised by body builders). I have since realized this is quite dangerous, because many essential nutrients are in fat only, and a diet without much fat and carbohydrates stresses out your liver. (see: Diet of Xah Lee)

Another interesting discovery is Three hares. Basically, in sacred buildings, a motif of 3 hares with connect ears appear, which appears in europe and china. The story entails some mysterious connection of religions and mythology, however, this story smells too much like a New Age shit. Essentially all the references points to one photographer's site that collect these photos and ponders on it.

another interesting quote:

When used for food, rabbits are both hunted and bred for meat. Snares or guns along with dogs are usually employed when catching wild rabbits for food. In many regions, rabbits are also bred for meat, a practice called cuniculture. Rabbits can then be killed by hitting the back of their heads, a practice from which the term rabbit punch is derived. Rabbit meat is a source of high quality protein.[11] It can be used in most ways chicken meat is used. ... Rabbit meat is leaner than beef, pork, and chicken meat.

I don't recall ever seeing rabbit meat sold in local supermarkets, in California, USA.

Note the interesting word: Cuniculture. And also about the Rabbit Punch.

About the naming:

Rabbits are often known affectionately by the pet name bunny or bunny rabbit, especially when referring to young, domesticated rabbits. Originally, the word for an adult rabbit was coney or cony, while rabbit referred only to the young animals. The word rabbit, however, mostly replaced the older word during the 19th century after coney became a vulgarism by analogy to the word cunt (widely considered vulgar) due to their similar pronunciation.

coney! (pronounced cunny) I love it.