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

constructed language book

discovered: 〔In the Land of Invented Languages: Adventures in Linguistic Creativity, Madness, and Genius By Arika Okrent. @ amazon

see also Xah's lojban Tutorial

Clojure Leiningen Tutorial (updated)

Intro to Chinese Punctuation

Clojure Instaparse Parser Tutorial (draft version. Read in peril & pain)

Ubuntu Kylin is the official Chinese version of the Ubuntu computer operating system.

It has been described as a “loose continuation of the Chinese Kylin OS”.[1] In 2013, Canonical reached an agreement with the Ministry of Industry and Information Technology of the People's Republic of China to co-create and release a Ubuntu-based OS with features targeted at the Chinese market.[2][3] Ubuntu Kylin is intended for desktop and laptop computers.[4]

The first official release, Ubuntu Kylin 13.04, was released on 25 April 2013, on the same day as Ubuntu 13.04.[5] Features include Chinese input methods, Chinese calendars, a weather indicator, and online music search from the Dash.[5]

In the latest release 14.10, it features its own Ubuntu Kylin Software Center (UKSC) and a utility which helps common end-users for daily computing tasks called Youker Assistant.

The team also cooperates with Sogou to develop Sogou Input Method for Linux. Since it is close sourced, it is not included in the official Ubuntu Kylin image, but users can download it from UKSC or Sogou's website.

source: Ubuntu Kylin

Kylin (operating system)

Kylin (Chinese: 麒麟; pinyin: Qílín; Wade–Giles: Ch'i-lin) is an operating system developed by academics at the National University of Defense Technology in the People's Republic of China since 2001. It is named after the mythical beast qilin. The first versions were based on FreeBSD and were intended for use by the Chinese military and other government organizations. With version 3.0 Kylin became Linux-based, and there is a version called NeoKylin which was announced in 2010.

In 2013, it was announced that a new Linux-based operating system with the same name would be released using Ubuntu. The first version, Ubuntu Kylin 13.04, was released on 25 April 2013.

Programer Salary

Clojure Tutorial: Parallel Assignment, Destructure Binding (updated)

Linux: View Directory as Tree (repost)

happened to find this:

the following Mathematica program uses linked lists to solve the n-queens problem: …

Here is the equivalent F#: …

source: http://mathematicanews.blogspot.com/2012/05/tree-data-structure-in-mathematica.html by Jon Harrop

and noticed it is written by Jon Harrop. I'm sorry to say, he's truly a loud-mouthing idiot. (if you don't know, Jon Harrop is infamous as a “troll” for posting idiot posts to various comp.lang newsgroups and peddling his F# books or whatever he's doing)

discovered a new keyboard mechanical key switch, the Cherry ML switch. The interesting thing is that it's not a full depth key, but somewhat like laptop key, but taller. Yet, mechinacl switch. See: Cherry G84 4100 Keyboard

Get yourself one for the holidays. Logitech Gaming Keyboards Review (minor update)

Google Chrome now pops up “page unresponsive” false positive every few seconds, even everything works fine. This makes it unusable.

Google product is going downhill everyday. From bugs to commericialization.

temp fix: start Google Chrome by: google-chrome --disable-hang-monitor

Google Chrome support forum disscussion: https://productforums.google.com/forum/#!topicsearchin/chrome/page$20unresponsive%7Csort:relevance/chrome/CjX7L7MLzX4

Razer Targus Gaming Keypad Review. But you should get Best Keypad: Razer Orbweaver, Mechanical Keys or Logitech G13 Gaming Keypad Review

looks like this is a new firewall software. firewalld. https://fedoraproject.org/wiki/FirewallD

not sure if it's a wrapper to iptables. Seems at least partly so.

see also Linux Firewall Tutorial: iptables & netfilter


Linux Command to Download YouTube Video (repost)

Erik Meijer on Xtreme Programing and Agile

Clojure Tutorial: Partial Function Generator (Currying)

Clojure binding forms: syntax sugar on drugs. Clojure Tutorial: Parallel Assignment, Destructure Binding

Ruby is lisp-2 too. Added example. Thanks to Dario Bertini. See: What's lisp-1, what's lisp-2? Why You should Not Use the Jargons lisp-1 lisp-2

Wolfram Language (aka Mathematica) is bundled with every RaspBerry. It is also to be bundled with Unity game engine.

raspberry pi ultimate starter kit 2014-12-01
CanaKit Raspberry Ultimate Starter Components

for a glimpse of Wolfram Language, see: Wolfram Language, Mathematica

Past Articles by Date