2010-09-04

RSI, emacs, or just too much typing?

My left wrist is whacked. No pain yet, but something is getting serious wrong.

Couple weeks ago, i wrote long about my realization that the problem was the left hand wrist motion to press the 1, 2, Tab etc keys by the bad habit using my index finger. (causing excessive side-to-side wrist motion) (see: Left Wrist Motion Pain; vi Esc key Syndrome.)

I made lots of changes in my habit and keybinding. I learned a whole lot more intricate detail about keyboards and habits, and things are going well; no more tingling sensation, because i have not moved my wrist from side-to-side, not a bit, even i still type many hours a day.

But this morning when i woke up, my left forearm, the area under it, there's some auto-twitching going on. Very slight, some vague sensation best described as tingling goes along with it, and i know it is BAD. I think because i typed too much yesterday.

I realized that i was wrong to think that side-to-side wrist motion was the only cause of my problem. APPPARANTLY, LEFT HAND'S THUMB BENDING INWARD TO HOLD THE ALT KEY can also cause a problem if done too much.

At the moment, i'm not sure i can pinpoint any particular habit or keybinding motion to blame. I type on Dvorak, and Dvorak uses right hand keys 14% more than left. But i don't have any problem with my right hand at all (PS, when writing this paragraph, i just realize that i always use my left hand to type the space bar. That could explain it!)

Am sending this out here as a warning to anyone who does heavy typing. Apparently, ErgoEmacs's ways of using Alt cannot solve prolonged typing.

perm url: Left Wrist Motion Pain; vi Esc key Syndrome.

2010-09-03

Programer Celebrities; Styles and Tack

Perm url with updates: http://xahlee.org/UnixResource_dir/writ2/programer_styles_and_tack.html

Programer Celebrities; Styles and Tack

Xah Lee, 2010-09-03

Xah Lee wrote:

Verdict: yay for Clojure!

On 2010-09-03, Pascal J Bourguignon wrote:

Whatever.

But judging from your “how to get list of vectors with value from file content...” question, one would think that after all the years you've been spending criticizing everything about programmers and programs, you'd at least have some sound notions of programming, but you seem actually to lack even the most basic programming notions.

lol Pascal.

asking simple language questions is no indication of one's knowledge in computer science nor expertise of the language.

Knuth, if he were to program in say java, lisp, javascript, php, or even html, he probably would be a beginner. But nobody would doubt his expertise as a computer scientist or a programer.

Same can be said for many language inventors, e.g. Larry, Guido, Wolfram, .... Except in the first few years where whole team is just the inventor, each is certainly no longer the top most expert of that lang, and they can ask a lot technical questions.

When a person becomes famous, there's the question of whether he'd ask trivial questions in public. For example, suppose you became a famous computer scientist, or mathematician. But, in today's world, you wouldn't know the most basic things about thousand subjects that's related to your field. e.g. Would Knuth ask basic html questions in some public place if one day he happens to need to write a line of html? On one hand, a highschool student can probably answer his question that otherwise he might spend few hours to dig into documentations, tutorials, etc. On the other hand, one might think: “jesus, Dr Knuth is asking a basic question about html??”.

Can you see the dilemma?

There's perl, python, php, javascript, java, c, c++, bash, html, css, Mathematica, ... langs, and hundreds thousands other tech and protocols etc. Each, mostly has a inventor, and for our purposes, they are celebrities. Each of them, do NOT have a BASIC understanding of the hundreds other langs, protocols, technologies. But due to their work, they probably have questions or curious about them everyday. Now, if you are one of these celebrity, would you, take the 5 min and get your question answered in some public social networking site such as online chat, irc, stackoverflow, or, are you the type that would try to spend few hours by yourself on it, or ask only your close friend and colleagues, in the name of public perception?

Now, think of a famous computer scientist or celebrity programer you know, and tell me if that person is the keep-to-self type or freewheeling ask-around type?

I've thought about this, and have tried to observe what celebrities do. My observation is that there's no universal behavior pattern, and it basically came down to personality. Some such celebrity, would never ask any such question in public, and tend to keep a “professor” public image. While on the other extreme, especially in the last 10 years due to the effect of the internet and communication tech on society, don't care and feel free to ask questions in public. (e.g. some such computer scientist and mathematicians openly write blogs, filled with questions that are basic outside of their very narrow speciality, or even something they should totally know but forgotten (frankly, doesn't matter how good is your memory, you probably forgot say 1% of what you know about a lang or field of study. Do you, remember the calculus you learned in highschool? or a philosophy course or a history course? But you can still be a award-winning mathematician, programer, writer, lawer, director, right? ))

what would YOU do, Pascal? are you the type who never do thought-flow in public?

also, keep in mind that the act of asking question, has social functions other than getting a technical answer. This is a big part of blogging and the web social networking is about.

if you have actually read much of my writings, do you, truely believe, that my understanding of lisp is such that i wouldn't know or unable to find out how to get a file content in one closed form functional line, or that not knowing about “vector” function in emacs lisp conflict with anything i criticized in computer science, languages, software engineering, or the programer culture?

today, i put on my blog the nice function you and TheFlyingDutchMan supplied: xahlee.blogspot.com elisp-read-file-content-in-one-shot.

note there is the other, almost identical, function:

(defun read-lines (filePath) 
  "Return a list of lines of a file at FILEPATH." 
  (with-temp-buffer 
    (insert-file-contents filePath) 
    (split-string (buffer-string) "\n" t)))

which i wrote about 2 years ago, that appears in one or more of these pages:

waybackmachine can be used to verify it.

i asked the question because i was tired, and i feel it is good to ask. It spurs conversation, as well as helping me. And it is certainly true, that my emacs lisp know-how, is below yours, or most of the emacs developers who frequent emacs newsgroups.

even though i criticize a lot of things, but more so there's much more i don't know. Though, i try to keep the degree of my criticism proportional the level of a thing that i do know. (albeit with wild hyperbole at times :D )

So unless you stop writting inflamatory articles (you could even retract all the past ones) and start to spend serious time _learning_ programming, you're totally disqualified to say anything about programming languages.

I would advise you to study "How to Design Programs" http://www.htdp.org/

O, good old newsgroup style. In return, I recommend you to read xahlee.org.

Celebrity Styles

On 2010-09-03, Marc Mientki 〔mien...@nonet.com〕 wrote:

How can I understand it???

By unstanding The Tao of Zen ☺

btw, Rich Hickey has a vid here: Are We There Yet? (2009-11-12) By Rich Hickey. Source www.infoq.com

it's over 1 hour long.

actually it's quite boring to watch. I watched the first 30 min but got bored.

nevertheless, it's a nice video, and i enjoyed it. And he's a nice guy. (it's funny that Whitehead seems to be his personal hero.)

PS ... i'm usually a observer type. So, when watching this video, i cant help but compare the different style, personalities, of various celebrities. i've watched a few in past years, some i blogged about, e.g.

writing this reminds me of a talk given by Linus about git that i watched on google vid... Linus has a flamboyant, charismatic style, but is also a easy going type of guy. (e.g. in our context, he'd probably ask any simple question that pops up in his mind) Compare to Neal Stephenson, which is quite up-tight and exceedingly boring to watch. Yaron Misky above, is quick and fast... and there's Richard Stallman, who's public lecture style can be said to be more methodological...

(btw, Linux's git talk totally sold me on git; but more significantly, by his talk it dawned on me that the greatness of distributed revision systems is not about being non-centralized, but the agility to move and grow and evolve locally with global impact.)

Being Humble and Tactfulness

On 2010-09-03 Pascal J Bourguignon wrote:

The problem is not that you didn't know insert-file-contents or similar functions.  This is indeed natural and it's on the ignorance of this that I judge your programming skills.

It's on your use of sequential assignments and copy-and-paste for a repetitive job.

you see, Pascal, i've been trying to be more tactful in recent months. You know? like not being a cold critical ass, and to engage people in a direct and more personal, friendly way.

are you sure, that your writing off of me, is justified?

because i humbly asked a question, now comes the baggage of incompetence to fend off?

because i posted a quick question, now i'm accused that my coding style is copy-and-paste and “sequential assignments for a repetitive job”?

loly.

although i try to be more tactful, but i reserve the right to remain Xah, at least in spirit, and hope not to become some smooth politician always with round-about non-specific all-pleasing expressions. y'know? the wisdom we hear about “just be yourself”, right? ☺

so now, instead of bouncing you off with pompous philosophy, rude logic, fully decorated with expletives, i take the more mild approach, of teaching you things that i see you don't know. (oh god! i fucked it up! i've just been demeaning, stepped on all the rules about friendship n leadership n persuasion principles in every book. Oh GOD, i'm such a fucking failure!)

So let me teach you: To be humble is to ... (i dunno. (be yourself?))

haha. Actually, never mind any of that. I'm just all bullshitting. ☺ One thing i learned is that, being too serious at all times isn't a good thing.

Computer Keyboard Gallery

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

Computer Keyboard Gallery

Xah Lee, 2006-06, 2010-09-03

I'm a computer programer, and sit in front of a computer for more than 8 hours a day every day since about 1990 (this usually includes weekends as well as holidays). I'm also a efficiency nerd and has a untold infatuation with computer keyboards. I have read almost all popularly published reviews of keyboards or special input devices (mostly in MacUser and MacWorld magazines during ~1990-1997), as well as tried them whenever i had a chance, as well software related input issues such as The Dvorak Keyboard Layout, keyboard remap codes on various operating systems, different keyboard shortcuts and macros softwares on different operating systems. This page is some haphazard commentary on computer keyboards, the keys, their layout, and the design, accompanied with photos of them.

Generic PC Keyboard

I have a keyboard love. Every time i go to a computer shop, i would try my hands on all their input devices on display. In particular, computer keyboards. Loitering in the store for 30 min on keyboards is not unusual.

Before i started to use a split-keyboard in ~2005, i actually find that the best keyboard are the cheapest, generic PC keyboard. They are functional, clean design, sturdy, cheap ($10) and replaceable, good tactical feedback. They don't have weird shapes, weird tactile feel, a bunch of ugly buttons and knobs.

(I do, however, believe in extra application launch buttons, volume control knob, embedded pointing device, but many designs on the market are a turn off).

generic PC keyboard

A Generic PC Keyboard. left side closeup.

generic PC keyboard

This keyboard i used in the period 1999-2002. A ergonomic habit i have is to have 2 or 3 stacks of books placed together in front of the keyboard, so that they form a rectangular platform of 3 to 4 cm in height. When typing, i rest my forearms on the books, so that my wrists do not bent upwards. Here's a photo showing this keyboard in my office, and the books i have in front as wrist pads.

Note the Power management keys on the top right of the keyboard. These I actually never used.

Note the PrtScn (Print Screen) key, SysRq (System request) key, ScrLk (Scroll Lock), Break keys. These keys are historical relics and are more or less defunct today, except the Print Screen key that is often used for creating screenshots in Microsoft Windows.

Here's a summary of what these keys are, based on Wikipedia:

  • PrtScn: In 1990s or earlier, it sends the screen's text into a serial port. Literally, causing the screen to be printed. (at the time, most monitors can only display text.) Today, this key is used in Windows and Linux to do screenshot (copy screen bitmap into the clipboard). This key is not used on the Mac.
  • SysRq (System request): This key causes a interrupt to the operating system. It is kinda like the role of today's Control-Alt-Delete on Windows. However, this key is pretty much defunct today.
  • ScrLk (Scroll Lock): Pretty much a defunct key today. Used to toggle the behavior of arrow keys so that, when ScrLk is on, the up/down arrows scrolls the window.
  • The Pause and Break are 2 keys. They are pretty much defunct today. They were used for sending a interrupt signal of sorts, as today's more familiar 【Ctrl+c】 on PC and 【Cmd+.】 on Mac.

Microsoft Ergonomic Keyboards

Since 2005, i have adapted to the split-keyboards and find Microsoft keyboards the best.

I used to hate split keyboards. I bought a Microsoft Ergonomic Keyboard in 2005 because during that year i was using a laptop 8 hours a day, and my wrists and fingers are starting to feel weird. Once i adopted the split keyboard, i never went back to one-piece keyboards. If i type on a one-piece keyboard for even a minute, i feel discomfort in how it bends my wrists.

Microsoft Natural Multimedia keyboard

The Microsoft Natural Multimedia Keyboard, introduced in 2004. (Review)

Mirosoft's split keyboards is of a fantastic design. Besides splitting the key set and angle them for the wrists, other notable features is the modifier keys placed in symmetrical distance from the index finger keys, and in sizes about 4 times as large. This is fantastic if you are a programer and uses Emacs.

The top has a row of special buttons that provides one-button launching/switching to applications — extremely convenient. They can be reset to any application you choose thru the bundled software Microsoft IntelliType Pro. (Comes in a Mac version too. I use this keyboard on Macintosh computers) The middle is the music-playing program control, also extremely useful. I can just play/stop/skip songs without switching into the music player.

(Note: Even before i used a keyboard with such extra app-launching-keys, i've always have assigned the functions keys to launch applications. So, in my work day, i switch among applications by single key presses. (as opposed to using the mouse, or tabbing thru the app-switching mode))

A minor bad point of this MS keyboard is that the function keys are arranged in 2 continuous rows, instead of traditionally separated into 3 blocks of 4 keys each. The continuous placement makes it difficult to touch-type the function keys in the middle of the blocks.

Microsoft Natural Ergonomic Keyboard 4000

The Microsoft Natural Ergonomic Keyboard 4000, introduced in 2005. (review) amazon

Microsoft Comfort Curve keyboard 2000

Microsoft Comfort Curve keyboard 2000. (review) amazon

  • “Microsoft Wired Natural Keyboard Elite” amazon

The F-Lock Key Problem

Apple Keyboards

Apple iMac Keyboard A1242

Apple's keyboard as of 2008. Image Source

  • “Apple Wireless Keyboard” amazon
  • “Apple Aluminum Wired Keyboard MB110LL/A” amazon

Full review: Apple Keyboards.

Sun Microsystem's “Type 6” Keyboard

Sun Microsystem's Keyboard

Sun Microsystem's “Type 6” Keyboard.

Full review: Sun Microsystem's “Type 6” Keyboard.

Kinesis Contoured Keyboard

Kinesis Contoured keyboard

The Kinesis contoured keyboard. Source Kinesis keyboard

Full review: Kinesis Contoured Keyboard Review and RSI.

The Idiocy of Hacker Keyboards

happy hacking keyboard lite2

The Happy Hacking keyboard, model lite 2. image source Happy Hacking Keyboard

Full review of several weird keyboards: The Idiocy of Hacker Keyboards.

Misc

Here's a interesting site that gives a fairly comprehensive images of the keyboard hardware key layouts for about 20 manufactures. A Gallery of Layouts of Actual Computer Keyboards.

Sun Microsystem's “Type 6” Keyboard

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

Sun Microsystem's “Type 6” Keyboard

Xah Lee, 2006-06

Sun Microsystem keyboard is one of the worst. The following shows the one that is the keyboard for Sun's Ultra 5 computer (circa 2000).

Sun Microsystem's Keyboard

Sun Microsystem's “Type 6” Keyboard.

Sun Microsystem's Keyboard

This keyboard's got 2 columns of special keys on the left. Also note, the Caps Lock and Control keys are swapped. And, it has a big Help button on the top left, and a blank key. (If you think that putting Control left to A is good, see: Why You Should Not Swap Caps Lock With Control.)

I hardly ever use this keyboard or sit in front of this computer. So i don't know what these keys actually do. I don't think most of these special keys do anything useful. Most of the time, i just telnet/ssh from the PC running WindowsNT, using the generic PC keyboard. This Ultra5 is used as a server, it is one of the test bed for releasing our web-based software.

Sun Microsystem's Keyboard

Note the Compose key and Alt Graph keys. I've never used it. In writing this page, i learned that they are used to type special characters such as éäç¡£¥© etc. The key marked with a diamond (◆) is the Meta key, a key inherited from Lisp Machine's keyboards and today mostly known for its use in Emacs. This special modifier key is similar to the Command key (⌘) on Apple's computer's keyboards, or the Windows key on PC keyboards.

More photos: Mid section close-up, The Compose, Alt Graph keys, Top indicator LEDS, Number pads.

For some photos of lisp machine's keyboards, see: Why Emacs's Keyboard Shortcuts Are Painful.

elisp: read file content in one shot

Here's a short elisp example to get file content into a string.

;; thanks to “Pascal J Bourguignon” and “TheFlyingDutchman <zzbba...@aol.com>”. 2010-09-02
(defun get-string-from-file (filePath)
  "Return FILEPATH's file content."
  (with-temp-buffer
    (insert-file-contents filePath)
    (buffer-string)))

And, remember, you can also get them into list of lines.

(defun read-lines (filePath) 
  "Return a list of lines of a file at FILEPATH." 
  (with-temp-buffer 
    (insert-file-contents filePath) 
    (split-string (buffer-string) "\n" t)))

For more about processing a file line by line, see: Process a File Line by Line in Emacs Lisp.

2010-09-01

emacs: select current line with single command

Previously, we've covered Single Command to Delete Whole Line and How to Copy/Cut Current Line. But what if you want to select the current line with a single command? Very short, like this:

(transient-mark-mode 1)

(defun select-current-line ()
  "Select the current line"
  (interactive)
  (end-of-line) ; move to end of line
  (set-mark (line-beginning-position)))

This is added to Emacs Lisp Examples, check it out for other useful exmaples.

Chinese Input with Dvorak Layout (Microsoft Pinyin IME)

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

Chinese Input with Dvorak Layout (Microsoft Pinyin IME)

Xah Lee, 2010-08-30

If you type Chinese, but also uses the Dvorak Keyboard Layout, how do you get the Chinese input using Dvorak layout?

Here's the answer for Microsoft Windows.

Press 【Win+r】 then type “regedit”. Then, go to the folder in this path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000804

That's the folder for Chinese simplified.

In the one named “Layout File”, change the value to “KBDDV.DLL”

Then, restart Windows. (relogin might also work.)

Chinese Dvorak Microsoft IME

Microsoft Registry showing the Chinese (simplified) input method.

Here's the folder name for some other languages.

LanguageFolder NameOriginal “Layout File” value
Chinese Simplified000000404KBDUS.DLL
Chinese Traditional000000404KBDUS.DLL
Japanese00000411KBDJPN.DLL
Korean00000412KBDKOR.DLL

Before you change, write down the original value, just in case you want to change it back.

Reference: 〈Not all keyboards are included in MSKLC's lists〉 (2005-04-16), by Michael S Kaplan. At: blogs.msdn.com/b/michkap. (Note that Michael is the one who created the〈The Microsoft Keyboard Layout Creator〉 at msdn.microsoft.com. )

Was this page useful? If so, please do donate $3, thank you donors!

google public dns server

Have problems with your dns server? use google's! Google has a public dns for this purpose. “8.8.8.8” and “8.8.4.4”. See: http://code.google.com/speed/public-dns/.

2010-08-31

Poynter Institute, Language Log, Grammar

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

Poynter Institute, Language Log, Grammar

Xah Lee, 2010-08-31

Discovered the Language Log few months ago, but only started to read it this week.

today's article:〈The Glamour of Grammar〉 (2010-08-31), by Mark Liberman. At: http://languagelog.ldc.upenn.edu/nll/?p=2596

I don't think i like the Roy guy. Idiotic. All he got to say is how much he's respected.

The first other article i checked out is:

〈Slippery glamour〉 by Mark Liberman, at http://languagelog.ldc.upenn.edu/nll/?p=322

Very nice work.

I went to look at Mark's bio, ( http://www.ling.upenn.edu/~myl/ ) a professor of University of Pennsilvania. Departmet of lingusitics. NICE. No wonder he makes sense on english.

I felt eager to share my view of sides here, albeit only have read 2 articles above thus far, but at the moment i went on and read some more. This one:

〈Don't tell Sister Catherine William〉 (2008-07-05), by Mark Liberman, at: http://languagelog.ldc.upenn.edu/nll/?p=323

Is also very nice. This one, on matters of relations of linguistics, generative grammar, descriptive school of thought, even i, can catch with his pants down, if i were to see it first. (but then, if i were, i probably would have been swerved by the highness oozing out of “Poynter Institute.”.)

What infuriate me the most is the tendency to throw names, jargons, empty fluffs. (See: Politics and the English Language.)

What a idiot: “O! but i am respected i sell million copies of my writing book to journalists...”.

Maybe it's too quick to judge a man out of just 2 articles? I dunno, but i wonder how many thousands of journalists'n'writer wanna-be idiots have been suckered up into the writing establishment guilds.

For u writers out there, a lil advice from the redoubtable Xah Lee: study mathematical logic, study linguistics, if you want to improve your writing. Don't, ever, think about anything “grammar”. Fuck it.

Was this page useful? If so, please do donate $3, thank you donors!

Best Input Devices (Jog/Shuttle, Touchpad, Cyborg Mouse, Pen Tablet)

Perm url with updates: http://xahlee.org/kbd/input_devices.html

Best Input Devices (Jog/Shuttle, Touchpad, Cyborg Mouse, Pen Tablet)

Xah Lee, 2010-08-31, 2010-11-05

Discovered quite a few excellent input devices. Here's a quick list and comment.

Cyborg RAT 5 Gaming Mouse

Cyborg RAT 5 gaming mouse 2-s

Cyborg RAT 5 gaming mouse. amazon

“Cyborg RAT 7 Gaming Mouse Reviews”

The Cyborg is probably the best mouse, regardless whether you use it for gaming or not. It's got 7 customizable buttons; standard scroll wheel, but plus a thumb scroll wheel! Says some incredible dpi but i never care about the dpi much as long as it is decent.

Who Needs 7 Buttons and 2 Scroll Wheels?

I do, even for normal work that's not a game.

I'm a functional guy. What i like most about this mouse is 7 programmable buttons and 2 scroll wheels. My current mouses both have 5 buttons. (i use 2 mouses at all times, one for each hand, whichever comes natural. Been using 2 mouses since mid 1990s.) Both of my current mouse has 5 buttons. But that's not enough!

Suppose you are in a web browser. The left is click, and right is contextual menu. The middle button can close a tab, or it can open a link in a new tab. This is more convenient than using one hand to hold Ctrl and the other hand to click. The 4th and 5th button are for page back/forward.

So there, all used up. What more do i want? I want 2 more buttons to switch to next/prev tab, to begin with.

(you might think you don't need the right button and can set it to something else. Actually you do, few times a day. e.g. to copy the link url, to right click on toolbar, or in Firefox to use some of the extensions. No, the right-click functionality cannot be done with Control+Click nor by the Menu key.)

Is This Mouse Good?

As of 2010-11-05, according to amazon reviews, this mouse may not be so good. (read those 1 star or 2 star reviews) It's perfect in hardware, but software is bad. • It has tracking issues. • The bundled software sucks. • Not comfortable for small hands, and hard to lift. • It does not work in Mac OS X.

For more mouse reviews, see: Review Of Gaming Mouses.

Contour Design's Jog/Shuttle Control

shuttle pro 2 controller

“Contour Design's Shuttle Pro 2” amazon

See: Why You Need a Jog-Wheel and Shuttle Control?.

Apple's Magic Mouse

Apple magic mouse

“Apple Magic Mouse” amazon Source

Apple Magic Mouse. The entire surface is smooth. No buttons. No scroll wheel. It works by touch sensitivity, like a touch pad. And you can use “gestures”. For example, to left click, tab on the left side with one finger. To scroll, move your finger on the surface up or down. To zoom, touch the surface with two fingers and widen your fingers.

Apple magic mouse

Is this good mouse? No. If you want to impress your friends, yeah. If you want it for industrial use, e.g. heavy gaming, long hours in image-editing or editing in 3D Modeling Software, it would suck badly.

Apple Magic Trackpad

Apple magic trackpad 2

“Apple Magic Trackpad” amazon Source

The Magic Trackpad is just a large trackpad. That's all. I wouldn't say a trackpad is good replacement for a good mouse in general.

Every few years, Apple comes out with shiny and novel toys. Actually i don't recommend them. If you are a casual computer user, yeah Apple's input devices look great and work well. If you are in any way using the computer professionally, such as serious gaming, Photoshop or visual artist, creating 3D Models, or programing (heavy Emacs or keyboard Macros use), Apple's creative input devices are usually less efficient and less ergonomic than the humble homely standard ones.

See also: Apple Keyboard Reviews.

Wacom Pen Tablet

Now, if you do a lot image editing or drawing, you need a pen tablet, absolutely. This is something i can recommend.

  • “Wacom Bamboo Pen Tablet” amazon

What About the Best Keyboard and Trackball?

Just to be complete… the best keyboard, gaming or not, to me, is “Microsoft Natural Ergonomic Keyboard 4000”.

O wait, actually, i think the best is Kinesis Contoured Keyboard, but i never actually owned it.

The best trackball, is probably the “CST's 5-button L-Trac high performance laser optical trackbal”. Reviews here: Best Trackball Mouse.

CST2545-5W trackball

“CST's 5-button L-Trac high performance laser optical trackball” amazon

and i truely recommend the Logitech G13 Advanced Gameboard, if you are a gamer or programer, who must have extra buttons. And no, i don't want 【Ctrl+Meta+Shift+Alt+@】. I want single goddamn key. I rather have 30 extra keys than 5 more modifier keys. All seriously, for example, i have setup AutoHotkey so that i press a single key for 【Alt+Ctrl+Tab】 or 【Alt+Ctrl+Shift+Tab】 or 【Win+Ctrl+Shift+Tab】 or 【Alt+Tab】 or 【Alt+Shift+Tab】. And i have single key for 【Ctrl+PageUp】 and 【Ctrl+PageDown】. And no, i don't want Apple's reductionism rectangular array beautiful shit. I want my buttons to be different shapes, in separate clusters, and curved. A airplane cockpit is a good example that illustrates practical functionality and efficiency. Just imagine, if Apple designs a cockpit, all the controls and knobs become one neat rectangular array of identical buttons. (see: Keyboard Shortcut Design: Dedicated keys, Special Buttons, Extra Keys.)

logitech g13 gameboard 2-s

“Logitech G13 Advanced Gameboard” amazon

There, i covered it all. Buy them all!

PS how could i have forgotten headset and web cam? Oh well, for headset i recommend “Sennheiser PC151 headphone” amazon. See: Gaming Headset Reviews.

Microsoft LifeCam Cinema

“Microsoft LifeCam Cinema” amazon.

For webcam i recommend: “Microsoft LifeCam Cinema”.

book citing xahlee.org

Discovered a book citing my site. 《Enterprise Interoperability II: New Challenges and Approaches》 amazon (2007), by Ricardo Jardim-Gonçalves, Jörg P. Müller, Kai Mertins, Martin Zelm. . Cites: What is Expressiveness in a Computer Language.

More at: Printed Citations to XahLee.org.

FireFox spellchecker addon

Perm url with updates: http://xahlee.org/js/blog.html

Discovered a FireFox extension that lets you spell check the window (whole window, not just inside input text boxes). This is useful when your a developing a website. https://addons.mozilla.org/en-US/firefox/addon/11259/.

2010-08-30

Dvorak, Matron, de-ergo, NEO, Colemak, Programer Dvorak, Keyboard Layouts Fight!

Perm url with updates: http://xahlee.org/kbd/dvorak_and_all_keyboard_layouts.html

Dvorak, Maltron, Colemak, NEO, Bépo, Turkish-F, Keyboard Layouts Fight!

Xah Lee, 2010-08-30, …, 2011-03-02, 2011-06-10

Noticed that today there are a lot of keyboard layouts. There's your QWERTY, and there's Dvorak. That's good enough, right? No. Apparently, a lot people are making a lot layouts. Some are specialized on a particular language (e.g. German, Spanish, Portuguese, French), some aim for easier transition from QWERTY, some are designed for programers.

Here's a list of them.

QWERTY

The good old QWERTY, always around when u don't need it.

    qwert yuiop []\
    asdfg hjkl; '
    zxcvb nm,./

Dvorak

My favorite.

    ',.py fgcrl /=\
    aoeui dhtns -
    ;qjkx bmwvz

Dvorak becomes a ANSI (American National Standards Institute) standard “X4.22-1983” and “X3.207:1991”.

Following is the numbers row of the original Dvorak design, but is not in the ANSI standard and is not widely used.

    75319 02468

Microsoft is probably the first OS to include Dvorak out of the box, sometimes in mid 1990s. Mac didn't include one until Mac OS 8 or 9, in late 1990s.

For more about Dvorak, see: Dvorak Keyboard Layout.

Maltron

The Maltron keyboard is actually a keyboard hardware. Its design shape is similar to Kinesis Contoured Keyboard, featuring split key clusters for each hand, bowl shaped surface, straight aligned keys, major key clusters for the thumbs (Enter, Delete, Space, …).

The company created its own layout the Maltron layout; design goal is similar to Dvorak. But their keyboard hardware also support QWERTY and Dvorak. maltron.com.

    qpycb vmuzl
    anisf dthor
    .,jg, ;wk-x
       e

If you are wondering about that odd “e”, that's one of the key for the left thumb cluster. Other keys for the thumbs are Space, Enter, ⌫ Backspace, ⌦ Delete, ↹ Tab, arrow keys, Home, End, Page Up, Page Down.

maltron usb dual l90 uk mac dvorak 1-s

Maltron keyboard with Dvorak layout.

One problem Maltron never appealed to me is because the keyboard is quite ugly. Also am not sure why they have to invent the Maltron layout since Dvorak is already there, perhaps due to patent issues of the time. (according to their marketing material, the reason given was “better than Dvorak”, of course.)

Time mag actually ran a article on it in 1981. Science: The Case of QWERTY vs. Maltron (1981-01-26) at time.com

For explanations about why the thumb cluster keys are a major improvement over PC keyboard, see: Kinesis Contoured Keyboard Review and RSI.

Programmer Dvorak

Programmer Dvorak (by Roland Kaufmann at kaufmann.no) is just like Dvorak, except the following changes:

  • ① Inverted the number row “12345…” with the symbols row “!@#$%…”. To type numbers, you have to press Shift.
  • ② The number keys are re-arranged to follow the more ergonomic, original Dvorak layout.
  • ③ The symbols on the number row have also been re-arranged, probably corresponding to their frequency in programing language source code.
  • ④ Swapped the keys ' and ;.
  ~ %7531 90246 8`
  $ &[{}( =*)+] !#

I like the idea of re-arrange numbers to be more ergonomic, but am not sure about inverting numbers and symbols, nor swapping ' and ;.

I have tried the inverted number row, for a few weeks in mid 2000s, but in the end i abandoned it.

One problem is that the numbers are needed often too, especially a sequence of numbers like credit cards, ID numbers, dates “2010-08-30” or if do a lot math programing like “x^2 - 1/5 * 1.6”. But now you need to press Shift for the numbers. (Roland wrote that you could use Caps Lock, but often in programing the Caps Lock is set to Ctrl, or set other keys (emacs 【Meta+x】, or Esc, etc).)

If you have a number pad, you can always use the number pad for typing long numbers, but that also means you move your hands away a lot. (i use my number pad as extra function hotkeys)

In typical source code of popular languages, symbol characters appear more often than numbers. If the keyboard hardware is wired with inverted number/symbol row, i think i would like it. But for me it's too much trouble to adopt another non-common layout for small advantages.

For swapping the key ; and '… It is clear that ; is more frequently used in programing languages. But in English, the apostrophe ' is actually more frequent than semicolon ;. A coder still need to write plain english often, in comments, in email communication, in documentation, or blogs. Also, for me it's easier to curl in my pinky to the row below than extending it up to reach the above row. So, am not sure swapping them is a improvement.

My personal solution for programing is to have modifier keys ((Win = Super), (Menu = Hyper)), together with the home row keys, to produce the most frequently used symbols: () [] {} "" = +. The matching pairs such as paren are inserted in pairs always, and cursor placed in between. (You can get my emacs init files at: Xah Lee's Emacs Customization Files.)

Colemak, Workman, Asset, Capewell

Colemak Capewell, Workman, are supposedly more efficient than Dvorak. They all keep the ZXCV keys in the same position as QWERTY for easy transition.

Colemak

Colemak is designed for easy transition from QWERTY. colemak.com. The colemak site appeared in 2005, and is aggressively marketed.

    qwfpg jluy; []\
    arstd hneio '
    zxcvb km,./

Workman

Workman is a improvement of Colemak. It appeared in ~2010.

    qdrwb jfup; []\
    ashtg yneoi '
    zxmcv kl,./

Here's his story on why it is invented. A Different Philosophy in Designing Keyboard Layouts (2010-09-06) By OJ Bucao. @ Source viralintrospection.wordpress.com.

Asset

Asset is designed for easy transition from QWERTY. millikeys.sourceforge.net The page appeared in 2006.

    qwjfg ypul; []\
    asetd hnior '
    zxcvb km,./

The red colored keys are different from QWERTY. The Colemak has 17 keys different from QWERTY. The Asset has 14.

Capewell

The Capewell keeps the XZCV keys same as QWERTY. It is designed by Michael Capewell. The date seems to be 2005. michaelcapewell.com keyboard.

    .ywdf jpluq
    aersg btnio
    xzcv; kwh,' 

de-ergo and NEO (German)

The de-ergo layout is optimized for Germany language. forschung.goebel-consult.de de-ergo. A supposedly improved version is the NEO layout. It started around 2005. pebbles.schattenlauf.de neo layout. The following shows the NEO layout.

    qvlcw khgfj ß+
    uiaeo snrtd y#
  < öüäpz bm,.x

Neo layout seems to have a community site and seems to have some cult following. http://www.neo-layout.org/.

Dvorak-fr, Bépo, bvofrak (French)

There appears to be 2 layouts for the French language, both designed for efficiency. Both designs follow Dvorak layout principles. Both have vows on the left hand home row.

Dvorak-fr

One is called “Dvorak-fr” at algo.be dvorak-fr. This layout appeared in 2002.

  * 12345 67890 +%
  _ =/-è\ ^(`)" []
   
    :’ég. hvcmk z¨
    oaueb fstnd w~
  à ;q,iy xrlpj

Dvorak-fr has 2 other variations. “Dvorak-fr-e” for entering all euro lang characters. “Dvorak-fr-k” for the Kinesis Contoured Keyboard.

Bépo

The other is layout optimized for French is Bépo, at bepo.fr.

  # 12345 67890 °`
  $ "«»() @+-/* =%

    bépoè !vdlj zw
    auie; ctsrn mç
  ê àyx:k ?qghf

Both Dvorak-fr-e and Bépo are designed to enter most or all accented characters for other european languages.

It's interesting that both invert the number row. Their designers seem to be programers. However, they do not use the original Dvorak layout for the number keys arrangement.

Bépo is a later invention than Dvorak-fr. It claims to improve some problems in Dvorak-fr, and is more well marketed.

bvofrak

  % €0123 45678 9>
  # $=()+ -*/"« »<

    jcdhx ywpé. !k
    ntsrl oeiau ,
    fgvqm 'èbàz ç

2011-03-02 There's another French Dvorak layout, based on Bépo. http://bvofrak.blogspot.com/.

pt-Nativo (Portuguese)

“pt-Nativo” layout is a efficient layout for Portuguese language, based on Dvorak principles. It is created by Ari Caldeira, in around 2006. Home page at tecladobrasileiro.com.br.

    /,.hx wltcp ~-
    ieaou mdsrn ´'
  ; yçjbk qvgfz \

The “br-native” site is very well designed, and the author has put a lot thought about designing the layout.

Misc Other Layouts

There are also a Dvorak layout for single left hand, and one for single right hand. And there are also various ergonomic-oriented layouts (inspired from the Dvorak layout) for several other european languages. e.g. Turkish-F, Spanish, Italian, Greek, Swedish, Norwegian, Finnish, and more. Except the Turkish-F, most seem to be designed by a single programer. For some languages, there are competing layouts. For links to these layouts, see: Dvorak Simplified Keyboard.

There are also a lot personal, non-published layouts out there. Here's one created by Claudius Hubig, at chubig.net.

Keyboard Layout: Dvorak vs Colemak: What Do You Get for Improving on Dvorak?

What About a Reasonable Efficient Standard Layout for All Languages?

Another common problem is for international users, of non-English languages. For example, German, Spanish, French, and even Chinese and Japanese can benefit because their input methods commonly rely on Latin alphabet. (See: Chinese Pinyin Letter Frequency and Dvorak Layout.)

In these languages, usually there are few extra characters that needs to be typed. There are many standardized layouts for them (e.g. QWERTZ, AZERTY), but often they still requires you to type the special chars by a combination of key press using AltGr modifier, and these layout usually do not consider any ergonomics in the sense of Dvorak. (see: Idiocy of Keyboard Layouts: QWERTZ, AZERTY, Alt Graph.)

It's much better to find ways to create a universal layout that are largely efficient, fixes the hardware layout problem, fixes the number arrangement problem, and can be used for all languages. I think this is quite doable. Neo, Bépo, and i think br-Nativo already claim to be general for inputting all eruo langs, except the main letter keys are arranged for particular language.

Ultimate Keyboard Layout?

I entered the fray. I can't help it. It's not so much a key layout, but rather a physical keyboard design. See: Ultimate Xah Keyboard Layout.

Thanks

Thanks to the following people who have made useful comments.

  • Scott L Burson told me about Asset layout. Source.
  • Hugues told me about Bépo layout.
  • Elena (egarr…@gmail.com) corrected a error in my “Progrmmer's Dvorak” layout.
  • Xavier Gomes Pinho told me about the “br-native” layout. Source
  • Roland Kaufmann made informative comment on the programer Dvorak layout and also about Dvorak on Linux.
  • Hugues Dumez mentioned the bvofrak for French.

2010-08-29

Transform HTML Tags with Emacs Lisp

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

Transform HTML Tags with Emacs Lisp

Xah Lee, 2010-08-29

This page is a tutorial, showing a real-world example of using emacs lisp to do many tag transformation.

The Problem

Summary

I need to transform many html tags. Typically, they are of the form 「BeginDelimiter...EndDelimiter」, where the delimiters may be “curly quotes”, or it may be a html tag such as 「<span class="xyz">...</span>」

I need to apply the transformation on over 4 thousand html pages, and needs it to be accurate, mostly on a case-by-case base with human watch.

Also, the delimiters may be nested, so a simple regex cannot work. They either getting too much text (using default greedy match) or getting not enough text (using shy group). With a elisp script, one can use “if” and other emacs functions, to correctly find the matching ending tag, as well automatically skip cases that this transform should not apply, so drastically lessen the cases for human watch.

Detail

In the past week, i spend about 2 days and done a lot text processing with elisp on the 4 thousand files of my site. Here's the changes i've made:

  • “book title” ⇒ 《book title》
  • “article title” ⇒ 〈article title〉
  • “computer code” ⇒ 「computer code」
  • “file path” ⇒ 〔file path〕
  • “emacs key notation” ⇒ 【emacs key notation】

The purpose of the change is to make the syntactical markup more semantically precise. Before, they are all marked by double curly quotes. Now, if i want to find all books i cited on my site, i can do so easily by a simple syntactical parsing (e.g. grep). These changes also make the text easier to read. In the future, if i want all book titles to be colored red for example, i can easily do that by changing the 《》 to a html markup (e.g. 「<span class="title">...</span>」), or use a javascript to do that on the fly. Same for emacs keybinding. For example, with this clear syntax, it's easier to write a javascript so that when mouse is hovering over the keybinding notation, it shows a balloon of the command name for that key.

All this is part of the HTML Microformat, which is part of semantic web concept. The basic ideas is that, the syntax encodes semantics. This advantage is part of the major reason XML becomes so useful. (the other reason is its regular syntax.)

The delimiters for 《book title》 and 〈article title〉 is a Chinese convention. The delimiters 【lenticular bracket】 and 「corner bracket」 and 〔tortoise shell bracket〕 are Chinese brackets. See: Intro to Chinese Punctuation with Computer Language Syntax Perspectives and Matching Brackets in Unicode.

Also, much of the html markup on my site has been cleaned up. For example:

  • 「<span class="code">...</span>」 ⇒ 「<code>...</code>」
  • 「“<span class="code">...</span>”」 ⇒ 「<code>...</code>」 (Remove the redundant curly quote. It can be auto added with Cascading Style Sheet (CSS) if needed.)
  • 「<span class="key">...</span>」 ⇒ 「<kbd>...</kbd>」 (Change to standard tag; reduce char count.)
  • 「<span class="kbd">...</span>」 ⇒ 「...」 (Remove the tag. Was designed to mark emacs key notation, but doesn't make much sense. Now, 【】 does it.)

There are several advantages in these changes. For example, 「<code>」 is much shorter than 「<span class="code">」, and it has a somewhat standard meaning. It is also unique than “span” tag, so that reduces ambiguity when i need to process “span” tags. Same with the change to the “kbd” tag.

Keystrok Notations Problems

Also, i used to use a 「<span class="kbd">...</span>」 tag to markup emacs key notation, but my use isn't consistent. For example, “Ctrl+x find-file” might be marked as 「【Ctrl+x】 find-file」 or 「【Ctrl+x find-file】」. The problem is actually quite thorny. It is about designing a consistent notation for keyboard shortcuts. Keep in mind that there are many types of key shortcuts. e.g. single key such as 【F1】, 【Win】, or normal combination such as 【Ctrl+x】 , or a sequence of the combination above such as emacs's 【Ctrl+x Ctrl+f】 and 【Ctrl+x f】, or Windows's 【Alt+Space c】, 【Alt t i】 (accessing menu by key, called “menu accelerator”). (A sequence of single keys is also common when you have sticky keys on, available in Windows, Mac, Linux.)

In general, it is not trivial to design a notation that is not ambiguous and covers all these different types of common key shortcuts practices. In general, you want a notation that can contain a sequence of key-press elements, and each key-press element can be a single key or key combination (such as 【Ctrl+x】). Also, note that the key 【Ctrl+x】 does not simply mean pressing them together, but actually pressing and hold Ctrl first, and release it last.

Also, in designing such a notation, there's a consideration of space char in the notation. For example, 【Ctrl+c Ctrl+c】 does not mean you have to press a space in this sequence, rather, space is used as a separator.

Another issue to consider is the plus sign in it. For example, 【Ctrl+x】 does not actually involve pressing the “+” key. Rather, “+” is used to indicate combination. This can be a readability problem when you have 【Ctrl++】(usually for zoom in). (in Microsoft's software, such case is simply written as 【Ctrl+】 — a break of regularity. Apple's notation simply does not use any conjunction sign; it just place 2 keys together meaning for simultaneous pressed keys..)

Another issue is whether to consider a key as a key or as a character. For example, by convention, 【Ctrl+X】 means pressing the lower case x key, not capital X. This does introduce ambiguity. Most app's menu use a notation that explicitly include a Shift key. For example, in FireFox, “Show All History” shortcut is written as 【Ctrl+Shift+H】, but for “Zoom In” it is written as 【Ctrl++】 not 【Ctrl+Shift++】 nor 【Ctrl+Shift+-】. When you consider different keyboard layout, for example the QWERTZ layout used in Germany, the # key is not the shifted 3, this inconsistency about Shift key creates more ambiguity. (See: Idiocy Of Keyboard Layouts.)

Also, what does it mean when you have a sequence of char? For example, 【Ctrl+x】 does not mean pressing C, then t, then r, then l. However, in 【Meta+x dired】, it does mean press each of the character in the word “dired”.

See also: A Short Survey Of Keyboard Shortcut Notations.

The way i want a human readable key notation with the degree of precision is close to creating a language for key macro applications. But if you look at those apps, their syntax is not human readible, hugely inconsistent, and basically most of them are just syntax soup with lots of special cases. See:

Solution

To do these tag transformations, simple cases such as

“file path” ⇒ 〔file path〕

, where the delimiters are single characters and there's no nesting, they can be done with emacs's dired-do-query-replace-regexp. (See: Interactively Find and Replace String Patterns on Multiple Files.)

More complicated cases with nested html tags, can be done with a elisp script. Here's the general plan.

  • Open the file
  • Search for the tag
  • If found, move to the beginning of tag, mark positions of beginning and ending of the opening tag
  • Use sgml-skip-tag-forward to move to the end matching tag
  • Mark positions of beginning and ending of the ending tag
  • Replace the beginning and ending tags with new tags
  • Repeat

To open the file, we can use “find-file”.

To search for the tag, we do:

(while
 (search-forward "<span class=\"code\">"  nil t)
...
)

We give “t” for the third argument. It means don't complain if not found.

The next step is to get the beginning and ending positions of the opening tag. The end position is simply the current cursor position minus 1, because the search-forward automatically place it there. To get the beginning position, we just use search-backward on “<”

Now, we need to get the beginning and ending positions of the matching end tag. This may be a problem because the tags are nested, so there may be many 「</span>」 before the one we want.

The good thing is that emacs's html-mode has sgml-skip-tag-forward function. It will move cursor from a beginning tag to its matching end tag.

Once we got the beginning and ending positions for the beginning and ending tags, we can now easily do replacement. Just use “delete-region”, then use “insert” to insert the new tag we want. One thing important is that we should do replacement with the ending tag first, because if we replace the beginning tag first, the positions of the ending tag will be changed.

Complete Code

;; -*- coding: utf-8 -*-
;; 2010-08-25

;; change
;; <span class="code">...</span>
;; to
;; <code>...</code>

(setq inputDir "~/web/xahlee_org/" ) ; dir should end with a slash

(defun my-process-file (fpath)
  "process the file at fullpath fpath ..."
  (let ( mybuff changedQ p3 p4 p8 p9)

    ;; open the file
    ;; search for the tag
    ;; if found, move to the beginning of tag, mark positions of beginning and ending of < and >
    ;; use sgml-skip-tag-forward to move to the end matching tag </span>
    ;; mark positions of beginning and ending of < and >
    ;; replace them with <code> and </code> 
    ;; repeat
    (setq mybuff (find-file fpath ) )
    (setq changedQ nil )

    (goto-char 0)
    (while
        (search-forward "<span class=\"code\">"  nil t)
      (backward-char 1)
      (if (looking-at ">") 
          (setq p4 (1+ (point)) )
        (error "expecting <" )
        )

      ;; go to beginning of "<span class="code">"
      (sgml-skip-tag-backward 1)
      (if (looking-at "<") 
          (setq p3 (point) )
        (error "expecting <" )
        )
      (forward-char 2)

      ;; go to end of </span>
      (sgml-skip-tag-forward 1)
      (backward-char 1)
      (if (looking-at ">") 
          (setq p9 (1+ (point)) )
        (error "expecting >" )
        )

      ;; go to beginning of </span>
      (backward-char 6) 
      (if (looking-at "<") 
          (setq p8 (point) )
        (error "expecting <" )
        )
      
      (when (yes-or-no-p "change? ")
        (delete-region p8 p9  )
        (insert "</code>")
        (delete-region p4 p3 )
        (goto-char p3)
        (insert "<code>")
        (setq changedQ t )
        ))

    ;; if not changed, close it. Else, leave buffer open
    (if changedQ
        (progn (make-backup))                        ; leave it open
      (progn (kill-buffer mybuff))
      )
    ))

(require 'find-lisp)

(let (outputBuffer)
  (setq outputBuffer "*span tag to code tag*" )
  (with-output-to-temp-buffer outputBuffer
    (mapc 'my-process-file (find-lisp-find-files inputDir "\\.html$"))
    (princ "Done deal!")
    )
  )

In the code above, i also put extra checks to make sure that the position of beginning tag is really the 「<」 char. Same for ending tag. (probably redundant, but i tend to be extra careful.)

Also, i used a “yes-or-no-p” function, so emacs will prompt me for each change that i can visually check.

For those files that are changed, i leave them open. So, if i decided on a whim i don't want all these to happen on potentially hundreds of files that i've changed, i can simply close all the buffer with 3 keystrokes with ibuffer. Same if i want to save them all.

For files that no change takes place, the buffer is simply closed.

Emacs is fantastic!

Was this page useful? If so, please do donate $3, thank you donors!