2011-10-07

Richard Stallman on Steve Job's Death

Perm url with updates: http://xahlee.org/comp/Richard_Stallman_on_Steve_Jobs_death.html

Richard Stallman on Steve Jobs's Death

, 2011-10-07

in case you are wondering, here's what Richard Stallman posted about death of Steve Jobs. Quote:

Steve Jobs, the pioneer of the computer as a jail made cool, designed to sever fools from their freedom, has died.

As Chicago Mayor Harold Washington said of the corrupt former Mayor Daley, "I'm not glad he's dead, but I'm glad he's gone." Nobody deserves to have to die - not Jobs, not Mr. Bill, not even people guilty of bigger evils than theirs. But we all deserve the end of Jobs' malign influence on people's computing.

Unfortunately, that influence continues despite his absence. We can only hope his successors, as they attempt to carry on his legacy, will be less effective.

it's posted on his blog at Source stallman.org

it seems, many FSF advocates are offended by this.

I hold slightly positive view of Steve Jobs. (been a dedicated Mac fan from 1991 to 2005) Am slightly sad that he died. However, am not offended by RMS's remarks. Everyone dies. In my moral book, it's not more wrong to criticize when a person just died; whether the person is alive or just died SHOULD NOT make any difference. Also, it's his personal blog, not on fsf.org or gnu.org.

It's not too surprising of RMS's behavior neither. He's been like that in past few years. Screeching publicly against all smart phones (iPhone, Android), attacking cloud computing, attacking Google, made enemies with many major figures in the open source community, got kicked out by several linux communities afaik (e.g debian), and calling Miguel de Icaza a traitor or such …

He, seems to have lost touch, becoming bitter old man, his GNU software suite getting less and less relevant, and i don't see he's getting any more followers neither.

Live, and let live.

Nude Alice by Alessandro Barbucci

New: Nude Alice by Alessandro Barbucci

GNU Emacs dev, Richard Stallman, Personality Cult

got a email from gnu emacs bug people about a bug being fixed.

the bug was filed 2 years ago, and was fixed 1 year ago. See: Source debbugs.gnu.org.

i've filed perhaps 40 in the past. Perhaps 10 are taken and fixed.

in general, got no thanks, no appreciation. This isn't just me. I've been involved with GNU Emacs dev (casually) for 5 years now. I've seen and read enough to know. Many developers who contributed far more to emacs, with code and packages, are treated like that. Under communism, of the FSF branch, you are just a node for the good of all. The people who got thanked, perhaps the only person, is Richard Stallman. Nobody else. His communism ideology made it that way. He's now a Cult of personality.

am pretty tired Richard Stallman and his leadership.

am not likely to send any bug reports or anything anymore.

2011-10-05

Chinese Fonts Comparison; 中文字型比較

Perm url with updates: http://xahlee.org/lit/chinese_fonts.html

Chinese Fonts Comparison; 中文字體比較

Xah Lee, 2011-10-05

This page shows a comparison of Chinese fonts. These fonts are bundled with Microsoft Windows Vista and 7.

The sample text includes use of various brackets and “quotation marks” and comparison of number 0 with letter O, and latin alphabets (some Chinese font's latin alphabets are monospaced (fixed width), while others are proportional (variable width). (check the rendering of “i”.))

If you are not on Windows 7 or Vista, the text you see may not be using the font indicated. In that case, see a graphical rendering at the bottom.

【Arial Unicode MS】 漢语的文字系统漢字是一种意音文字,表意的同時也具一定的表音功能。漢語包含“書面語”以及‘口語’兩部分。古代《書面》汉语称为文言文,现代〈书面〉汉语一般指現代標準漢語。〖α=f[x]+5*10〗 {One list out}

【Microsoft JhengHei】 漢语的文字系统漢字是一种意音文字,表意的同時也具一定的表音功能。漢語包含“書面語”以及‘口語’兩部分。古代《書面》汉语称为文言文,现代〈书面〉汉语一般指現代標準漢語。〖α=f[x]+5*10〗 {One list out}

【MingLiU】 漢语的文字系统漢字是一种意音文字,表意的同時也具一定的表音功能。漢語包含“書面語”以及‘口語’兩部分。古代《書面》汉语称为文言文,现代〈书面〉汉语一般指現代標準漢語。〖α=f[x]+5*10〗 {One list out}

【SimSun】 漢语的文字系统漢字是一种意音文字,表意的同時也具一定的表音功能。漢語包含“書面語”以及‘口語’兩部分。古代《書面》汉语称为文言文,现代〈书面〉汉语一般指現代標準漢語。〖α=f[x]+5*10〗 {One list out}

【FangSong】 漢语的文字系统漢字是一种意音文字,表意的同時也具一定的表音功能。漢語包含“書面語”以及‘口語’兩部分。古代《書面》汉语称为文言文,现代〈书面〉汉语一般指現代標準漢語。〖α=f[x]+5*10〗 {One list out}

【KaiTi】 漢语的文字系统漢字是一种意音文字,表意的同時也具一定的表音功能。漢語包含“書面語”以及‘口語’兩部分。古代《書面》汉语称为文言文,现代〈书面〉汉语一般指現代標準漢語。〖α=f[x]+5*10〗 {One list out}

【DFKai-SB】 漢语的文字系统漢字是一种意音文字,表意的同時也具一定的表音功能。漢語包含“書面語”以及‘口語’兩部分。古代《書面》汉语称为文言文,现代〈书面〉汉语一般指現代標準漢語。〖α=f[x]+5*10〗 {One list out}


Here's a image rendering.

chinese fonts comparison
Comparison of Chinese fonts on MS Windows

Basics of Chinese Font Names

In general, if you want a font with variable strokes, look for a font name that contains “Kai”, which means 楷軆, which means “regular script”. Otherwise, for normal readable text, use Song or Ming (宋體, 仿宋體, 明體). These are like regular script but more geometric so it's more clear on computer screen. Font names with “Hei” is usually a heavier variant of Song.

See also: Chinese Character Etymology and Script Styles.

2011-10-04

How Can You Tell the Difference Between Chinese, Japanese, Korean?

new article. See at How Can You Tell the Difference Between Chinese, Japanese, Korean?

李敖: 才女与美女如何兼备; Li Ao: Pretty Women vs Brainy Women

Perm url with updates: http://xahlee.org/Periodic_dosage_dir/li_ao_on_women_beauty_vs_brainy.html

李敖: 才女与美女如何兼备; Li Ao: Pretty Women vs Brainy Women

Xah Lee, 2009-11-20, 2011-10-04

Some lectures by Li Ao on his talk show.

“李敖语妙天下 2009年2月26日 才女与美女如何兼备 Part 1”.

In the above, he mentioned a book, American Policy Toward Communist China, subtitled “The historical record: 1949‒1969” by Foster Rhea Dulles. amazon It is published in 1972.

Montblanc Fountain Pen

He chatted about luxury Fountain pen, among other things.

In it, he has written a poem, published as a ad, for the luxury fountain pen maker Montblanc (company). The poem goes thus:

附庸風雅情多有
隨波逐流理可無
名牌滿身一身淺
筆底深處見功夫
  -李敖題萬寶龍
luxury and elegance, pursues the plebian
fashion and show, as waves following waves
brandnames allover shallow bodies
it's in the marks of pen, reveals true depth
 (translation by Xah Lee)

Fantastic.

Virginia Woolf and Montblanc Fountain Pen

“李敖语妙天下 2009年2月26日 才女与美女如何兼备 Part 2”

He also talks about Virginia Woolf (1882‒1941). He also mentioned and showed us, that the Montblanc produced a special edition of their fountain pen in memory of Virginia Woolf. Here's a quote from Wikipedia:

After completing the manuscript of her last (posthumously published) novel, Between the Acts, Woolf fell into a depression similar to that which she had earlier experienced. The onset of World War II, the destruction of her London home during the Blitz, and the cool reception given to her biography of her late friend Roger Fry all worsened her condition until she was unable to work. On 28 March 1941, Woolf put on her overcoat, filled its pockets with stones, and walked into the River Ouse near her home and drowned herself. Woolf's body was not found until 18 April 1941. Her husband buried her cremated remains under an elm in the garden of Monk's House, their home in Rodmell, Sussex.

In her last note to her husband she wrote:

Dearest, I feel certain that I am going mad again. I feel we can't go through another of those terrible times. And I shan't recover this time. I begin to hear voices, and I can't concentrate. So I am doing what seems the best thing to do. You have given me the greatest possible happiness. You have been in every way all that anyone could be. I don't think two people could have been happier 'til this terrible disease came. I can't fight any longer. I know that I am spoiling your life, that without me you could work. And you will I know. You see I can't even write this properly. I can't read. What I want to say is I owe all the happiness of my life to you. You have been entirely patient with me and incredibly good. I want to say that – everybody knows it. If anybody could have saved me it would have been you. Everything has gone from me but the certainty of your goodness. I can't go on spoiling your life any longer. I don't think two people could have been happier than we have been. V.

Montblanc pen Virginia Woolf edition
Montblanc pen, Virginia Woolf edition

He mentioned the unfairness of Nobel Prize. Virginia died without getting a Nobel Prize. In 1938, 3 years before her death, it was given to a women Pearl S. Buck (1892‒1973). Nor was it given to Russian novelist Leo Tolstoy (1828‒1910) (War and Peace, Anna Karenina). Nor the Polish-born English novelist Joseph Conrad (1857‒1924).

On Brigitte Bardot

He also mentioned the french actress Brigitte Bardot (b1934). He mentioned, that when she's old, she does not have any mirrors in her house (unable to stand seeing her old ugly self in comparsion when she's a sex symbol.), and how she became a “animal rights” activist.

粉绵磨镜不忍照,
女子盛时无十年。
 —陆放翁(陆游) (1125‒1210)
polished mirrors i dare not look
a woman's beauty beams less than ten
 (translated by Xah Lee)

These movie star ignorant idiots. It's animal rights, or human rights, or this and that donation, causes, helping out, save the world shit, because when they are old, they don't have any content, but still a human animal with vanity and self-worth consciousness. The inane “helping out” behaviors are moves of self-worth redemption.

One story of her cited by Li Ao, is how she castrated a neighbor's donkey because she think the donky is sexually harrassing her female donkey. Here's a quote from Wikipedia:

She once had a neighbor's donkey castrated while looking after it, on the grounds of its “sexual harassment” of her own donkey and mare, for which she was taken to court by the donkey's owner in 1989. In 1999 Bardot wrote a letter to Chinese President Jiang Zemin, published in French magazine VSD, in which she accused the Chinese of “torturing bears and killing the world's last tigers and rhinos to make aphrodisiacs”.

220px-Brigitte Bardot BrigitteBardot
Brigitte Bardot (b1934), then (1968) and now (2002). Source Source On the left, a hot bimbo. On the right, a hag. A hag is when a bimbo got old and refuses it.

For vids of her youth, see: Brigitte Bardot .

“李敖语妙天下 2009年2月26日 才女与美女如何兼备 Part 3”

He mentioned about a poem by John Donne (1572‒1631). For the transcription, see: The Bell Tolls for Thee; 鐘為汝鳴.

“李敖语妙天下 2009年2月26日 才女与美女如何兼备 Part 4”

In this part, he talks about the ex movie star, his ex-wife, Hu Yin Meng (胡茵梦)

“李敖语妙天下 2009年2月26日 才女与美女如何兼备 Part 5”

The Bell Tolls for Thee; 鐘為汝鳴

New article, see at: The Bell Tolls for Thee; 鐘為汝鳴 (English, Chinese, literature, poetry)

2011-10-03

emacs lisp function: show hex in decimal

Anonymous wrote to ask how to write a emacs command to show the decimal value of a hexadecimal string under cursor in source code. Here's answer at bottom: Emacs Lisp: Converting Decimal and Hexadecimal Numbers.

2011-10-02

Non-Javascript Web Sites Are Now History

It used to be, that when a website requires javascript, and if your browser had it turned off, the site would warn you, and optionally giving you directions about how to turn it on. (similar with cookies)

I noticed, in recent months, that many Google sites don't do this anymore. The site simply fail without giving any reason.

Worse, even for some Google sites that never required js, but now ceased working. Google translate, Google image search, are 2 examples i recently experienced. (but i haven't done detailed investigation)

So what does this mean? some quick thoughts:

① Web has come to the point that javascript is accepted as integral part, cannot be done without. Those academic, static, sites, are now considered history.

② Google of course relies on dynamic web to survive, thus js. They, for political reasons, must push js, and HTML5. Vast majority of their product, their bread n butter, depends on js. So, the gesture of simply dropping error messages for non-js browser is a reflection of this.

While we can think about political motives, but i think it's actually a reasonable move. For those who know what javascript is and would take the trouble to turn it off, are like those who choose to lead a unusual life style. It is not necessary to tell these people that their javascript is off; they KNOW! Separately but more importantly, coding dynamic websites to take care of both javascript version and none-javascript version (e.g. using basic HTML forms or other server based tech) is a pain and tremendous time drain. It's much more efficient for dynamic websites to assume that javascript is part of the platform. Also note perhaps 99.9 sites are dynamic websites today. One can still write static html if one wants, and it has nothing to do with this issue.

Emacs Lisp: a Function That Works on String or Region

Perm url with updates: http://xahlee.org/emacs/elisp_command_working_on_string_or_region.html

Emacs Lisp: a Function That Works on String or Region

Xah Lee, 2011-10-02

This article shows you how write a elisp text-transform function that can be used in 2 ways: ① change text in a buffer region. ② takes a string argument and returns a string.

Emacs lisp level: advanced.

Problem

Summary

For a function that transform text, find a way to code it so that:

  • ① When called interactively: When there is a text selection, transform the selected text. Otherwise, use the current paragraph as input.
  • ② When called in elisp code, the function can take a string and return a string, or, it can take buffer positions {ξfrom, ξto} and work on that region (i.e. replace the region with result).

For example, suppose you have a command “remove-vowel” that works on a region, but you also want a version “remove-vowel-string” which just takes a string input and returns a string. The string version is very convenient in lisp code. But i don't want to keep 2 functions. I want just one single function.

Detail

Been coding elisp for 5 years now, perhaps about 2 hours a day. I have perhaps ~30 commands that do text transformation on text under cursor. For examples: changing URL into a HTML linkchanging the filename under cursor into a HTML image linkasciify-stringtransform date formatchanging a region into a standard citation formatcompact-css-regionchange source code text to syntax colored html, … etc.

In the past year, i find that i often need 2 versions of a function. One version for working in a buffer, while another version simply work on string. The string version is very convenient and simple when used in elisp code.

This is becoming a problem, because for every text processing function i seem to need to write and maintain 2 versions. For example, let's say i have a function named “remove-vowel” that changes “something” to “smthng”. Typically, i'd write a “remove-vowel-string” that takes a string as argument and output a string. Then i write another version “remove-vowel” that is a interface wrapper, and calls “remove-vowel-string” to do the actual work.

Having 2 versions of every function is becoming annoying. So, today i thought about it and came up with a solution.

Solution

The solution is this: The function would take 1 argument, and 2 more optional arguments, like tis:

(defun remove-vowel (ξstring &optional ξfrom ξto) …)
  • If “ξstring” is given, then the function take that as input and returns a string.
  • If “ξstring” is nil, then the function takes {ξfrom ξto} positions and change the text in the region.

When “remove-vowel” is called interactively, simply feed the function {nil, ξfrom, ξto}.

This way, the function can be used as a string manipulation function, or it can be used as a buffer text changing function, with no penalties or inefficiencies i can think of. Here's how it's done using “remove-vowel” as example:

(defun remove-vowel (ξstring &optional ξfrom ξto)
  "Remove the following letters: {a e i o u}.

When called interactively, work on current paragraph or text selection.

When called in lisp code, if ξstring is non-nil, returns a changed string.
If ξstring nil, change the text in the region between positions ξfrom ξto."
  (interactive
   (if (region-active-p)
       (list nil (region-beginning) (region-end))
     (let ((bds (bounds-of-thing-at-point 'paragraph)) )
       (list nil (car bds) (cdr bds)) ) ) )

  (let (workOnStringP inputStr outputStr)
    (setq workOnStringP (if ξstring t nil))
    (setq inputStr (if workOnStringP ξstring (buffer-substring-no-properties ξfrom ξto)))
    (setq outputStr
          (let ((case-fold-search t))
            (replace-regexp-in-string "a\\|e\\|i\\|o\\|u\\|" "" inputStr) )  )

    (if workOnStringP
        outputStr
      (save-excursion
        (delete-region ξfrom ξto)
        (goto-char ξfrom)
        (insert outputStr) )) ) )

The meat of this function is just (replace-regexp-in-string "a\\|e\\|i\\|o\\|u\\|" "" inputStr). But let's see how the input/output is done.

Use of (interactive)

The “interactive” is a declaration that lets emacs know how arguments are passed to the function when it is used interactively. For example, it can be user input from a prompt in minibuffer, or from “universal-argument” 【Ctrl+u】. Or, how to interpret the input, as a string, number, a buffer name, file name, etc.

When a function has (interactive) (usually placed right after the doc string), it means the function is a command (i.e. it can be called by “execute-extended-command” 【Alt+x】).

When a function has (interactive "r"), then emacs will take the {beginning, ending} cursor positions of a region and feed it to the function as the first 2 arguments. The "r" is called the “interactive code”. See: (info "(elisp) Interactive Codes").

Normally, the argument to “interactive” is a string, but it can be other lisp expression. When it is a lisp expression, the return value of the expression must be a list, and the items are feed to the function as arguments.

So, in our case of “remove-vowel”, our argument to “interactive” is a lisp expression that return a list of 3 items. Like this:

(defun remove-vowel (ξstring &optional ξfrom ξto)
 "…"
 (interactive
    (if (region-active-p)
        (list nil (region-beginning) (region-end))
      (let ((bds (bounds-of-thing-at-point 'paragraph)) )
        (list nil (car bds) (cdr bds)) ) ) )
…
)

If there's a text selection (region is active), it sets “ξstring” to nil and {ξfrom, ξto} to region {begin, end} positions.

If there's no text selection (region is not active), it sets “ξstring” to nil and {ξfrom, ξto} to paragraph's {begin, end} positions.

In both cases, the “ξstring” is set to nil, so the function will work on the region text.

(See: Using thing-at-pointWhat's Region, Active Region, transient-mark-mode?)

Rest of Code

The above takes care of interactive use of the function.

Now, remember that our function takes 3 arguments: {ξstring, ξfrom, ξto}. The {ξfrom, ξto} are optional. When “ξstring” is given (i.e. not nil), the function will take that as input and return a string. Otherwise, it takes {ξfrom, ξto} as region positions and transform text in the buffer.

For clarity, first we set “workOnStringP”:

 (setq workOnStringP (if ξstring t nil))

then we set the “inputStr” like this:

 (setq inputStr (if workOnStringP ξstring (buffer-substring-no-properties ξfrom ξto)))

Now, it works on the string, like this:

(setq outputStr
 (let ((case-fold-search t))
  (replace-regexp-in-string "a\\|e\\|i\\|o\\|u\\|" "" inputStr) ) )

Then, it either returns the outputStr or just change the region in buffer, depending whether “workOnStringP” is true, like this:

(if workOnStringP
        outputStr
      (save-excursion
        (delete-region ξfrom ξto)
        (goto-char ξfrom)
        (insert outputStr) ))

The weird ξ you see in my elisp code is Greek x. I use unicode char in variable name for experimental purposes. You can just ignore it. (See: Programing Style: Variable Naming: English Words Considered Harmful.)