Profile

Cover photo
Xah Lee
2,692 followers|2,821,055 views
AboutPostsCollectionsPhotosYouTube

Stream

Xah Lee

Shared publicly  - 
 
#JavaScript quiz: what's the type of undefined, null, NaN? what's the type of Regex? http://xahlee.info/js/javascript_datatypes.html
JavaScript data types. type name, explanation. undefined, undefined is the only value of this type. When a variable has not been assigned, its value is undefined . When function doesn't have return statement, it returns undefined . Empty return statement ( return; ) also returns undefined .
1
Add a comment...

Xah Lee

Shared publicly  - 
 
#JavaScript Random Range, Randomize Array. fisher-yates shuffle. http://xahlee.info/js/javascript_random_number.html
How to get a random real number between min & max? // random real number in range {min, max}, including min but excluding max function randomReal(xmin,xmax) { return Math.random() * (xmax - xmin) + xmin;}. How to get a random integer? // random integer in range {min, max}, including min and max ...
1
Add a comment...

Xah Lee

Shared publicly  - 
 
ad block open source scumbag syndrome. If you don't like web ads, don't visit the site, or just ignore ads. It's that simple. 
1
Alison Chaiken's profile photo
 
I hate embedded video, period, including animated gifs.   I block embedded video content on site for which I pay.    I run an adblocker as it seems to be the only way to block embedded video ads.
Add a comment...

Xah Lee

Shared publicly  - 
 
what math is required for relativity?
1
Craig “blipvert” Lennox's profile photomichael livshits's profile photo
7 comments
 
Xah, ask Dick Palais, he wrote a book "Geometrization of Physics," may give you some more hints.
Add a comment...

Xah Lee

Shared publicly  - 
 
This has been bugging me lately. I always thought it's not important.
hand pain, pain. Biomechanics of the Upper Limbs: Mechanics, Modeling and Musculoskeletal Injuries http://xahlee.info/kbd/keyboard_problems.html
2
Ryuutei Sebastien BLANC's profile photoXah Lee's profile photo
2 comments
Xah Lee
+
1
2
1
 
yeah. I think they don't have business sense. afaik, kinesis took their idea, was working with them, but didn't work out, so kinesis took out the middle and sell it.
Add a comment...

Xah Lee

Discussion  - 
 
#git is there any tech consequence of not setting name and email? i.e. does it prevent push or something?
1
1
Alec The Geek's profile photoXah Lee's profile photoYuri Khan's profile photoMyaBabe Gt's profile photo
7 comments
 
In the old mainframe times, when you got a shell account username on a UNIX server hostname.domain, you automatically got a mailbox username@hostname.domain and web hosting under http://hostname.domain/~username.

Nowadays, combining the local user name with the hostname, even if it is fully qualified, on a machine where you do development, is unlikely to yield a working email address.

Therefore, prefer always having your ~/.emacs and your ~/.gitconfig with you.
Add a comment...

Xah Lee

Shared publicly  - 
 
Google Chrome audio monitors and sends whatever you said in your room to its server. https://news.ycombinator.com/item?id=9724409 
The binary blob in question is hotword-x86-64.nexe with sha256sum 8530e7b11122c4bd7568856ac6e93f886bd34839bd91e79e28e8370ee8421d5a. This is labelled as being a "hotword" implementation, ie, something that will monitor the microphone until someone says "OK google", then start listening and ...
1
Add a comment...
In their circles
586 people
Have them in circles
2,692 people
Adam Garcia's profile photo
Deejay Saph!re Official's profile photo
陈炜健's profile photo
Nga Nguyen Duy's profile photo
Balasubramani Manohar's profile photo
Grace Flores's profile photo
Mike Miller's profile photo
张藜藐's profile photo
Lulu Cai (loo)'s profile photo

Xah Lee

Shared publicly  - 
 
芯片 = microchip。去皮的灯心草:灯芯。芯 xīn = Pith of rush。( Pith,or medulla,is a tissue in the stems of vascular plants。Rush,is a plant,Juncaceae)。http://wordyenglish.com/chinese/blog.html
 ·  Translate
芯. xīn ㄒㄧㄣˉ. ◎ 去皮的灯心草:灯~(亦作“灯心”)。 其它字义. ● 芯. xìn ㄒㄧㄣˋ. 1. 物体的中心部分:岩~。矿~。 2. 装在器物中的捻子:蜡~儿(蜡烛的捻子)。引~。 3. 蛇和羊的舌头:~子。 2015-06-12. Chinese Word: 欸诶唉. 2015-06-12. Chinese Character Etymology and Script Styles 甲骨,金文, ...
1
Add a comment...

Xah Lee

Shared publicly  - 
 
ASCII non-printable #Unicode symbols ␀ ␁ ␂ ␃ ␄ ␅ ␆ ␇ ␈ ␉ ␊ ␋ ␌ ␍ ␎ ␏ ␐ ␑ ␒ ␓ ␔ ␕ ␖ ␗ ␘ ␙ ␚ ␛ ␜ ␝ ␞ ␟ ␡ http://xahlee.info/comp/unicode_character_representation.html
ASCII Table of Unprintable Chars. Decimal, Hex, Abbr, Unicode Symbol, Caret Notation, C Escape Syntax, Description. 0, 00, NUL, ␀, ^@, \0, Null character. 1, 01, SOH, ␁, ^A, Start of Header. 2, 02, STX, ␂, ^B, Start of Text. 3, 03, ETX, ␃, ^C, End of Text ...
1
Add a comment...

Xah Lee

Shared publicly  - 
 
so, am writing a #JavaScript lib.

in design, there's 2 choices of syntax.

the popular is this, as in JQuery and just about any lib:

f().g().h()

alternative, is traditional

h(g(f()))

I have to make a decision. You see, for most people, it's no brainer. Choice 1, done.
But, i depise the hackers and fashions and youngsters. I want to use choice 2.

so, let's dig in to the advantage analysis.

choice 1 is convenient. Because it's linear.
with choice 2, you have more nesting happening. Tends to be less readable.

But choice 1 brings in a semantic complexity. That is, in JavaScript, it does not truely have a postfix notation. Rather, the f.g.h works is because f returns a libX object, and g is a method libX object, and it also returns a libX object. Basically, your functions all returns a libX object, and you can thus dot it with a libX method.

with choice 2, it's simple. It's just functions. Functions return results.

Now, the lib am writing is XahDraw.js, so my namespace is xd. Let's look at the syntax again. It'd be actually like this:

xd.f().g().h()

alternative, is traditional

xd.h(xd.g(xd.f()))

as you can see, choice 2 is actually more less readable. But again, choice 2 got simplicity. The “xd.” is purely a namespace. While with choice 1, you've got this ambiguity, where, to know that g is a method of xd, you actually have to look (trace) to what xd.f returns.

for detail, see

On the Idiocy of Dot Notation of Object Oriented Programing Languages
http://xahlee.info/comp/oop_dot_notation.html

Object Oriented Programing: is Object Data or Namespace?
http://xahlee.info/comp/oop_is_object_still_data.html

ok. What else? is it possible to write
xd.h(xd.g(xd.f()))
without nesting.

the answer is no. Because JavaScript doesn't have postfix notation, nor prefix notation.

see
Concepts & Confusions of {Prefix, Infix, Postfix, Fully Nested} Notations
http://xahlee.info/UnixResource_dir/writ/notations.html

for example, if it does, say the post fix notation is 「|」, then it can be written as

xd.f() | xd.g() | xd.h()

ok. So far, am pretty much consider choice 2 is superior.

also, if you go with choice 1, then, note that object sometimes have properties that's not a function. So, for example, let's say g is a property, so you might have

xd.f().g = 3

(for example, the xd.f() returns a svg dom object, and g is color, so you are setting the color.
⁖ 「var myCircle = (xd.drawCircle().color = "red")」
)

but in choice 2, this would be 

xd.f().g = 3

now you can see this is quite interesting. Same syntax! Do you see a paradox? The 2 choices have different syntax, but now they have the same syntax! what's going on?

this actually illustrates the confusing point of the choice 1...

now am not in a state to think of this thoroughly...
The OOP Dot Notation. the syntax of object oriented programing language is commonly like this: object . method name ( option ). where object is the meat you want to work on, and the part in round bracket option is secondary.
2
2
Nick Alcock's profile photoXah Lee's profile photoIvan Pierre's profile photoEric Muller's profile photo
9 comments
Xah Lee
 
+Nick Alcock suppose someone asks if C can do addition, like, 1 + 2.
Then, do you show them a library to do that?
Add a comment...

Xah Lee

Shared publicly  - 
 
comprehensive #JavaScript in depth.
Xah JS Tutorial by Example.
new version out.
Reshare, buy. Thanks. http://xahlee.info/js/js.html
1
1
Séverin Tagliante-Saracino's profile photo
Add a comment...

Xah Lee

Shared publicly  - 
It's curious. Of the 2 JavaScript modes for emacs, none of them does coloring of much JavaScript builtin words or methods. In fact, none. They only color what's often technically called keywords, such as {for, while, var, null, function}, maybe 30 of them or such. None of the hundreds of builtin ...
1
Add a comment...
Xah's Collections
People
In their circles
586 people
Have them in circles
2,692 people
Adam Garcia's profile photo
Deejay Saph!re Official's profile photo
陈炜健's profile photo
Nga Nguyen Duy's profile photo
Balasubramani Manohar's profile photo
Grace Flores's profile photo
Mike Miller's profile photo
张藜藐's profile photo
Lulu Cai (loo)'s profile photo
Links
YouTube
Story
Tagline
thy years wants wit, thy wits wants edge and manners.