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 International Keyboard Layouts (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 Tutorial
see also Complexity and Tedium of Software Engineering
comment at https://plus.google.com/+XahLee/posts/5JrhNjhtXRT
How to unadd a file in git?
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
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
Linux: Change Sound Level by Command (on its own page)
Java Tutorial: The “extends” Keyword (minor update)
(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 LISP Syntax Problem of Piping Functions
this is a syntax induced semantic problem. similar happens to python, see Why Python 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 that my else is redundant, that i should do
if (xyz) { return xlink; } return getRandomPath();
Redundant his ass.
didn't my mom say, if you can't say things nice, shuddayap?
- (1) “if” should have a “else” in this case, it makes it easier to read.
- (2) but, that's actually just a preference. It's not absolute.
- (3) we humans, when reading mathematics or say formal logic, find it hard to read, and prefer something more English. My regard on this is that it's human problem. We need to acquire the taste to prefer the simpler logical form whenver possible. Because, mathematically, it is so. There's nothing that can fsck math.
- (4) therefore, the jslint should be the preferred style.
comment at https://plus.google.com/u/0/+XahLee/posts/F7CpXB3w3ES
JavaScript variable hosting, should you move variables declaration to top?
so, recently i've been thinkin about JavaScript's name hoisting. [see JS: 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: JS: Should You Move Variables to the Top?
comment at https://plus.google.com/+XahLee/posts/A4QLPLNi2QB