Xah's Programing Blog

On programing, languages, functional programing, Unicode, keyboard, hacker culture, ….

Want to master JavaScript in a week? Buy Xah JavaScript Tutorial.

python os.path.walk() is deprecated, and removed in Python 3. Use os.walk() Python: Traverse Directory

Python: How to Read & Parse JSON (minor update)

new addition. Keyboards Without Numeric Keypad, Under $30

Useful AutoHotkey Scripts (minor update)

Unicode in Ruby, Perl, Python, JavaScript, Java, Emacs Lisp, Mathematica (minor update)

Evolution of Laptop Keyboards, No More Page Up/Down Keys!

Unix/Linux Shell Shebang: Who Gets to Use the First Char? (repost)

Linux: Set Keyboard Repeat Rate by Command (minor update)

Linux: Xbindkeys Tutorial ⌨. New.

new finding, cheap ergonomic mouse. Ergonomic Mouse, Vertical Mouse

The Worst Programing Language Tutorial & Documentation Styles (new, on its own page)

Why You Should Swap Mouse Middle-Click & Right-Click? (new, on its own page)

How to Add/Change Firefox Keyboard Shortcuts (minor update)

Linux: How to Swap Mouse Buttons (updated)

repost. Microsoft's TypeScript Will Kill CoffeeScript & Dart❕. Reminder: if you are going to use a wrapper language for JavaScript, TypeScript is better than CoffeeScript or Google Dart.

Linux: How to Set F2 F3 F4 to Cut Copy Paste Globally ⌨

Now you can buy the Truly Ergonomic Keyboard on amazon. See the amazon links in Truly Ergonomic Keyboard

Computing and Its People (major redesign)

every year, i must recommend this for better operational efficiency: Mouse Hover to Auto-Raise Window

and ban double-click: Single-click Open File in Windows & Linux

Linux: How to Find System Info (repost)

new. Linux Keybinding Tutorial Index

Linux: 「wmctrl」 Add Keyboard Shortcuts to Switch to App ⌨ (new. On its own page)

Linux: LXDE: How to Change/Add Keyboard Shortcuts ⌨ (new)

Linux: LXDE Set Key Repeat Rate ⌨ (new)

Ubuntu Linux: Command Line Equivalent to Update Manager (updated)

Linux: LXDE Keyboard Shortcuts ⌨

Notes on A New Kind of Science

Why is Pluto not a planet? Ceres, Pallas, Juno, Vesta, Eris …. Unicode Astronomy & Astrology Symbols ☿ ♆ ♋ 🌙 🌛 🌝 🌞 (major update)

Lots mouse from China are making inroads in USA market. For a 18-buttons mouse, this is half the price than Logitech or Razer. Redragon Perdition 18-Buttons Mouse 红龙 灭世 鼠标

Installing Cygwin Tutorial (repost)


CM Storm Recon Mouse. Added a photo gallery and review.

Linux: Command to View/Delete Metadata in Image Files (major rewrite)

Linux: Shell Commands for GUI Apps (repost)

Linux: How to Set Default App? (minor update)

now on Reddit. See link to reddit at bottom. Programing Challenge: Constructing a Tree Given Its Edges

Python: Function to Get Number of Args of Function

in Python, it is impossible to write a function to get a function's number of args.

# python 2
# get number of args of a function. works for user-defined function only
# code by John Smith

def get_number_of_args(func):
    return len(func.func_code.co_varnames)

def g(a, b): pass

print (get_number_of_args(g))   # 2

it is possible for user-defined functions, at least in python 2. But not for builtin functions.

if possible, it should be here:

In 1961, the IBM 7094 became the first computer to sing, singing the song Daisy Bell. 《2001: A Space Odyssey》 🎶 Daisy Bell in 《2001: A Space Odyssey》 🎶

The Unix Pestilence (some update of logos)

Unicode Smilies (◔ ◡ ◔) (repost)

Why Python's Lambda is Broken and Can't be Fixed (repost)

Bondi Blue iMac Girl, 1999

Cheap Gaming Mouse

Programable Keypads: Add Extra Function Keys to Your Keyboard (updated)

AutoHotkey Syntax Problems (minor update)

there once was high-level graphics API Fahrenheit, QuickDraw 3D, but was killed by C,C++,unix hacker idiots.

little debian girl
“でびあんでしょう” (i'm Debian)

Windows: Keyboard Layout Tools, Key Macro Tools ⌨ (minor update)

Best Mouse for Programers: 17 Buttons (repost)

Ruby: Quoting Long String and Heredoc

spec with invalid HTML

if you search for the string ">><", you find them in these spec docs:

The Pain of Ampersand in HTML

new photos. Logitech G710+ Mechanical Keyboard

the Nature of Associative Property of Algebra (updated)

Java Tutorial: “this” Keyword (updated)

The “static” Keyword in Java (updated)

Java constructor complexity. Java Constructor's Return Type (updated)

Java Tutorial: Constructor (updated)

Java Tutorial: Arrays (updated)

Updated utf-8 usage on the web, from 2010 to 2015. See: Unicode Basics: What's Character Set, Character Encoding, UTF-8?

Java Array Syntax Soup (new)

Logitech G710+ Mechanical Keyboard (minor update)

Go Board Game as Cellular Automata

Keyboard RSI: 《Biomechanics of the Upper Limbs: Mechanics, Modeling and Musculoskeletal Injuries》. See bottom: Computer Keyboard Design Flaws

The Nature of Idioms in Programing Languages

History of Emacs & vi Keys (Keyboard Influence on Keybinding Design) (minor update)

you probably heard of emacs org mode. It's a markup, similar to markdown, but much more. Also supported by github. See: Emacs: Org Mode Markup Cheatsheet

Markdown Tutorial (minor update)

jbm has written a review comparing ergodox, truly ergonomic keyboard, and the new esrille. See bottom: Esrille New Keyboard (M-Type & TRON) from Japan

2015-02-05 tweeter spam on lang design

start coding, next 4 hours. but before i do so, let me talk about 2 aspects of judging a lang's design

when you judge whether you like a lang, there are 2 aspects. 1. consider the mistakes of the lang. 2. the lang design, by the creator.

every lang has mistakes. To see this, consider python2 to 3, perl4, and before, and perl6 is extension. js, and now es6 with strict, etc.

so, every lang has mistakes. But, if we ignore it for a moment, lang still remain its design characteristic. eg python3, perl6, ruby2, java8

now, the mistake part, can be big or small. We can say, eg look at python2, what % is considered a mistake. Do same for lang X.

so, diff langs, we can consider some percentage that are mistakes. But important thing is, even if all mistake fixed, still is a design X.

if a lang has huge amount of mistakes, then, that heavily influence whether we like it. Typically, large % of mistakes means no like.

but, typically, mistakes of langs, are comparable among langs. e.g. they all just a small percentage, not huge gap between langs.

so, to consider whether you really like lang x in comparison to other langs, you should not consider a lang's mistakes.

this way, you are judging weather you like lang x, not fooled in judgement just because it has some mistakes that are popularly known.

in other words, you want to consider whether you like lang x's design and philosophy.

now, js has lots mistakes/warts. e.g. number, array, and many detail of its prototype system. Many hacker idiots, focus on these.

php, has lots mistakes. its inconsistent sloppy naming of functions. again, hacker idiots focus on it.

python has mistakes. in particular, strings are bytes, not unicode chars, but fixed in python3.

but after you ignore the mistakes, you can then really judge, the lang's design, and see whether u like it, the design, its “philosophy”.

the above, concludes a section. That is, in judging a lang's design, it's more meaningful to not include the lang's mistakes.

now, when judging a lang, there's design aspect, but also practicality aspect, implementation, speed, field, lib size, popularity, etc.

most of these points are trivial questions. popularity, field, size of lib, speed, all can easily verified and agreed upon.

so, the tricky question, is again, the design/philosophy of the lang. What does it mean to say lang x is better than y?

but also, whether somebody like/disklike lang x is of no value. Because, each person has own habits, view, IQ, need.

whether you or someone like/dislike a lang has no value to the judgement of design of a lang.

finally, then, what is a better design of a lang? That would be another topic another day. On the meaning, on how to measure, on perception.

What Made Lambda Calculus So Powerful?

Functional Programing: is Real World Stateful?

old article. A Lambda Logo Tour (and why LISP languages using λ as logo should not be looked upon kindly)

Esrille keyboard can be ordered now outside Japan. See its home page: http://www.esrille.com/keyboard/. My review at: Esrille New Keyboard (M-Type & TRON) from Japan

in social and leadership situations, stupid + confident ≻ smart + unsure

the unicode SUCCEEDS ≻ does not have a absolute universal meaning, much like the greater than symbol.

Corsair now has a compact version of its mechanical keyboard. See: Keyboard: Corsair K60, K65, K70, K95 Review

(as-> expr name form1 form2 form3 …). See Clojure Tutorial: Clojure Function Chaining

Unicode: Punctuation & Printer's Symbols † ¶ © ® ™ ☙ (minor update)

Secretly Sniff Anything Typed from Microsoft Wireless Keyboard

Lisp Celebrities on How Common Lisp Sucks

the famous LISP expert Paul Graham asked how to type the logic symbol forall on Twitter. 〔https://twitter.com/paulg/status/555062607074586624〕.

this can be easily done. How to Create a APL or Math Symbols Keyboard Layout ⌨ (minor update)

the new Mac book is rumored to have the Power key at the Esc key location. A woe for vim users and emacs users alike.

to fix, see Mac OS X: Keyboard Layout, Keymapping, Keybinding, Software ⌨ (updated)

for Linux and Microsoft Windows, see:

Non-English-based programming languages

some interesting ones, that there are a lot Chinese users. Some are just aliasing the english keywords to Chinese. Here's 2 of them based on Python, But both seems dead:

but more interesting is new languages that are entirely in Chinese for Chinese. One of them, seems very popular, is:Easy Programming Language (易語言) (official site http://www.eyuyan.com/), a visual-basic like language.

Easy Programming Language (EPL, Chinese: 易语言) is a Chinese programming language, featuring a full Chinese environment. Its community may be the largest of all non-English-based programming languages. EPL is popular in China, considering the difficulties of adopting English for most Chinese speakers.

易语言是一门计算机程序设计语言,也通常代指与之对应的集成开发环境,其最大特点是通过汉语进行编程。语法风格类似于 Visual Basic。易语言的创始人是吴涛,早期称为E语言,他曾表示,创造易语言的初衷是进行用中文来编写程序的实践

at first the E-language has corresponding English version, but that seems dead.

will Clojure be popular? Not in 100 years. Here's sufficiently why. Clojure Tutorial: Magic Characters: ' \ @ ^ # ` ~ -> . (updated. Refresh)

Unicode: W3C Proposed Icons {Image, Video, Sound File, Trash, Keyboard, Mouse, …} (updated)

Clojure Tutorial: Clojure Function Chaining

Clojure this _ in (fn [x [_ y]] (+ x y)) took me 1 year to unstand. How do you know what magic chars sugar it is? you lookup C++ dictionary.

All Software Problems, Came from Unix and C

Proper Date Format on Websites

publishers and blog writers, don't use a stupid date format such as “10.07.14” or “10/07/14”, or any of the slash. Use this format: 2015-01-08, and this format only. This is a standard.

Unpatchable USB Malware

there is unpatchable malware. The gist seems to be that hackers can alter a USB's firmware, so that when you plug in the USB, it infects your computer, and this is essentially undetectable.

The take-away seems to be: never plugin a usb from untrusted source.

See: 〔That Unpatchable USB Malware Now Has a Patch … Sort Of By Andy Greenberg. @ http://www.wired.com/2014/10/unpatchable-usb-malware-now-patchsort/〕, and its links.

Unicode Full-Width Characters

Review of SpaceNavigator & Mathematical Models of 3D Inputs Control (minor update)

the term “ambiguous grammar” should be ban'd. It should be called “multi-parse-tree grammar”.

now, a API approach to Clojure Instaparse Parser Tutorial. First complete version.

Past Articles by Date