Xah Programing Blog

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

OCaml Tutorial: Function (rewrite. For beginner. My learning notes.)

amazon $50 tablet

amazong fire tablet 82660
amazon Fire tablet

amazon is selling tablets for $50. amazon

must be some kinda theory of economy. like, suck u in first, than make u do.

why syntax is more important than semantics

the guy who started the idiotic chant among hackers that semantics is more important than syntax, is probably Matthias Felleisen.

Method Chaining, Postfix Operator, and OOP

xfce vs lxde

after many back and forth over the years, i really want to like lxde, but prefer xfce.

pros of lxde: more energy efficient than xfce. GUI simpler & functional. Things Just work. Doc is excellent.

xfce you have to diddle a lot, things don't work, confusing UI, incomplete or non-existent doc.

lxde major problem: no display composition = sometimes tear&freeze, drag image is opaque, this is a problem, not just prettiness issue.

lxde major problem 2: No key to switch window of current app (and no, can't be easily scripted neither).

Programing Language Tutorials Index

now phone friendly (that is, display well in small screen). Best there are JavaScript, then emacs lisp then python.

unicode white flower

Unicode Search

a passage of process 2016-06-13
a passage of process


Siri, Cortana, Ok Google, Are the Future of AI, the Embodiment of AI

talking to myself about Cortana, Siri for an hour. It's huge.

They, going to be the AI. For vast majority of people, the general public, it is they, Cortana, going to be the window to tech. With a human female voice User Interface, it will also become intimate, in a natural way. That is, most people, are not tech savvy. They don't even know what a browser is. But Cortana (and Siri, ok Google), because it communicates with user via human language, and being a female, this will lead to natural connection, and making the user wanting more, and will thus push and push for Cortana to mature, and meet demand. (and there'll be porn aspects, a huge industry, but that's different topic. We focus on the average people and phone use here.). Cortana (Siri, similar services) , will become the Embodiment of Artificial Intelligence, as the populace have seen in movies. Most people are not into scifi or tech stuff, but it is via the interaction of human female voice that help daily things, grow attachment, and become average people's connection with tech.

i think ALL our tech progress, will also become measured by them. As in, how mature, how smart, Cortana, Siri becomes.

they going to be the #1 software growth in next decade.

xfce window focus bug

lots focus bug mouse hover to raise window, in xfce ubuntu 14.04. upgrading to xfce14.12, then you got wmctrl problem. 4 hours wasted.

here's the detail.

Activating a window from the taskbar doesn't focus it when 'focus follows mouse' https://bugs.launchpad.net/ubuntu/+source/xfwm4/+bug/1292122

now, its supposedly fixed. See: http://git.xfce.org/xfce/xfwm4/commit/?id=1a20a88

so, now you upgrade xfce to 4.12. Linux: How to Upgrade Xfce

but now, there's wmctrl problem. That is, when you use the wmctrl tool to switch window wmctrl -xa emacs, it won't focus, only raise.

if you turn off mouse raise window, then the problem goes away. But, i want mouse raise window.

sad face.

Linux: How to Upgrade Xfce

How Find Xfce Version?

lisp apostrophe quote '(a b c) came from MacLisp

scihub logo raven
SciHub logo.

SciHub logo. beautiful

On Dell laptop, how to change the function keys as F1 to F12?

You can press Fn + Esc to toggle. This works in linux too.

or, in Microsoft Windows, you can use a Dell util.

  1. press the ❖ Win key
  2. type “mblctr”, Enter ↵ to open the Windows mobility center.
  3. there, you'll find a box to let you switch F1 to F12 as function keys.

Dell i7559 Linux Boot Problem

Keyboard Hardware Dvorak vs Software Dvorak

Ubuntu 16.04 Install Google Chrome or Third Party .deb File

good languages now a dime a dozen

it seems, today we've reached a stage where good quality programing language is a dime a dozen.

high availability of quality prog langs don't seem to do much. Programer mindset is very slow to change.

seems we need another 10 years for C C++ java coders to die off. young spur change because they simply not aware what's before.

unicode search, new version

xah unicode search usage sample 2016-05

new version. Covering Unicode 8.0.

here: Unicode Characters ☯ ☭ ⚡ → ∑ ♀ ♂ ♥ 😄

the creeping impact of tech, internet

looking at all the video games, such as osu, dancing, all. amazing. You wonder how difficult to write such?

VERY Difficult!

it's a phenomenon where tech is catapulting everything. langs, libs, frameworks, paradigms, all exponential growth, vastly specialized.

in our tech circle, we see self driving car, computer beats human in go , 3D goggle, as demo of tech. actually, impact happen in million places we don't see

these million places, are not reported by the media. The video game osu, is 1 example. you don't know until you run into it.

today, you don't even find philosophers writing about these. but i do. On the Question of Too Many Programing Libs On the Question of Too Many Programing Libraries

you don't find philosophers reporting these phenomenons,not cuz none,but million things are happening that overwhelm'd your ability to be aware of all.

mechanical devices, steampunk, have a sense of wonder, because they are perceptible ancient science.

trackballs, have a sense of wonder, because they are mechanical devices.

trackballs pics 14858
Trackball Reviews

curved monitor

today i saw this.

acer predator 34inch curved monitor

that's 34 inch, 3440 x 1440 Resolution.

yes, it's curved.

  1. Douglas Crockford is 61. rob pike is 59. Yukihiro Matsumoto 51. Brendan Eich 54.
  2. these people more or less still code. don't know about Eich.
  3. i have been a failure. my life is at the ending. Xah Lee amounted to be a troll, best known as. Oh, and petty emacs tutorial.
  4. i still consider basically all my rants correct, and the lispers and perlers and python folks i argued with in decades are idiots.
  5. i'm giving myself about 5 years to do something. after that, the brain is really gone.
  6. a deep hatred has sustained my life. truly.
  7. 5 years isn't much. eg learn some math i always wanted to know, algebraic geometry, topology, godel stuff, would take good 2 or 3 years.
  8. but in 5 years, i could probably still code 1 or 2 project, really well, and say, be known for it.
  9. there's 2 faces on twitter. 1 marketing, say good things, encouragement. be positive. i've been trying todo, to peddle my website.
  10. but that's not me. once in a while, i can't help but hurst out the most hateful things. and there goes all my followers, aliented friends.
  11. the promotional, positive, happy stuff, is rather the most despicable. they spring from profiting. and is the worst of humanity.

linux command 「gksudo」

you can use gksudo to launch X11 apps, such as gksudo nautilus

the purpose is similar to sudo

man gksudo says:

gksu is a frontend to su and gksudo is a frontend to sudo. Their primary purpose is to run graphical commands that need root without the need to run an X terminal emulator and using su directly.

but when you actually need it?

apparently, sometimes when you need to sudo nautilus and it made the ~/.Xauthority owned by root (should be owned by user). Then, this create a problem where user can't login when in lightdm. (lightdm is the login screen.)

reference: http://askubuntu.com/questions/300682/what-represent-xauthority-file

how to find if your Linux machine support usb 3.0?

in terminal, type lsusb. If one of the line in the output contains “Foundation 3.0 root hub”, then that port is USB 3.0.

A Spontaneous Rant on D3.js

i think i seriously dislike d3.js. at this point, i think it's hack of hack. looks cool http://bl.ocks.org/mbostock/4063318 but the code, wtf?

there, you'll see it's doing pen drawing commands of svg path element. holy cow, a beautiful widely used powerful library and there it is, manually hacked up pen drawing commands of path of svg.

am this point, am not certain, either i'm totaly old and irrelevant, or d3 is truly sh�t of the “modern” programing generation fashion.

i mean, i look at the page, its descriptions, and thougt wow, this is well done. How is it possible to draw those calendar with so short code?

and, d3's code has always been incomprehensible. I've tried to study it a couple times since 3 years ago.

it's kinda weird. Its design is kinda weird. It claims that it doesn't lock you into any framework's functions, that d3 simply works with web standards. But actually, if you look at its design, with reactive programing “selection” “enter” “exit”, it right off the bat lock you into d3.

yeah, d3.js is weird. You know? am no computer graphics expert, but i've done math visualization for at least 10 years 〔➤see Visual Dictionary of Special Plane Curves〕 , and i know JavaScript the language very well, and i know DOM fairly well. 〔➤see JavaScript in Depth〕 But, it's still hard to understand d3.js. 〔➤see Practical SVG Tutorial

d3's home page https://d3js.org/ is just so impressive, and i have no doubt the lib is quality. After all, the lib has become basically the industrial standard, and the author and his work came from research projects.

but, but, d3 is really weird. How's it weird?

first, the way it does things, is by this certain “selection”, then “enter”.

like, you want to plot a bar chart or pie chart. You look for a function named barChart or drawRectangle, but there's no such. You just got these incomprehensible “enter” and “data” and “transformation” stuff.

there are several things here. This is some kinda reactive programing. That is, functions are bind to data, and when data changes, functions reflects it right off. This is kinda new. But, maybe am old, or not familiar with angular or backbone or facebook react, maybe that's why i find it incomprehensible. Is that it? Many of you work in the industry with these libs. But does any has problem with d3 as i do?

am sorry Mike Bostock, but a man's gotta rant.

but maybe, in a few years i'll think that D3 is really the right way.

What is Persistent Data Structure?

On the Question of Too Many Programing Libraries (on a page by itself)

adaptive sampling explained. new.

math plot adaptive sampling 2016-05-01
Adaptive Sampling, Plotting Math Curve

“look into my eyes, and you'll be reduced to a pawn”


Unicode: Math Symbols ∑ ∞ ∫ π ∈ ℝ²

starting a dedicated keyboard blog. See

Subscribe Xah keyboard Blogkeyboard_blog.xml

Subscribe there. I'll not duplicate keyboard stuff here. Thanks.

a dedicated keyboard blog allows me to freely post any keyboard related stuff quickly without dithering.

had a clarity, about designing my JavaScript svg library.

JavaScript Language Design: Dot Notation be Namespace or Object System

sigil for my φvariable ξnames

fret about whether i should continue using funky sigil for my variable names. As in:

xd.drawCircle = function (φcontainer, φcenter, φr, φstyle) {
    var ξcir = document.createElementNS("http://www.w3.org/2000/svg", "circle");
    ξcir.setAttribute("cx", φcenter[0]);
    ξcir.setAttribute("cy", φcenter[1]);
    ξcir.setAttribute("r", φr);

    if (φstyle !== undefined) { ( ξcir.setAttribute("style", φstyle)); };

    if ( φcontainer === undefined ) {
        return ξcir;
    } else {
        return φcontainer.appendChild (ξcir);

the problem, is people. Other people.

you see, it's like the many english spelling reform. It is sound and good, except, the masses, idiots, will not have it, and is doom'd to failure.

the reason i want to do it is here: Sigil for Function Parameter Names and Programing Style: Variable Naming: English Words Considered Harmful.

but i thought about it more due to the my dilemma of continuing the practice, in JavaScript or any lang other than emacs lisp. I took a walk, talking to myself, for 30 min. Here's some more insights.

the essential good of it, is that it embeds semantic info into syntax. That is, you can tell if a variable is a function parameter, or local variable, or not global, just by its name.

This is in general called sigil. (most popularized by perl, followed by ruby.)

there are other examples of widely accepted practice of embedding semantic info in syntax. For example, in Java and python, class names starts with capital letters. This is a strong convention, everyone follows. It is important, because, classes, variable, methods, have very different semantics. Being able to tell by a glance saves you time or error.

also read, if you are inclined:

but i think am going to stop this geek char sigil practice. My emacs lisp code base are full of it, it's hopeless. For lisp, i probably should push on my way, as lisp is weird already and lisp people are weird. But for my JavaScript code, which there isn't much, am thinking of stopping this φsigil ξthing, while the night is young!

the problem, is that whenever it is exposed and seen by other people, it's a problem. You'll need to do explanations, and you'll win yourself a weirdo badge. And, other consequences. For example, the jslint won't accept names that start with Unicode char.

unless, i keep my code to myself only. Imagine, i, am the greatest coder, couldn't care less what other coder do or say. I just churning out my own code that rules the world. Well, it hasn't happened yet.

Google Plus https://plus.google.com/+XahLee/posts/Ei5eKe8T49i

Ontology of Postfix Notation, Method Chaining, and Unix Pipe

24 hours clock, 00 start at top or bottom?

Uno 24 hours watch
Uno 24 - One Hand Men's Watch by Botta-Design. amazon

24 hours watches are superior, because, the needle points as a fraction of day. And, you can tell just by a glance, how much daylight is left, or how much a day is left.

roughly, half of the circle is daylight.

in designing a 24 hours clock, there's the question of whether the 0 clock should start at top or bottom.

the advantage of starting at top is that, it's just normal for 0 to start at top, as in our typical clock.

the advantage of starting it bottom is that, now, the daylight will roughly correspond to the upper half of the circle. This is somewhat natural because we associate light as above us.

if you look at existing 24-hour watches, see amazon at 24 hours watches, most has 00 at bottom. But for 24-hour clocks, most has 00 at top.

i'm making a JavaScript version, see JavaScript: 24 Hour Clock

new language, Kotlin, from JetBrains. Runs on Java Virtual Machine. Similar to Java, but designed to improve java.

Proliferation of Computing Languages

The Complexity of Java's Access Specifiers (oldbie, new home)

Clojure's Ring, Compojure, hiccup, perfect doc!

Clojure's Ring, Compojure, hiccup's docs are SUPERB! all by the same guy. Clear, concrete, + example! a rarity in industry.

by the way, the code are written by the same guy too. The guy is James Reeves, aka @weavejester. github at https://github.com/weavejester

see also Clojure: Essential Libs for Web App

HTTP Protocol Tutorial (new)

Python: GET Webpage Content

Perl: GET Web Page Content (on its own page)

Past Articles by Date