Xah Programing Blog Archive 2014-07

i'm doing more and more JavaScript. Visit my Xah Web Dev Blog for goodies. Click subscribe web dev blog.xml.

updated on the JavaScript + svg. Computer Languages Characters Frequency

See also: Practical SVG Tutorial

Idiocy of Keyboard Layouts: QWERTZ, AZERTY (minor update)

atom feed broken relative link, base url. No, hackers are broken.

in atom feed (aka webfeed, rss), by spec one can have a base url where other url are relative to, e.g.

<feed xmlns="http://www.w3.org/2005/Atom" xml:base="http://ergoemacs.org/emacs/">

this is required by spec.

but it's quite annoying that most webfeed/rss clients are broken about it. i regularly got complaints about my feed links being broken. My guess is that many saw the broken links and simply stopped subscribing.

(many clients, simply don't support the atom feed to this day. This include Emacs GNUS at least last year.) (Atom feed format is far superior than rss created by the scmbg Dave Winer. see [• Atom vs. RSS By Christopher Wellons. At http://nullprogram.com/blog/2013/09/23/ , Accessed on 2014-07-18 ])

many moons ago, when Google Reader was around, in the beginning, it was also broken, but later on they fixed it. Same for yahoo.

recently, Christopher Wellons's https://github.com/skeeto/elfeed/issues/37 also had this problem.

No, the hacker idiots are broken. The hackers, the industry coders, the agile fk, the extreme programing fk, the google io fk, the linux fk, and the RFC fffffffffkk, n one thousand frameworks fk.

see the section “Webfeed Reader Bug on Relative Link” at Atom Webfeed Basics

see also Complexity and Tedium of Software Engineering

comment at https://plus.google.com/+XahLee/posts/5JrhNjhtXRT

How to unadd a file?

# unadd a file
git reset myFileName
# unadd all added files in current dir
git reset .

is programing math?

How to Stop Xfce from Loading Last Session

marketing is the primary government of lang popularity. If JavaScript was named LispScript with nested parens, it'd have failed.

LispyScript. A javascript With Lispy Syntax And Macros! http://lispyscript.com/

just wtf is closure❓

One of the things i'm most annoyed with hacker types is closure. The hacker types, always clamor about closure, how powerful it is.

but, functionally, mathematically, closure is equivalent to using global variables. But the hacker types, don't get it.

Mathematica Expression Forms

mathematica7 expression forms 2014-07-11
Mathematica expression forms. Top: InputForm. Middle: StandardForm. Bottom: FullForm.

note: the indentation is automatic. There's no Tab character anywhere.

The FullForm at bottom, is isomorphic to lisp's sexp. In lisp, you have (f a b c). In Wolfram Lang, it's f[a,b,c].

[see Concepts and Confusions of Prefix, Infix, Postfix and Lisp Notations]

comment at https://plus.google.com/+XahLee/posts/apFFHAZtksB

JavaScript functional programing flexible coding style problem

one problem with functional programing in JavaScript and Wolfram Language is that, when there are a team of coders, the code becomes incomprehensible.

because, the function can be chained, function return functions, and the chaining function or method syntax is too convenient. So, everyone has a different coding style (here, the style refer to the semantic construct, not formatting). So, code become hard to understand.

lisp doesn't have this problem because the parenthesis prevents people chaining functions arbitrarily.

this is when python shines. First of all, it has a crippled lambda, so you can't have arbitrary functions inline or chain them. You have to define it by itself. Then, the language syntax prevents you from writing one-liners.

java, also works here. Because, the lang is so inflexible that you have to write everything out, each line can only do very little.

though, as a language designer, what can you say about this? what can you do?

isn't it ironic that if you create a language so powerful and flexible that it backfire? Something must be wrong with this logic? how to resolve this paradox?

in my way of thinking, whenever result of mathematical analysis conflict with human intuition or practice, it is human that needs to adopt. (For example, relativity, flat earth, concept of size, dimension, time. Habit. superstition. religion, etc.) but we must be very careful.

so here, if we verify by science truly that powerful language with flexible syntax indeed create a problem due to multitudes of incompatible programing style, then, the issue is about how to create or enforce a style. Because, math tells us that ensuring a unified style is a problem by itself.

many language designers, cut corners. They think, O that's too flexible and create a multi-style problem, therefore my language will not have this syntax. That is confounding of issues. It will solve the problem near-term, not long-term. It's like the qwerty layout for typewritters. When typists types too fast and the key jams, the problem was solved by changing the layout so typists can't type fast.

comment at https://plus.google.com/+XahLee/posts/jdhaR786KDg

Linux: Change Sound Level by Command (on its own page)

Java Tutorial: The “extends” Keyword (minor update)

The Sounds of Obsolete Technologies 1990 – 2000 (repost)

(xd.draw_vertical_grids(0,φwidth,0,φheight, lang_chars.length + 1)).map(function (x) {φsvg_element.appendChild(x);});

am starting to code javascript like Mathematica. Sweet!

and this is a major problem that lisp can't do, due to the nested paren. see Programing Language: LISP Syntax Problem of Piping Functions

this is a syntax induced semantic problem. similar happens to python, see Why Python's Lambda is Broken and Can't be Fixed

Concerning the Cut Off of the Flow of the Code

so, i have this nice code:

// …

            var xlink = getRandomPath();

            // 338 pages. 1/338 = 0.002958
            if ( xlink.search(/hrefgram2/) !== -1 ) {
                if ( Math.random() < 0.0029 * 0.0029 ) {
                    return xlink;
                } else { return getRandomPath(); }

            // 203 pages. 1/203 = 0.004926
            if ( xlink.search(/monkey_king\//) !== -1 ) {
                if ( Math.random() < 0.0049 * 0.0049 ) {
                    return xlink;
                } else { return getRandomPath(); }

            return xlink;

jslint is telling me:

Unnecessary 'else' after disruption.

after looking up, it means he says that my else is redundant, that i should do

if (…) {
            return xlink;
        return getRandomPath();

Redundant his ah.

didn't my mom say, if you can't say things nice, shuddayap?

actually, after thinking about it, i think the jslink style is better. My thought flow goes like this:

comment at https://plus.google.com/u/0/+XahLee/posts/F7CpXB3w3ES

Programing Language: Function Dependency

Hackers and the Foobar Phrase

JavaScript variable hosting, should you move variables declaration to top?

so, recently i've been thinkin about JavaScript's name hoisting. [see JavaScript: Variable/Function Declaration Order, Name Hoisting]

am thinking, what a bizaro behavior. Was it accidental or by design? I think it must be design, because it can't happen by accident. But who would design a loon like that?

then, it just dawn'd on me now, there's precedence: lisp!

(let (x y z)
 ; ...

so, thinking about it, it's really alright. A bit odd, but alright.

i think i'll adopt to actually do move all my var declarations to top.

see this for context: JavaScript: Should You Move Variables to the Top?

comment at https://plus.google.com/+XahLee/posts/A4QLPLNi2QB

Fundamental Problems of Lisp

What's the Airspeed of Unladen Swallow?

python unladen swallow wolfram alpha 3

Programer Humor: Wolfram Alpha Ad: Python Unladen Swallow