What’s worth watching

What’s worth watching

Chrome tab tooltips

Chrome adds a ‘volume’ icon to browser tabs that are playing audio in the background.

‘Volume’ tab icon

And that’s not all. A ‘recording’ icon appears in place of the ‘volume’ icon when your webcam is being accessed.

‘Recording’ tab icon

Why waiting is torture

This is excerpts from “Why Waiting Is Torture” by Alex Stone, The New York Times.

Instead of reducing wait times, Houston airport moved the arrival gates away from the main terminal and routed bags to the outermost carousel. Passengers now had to walk six times longer to get their bags. Number of complaints about the long waits at baggage claim dropped to near zero.

Isn’t it brilliant?!

Occupied time (walking to baggage claim) feels shorter than unoccupied time (standing at the carousel).

This is also why there are mirrors next to elevators and packs of gum along supermarket checkout aisles.

Mongo shell as an interactive JavaScript interpreter

Do you have MongoDB installed? If you do then you have JavaScript interpreter. MongoDB has SpiderMonkey JavaScript engine. To start an interactive shell you have to type mongo --nodb in the shell.

$ mongo --nodb
MongoDB shell version: 2.2.0
> var user = {name: "Anton Eprev", age: 27}
> user
{ "name" : "Anton Eprev", "age" : 27 }
> print(user)
[object Object]
> printjson(user)
{ "name" : "Anton Eprev", "age" : 27 }
> var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
> print(numbers)
> printjson(numbers)
[ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]

And of course the shell allows you to use loops, user functions and etc.:

> for (var i in user) { print(i, user[i]) }
name Anton Eprev
age 27
> function add(x){ return function(y){ return x + y } }
> add(3)(4)
> {
... for (var i = 0; i < 10; i++)
...     print(i)
... }

You can also use the cat function to read the file’s contents.

> var profile = cat('.profile')
> profile
export PATH=/opt/local/bin:/opt/local/sbin:$PATH

You may even explore global scope by executing printjson(this) and find out the following functions:


And finally, you can run a JavaScript file using MongoDB shell.

$ cat hello.js
print("Hello World!");
$ mongo --nodb hello.js
MongoDB shell version: 2.2.0
Hello World!

Happy coding =]