Posts

Showing posts from 2013

web hosting service with virtual machine

woot! just activated my digitalocean account. It's a web hosting service using virtual machines. Meaning, you have a whole linux box to yourself, as a dedicated box, with root access. So, you can do anything you want. Ruby, Rails, ngixn, Node.js, anything, or just play with it. They run it on solid state drive.https://www.digitalocean.com/

programing language: closure should be ban'd

slightly updated. Python: Function with State (closure-like)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. 〔☛ Emacs Lisp Symbol …

♥ JavaScript, Node.js, socket.io ♥

thanks to friends on g+, discovered Socket.ioSocket.IO is a JavaScript library for realtime web applications. It has two parts: a client-side library that runs in the browser, and a server-side library for node.js. Both components have a nearly identical API. Like node.js, it is event-driven.Socket.IO primarily uses the WebSocket protocol, but if needed can fallback on multiple other methods, such as Adobe Flash sockets, JSONP polling, and AJAX long polling,[2] while providing the same interface. Although it can be used as simply a wrapper for WebSocket, it provides many more features, including broadcasting to multiple sockets, storing data associated with each client, and asynchronous I/O.It can be installed with the npm (node packaged modules) tool.[3]home: http://socket.io/github: https://github.com/LearnBoost/socket.ioif you have Node.js's npm installed, npm install socket.ioJavaScript, Node.js, am in heaven. Screw perl, python.Node.js Video Tutorial by Ryan Dahl, with Annota…

♥ 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. 〔☛ Computing & its P…

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

just made a new discovery about the OOP fiasco.in node.js, the “object” is no longer a data, rather, it's more used as a namespace. For example,varpp = require('path'); pp.extname('xyz.html') // ⇒ .htmlthis is actually fantastic. Screw the OOP.What are OOP's Jargons & Complexities (OOP as Functional Programing)On the Idiocy of Dot Notation of Object Oriented Programing LanguagesMeaning of Object in Computer LanguagesConfusing Terminology in JavaScript/DOM: tag, element, node, object, attribute, property, method

beauty and the beast: what's the evolutionary psychology's reason for men preferring beautiful women?

saw a tweet on Chinese weibo, saying that the worst is for you (men) to worry about your looks, because, women don't care. They care about your ability, personality, your commitment to her.true enough. (is this critically true? well, i think so, but not gonna worry about that now) What got me thinking, is what's the reason that men care about women's looks, but in particular, she be beautiful, not just young.men like young, and that's because only young ones have more chance of reproduction. But why beautiful? well, youth and beauty are connected, but, the thing is, say there are 5 college teens walking on a street, and say one has the looks of models, but the others are rather ugly. The most beautiful one will be our focus. What's the evolutionary psychology's explanation for this?O, btw, have you heard of “beauty and the beast”? It's a perennial tale, in fairy tales, folk lores, or today, in movies, novels, posters, comics. (⁖ phamtom of the opera) Male, …

JavaScript declaration and assignment

JavaScript. Multiple variables can be declared on the same line, separated by comma var name1, name2, name3 …;// declare variable, use 「var」 varx; vary; // multiple variables can be declared on the same line, separated by comma vara, b, c;Multiple variables can be declared and assigned at the same time.// declare variable and assign varx = 4; // declare variable and assign multiple variables vara = 1, b = 2, c = 3;When a variable is declared but not assigned, the default value is undefined.When a variable is not declared nor assigned, and you try to access it, you get ReferenceError.varx; console.log(x); // prints 「undefined」 console.log(y); // ReferenceError: y is not definedJavaScript Tutorial by ExampleJavaScript Variable Scope: Function Level vs Block LevelJavaScript: Variable & Function Declaration Order: Name Hoisting

Teary Eyes, a Need for Intimacy

the primary purpose of tears in weeping is to signify a need for intimacy.for adults, typically, it's attractive when done by female.you can see, in media, for example Miley Cyrus's 〈Wrecking Ball〉 featuring big blue eyes with tears. And also, in Lady Gaga's 〈Bad Romance〉see also Reading Notes on 《Intimate Behavior》#feminism

Wilt Thou Gallantly Tilt at Windmills

Tilting at windmills is an English idiom which means attacking imaginary enemies. The word “tilt”, in this context, comes from jousting.The phrase is sometimes used to describe confrontations where adversaries are incorrectly perceived, or to courses of action that are based on misinterpreted or misapplied heroic, romantic, or idealistic justifications. It may also connote an importune, unfounded and vain effort against confabulated adversaries for a vain goal.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…

JavaScript Unicode Search box

Image
major update on unicode search. You can search by name, codepoint (decimal or hexadecimal) or paste in Unicode characters. Search is now real-time. Result shows as you type. For example, try to find unicode related to christmas. 🎄🎅.Use the search box at Unicode Symbology ☢ ☯ ☭ ∑ ∞ ♀ ♂ ♥Unicode search screenshot

JavaScript Name Hosting and One-Liner Functional Style

JavaScript has name hosting. 〔☛ JavaScript: Variable & Function Declaration Order: Name Hoisting〕 and i think Douglas Crockford recommends to move all vars to the top, to reflect reality.but look at the following code. Moving all var to the top would be silly.functiondisplaySearchResult (charArray, anchorNode) { // clear the result first while (anchorNode.hasChildNodes()) { anchorNode.removeChild(anchorNode.lastChild); } if ( charArray.length === 0 && searchBox.value.length !== 0) { varnoResult = document.createElement("span"); noResult.innerHTML = "none found. Try type more characters, or try “star”, decimal search “#97”, hexadecimal search “#x61”, or enter a Unicode “♥”"; noResult.style.color="red"; anchorNode.appendChild(noResult); } else { for (varii = 0; ii < charArray.length ; ii++) { varuNum = charArray[ii]; varuHex = uNum.toString(16);������������…

JavaScript syntax soup: 「p in o」

another episode of syntax soup. In JavaScript, you have p in o and for (var p in o) {…}. The first looks the same as part of the second, but have completely different semantics.Soup. Soup. Soup. It's All Soup.JavaScript: Property, Prototype Chain, Enumerable: Accessing & Listing PropertiesPython's Context Dependent Syntax Soup: 「… in …」 And 「… not in …」

Stereographic Projection & mobius transformation

Image
Stereographic Projection & mobius transformation。 If you want to understand Einstein's theory of relativity, you must understand mobius transformation. To understand mobius transformation, you must first understand Riemann sphere, complex numbers, geometric inversion. stereographic projection by Henry Segerman赤平投影和莫比乌斯变换。如果你想了解爱因斯坦的理论,你必须明白莫比乌斯转型。要了解莫比乌斯变换,必须先了解黎曼球,复数,几何反转。see http://xahlee.info/math/stereographic_projection_physical_model.html

wikipedia controversies

wikipedia is not without controversies in its reliability. However, in general, if you are a learned man, and read it frequently, you basically know by heart which parts is not trustworthy.when you are a learned man (as in, you have several degrees, or is a scholar, and often minimally knowledgeable in diverse fields from sciences to humanity, such as philosopher), you can basically tell when you read something that came across as funny, wikipedia or not. Because, you know what you know and what you don't know, and you have good experience of seeing questionable writing.And, if you do use wikipedia a lot, you also know which type of article, or part of the writing style, is red ink.gratuitous links:The Heart of Wikipedia: Why is Wikipedia Successful?Lispers and WikipediaWikipedia MoronsEncyclopedia, My ExperiencesDeath of EncartaLinks to Wikipedia from Xah Sites

Python: Example of Using Sets

Python: Example of Using Sets# -*- coding: utf-8 -*- # python # utility to show the difference of JavaScript's encodeURI and encodeURIComponent functions # 2013-12-09 digits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} letters_upper = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'} letters_lower = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', &#…

do you understand the lang 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.

Wolfram Language and Lisp, Clojure

every developer should buy a copy of Mathematica, because it will expand their mind. —Rich Hickey (clojure inventor)Wolfram language is on the news recently.〔Something Very Big Is Coming: Our Most Important Technology Project Yet2013-11-13 By Stephen Wolfram. @ blog.stephenwolfram.com…〕〔Putting the Wolfram Language (and Mathematica) on Every Raspberry Pi2013-11-21 By Stephen Wolfram. @ blog.stephenwolfram.com…〕Mathematica is very similar to lisp. Every concept of lisp has a counter-part in Mathematica. Symbols, atoms, read/eval/print loop, symbol properties, nested expression (sexp and Homoiconicity), macros (in M it's far more advanced, called pattern matching (but Haskell and Ocaml's Pattern Matching not like M, because M work on symbols, as do lisp macros)), even package system is akin to Common Lisp.if you want to get a sense of what the lang is like, watch this video:Kovas Boguta — session — Clojure NYC Meetup 20120516. From Tom Hickey, 2012Mathematica part start at 5:50 …

What Does “Formal Method” Mean?

one abuse of term in math & programing is “formal”, ⁖ formal methods, formal proof. In practice, people meant roughly “more rigorous”. But, it has a more technical meaning: formal in “formal language”, Hilbert “formalism”, the “form” of formulas, calculational proof.when programers mention formal methods, ⁖ lisper, haskeller, pythoner, please help better the world by shoving a cucumber in their mouths.see also Math Notations, Computer Languages, and the “Form” in Formalism

Guido Says: Python 3 Things Still Unsolved: Multi-Line Lambda

lol. In Guido's python 3 retrospect, his last item is: “Things still unsolved: Multi-line lambda”.〔Python 2 vs. Python 3: A retrospective2013-11-09 By Guido Van Rossum. @ www.dropbox.com…〕See also:Lambda in Python 3000Why Python's Lambda is Broken and Can't be FixedThe Fate of Lambda in Python 3000 and Scheme v300Python Unicode Tutorial 🐍

Example of JavaScript Sort Method Using Custom Sort Function

Example of JavaScript Sort Method Using Custom Predicate// array sort example varaa = ["a1", "a70", "a8", "A2"]; // default sort. element compared as string aa.sort(); console.log(aa); // [ 'A2', 'a1', 'a70', 'a8' ] // sort by comparing as numbers after first char aa.sort(ff); console.log(aa); // [ 'a1', 'A2', 'a8', 'a70' ] functionff (x,y) { varnx = parseInt(x.slice(1)); // remove first char. consider rest as number varny = parseInt(y.slice(1)); if ( nx < ny ) { return -1; } if ( nx > ny ) { return 1; } if ( nx == ny ) { return 0; } }see more at JavaScript Array Methods

How to Connect BlackBerry PlayBook to Linux

Perm URL with updates: http://xahlee.info/comp/blackberry_playbook_unable_to_delete_file.html• plug in the USB between PlayBook and Linux machine.• on PlayBook, go to 〖About〗, find the USB IP address of the PlayBook. In the About screen, the Network menu. Note, it's the USB'S IP address, not the wifi ip address.• on PlayBook, go to 〖storage & sharing〗, set the menu “USB Connections” to “Connect to Window”. In the “File Sharing” section, turn it on.on Linux, just open a folder, and in the address type smb://169.254.134.77/, where the IP is your IP.BlackBerry PlayBook is the worst tablet.

the phenomenon of selfy

Image
the phenomenon of selfysince tech advanced to the point where everyone had a camera carried in their pocket, there's a phenomenon called “selfy”. That is, people taking a photo of themselves. And, in particular, in the context of male vs female, it's always the girls, who do that. Not just normal photos, but also nude photos of themselves. #feminismKim Kardashian tits and ass. from her own blog, 2013-10-16img src

Math Terminology: Magma vs Groupoid

Math Terminology: Magma vs GroupoidThe term magma for this kind of structure was introduced by Nicolas Bourbaki. The term groupoid is an older, but still commonly used alternative which was introduced by Øystein Ore.why did the Bourbaki guys introduce the term magma? it seems to me groupoid is a better term. Was it introduced to avoid confusion due to the many slightly different definitions of groupoid?

clock secondhand gear mechanism

Image
clock secondhand gear mechanism

The Death of Perl, UML, Design Patterns, eXtreme Programming

there are few things am rather happy in my programing career.the death of Perl.death of UML, eXtreme Programing, Design Patterns.death of Sun Microsystems.those are scums lying thru their teeth.am looking forward to the death of Agile, MySQL, Apache.Apache is experiencing slow death by nginx, node.js. 〔☛ Tech Humor: Apache vs Node.js vs NGINX 📺〕 MySQL is getting killed by Oracle — how ironic. Agile is a lingering mutation of eXtreme Programing. 〔☛ EXtreme Programing and Agile Voodoo〕Justice — feels good.Why Software Suck: Design Patterns QuackeryPerl Books Survey 2002The Nature of the Unix Philosophy Apache HTTP Server Tutorialnginx TutorialPerl: Learn Perl in 3 Hours

how much you'll get for writing a programing book?

how much you'll get for writing a programing book?maybe $2 per book, and if you are successful, you might sell 4k copies.how long does it take to write it? half a year to a year or more, full time work.references:〔Coding Horror: The Book2012-07-10 By Jeff Atwood. @ www.codinghorror.com…〕〔Do Not Buy This Book2007-10-04 By Jeff Atwood.. @ www.codinghorror.com…〕〔Programming Book Profits2008-01-21 By John Resig. @ ejohn.org…〕〔Hard Work, No Pay: What's the Point?2007-10-08 By By Charles Petzold. @ www.charlespetzold.com…〕〔Secrets of book publishing I wish I had known2008-07-10 By Mark Hurst. @ goodexperience.com…

lady justice kissing lady liberty

Image
gay marriage ruling cartoon by Nate Beeler 2013-06-26. img srcLady Justice (Latin: Iustitia, the Roman goddess of Justice, who is equivalent to the Greek goddess Dike) is an allegorical personification of the moral force in judicial systems.In ancient Greek culture, Dikē (Greek: Δίκη, English translation: “justice”) was the spirit of moral order and fair judgement based on immemorial custom, in the sense of socially enforced norms and conventional rules. According to Hesiod (Theogony, l. 901), she was fathered by Zeus upon his second consort, Themis.The sculptures of the Temple of Zeus at Olympia have as their unifying iconographical conception the dikē of Zeus, and in poetry she is often the attendant (paredros) of Zeus. In the philosophical climate of late 5th century Athens, dikē could be anthropomorphised as a goddess of moral justice. She was one of the three second-generation Horae, along with Eunomia (“order”) and Eirene (“peace”):Dike (mythology)

Angry Birds on the Plane

there's a dude sitting besides me on the airplane, playing Angry Birds on iPad. All of a sudden, he shouts: “i've got 2 bombs, go to hell you stupid pigs”. I jumped, and all other passengers wet their pants.飞机上有个二逼坐我旁边用iPad玩愤怒的小鸟,玩着玩着突然激动地大吼一声:“我有两个炸弹!都他妈死吧蠢猪们!”当时吓了我一大跳…… 那天飞机上的其他乘客也都吓尿了...... (from xie107)

Hacker News Hit Traffic Effect

Hacker News Hit Traffic Effectyesterday's Hacker News hit, 5.5k visits. 〔https://news.ycombinator.com/item?id=6056420〕 Last time in April hit is 4.5k visits. 〔https://news.ycombinator.com/item?id=5536134〕 About 50% are using Google Chrome. 26% Firefox. 8% IE.

Remember the Windows Monopoly?

Image
Remember the “Windows Monopoly?” Yeah, That Was a ThingBill Gates - United States vs Microsoft, 1998Read:On Microsoft HatredWhat is Monopoly? Apple or Google or Microsoft?The Microsoft Hatred FAQMicrosoft Hatred & Godrun and go buy: Basic Economics by Thomas Sowell.

BlackBerry Tablet Browser Sucks: CSS rel attribute match support

Image
amazing, in this day of age, the BlackBerry tablet doesn't support this CSS:a[rel="next"]:before {content:"▶ ";font-size:2ex} a[rel="up"]:before {content:"▲ ";font-size:2ex} a[rel="previous"]:before {content:"◀ ";font-size:2ex}the CSS above is supposed to match navigation links such as this:<arel="previous"href="a.html">a</a> <arel="up"href="b.html">b</a> <arel="next"href="c.html">c</a>It should marke each nav link with a proper Unicode triangle, like this:nav bar screenshotbut in BlackBerry, all links are marked with ◀.test here: Blackberry Tablet Rel Next Link Css Test〔☛ CSS 2.1 & CSS 3 Selector Syntax〕The browser on BlackBerry's user agent string is:Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/536.2+

Modern Hipster Obsession

today, the super popular Oatmeal comics has this piece: 〔The terrible and wonderful reasons why I run long distances - The Oatmeal2013-07-15 By Matthew Inman. @ theoatmeal.com…〕 it's a long one, some 10 pages in 5 parts.in the end, he linked to his blog about his toenail falling off. See photo here http://theoatmeal.com/blog/ultramarathonthat's strange and pretty sick to look at. Is toenail problems some sort of common problem for marathon runners?it's a enjoyable comic, and inspiring. However, if you are like him, it's call pathetic. Running obsession like that as he does is a symptom of psychological problems, just as body builders or gym goers that he dissed.and, now the Xah American say. In rich countries, such as US, the online hipsters worry about being fat. People do “try-something-new-for-30-days”, people invent foodies, yelp, these hip and well-fed and got-nothing-to-do folks, tries to live a healthy living, wholesome life, tries to help blacks, tries to save …

Unicode Naming: Slash or Solidus

Unicode changed the name of slash “/” to from “SLASH” to “SOLIDUS”. Is this a good name change?here's other slash symbols in Unicode:/⁄∕/⧸⫽⫻\⧵⧹⑊﹨\ See also: Unicode Search: Find Your Symbols

Why's vi's ADM-3A Terminal Chose {H J K L} Keys for Arrows?

you know how the vi keys came from the ADM-3A terminal's keyboard? but do you know why THE KEYBOARD chose {h j k l} instead of say {i j k l}?Answer: hackery.that's the answer for all unix things, btw.See, updated: History of Emacs & vi Keys (Keyboard Influence on Keybinding Design).Emergency vi (vi tutorial)Using Voice to Code Faster than Keyboard 📺Text Editor's Cursor Movement Behavior (emacs, vi, Notepad++)on vi Keybinding vs Emacs KeybindingProgramer Hand Health: vi Esc Key Syndrome

Strange Phenomenon in Chinese Microblogs: Images Instead of Text

中文Weibo有个奇妙的现象。本来限制字数,基其让人话简语重。但,用户开始把长篇大轮以图发出。这一下,一张图是文子码数位大小的百倍,又不能搜索,又不能清楚的字体放大。美国英语Twitter类比较没有这现象。奥妙。There's a curious phenomenon in Chinese Weibo (microblog). That is, normally the character limit is to make user's post dense and focused. However, Chinese people started to use image instead for long Chinese articles. The transmission size of a image is a thousand times greater than text, and it can't be searched, nor resized clearly. Strangely, English microblogs such as twitter haven't developed this phenomenon.

Will #lgbt and Feminism Become Passé?

recently i realized, the #lgbt (lesbian gay bisexual transsexual) kinda stuff is not going to end. Actually, lgbt will come to pass sooner or later, but women's jostling for power with men is not going to end, which once known as feminism.this is because, tech will not cease advancing, making muscle not necessary, and women will continue to hitch a ride in the power ladder.the #lgbt kinda thing that's so hot in recent years, will pass as zeitgeist, however. Because, gay and the tranny stuff is only a minuscule percentage of human animals. Currently, gay borrows tranny for a ride, and feminism borrows lgbt for a ride. Gay and Tranny stuff can't last.but female's struggle for more power, will not cease, because, women, the half of human animal, doesn't have inherent sexual difference from men in hunger for power. The fashionable terms may change, but essentially #feminism will keep going for a decade, 2 decades, 10 decades...sex will become just a pure pleasurable …

JavaScript Object's Properties Are Strings

remember, in JavaScript, Objects are just unordered key/value pairs. And the keys are string, cannot be numbers. (the value can be any type) If you have o = {2:7, 3:4}, the keys are still strings, because JavaScript automatically does number to string conversion.here's a example.o = {"a":7, 2:4} vark = Object.keys(o); console.log(typeof(k[0])) // string console.log(typeof(k[1])) // string

dodecahedron tits

Image
dodecahedron tits

quintessence of a woman's beauty

Image
Quintessence of a woman's beauty. Location Riga, Latvia. photo by Andris Dūmiņš
View Larger Map

Emacs Regex Advantages, Whitespace Syntax & Semantics Complexity in Computer Languages

Emacs Regex Advantagesemacs regex is usually a pain, but it has advantages.today, i need to change text like this:<p>盖闻天地之数,有十二万九千六百岁为一元。将一元分为十二会,乃子、丑、 寅、卯、辰、巳、午、未、申、酉、戌、亥之十二支也。每会该一万八百岁。且 就一日而论:子时得阳气,而丑则鸡鸣;寅不通光,而卯则日出;辰时食后,而 巳则挨排;日午天中,而未则西蹉;申时晡而日落酉;戌黄昏而人定亥。</p>to this:<p>盖闻天地之数,有十二万九千六百岁为一元。将一元分为十二会,乃子、丑、寅、卯、辰、巳、午、未、申、酉、戌、亥之十二支也。每会该一万八百岁。且就一日而论:子时得阳气,而丑则鸡鸣;寅不通光,而卯则日出;辰时食后,而巳则挨排;日午天中,而未则西蹉;申时晡而日落酉;戌黄昏而人定亥。</p>Basically, i need to remove newline chars, and only if it is inside the “p” paragraph tag, and only when that text is Chinese, not English.there are few hundred of such pages i need to do this.Emacs regex has a nonascii character class. So, i can use this regex:\([[:nonascii:]]\{3\}\) \([[:nonascii:]]\{3\}\)and replacement is this:\1\2〔☛ Emacs: Text Pattern Matching (regex) tutorial〕I looked at Python, it doesn't have a named char class for Unicode. Though, am sure one can use a char range. Perl does support Unicode char class, same syntax as emacs, whic…

HTML Meta Language Tag Obsolete

the meta language tag:<metahttp-equiv="content-language"content="zh">is now obsolete. See: http://www.w3.org/TR/2011/WD-html-markup-20110113/meta.http-equiv.content-language.htmlinstead, use the “lang” attribute, like this:<bodylang="zh">…</body>

Douglas C Engelbart Died

Douglas C Engelbart died yesterday, on July 2nd. 1925 〜 2013. 88 years old.he invented the mouse 〔☛ Computer Mouse, Trackball, Input Devices〕, and is a pioneer of computer networks.I figured since i write so much about keyboard and mouse, i should mention it.See this interesting post to learn more about him. 〔Engelbart's Violin2012-05-23 By Stanislav. @ www.loper-os.org…

Paris Hilton, on Sexual Competition Among Primates

ran into a pop love song today, sung by female. One of its salient vocal goes like this: I can do what she can do so much better and, what a wonder, it's a song by Paris Hilton.

Unicode Navigational Pointers

◄►◅▻☚☛☜☝☞☟👆👇👈👉🔙🔚🔛🔜🔝These are new in Unicode 6 i think. If it doesn't display, get the font, see: Unicode 6 Emoticons and Supporting Fonts. For many other arrows, see: Unicode: Arrow Symbols ← → ↑ ↓

Emacs Lisp, Coding Style, Language Idioms, Controversy

now and then, i get criticisms on my emacs lisp tutorial. They point out that i'm not following convention. Most of the time, they just pointing out that my trailing parenthesis are not tugged into a single line (aka hanging parenthesis). Other common complaints is that my code is not idiomatic.I appreciate criticisms, and welcome negative ones. Though, coding style and idiomatic programing are two aspects of programing i've put a lot thought in, more so than most programers.In summary:Coding style conventions are mostly harmful. The language's syntax and semantics should naturally enforce it.Idiomatic programing are harmful. It should be ban'd, except the type of idiom that has a non-trivial effect on algorithm or computational complexity.here's some excerpt from discussion on Google Plus thread+Nick Alcock +Elias Mårtenson i think the concept of code formatting style is harmful, for a lang with regular syntax, such as lisp, xml, Mathematica. In the latter two, on…

lisp cult

i damn hate the lispers, in particular, old Common Lispers. Sputtering scientifically baseless shit.programing lang communities need more science. Not lore, convention, cult dogma.it is incredible, that lisp monotonic syntax is a problem seen by all non-lispers and expert lispers, but the lisp cult insists no problem.then, lispers sing macros, but none ever seen Mathematica pattern matching.lisper insists regular nested paren, data is code shit, yet when u point out it's not regular, they say it's ok.while, lispers don't seem to see the XML, Mathematica, both have more regular nested syntax, and code is data too.it's helpless, because years after year, the cult cultivates untruth. Thoughts are ingrained. like religion.Concepts & Confusions of {Prefix, Infix, Postfix, Fully Nested} NotationsPrograming Language: Fundamental Problems of LispPrograming Language: LISP Syntax Problem of Piping FunctionsLISP Sans Parenthesis, 1958 to 2013, a SurveyWhat Are Good Qualities of C…

Math: Symmetry, Flatland, by Ian Stewart

A new book. 〔Symmetry: A Very Short Introduction2013-07-12 By Ian Stewart. amazon〕It cited my work: Discontinuous Groups of Rotation and Translation in the Plane. ☺Ian Stewart is a well-known mathematician. He has written many books introducing interesting math to the laymen. Including:〔Flatterland: Like Flatland, Only More So2002-04-16 By Ian Stewart. amazon〕〔The Annotated Flatland: A Romance of Many Dimensions2008-07-22 By Ian Stewart. @ amazon〕You can also read Flatland here: FLATLAND: A Romance of Many DimensionsThere's also a Chinese translation: 神奇的二维国 (Flatland)

Engineer's Romance

Image
“the romance of engineers u no unstand”

Linux, Audio Problem, pulseaudio

in Linux, if audio doesn't work, you can trypulseaudio -k # kill itthen wait few seconds for it to die. You can check bypgrep -l pulseaudiothen, start pulseaudio again.pulseaudio --start # start it againTo start the sound level control panel, do:setsid pavucontrol # start sound level control panelnow, if your desktop dock volume shows gray, you might need to restart it.# restart xfce dock pkill xfce4-panel setsid xfce4-panelThe Linux audio problem is caused by the kernel having problem with several popular Logitech webcam. In my case, its Logitech HD Webcam C310 amazonIn your syslog, tail -f /var/log/syslog, you get flooded by this message:kernel: [ 1438.563209] 3:3:4: cannot set freq 48000 to ep 0x86 kernel: [ 1438.563976] 3:3:4: cannot set freq 48000 to ep 0x86 kernel: [ 1438.565348] 3:3:4: cannot set freq 48000 to ep 0x86The solution is just to unplug that webcam.You can see bug report here. https://bugzilla.kernel.org/show_bug.cgi?id=44281

Philosophy, Extreme Utilitarianism on the Dead

Perm URL with updates: http://xahlee.org/Periodic_dosage_dir/pd.html#philosophyjust got a idea. We need to create a society, where dead is regarded irrelevant, period.no eulogies, no hating or admiring of the dead (such as Hitler, Lincon, past heroes, kings, great artists, anything)the gist of the theory is some aspect of extreme utilitarianism.i got this inspiration now because someone's twitting about people hating some dead guy, as taught in school. e.g. you spit on some bastard's grave, who have done your country wrong. And such act, and the emotion associated with it, is a waste of time.so far, without further research/thinking, i think that MOST of acts, behaviors, emotions, in relation to the dead, is a futile, useless, one. It is somewhat similar to admiring God.also, i guess the above might probably be already covered, ⁖ as a idea by some philosophy or movement in some region or history…

What's HTTP Etag?

Perm URL with updates: http://xahlee.info/js/http_etag.htmlHere a quote from Wikipedia HTTP ETag:An ETag or entity tag, is part of HTTP, the protocol for the World Wide Web. It is one of several mechanisms that HTTP provides for web cache validation, and which allows a client to make conditional requests. This allows caches to be more efficient, and saves bandwidth, as a web server does not need to send a full response if the content has not changed.An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL.The use of ETags in the HTTP header is optional. The method by which ETags are generated has never been specified at any time in the HTTP specification.here's a sample HTTP header:◆HEAD http://xahlee.info/ 200 OK Connection: close Date: Thu, 27 Jun 2013 04:34:23 GMT Accept-Ranges: bytes ETag: "d0dc0093-2393-4dfed7ff74f80" Server: Apache Content-Length: 9107 Content-Type: text/html; charset=utf-8 Last-Modified: Mon, 24…

encryption: What's Perfect Forward Secrecy?

Perm URL with updates: http://xahlee.info/comp/perfect_forward_secrecy.htmldue to the Edward Snowden and NSA fiasco of recent, there's something called Perfect forward secrecy going around.here's what it means. When you are using Public Key Cryptography (PKC), such as HTTPS protocol, you have public key and private key. For example, when you buy something on Amazon, its public key is in your browser, and its server has its private key.The point here is that, once the secret key is lost, all is lost. If NSA have saved all your encrypted traffic for years, they may one day ask/get Amazon's secret key, and your life's history is a open book.Now, PKC with Perfect Forward Secrecy (PFS) doesn't have this problem. Here's a excerpt from Wikipedia:In an authenticated key-agreement protocol that uses public key cryptography, perfect forward secrecy (or PFS) is the property that ensures that a session key derived from a set of long-term public and private keys will not b…

Python: Compute Exact Fractions

# -*- coding: utf-8 -*- import fractions print( fractions.Fraction(5,100)) # 1/20 print( fractions.Fraction(4,100)) # 1/25 print( fractions.Fraction(3,100)) # 3/100 print( fractions.Fraction(2,100)) # 1/50Note that Mathematica had this feature, transparently, since 1990.In Mathematica, any exact number are computed exactly. Number without a decimal dot are exact.

Silly Unicode Name Change: CENTER → CENTRE

Silly Unicode Name Change: CENTER → CENTREUnicode: Dingbats, Cultural Symbols (updated)in Unicode, the name of the character ✲ is changed from OPEN CENTER ASTERISK to OPEN CENTRE ASTERISK. What's the technical reason they make such a silly change? Poltical reason?

Emacs Projects Proposal: Language Aware Modes for Emacs Lisp, HTML5, CSS

remember, am proposing several emacs projects.the HTML5 mode, and emacs lisp mode, and CSS mode, are going to be semantic unit based editor. That is, any keystroke you type, work on the semantic unit of the language. So, it is IMPOSSIBLE to create invalid syntax when you use the mode.also, a new idea is that it'll completely eliminate any form of manual formatting. You NEVER need to press Tab ↹ or Space or Return ↩ for the sake of aligning your code to make it pretty. NEVER. Instead, you press a button, then the current code block is automatically formatted, in a standard convention or in a preference you set up. Another button format the entire buffer, etc.another “new” idea, is that these modes's coloring are “mostly” keyword based. That means, if it's colored in a particular way, you know for sure it's a particular type or word of the language. If it is not colored, you know for sure it's not a core language keyword, or that you had a typo. In other words, the c…

Functional Programing: the Jargon “Lambda”

these days, with functional programing getting popular, and lots lots new languages, the lambda name is falling out of fashion, and i think that's a good thing.for example, in JavaScript, its functions are lambdas (⁖ function xyz {…}), but no JavaScript literature calls it lambda. 〔☛ Functional Programing in JavaScript〕 Same situation in Ruby. Younger generation using these languages, never thought about lambda, yet they benefit from what these so-called “anonymous” function provides. The name lambda actually harms understanding.in Mathematica, the lambda is called Pure Function, but is written simply as Function[…]. (it's called Pure Function to differentiate from functions defined using pattern matching) Mathematica has been that way since version 1 in 1988.the most important thing about lambda, isn't any advanced use, such as “closure”, or things one hear from the Haskell world. It's simply that the function is a expression, namely it returns a value that represents…

United Kingdom slang: “bird” for “chick”

In United Kingdom, they call a girl “bird”, analogous to the US slang “chick”.it's wrong to call a girl “bird”, because, “bird” is descendant of dinosaur. Dinosaur are not cuddly creatures.

Internet Explorer Anime Girl

Image

emacs key poll, C-c and C-x

list 10 commands in #emacs you use the most.5 that start with C-c key. (any mode)5 that starts with C-x key.(or more than 5 if you want. You can just write down the key, but with the mode's name.)

Declaring Character Set in CSS File @charset

by default, CSS file is assumed to be UTF-8 encoded, unless the server or other mechanism says otherwise.however, you can declare it in your CSS file, in first line, like this:@charset"UTF-8";reference. 〔Declaring character encodings in CSS2010-08-07 By W3C. @ www.w3.org…

web design: another white on gray

Image

unix man page getting obsolete?

these days, man page is getting the slack. Instead, the embedded inline doc --help option is emphasized. Often, the info from --help is more complete than man page. Many programs don't even bother to write a man page, but the linux distributor such as Debian, writes one for them, pro forma.For example, i wanted to know what's the --minimal option do in xfce4-display-settings. So, i man xfce4-display-settings. The output doesn't mention it.XFCE4-DISPLAY-SETTINGS(1) User Commands XFCE4-DISPLAY-SETTINGS(1) NAME xfce4-display-settings - Display settings for Xfce DESCRIPTION Usage: xfce4-display-settings [OPTION...] Help Options: -?, --help Show help options --help-all Show all help options --help-gtk Show GTK+ Options Application Options: -v, --version Version information --display=DISPLAY X display to u…

Unix Shell Syntax, 2000 〜 2013

as of 2013, the unix shell tool syntax have gone thru more evolution.note, in 1990s, the GNU introduced the double-dash syntax. ⁖ diff --brief, in hope to make it readable. Unfortunately, it didn't really catch on. Most commands today do offer the double-dash variant, but only for some options. The double-dash option does not necessarily mean there's a corresponding single-dash one, and vice versa. What happened instead is just a new syntax variation.during 2000s, a new syntax form became popular, one that has a “action” keyword immediately following the command name. Here are some prominent examples:apt-get install --simulate -y ‹name›git add -m"…" ‹fpath›iptables --table filter --append INPUT --jump DROPOne good example of the confuse ball in one command can be seen in Linux's “ps” command. See man ps.read more at: Unix Pipe as Functional Language

the effect of keyboard hardware on your keyboarding habit

Here's a example. From 2005 to 2008, i was using the classic Microsoft Natural Keyboard. In about 2009, i switched to the new model Microsoft Natural 4000. The new keyboard is great, and i think it's a improvement, however, ON THAT KEYBOARD i developed a habit to press the {1, 2} keys by twisting my wrist to the left and press it with my middle finger (instead of using pinky and not turning wrist. (because, somehow on this new model, it's harder to press the 1 with pinky)). Then, i developed RSI symptoms. RSI cause is very difficult to track down, but eventually, after panicking for weeks, i eventually tracked it down to this wrist movement. For the full story, see: Programer Hand Health: vi Esc Key Syndrome. Here's another personal example: Keyboarding: Effect of Mechanical Key Switches on You.see also Bad Advices from Programers about Typing & Keyboard (RSI)

JavaScript Book by David Flanagan, and the Man-made Complexity in Computer Language

Image
Perm URL with updates: http://xahlee.info/comp/js_book_man_made_complexity.htmlAm very impressed with this book. VERY. 〔JavaScript Definitive Guide (6th ed.)2011-05-10 By David Flanagan. @ amazon〕 Normally, if you've been programing for a few years, you can quickly start to program in a new lang. You just learn the basics, types, loops, list/array, function/objects, module, then you can practically code anything you want, albeit in a non-optimal way. But, you'll have a lot questions, especially with complex languages. Questions like scope, evaluation model, and the language's overall “model”. What happens if you do xyz. Understanding these makes you a true expert in that lang. To understand a lang well, is to be able to have a sense of a mathematical model of the language.(and almost all modern langs are quite complex, including Java, Python, Ruby. Now, JavaScript is easy to use, but it turns out it's quite complex too actually, the hairy details of its prototype inher…

Interface Design: How JavaScript Breaks UI, and the Evolution of User Interface

so many “modern” pure JavaScript based websites f�cks up the page so that basic universal browser operations broke. For example:• Control+click or middle click on a link to open in new tab, or 【Ctrl+n】 to open new page, will not always work.Perpetrator include Google's Google Plus, Twitter.When a key that works only sometimes, it's annoying, but also dangerous, because after a few times of non-working, you stop using that key. Instead, user goes for the sure way of using the more cumbersome mouse.• When a page contains Video (Flash) such as YouTube, almost always your keys such as ⇟ Page ▽, don't work anymore, because the “focus” is on Flash or some particular JavaScript scripted element, so key input got stolen. You need to click somewhere outside the video first.From user's perspective, it's plainly annoying. However, the thing is, these fancy sites don't care, for good reasons, because, vast majority of people, probably 90%, don't even know about basic …

dollar sign in JavaScript

lots JavaScript libs use dollar sign “$” as the name of their primary function.It seems, it started with the prototype lib, then others picked it up, in particular jQuery.here's a quote from stackoverflowAs far as I can see, it's not recommended to use because the ECMAScript specification states that: The dollar sign ($) and the underscore (_) are permitted anywhere in an identifier. The dollar sign is intended for use only in mechanically generated code.Update: The above refers to ECMA-262 3.0. However, this is no longer the latest edition. Currently, 5.1 is the latest edition. In ECMA-262 5.1 the above text is changed to: The dollar sign ($) and the underscore (_) are permitted anywhere in an IdentifierName.That is, it seems that they dropped the "restriction" or whatever you want to call it.So, is this the case where practice forced a chance in spec?

javascript books

JavaScript Books〈JavaScript Definitive Guide〉 amazon〈Professional JavaScript for Web Developers〉 amazon〈JavaScript: The Good Parts〉 amazon〈JavaScript Web Applications〉 amazon

git tip: fast way to revert to last commit

when you just pulled from remote, and realized it didn't work, you can quickly revert.# revert before last commit git checkout HEAD@{1}

Linux: How to Upgrade Xfce

to find your current version, type xfce4-about --versionto upgrade:# upgrade xfce sudo add-apt-repository ppa:xubuntu-dev/xfce-4.10 sudo apt-get update sudo apt-get dist-upgrade# delete cache rm -rf ~/.cache/ ~/.compiz # restart sudo shutdown -r 0