Xah Programing Blog Archive 2013-12

to all my readers, and many supporters this year, am a man of few words meanwhile rant a torrent. I hope you have a great coming 2014!

Mathematica: Optimizing A Raytrace Code: Jon Harrop vs Xah Lee (essay format updated)

references, the source of all software complexity. Python: Copy Nested List, Shallow/Deep Copy (updated)

'tis incumbent upon me, to write down the entirety of humanity's programing essays. Hacker Cult

added a real closure example at bottom Python: Closure in Python 2, using python 3. Python 2 can't really do it. Python 3 added the nonlocal keyword that made it possible. Real ugly.

programing language: closure should be ban'd

slightly updated. Python: Closure in Python 2

btw, hacker-type of programers will probably object, saying that the techniques on that page isn't “closure”. However, if you consider closure as purpose, then it amounts to a function with state. Python can do real closure, which is a function with a “closed off” variable environment. Will have to write a tutorial on that another day. (if you want to know, a web search should easily find you tutorials on that)

see also Python Scope Complexity, Shallow Copy, Deep Copy, Circular List, and the Garbage Underneath Computer Languages

“closure” in programing is something i truely despise. Because it creates a complexity level that's voodoo. All it achieves is function with state. First of all, function with state should be avoided. But if you really want, OOP is a systematic way of function with state, use OOP then. Or, in some languages, use the property of a function, such as in lisp or in JavaScript. [see Emacs Lisp Symbol (tutorial)] [see JavaScript: Closure] If you don't want OOP, then, just use global vars with a special scheme of naming them, such as starting with 2 underscore “__” and end with a random id. [see What's Windows CLSID? Second Life UUID?] In fact, many languages uses this scheme to do things. Python has special variables that has underscore in its naming, for example, __name__, Mathematica has internal variables name$random_string as used by Module[] function to generate local variables. http://reference.wolfram.com/mathematica/ref/Module.html

here's real closure in JavaScript JavaScript: Closure

Node.js Documentation Problems

Linux: Bash Keys, Terminal Keys, Man Page Keys (minor update)

Linux: Users and Groups (updated)

Linux: File Permission System (updated)

♥ Ryan Dahl, mathematician turned programer ♥

been wanting to write this for a while. The node.js creator, Ryan Dahl, i really like. He's a mathematician originally, doing his phd. (i forgot exactly what topic, anyone? algebraic topology or something)

Anyway, i've watched about 5 of his video presentations over the past year year, and read several of his article, opinions on languages and software, and studied his creation node.js.

i really like this guy. This guy, his opinions, are somewhat controversial. But, i find that, his thinking, and views on software, is quite in sync with mine.

i think possibly this is because we are both math guys first. He's never took any computer course. Nor i.

i don't speak for all math guys, but, for me, coming to programing, most of it is pure complex garbage. The coders, in particular unix, perl, python, they don't know what they are talking about. Different ideas are extremely hard to get to them, as i've written few thousand articles on various aspects. [see Hacker Cult]

also, note that, mathematicians don't think alive themselves. In fact, there are also camps of extreme opposite styles who don't like the other.

Python creator, Guido, is also a mathematician (don't know exactly to what extent. If he simply has a math digree, that kinda doesn't count.). But, i think he may be a coder before he is a mathematician. His thoughts on computing, stabs mine in every way.

Knuth is a mathematician. Though, i didn't like his thoughts much.


love the Ryan Dahl guy. Today's work, annotated the whole thing. His video is the best intro to node.js. Node.js Video Tutorial by Ryan Dahl, with Annotation

PS i will not repeat here too much stuff from my web dev blog. So, if you haven't already, subscribe my wed dev blog at Xah Web Dev Blog. The rss/atom link is at the right side on that page.

Linux: Download Website: wget, curl, HEAD, GET (old tutorial, but now on a page of itself)

How to fix last commit message?

git commit --amend -m "new commit message"

Linux: Reset Terminal, Clear Screen History

Object Oriented Programing Mutation: “Object” Is No Longer Data, But Namespace

Linux: Firewall Tutorial, iptables, netfilter (new syntax coloring)

Testing Server Performance Using Apache Benchmark Tool

Linux: Basic Shell Commands (updated with new syntax coloring)

On Sun Microsystems's keyboard, there's a Compose key and a Alt Graph key. What's the difference? See: Sun Microsystems Type 6 Keyboard (updated)

found a key symbol for compose key. see Unicode Keyboard Symbols ⌘ ⏎ ⌫

Wilt Thou Gallantly Tilt at Windmills?

Writing Programing Tutorial vs Coding a Project

writing programing language tutorial isn't easy, and is extremely time consuming. Suppose you are reading a book or a doc. In few minutes, or even after a hour with coding, you understood it, and can employ it right away in your project or job. But, if you want to write a tutorial of what you just learned, it'll take 10 folds more time. Because, first of all you have to give context of why, and this aspect often takes some research by itself. Then, you have to have a good understanding of the whole instead of just the parts you just understood, because otherwise its like the blind men feeling the elephant and you can't say to readers that a elephant is pillar-like and period (this happens to haskell monad blogs). Then, you need to give good examples. Proper ones, and ones that are idiomatic, industrial accepted. So, it's like you have to have a survey of sorts, either from experience or have read tons about it. And, if you are like me, have idiosyncratic bent on things, you need to put things into style yet respect all the above mentioned issues. That doubles or triples the time and effort.

note that, this is not to imply that coding a project is easier. They are quite different endeavors. For example, if you are coding a project, once you read something, you can put to use right away, but, then you have 100 other details and complexities you need to solve, that you otherwise don't have to deal with if you are writing a tutorial. Tutorials typically deal only with clean, crystallized, account.

comment on g+

Razer Left-Handed 17-Buttons Mouse❕

just discovered. Razer just released a left-handed mouse, but a full-featured gaming mouse.

Razer Naga left handed gaming mouse
Razer Naga 2014 Left Handed MMO Gaming Mouse. Buy at amazon

This is fantastic. I'm not left-handed, but i always use 2 mouses, one for each hand. I use whichever one i feel like at the moment.

Right now, my right-hand mouse is the Logitech G700, and i really love it. However, my left-hand is the sucky Microsoft SideWinder X3 symmetrically shaped one. The 4th and 5th buttons are on the side, very hard to use, essentially useless.

If you want a less fancy, just 5-buttons left-handed mouse, go for Razer DeathAdder 3500 PC Gaming Mouse — Left Hand Edition

Fancy Mouse with Full Linux Support?

ROCCAT Kone mouse 96649
ROCCAT Kone mouse. ROCCAT KONE mouse

most gaming mouse lets you customize keys, but the software works in Microsoft Windows only. Then, you can use in Linux. But if you want Linux support from ground up, look no further than ROCCAT. See How to Choose a Gaming Mouse?

Python: How to Find Python Interpreter Path, Script Path, from Running Script (updated)

tri game2
Black's turn. Who wins?

Go Board Game on Hexagonal and Triangular Grids

internet speed growth
Internet speed growth. Table[{1990 + x, 1.2*1.5^x}, {x, 0, 22}]

How Fast Does Internet Speed Grow? (updated)

Search Unicode Characters

major update.

xah unicode search 2013
Unicode Search

Unicode Basics: What's Character Set, Character Encoding, UTF-8? (updated)

Meaning of Object in Computer Languages (major update)

more soup. JavaScript Syntax Soup: 「p in o」 vs 「for (p in o) {…}」

Web Browser Unicode Support Test Page

Linux: Setup AutoScroll (updated)

python iterator and generator and “list comprehension” crap

python is such a fck. It takes idiotic parts of functional programing concepts, such as list comprehension and generator, and mix in with its own OOP fck. And the hacker types all goes, wow, python supports advanced functional programing. PHP is more FP than python ever will be.

my hatred for python's iterator and generator cannot possibly go deeper. See, expanded: Python 3: Map with Side Effect Doesn't Work If Result is Not Used

other gratis links:

A Functional Programing Architecture on JavaScript/DOM

formal language approach to computer language tutorial and documentation

look at the syntax coloring of these pages.

this is what it means, of treating a language as a formal language.

in essence, the tutorial are written with focus of syntax, and only that as much as possible. Note the syntax coloring. It's a simple form of BNF.

all tutorials i've ever read, in the past 2 decades, i don't think one of them stick to a form that's close to a formal language (except Mathematica!). Not java, perl, python, unix man.

Meaning, machine can actually parse it. I'm slowly developing my own BNF notation.

programing: x^(1/2) for square root

in any language, you can use x^(1/2) to do square root. For example, Python 2**(1/2.). JavaScript Math.pow(2,1/2)JavaScript Tutorial by Example

do you understand the language well before you use frameworks?

normally, the way a programer uses a lib or framework is that he already knows the lang well, so uses the lib that makes it convenient. However, that doesn't seem to be the case with JavaScript jQuery, or lots other framework in JS or other lang, these days.

these days, many programers just learn the framework, without knowing the language well. I think this is particularly so with JavaScript and Ruby.

is this good or bad?

in one sense, obvious bad. The sign of times, when idiots reign on earth…

but perhaps that's actually progress. Who understand how sine, cosine is implemented? raise your hand.

Vector Normalize Function in Mathematica, APL, Haskell, Ruby, Python, Perl, Lisp, JavaScript, Java, … (updated)

The Naming of List Things in Computer Languages

perl. type corelist /JSON/ to search by regex of modules. Perl: List Available Modules, List Module Search Paths (updated. thanks to Robin Lee for tip)

Perl. Perl: gzip Files (updated. thanks to Robin Lee for tip)

Python: Read/Write to JSON

Alan Kay on Object Oriented Programing

my bitching about Python Doc made it to the core. see bottom Python Doc Problem Example: gzip

learned about Elm programming language. See Proliferation of Computing Languages

Python's Context Dependent Syntax Soup: 「… in …」 And 「… not in …」

The Idiocy of Python's Function Parameter Specification

python: list modules, module search path, intepreter path


Ask me question on patreon