2012-03-31

Blondie

several updates/addition on Blondie's songs.

2012-03-30

Geek Latte Art: GNU, Beastie, Golang

gnu logo latte art 600x800
GNU logo latte art. 2448×3264 (photo by Yuko Honda Source www.flickr.com)

Geek Latte Art: GNU, Beastie, Golang

Add-A-Gram Programing Puzzle

John Snader posted a very interesting coding challenge problem. See: Source irreal.org.

try implement it in elisp or your fav lang.

Unicode: Egyptian Hieroglyph Characters

here's egyptian hieroglyph in unicode.

�� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� ��

for the full list of chars, rendered images, fonts, see: http://xahlee.org/comp/unicode_egyptian_hieroglyph.html

Is Programing Art or Science

[refreshen of the blood.]

Dear friends,

You mentioned the title of Donald Knuth's magnum opus Art of Programming in the context of discussion that fringes on whether programing is science or art. I'm quite pissed off at work at the moment, so let me take the time to give some guide on this matter to the daily programers.

At the bottom rung of programers, there's no question about whether programing is science or art. Because monkey coders could not care less. These folks ain't be reading this post, for they hardly will have heard of lisp.

This leaves us with elite programers who have a smattering of interests on cogitation and philosophical conundrums. So, is programing a science or art?

final say here: Is Programing Art or Science

HTML5 Page Article Tag and Page Structure Tags

updated: HTML5 Page Article Tag and Page Structure Tags

2012-03-29

w3c html validator invalid!

Loly, by W3C spec at http://www.w3.org/TR/html401/types.html#type-name, the value for element attribute (e.g. {id, class}) must start with a letter. Quote:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

However, you can start with a unicode greek α and it passes W3C's validator.

Here's a test page: Test: Unicode Character in HTML ID Attribute Value.

much more at http://xahlee.org/js/w3c_html_validator_problem.html

Case Sensitivity in HTML/HTML5/XHTML/CSS

Perm URL with updates: http://xahlee.org/js/case_sensitivity_html5_xml_css_js.html

Case Sensitivity and Allowed Characters in Attribute Names

  • HTML4, HTML5: tag names are NOT case sensitive. <p class="…">…</p> = <P cLAss="…">…</p>
  • XHTML, XML: are case sensitive, and must be all lowercase.
  • ID element, attributes values, in any HTML/XML are case sensitive. e.g. <span class="aaa"><span class="AAA">.
  • Javascript is case sensitive.

Best is to always be case sensitive in your code.

Allowed chars in “id” <div id="myID">…</div> must start with a letter (A to Z, uppper or lowercase). After that, it can be digits (0 to 9), hyphen -, colon :, period ..

In practice, you can start with a unicode char in id, such as α, and the W3C validator will pass it as valid (as of 2012-03-29). (➲ Using Unicode in HTML Attributes)

2012-03-28

Unicode Symbol Use: ➲ U+27B2

Decided to adopt a new unicode symbol usage. On my site, i have hundreds links of the form: (See: ‹link title›.). So, a article may have lots “(See: …)”, sometimes a few in a paragraph. I decided to replace the “(See: …)” with just “(➲ …)”, and get rid of the ending period.

Note that the Unicode char is U+27B2, named “CIRCLED HEAVY WHITE RIGHTWARDS ARROW”. It displays fine by default in all major browsers. This is a important point to consider when you want to adopt some unicode char. (➲ Arrows in Unicode)

Originally, i thought of using a eye icon. The one that i found are:

  • �� “EYES”
  • �� “EYEGLASSES”

but these characters are probably new in unicode 6, and they do not show in browsers except Firefox on my machine. Also, they don't really fit. The eyeglasses is OK but in normal sized font it's illegible. Then, i thought of using “WHITE RIGHT POINTING INDEX”. This char shows up but again not legible without larger font. This is a important point, because it ruled out many other iconographic symbols. I don't want to use HTML markup to enlarge the font, because that adds bulk and complexity and is distracting.

Then i thought of using a Egyptian eye icon. It is quickly ruled out because none of them shows up. (➲ Unicode: Egyptian Hieroglyph Characters)

Then i thought of just using a arrow, like this: (→ Syntax Design: Use of Unicode Matching Brackets as Specialized Delimiters), but that left paren and the arrow combo made it look like a emoticon. This is another interesting discovery. This means, certain sequence of symbols may create out-of-context side-effects that you want to avoid. (similar to the rise of ligatures)

So, in the end, i thought some other arrow might work. Thus i ends up with ➲. This is not the final choice, i might change it to something else in the future.

Why do i change the more clear “(See: …)” to a icon? It's not a critical change, nor a necessarily one. The change does not matter much to readers (in fact, probably reduce the meaning of the text a tiny bit. (because when you use English word “see”, the meaning is clear and the usage idiomatic. But with a symbolic icon, it became rather cryptic.)). But the advantage with the change is that it makes the text more systematic, and amenable for parsing. (kinda like a micro markup)

read more at Semantics & Symbols: Examples of Unicode Symbols Usage

2012-03-27

Emacs + Keyboard Geeking, the Nth Episode 2012-03

Perm URL with updates: http://xahlee.org/kbd/keyboard_geeking_2012-03-27.html

Just spent ~4 hours and did major surgery on my keyboard system again.

specifically, the change is this:

Before, the 【Menu+‹key›】 combo insert various Unicode chars, and Caps Lock does emacs's “execute-extended-command” (M-x). Now, the two are switched. Now the Menu key does “execute-extended-command” (just like on Linux by default), and 【Caps Lock ‹key›】 inserts Unicode chars (note it's a key sequence here, not combo.).

Also, Esc now does emacs's cancel 【Ctrl+g】.

The mappings are done using AutoHotkey and emacs. Here's related references and tutorials:

Note that all my {F1, …, F12} function keys are used up. All 15/17 keys on the numberpad are also used up (the exceptions are Num Lock and Enter). All 9 app launch special buttons on the keyboard are also used up. Some of these keys are used globally, some are app specific. If you have empty function keys, you should make use of it NOW! (➲ Increase Productivity Using F1 … F12 Keys)

here's a summery of my keyboard shortcut design principle.

  • ① the most fundamental principle: always bind the most frequently used operation to the easiest key (Frequency must be determined by statical means, as much as possible. (habit clouds your judgement) (➲ Emacs's Command Frequency)). Over the years, i find that this principle out weight any other, by far. This is the single most important principle.
  • ② key-combinations (i.e. hold a modifier key and press another), should be completely abolished.

wrote much about this already here: Keyboard Shortcut Design: Dedicated keys, Special Buttons, Extra Keys.

for some reason, i've always loved keys, and efficiency. Got a Brother electric typewriter in ~1986. (First computer use is ~1990. My first computer is ~1991.) Was QWERTY typist. Switched to Dvorak ~1993. Wrote my own Dvorak layout for Mac OS using ResEdit, ~1993. Use QuicKeys from ~1992 to 2002, and had IJKL keys as cursor movement. First emacs use ~1998. Live in emacs starting 1999. From 1999 to 2005, i use default emacs keys, and use emacs in text terminals exclusively. Have always explored all keyboard shortcuts in every OS/App i've used. ErgoEmacs keybinding started in 2007. Starting in 2007, i got really heavy with keybinding design and spend hours every month, studying, thinking, researching, tweaking, keys. LOL. The experience is sometimes frustrating, because the keyboard itself is so badly designed (➲ Keyboard Hardware Design Flaws), and then ALL the keyboard tools, counting emacs and {Windows, Mac, Linux}, all have quirks that doesn't let you do certain bindings. So, when thinking about optimal key placement, you have to consider lots aspects. (preferrably, you want your bindings to work on all OSes, and on all keyboards (e.g. some don't have Menu key or RWin key, then there's Difference Between Apple and PC keyboards.), and also generally compatible with existing conventions, minimize using advanced features of keymacro utils (because some key combo won't work in another OS).), and then muscle memory change is a pain. So far, i haven't explored much of Linux's keyboard system. Did spent a month on linux last year. The keyboarding issues there isn't roses.

Here's 2 lines i added to my AutoHotkey:

#IfWinActive ahk_class Emacs

CapsLock::Send ^2 ; call Ctrl+2
Esc::Send ^g ; call C-g

The 【Ctrl+2】 in MY emacs customization is a prefix to commands that insert unicode. See: xah_emacs_unicode_input.el.

What Keyboard You Use and How Much You Type, Really?

Note: when we talk about keybinding, keyboarding habit, etc, it's important to say what keyboard one actually use, and how much one really types (from stat of a keylog). Otherwise, there's a lot miscommunication in online forums. One person says X, another can't see how X would be good, and it turns out one is using laptop keyboard and another fancy Kinesis, etc.

Also of interest is how much one really types. We often hear “I sit on computer 10 hours a day for n years, and i think the keybinding/keyboard should be this or that way”. We coders all sit in front of comp all day. I did a calculation from my keylog last year to see how much i really typed. I was surprised to find that i actually type only 17k keystrokes a day, and that's only about 70 minutes per day if we use 50 wpm. See: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?.

The keyboard i currently use is Microsoft Natural Multimedia keyboard.

Ruby is Just Fantastic

Ruby is Just Fantastic

Ruby is just fantastic. Spent a total maybe 4 hours in past days reading its doc/tutorial. Far better than python and perl.

my feeling is exactly the same as Steve Yegge blog on Ruby. Don't like perl? there's python. Why O Why the world needs Ruby? Then, you learn a bit about Ruby and it just blow python and perl off the earth. No wonder it rose up among so many coder geeks. Plus, its doc and tutorial is beautiful. Unlike the perl cult fuck littered with inane litanies, or the python fucks with “comp-sci R Us” incomprehensible fuck.

to be sure, Ruby lang is not too diff from perl/python. If you are a lang aficionado, and already know one of {perl, python, php, javascript}, then there's really not much new in Ruby. You better off to pick up {OCaml, Haskell, Mathematica, erlang, …}.

search Yegge on Ruby to read his blog.

i'll be working on Xah Take of Ruby tutorial now. Starting with strings, perhaps today.

Perm URL with updates: http://xahlee.org/UnixResource_dir/writ/why_not_Ruby.html

Emacs Tip: Make Menu Key Do M-x

(global-set-key (kbd "<apps>") 'execute-extended-command) ; make the menu/apps key do M-x

this is default on linuxes.

Of you linux users, do you use M-x more often or Menu key to call command by name?

New Emacs Wiki: wikemacs.org

A new emacs wiki http://wikemacs.org/

started by Bozhidar Batsov (who brought us emacs prelude pack.)

Help contribute!

(also thanks to Alex Schroeder for the huge work on http://www.emacswiki.org/ since about 2005!)

I'd much prefer Wikipedia style, the content as well as Wikimedia software. Emacswiki (EW) is just chaotic and often incorrect or outdated info, and there's no impetus to fix those while as a wiki it does have the power to.

for example, while i was looking at yasnippet ~2007. I discovered there's quite a lot template systems already, some are bundled in emacs. Thanks to EW for that. However, aside from just a list of names, it's impossible to know much of anything. I spent a day diving among the chaotic info on EW. If it was like Wikipedia, then, in a hour i'd have read a summary of all template systems, know which exactly are bundled, when, in what emacs version, and also get a summery of their differences, their feature set, and code samples on defining a template with each.

A wiki system can do this, and you all will contribute. Just look at how great Wikipedia have become, its quantity and quality. But i don't understand why Alex refuse to do this. He does not have actually to do anything, all he simply have to do is to edit his guideline/mindset, so all contributor can follow towards that automatically and naturally. He somehow have a mindset that ANY thing ANY user add there is FINE. That's the problem.

(i have written a summary of yasnippet and a couple other entries on EW in the past, trying to summarize it well in Wikipedia style… but rarely do it because either it bit rots or became just more chat again after a while)

the second issue is the wiki software… but that's less important. IF wikimedia (or other more powerful) software is used, then we could have a separate talk/discussion page, or even a entirely separate forum system. Sticking with one-man oddmuse software just won't scale.

Keyboard Evolution: Zoom Button, Dedicated Keys

Logitech Wave Keyboard zoom button
Zoom rocker button on Logitech Wave Keyboard. amazon
ms n4000 keyboard zoom slider
The Zoom Slider on Microsoft 4000. amazon img src

read more at http://xahlee.org/kbd/zoom_button_in_keyboard.html

2012-03-26

Perl Documentation: The Key to Perl

Perm URL with updates: http://xahlee.org/perl-python/key_to_perl.html

So, i wanted to know what the option perl -C does. So, here's perldoc perlrun. Excerpt:

    -C [*number/list*]
         The -C flag controls some of the Perl Unicode features.

         As of 5.8.1, the -C can be followed either by a number or a list of
         option letters. The letters, their numeric values, and effects are
         as follows; listing the letters is equal to summing the numbers.

             I     1   STDIN is assumed to be in UTF-8
             O     2   STDOUT will be in UTF-8
             E     4   STDERR will be in UTF-8
             S     7   I + O + E
             i     8   UTF-8 is the default PerlIO layer for input streams
             o    16   UTF-8 is the default PerlIO layer for output streams
             D    24   i + o
             A    32   the @ARGV elements are expected to be strings encoded
                       in UTF-8
             L    64   normally the "IOEioA" are unconditional,
                       the L makes them conditional on the locale environment
                       variables (the LC_ALL, LC_TYPE, and LANG, in the order
                       of decreasing precedence) -- if the variables indicate
                       UTF-8, then the selected "IOEioA" are in effect
             a   256   Set ${^UTF8CACHE} to -1, to run the UTF-8 caching code in
                       debugging mode.

         For example, -COE and -C6 will both turn on UTF-8-ness on both
         STDOUT and STDERR. Repeating letters is just redundant, not
         cumulative nor toggling.

         The "io" options mean that any subsequent open() (or similar I/O
         operations) in the current file scope will have the ":utf8" PerlIO
         layer implicitly applied to them, in other words, UTF-8 is expected
         from any input stream, and UTF-8 is produced to any output stream.
         This is just the default, with explicit layers in open() and with
         binmode() one can manipulate streams as usual.

         -C on its own (not followed by any number or option list), or the
         empty string "" for the "PERL_UNICODE" environment variable, has
         the same effect as -CSDL. In other words, the standard I/O handles
         and the default "open()" layer are UTF-8-fied *but* only if the
         locale environment variables indicate a UTF-8 locale. This
         behaviour follows the *implicit* (and problematic) UTF-8 behaviour
         of Perl 5.8.0.

         You can use -C0 (or "0" for "PERL_UNICODE") to explicitly disable
         all the above Unicode features.

         The read-only magic variable "${^UNICODE}" reflects the numeric
         value of this setting. This variable is set during Perl startup and
         is thereafter read-only. If you want runtime effects, use the
         three-arg open() (see "open" in perlfunc), the two-arg binmode()
         (see "binmode" in perlfunc), and the "open" pragma (see open).

         (In Perls earlier than 5.8.1 the -C switch was a Win32-only switch
         that enabled the use of Unicode-aware "wide system call" Win32
         APIs. This feature was practically unused, however, and the command
         line switch was therefore "recycled".)

         Note: Since perl 5.10.1, if the -C option is used on the "#!" line,
         it must be specified on the command line as well, since the
         standard streams are already set up at this point in the execution
         of the perl interpreter. You can also use binmode() to set the
         encoding of an I/O stream.

reading that is like a adventure. It's like this:

The -C is a key to unlock many secrets. Just get it, and you'll be all
good to go, except in cases you may need the inner key. You'll find a
hinge in the key, open it, then there's a subkey. On the subkey,
there's a number. Take that number to the lock, it will open with
keyX. When you use keyX, it must be matched with the previous inner
key with 8th bit. keyX doesn't have a ID, but you can make one by
finding the number at the place you found the key C. Key C is actually
optional, but when inner key and keyX's number matches, it changes the
nature of the lock. This is when you need to turn on keyMode …

Spamlicious: Buy Twitter Followers

Perm URL with updates: http://xahlee.org/w/buy_twitter_followers.html

buy twitter followers screenshot 2011-07-17
Buy twitter followers screenshot, taken on 2011-07-17, from a website (spam, blackhat seo). (Full sceenshot: )

2012-03-25

Movie John Carter (2012)

John Carter (film).

The film is currently (unadjusted for inflation) one of the biggest box office bombs in film history, with a total net loss of $115,553,000.1

lol. But the trailer is pretty cool. Especially the second one.

Movie John Carter trailer.
Movie John Carter full trailer.