2011-09-07

Project Gutenberg Founder Died (Michael S Hart, 1947‒2011)

Michael S Hart (1947‒2011) died on Sept 6. Cause of death is not mentioned.

Here's the news sources:

I benefited from Project Gutenberg. Specifically, i used it to get the original text for the following 3 annotated work:

2011-09-06

2 artworks

2 Artworks

Murasame Maru street 2 dummies-s
Seems to be a cover art for a japanese pregnant porn magazine. Author seems to be Murasame Maru 村雨丸.
half elf
author unknown.

Please comment if you know any info about these artwork.

2011-09-05

T-Mobile Commercials: Hottie Carly Foulkes

Perm url with updates: http://xahlee.org/funny/t-mobile_hottie_Carly_Foulkes.html

T-Mobile Commercials: Hottie Carly Foulkes

Mobile phone commercial featuring the hottie Carly Foulkes (b1988).

T-MOBILE COMMERCIAL NBA SIDEKICK 4G FASTEST DEMO
Monthly Mugging
T-Mobile myTouch 4G “New Ride”

Look above, she's got elf ears.

Step Up to Nationwide 4G Without Losing Your Shirt
A Special Greeting for T-Mobile Fans

Look at the make up, the attire, the body languages, the script, it's all engineered to precision with the science of psychology.

T-Mobile commercial dissected.

2011-09-04

Photography is High Art?

Perm url with updates: http://xahlee.org/arts/art_of_photography.html

Photography is High Art?

Xah Lee, 2011-09-04

Starting to take photographers out of my circle.

As a class of human animals on this earth, with respect to my taste and propensities of academic and humanity issues, i find photographers — shallow. In particular, those loud on the blogsphere (e.g. Trey Ratcliff). And, there's also the googler photo community manager Brian Rose. On g+, they are running the show. (note: if you are looking for photographers to add, just check out the above twain's posts. There are posts that collect all the pop photographers on g+, each got a myriad followers.)

The word photographer is loaded. It is this quasi-artist type of folks, of which requires little imagination compared to a painter, and little skill compared to a craftsman, similar to “designer” class or other post-modernistic “artists”. If you have fingers, you are a photographer material to begin with. (contrast this with, say, pianist)

Photographers, like designers (e.g. typographer. Also, calligraphers), when successful (e.g. Annie Leibovitz (see a big list here Category:American photographers)), are heightened out of proportions, gilded with theories of esthetics, exhibited in art museums and galas. (you know? there are artistic charlatans that peddle the idea that a splash of paint on canvas is fine art, or randomly piled up cubes as sculpture, and there is a award-winning composer whose magnum opus is silence. It is this type of phenomenon, that made me despise the word photography as a art form. I wonder now whether there has been photographers who have propounded that a photo of a white wall constitute a art)

I've always thought, that photographer as a profession is dying. Some 20 years ago, a pro photographer means you really need to have the equipment. Those bulky lenses carried on shoulders, with understanding of optics and technical know-how of complex optical equipment and film chemistry, and means of traveling, prop setup, etc. Today, all these fell by the wayside. On photo sites such as flickr, there are giga billions of photos, and a significant percent of them are great photography. These are done not by some professionals with years of training in photo school or under apprenticeship, but by “accident”. Google, with its Google Map, has taken a systematic approach where it runs cars around every road of major cities, with cameras that automatically take photos in all directions every few meters, producing a world of photos. These are functional photography, where you get to see things and people as they are, sans the artificial artistic touch, and it's really great and amazing, a real treasure to anthropology for the masses. (not that artistic touch is bad, just overvalued.)

If i were to spend 30 min a day gazing at photos, i'd rather goto Google Map's street photos of the world. If i were to spend time on visual art, i look for those whose production took a mastery of skill with imagination. If i were to look at photos of pretty faces, i have my porn collection.

Funny Video: Cat Teasing Dog

Perm url with updates: http://xahlee.org/funny/cat_teasing_dog.html

Funny Video: Cat Teasing Dog

Xah Lee, 2011-09-04

cat teasing dog

Selena Gomez - Love You Like a Love Song

Perm url with updates: http://xahlee.org/music/love_you_like_a_love_song.html

Selena Gomez - Love You Like a Love Song

Xah Lee, 2011-08-27

Love You Like a Love Song (2011), sung by Selena Gomez (b1992)

Selena Gomez - Love You Like a Love Song

The repeat-peat-peat stuttering is a parody of Max Headroom (character), a fictional animated talking-head character that drew a craze in ~1988.

The lyrics “musical, lyrical, magical”, reminds me of Supertramp's The Logical Song.

Fan video featuring “Supertramp - The Logical Song”

2011-09-03

xah lee blogs and what you like to see?

Xah Lee Blogs and What You Like to See?

Recently on g+ i asked where people know me from and what they like me to post on g+. (See: Source plus.google.com) One conversation leads to the fact that some people don't know i have webfeed of separate topics. So, here's a Reminder, and a poll.

If many subjects in my blog are not interesting to you, you can subscribe to individual topics, e.g. emacs only, programing only, math only, arts only, etc, at this page: Subscribe to XahLee.org Site Feed.

This blog at xahlee.blogspot.com is a aggregate of all, but except english vocabulary subject, which you can subscribe at wordy-english.blogspot.com.

am also on g+, twitter, facebook. In these places, i post links to new articles, and selected old articles few times a day. Also random chat (mostly on g+).

if you like my articles, please retweet or tell friends. Thanks for helping.

2011-09-02

Emacs Lisp: Writing a Date Time String Parsing Function

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

Emacs Lisp: Writing a Date Time String Parsing Function

Xah Lee, 2011-09-02

This page shows a example of writing a emacs lisp function that parses a date time string.

The Problem

Write a elisp function. The function will take a string argument that's any of common date time format, e.g.

  • 2011-09-02T05:29:26-07:00 (ISO 8601)
  • 2011-09-02 (ISO 8601)
  • Fri, 2 Sep 2011 11:14:11 +0200 (unixy)
  • 09/02/2011 (USA)
  • Sep 2, 2011
  • 2 Sep, 2011
  • 2 September, 2011

and output a canonical form 2011-09-02.

Solution

If you've worked with elisp for a while, or from a web search, you'll know there's a time parsing function “parse-time-string”, from the file 〔parse-time.el〕, with feature name 'parse-time (that is, you call (require 'parse-time) to load it). (See: Emacs Lisp's Library System: What's require, load, load-file, autoload, feature?.)

Here's its inline doc:

parse-time-string is a compiled Lisp function in `parse-time.el'.

(parse-time-string STRING)

Parse the time-string STRING into (SEC MIN HOUR DAY MON YEAR DOW DST TZ).
The values are identical to those of `decode-time', but any values that are
unknown are returned as nil.

However, a little test shows that this function doesn't parse some common date formats. In particular, it doesn't understand ISO 8601 nor USA custom of mm/dd/yyyy.

;; testing for supported formats for “parse-time-string”
;; As of 2011-08-15 GNU Emacs 23.2.1

(require 'parse-time)

;; unixy formats
(parse-time-string "Date: Mon, 01 Aug 2011 12:24:51 -0400") ; yes
(parse-time-string "Local: Mon, Aug 1 2011 9:24 am")        ; yes

(parse-time-string "2007, August 1")                        ; yes
(parse-time-string "August 1, 2007")                        ; yes
(parse-time-string "august 1, 2007")                        ; yes. Lowercase ok.
(parse-time-string "August 1st, 2007")                      ; no. The date is nil.
(parse-time-string "aug 1, 2007")                           ; yes. Month abbr OK.
(parse-time-string "1 aug, 2007")                           ; yes

(parse-time-string "8/1/2007")     ; no. Takes the 8 as date, 1 as nil
(parse-time-string "08/01/2007")   ; no. Takes the 8 as date, 1 as nil
(parse-time-string "8,1,2007")     ; no
(parse-time-string "2007-08-01")   ; yes
(parse-time-string "2007")         ; yes
(parse-time-string "2007-08")      ; no
(parse-time-string "2011-08-01")   ; yes
(parse-time-string "2011-08-01T11:55:37-07:00") ; no. got nothing

For me, i need it to understand the USA customary format 8/1/2007 interpreted as month/day/year. Ι also need it to understand formats such as August 1st, 2007. And i also need it to understand ISO 8601 format such as yyyy-mm, yyyy-mm-dd, yyyy-mm-ddThh:mm:ss-07:00.

The simplest solution is just do a regex match on the form. I don't need the time info, so it makes the problem slightly simpler. Here's my code:

(defun fix-timestamp-string (dateStr)
  "Returns yyyy-mm-dd format of timeStr

For examples:
 「Nov. 28, 1994」 ⇒ 「1994-11-28」
 「November 28, 1994」 ⇒ 「1994-11-28」
 「11/28/1994」 ⇒ 「1994-11-28」

Any “day of week”, or “time” info, or any other parts of the string, are discarded.

Code detail: URL `http://xahlee.org/emacs/elisp_parse_time.html'"
  (let (dateList ξyear ξmonth ξdate yyyy mm dd)
    (require 'parse-time)

    (setq dateStr (replace-regexp-in-string "^ *\\(.+\\) *$" "\\1" dateStr)) ; remove white spaces

    (cond

     ;; USA convention of mm/dd/yyyy
     ((string-match "^\\([0-9][0-9]\\)/\\([0-9][0-9]\\)/\\([0-9][0-9][0-9][0-9]\\)$" dateStr)
      (concat (match-string 3 dateStr) "-" (match-string 1 dateStr) "-" (match-string 2 dateStr))
      )
     ((string-match "^\\([0-9]\\)/\\([0-9][0-9]\\)/\\([0-9][0-9][0-9][0-9]\\)$" dateStr)
      (concat (match-string 3 dateStr) "-" (match-string 1 dateStr) "-" (match-string 2 dateStr))
      )

     ;; some ISO 8601. yyyy-mm-dd
     ((string-match "^\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\)$T[0-9][0-9]:[0-9][0-9]" dateStr)
      (concat (match-string 1 dateStr) "-" (match-string 2 dateStr) "-" (match-string 3 dateStr))
      )
     ((string-match "^\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\)$" dateStr)
      (concat (match-string 1 dateStr) "-" (match-string 2 dateStr) "-" (match-string 3 dateStr))
      )
     ((string-match "^\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)$" dateStr)
      (concat (match-string 1 dateStr) "-" (match-string 2 dateStr))
      )
     ((string-match "^\\([0-9][0-9][0-9][0-9]\\)$" dateStr)
      (match-string 1 dateStr)
      )

     ;; else
     (t
      (progn
        (setq dateStr (replace-regexp-in-string "January " "Jan. " dateStr))
        (setq dateStr (replace-regexp-in-string "February " "Feb. " dateStr))
        (setq dateStr (replace-regexp-in-string "March " "Mar. " dateStr))
        (setq dateStr (replace-regexp-in-string "April " "Apr. " dateStr))
        (setq dateStr (replace-regexp-in-string "May " "May. " dateStr))
        (setq dateStr (replace-regexp-in-string "June " "Jun. " dateStr))
        (setq dateStr (replace-regexp-in-string "July " "Jul. " dateStr))
        (setq dateStr (replace-regexp-in-string "August " "Aug. " dateStr))
        (setq dateStr (replace-regexp-in-string "September " "Sep. " dateStr))
        (setq dateStr (replace-regexp-in-string "October " "Oct. " dateStr))
        (setq dateStr (replace-regexp-in-string "November " "Nov. " dateStr))
        (setq dateStr (replace-regexp-in-string "December " "Dec. " dateStr))

        (setq dateStr (replace-regexp-in-string " 1st," " 1" dateStr))
        (setq dateStr (replace-regexp-in-string " 2nd," " 2" dateStr))
        (setq dateStr (replace-regexp-in-string " 3rd," " 3" dateStr))
        (setq dateStr (replace-regexp-in-string "\\([0-9]\\)th," "\\1" dateStr))

        (setq dateStr (replace-regexp-in-string " 1st " " 1 " dateStr))
        (setq dateStr (replace-regexp-in-string " 2nd " " 2 " dateStr))
        (setq dateStr (replace-regexp-in-string " 3rd " " 3 " dateStr))
        (setq dateStr (replace-regexp-in-string "\\([0-9]\\)th " "\\1 " dateStr))

        (setq dateList (parse-time-string dateStr))
        (setq ξyear (nth 5 dateList))
        (setq ξmonth (nth 4 dateList))
        (setq ξdate (nth 3 dateList))

        (setq yyyy (number-to-string ξyear))
        (setq mm (if ξmonth (format "%02d" ξmonth) "" ) )
        (setq dd (if ξdate (format "%02d" ξdate) "" ) )
        (concat yyyy "-" mm "-" dd)

        ) ) ) ))

This code is easy to understand. The function takes a string, and returns a string.

The whole code is just one giant multi-branch conditional test, known in other languages as “case” or “switch”. Elisp conditional takes this form:

(cond
 (TEST1 BODY)
 (TEST2 BODY)
 …
 )

Each of the TEST is either true (not “nil”) or false (“nil”). Emacs will go thru them in sequence. The first test that's non-nil, its body will be executed, then exit the conditional.

In my code, the first few tests are regex match of forms like nn/nn/nnnn where each “n” is a digit. When any of these match, then basically i got what i want, and the code exists. Here's one example:

 ;; USA convention of mm/dd/yyyy
 ((string-match "^\\([0-9][0-9]\\)/\\([0-9][0-9]\\)/\\([0-9][0-9][0-9][0-9]\\)$" dateStr)
  (concat (match-string 3 dateStr) "-" (match-string 1 dateStr) "-" (match-string 2 dateStr))
  )

When none of these match, then it goes to the end of the test (t BODY), where the “t” there is always true, and run a giant BODY. In the BODY, first i replace each full spelling of month names by their abbrev using “replace-regexp-in-string”, e.g.

(setq dateStr (replace-regexp-in-string "January " "Jan. " dateStr))

This is done because in emacs 22, the “parse-time-string” doesn't understand fully spelled month names. (this has been fixed.)

Then, i also replace {1st, 2nd, nth} etc by {1, 2, n}. Then, i simply feed it to “parse-time-string” and get a parsed date time as a list. After that, just extract the elements from the list and reformat the way i want.

Now, remember that my function takes a string and returns a string. It is not a interactive command. What i actually want is a interactive command, so that i can press a button, then the date on the current line will be transformed to the format i want. Here's the interactive command wrapper, which calls my “fix-timestamp-string” function to work:

(defun fix-timestamp ()
  "Change timestamp under cursor into a yyyy-mm-dd format.
If there's a text selection, use that as input, else use current line.
All other text in input are discarded.
For example:
TUESDAY, FEB 15, 2011 05:16 ET
becomes
2011-02-15
.
See `fix-timestamp-string' for detail."
  (interactive)
  (let (bds p3 p4 inputstr)
    (setq bds (get-selection-or-unit 'line))
    (setq inputstr (elt bds 0) )
    (setq p3 (elt bds 1) )
    (setq p4 (elt bds 2) )
    (delete-region p3 p4)
    (insert (fix-timestamp-string inputstr)) ))

The “get-selection-or-unit” is my custom function as replacement for “thing-at-point” function. See: Emacs Lisp: get-selection-or-unit.

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.)

I ♥ Emacs.

today's Wordy English, and what makes a great essayist

today's Wordy English: gaunt, and what makes a great essayist: http://wordy-english.blogspot.com/2011/09/gaunt.html

2011-09-01

Are Googlers the Minions of Google Marketing?

Perm url with updates: http://xahlee.org/w/Googler_marketing_minion.html

Are Googlers the Minions of Google Marketing?

Xah Lee, 2011-09-01

it's somewhat disappointing. Vast majority of googlers on g+, they all seem to be doing marketing for google. It's all nice tweets, new features of g+, how great g+ is, news of another net celebrity joining g+.

maybe they just love the company they work for? But if you look closer, i don't think it's peach-n-cream like that. They seldom, basically never, tweet about actual work, or any thought that might be negative to google, in fact, vast majority don't tweet anything non-google at all (except generic crowd-pleasing cat pics or piping thru luke-warmed news).

a job is a job. Even though google caters a great and fun environment for its employees, am pretty sure there are still pressures, conflicts, or just tiredness, at least occasionally.

then, outside of g+, there are a few dedicated blogs of ex-googlers. There, it's usually always somewhat negative of google, with polite words patched over on top.

it's natural for one to carefully avoid talking about his work, his boss, especially negative parts. But the number of googlers online, and how they all seem to be doing google marketing, seems, unnatural.

just to be sure, am trying to think of how other big companies are like regarding this. Apple, Microsoft, HP, Oracle, IBM, etc. I don't really knom much blogs by these company's employees to say, except that Steve Jobs made the fan do marketing for them.

PS ok, a new thought. Maybe google is like that because they have shaped their marketing into a science, like everything else of their algorithm and scientific methodology fetish. So, instead of having dedicated marketing personnel (which they do), they spread marketing informally to be parts of work to all staff (e.g. programers and managers too). So, any worker, are encouraged to use perhaps their break time or “the 20% time” to do google marketing on their own, without being directed. May it be a simple tweet of some new Android cuddly at Google, or participate a video broadcasting some new Google feature.

PS if you need a g+ invite, click: Xah Lee's G+ Invite.

Women in Tech: Today's G+ Recommendation? You Decide.

Perm url with updates: http://xahlee.org/w/women_in_tech_TWiT.html

Women in Tech: Today's G+ Recommendation? You Decide.

Xah Lee, 2011-09-01

due to g+, recently i got acquainted with a couple of online video shows. One of them is TWiT. (it has nothing to do with Twitter, btw. It stood for This Week in Tech, started by Leo Laporte (g+) (i just looked up Leo's profile. O yeah, i remember him, a jolly comedian-like fellow, because recently i've watched one of his show, also featuring Gina Trapani (g+) , who is a coder among startup things, and she espouses Java! (that's a LOL)))

This TWiT show, was what prompted me to write about how TV Has Arrived on The Web (which, the host dully spend some 30 secs to recite a passage about the greatness of NetFlix in lively personalized detail. Catherine Fitzpatrick (g+) , the communism expert, reminded me that the proper word for it is Infomercial.)

anyhow, probably for many of you guys, that what first prompted you to watch the show is a twain Sarah Lane (g+) and Amber Mac (g+). Both got few million followers.

Sarah is this attractive animated chick. Amber is just one angelic face, attractive notwithstanding.

it is these qualities, that attracted me to the show in the first place. So far i've watched 2 episodes of their shows. Having watched them on video, i now know better who the heck are these popular women i'm following on g+. (in their last show, they talked about a new service of having online friends (aka strangers) to give you wakeup calls. Sarah & Amber, try me! I pack a dollop in the word creep.)

now you pretty females got all the breaks. You all net activists and feminists and transexual advocates and nym-cryers out there. Shouldn't society be, like, more fair, so that the public should pay more attention to a old ugly and poor and underpowered man like me?

PS if you need a g+ invite, click: Xah Lee's G+ Invite.

poem: iron ball

2011-09-01

iron ball,
rusted and scarred,
tittering on the window sill,
wondering, when
he's gonna fall