Xah Web Dev Blog Archive 2013-12
split into 2 pages.
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.
thanks to friends on g+, discovered Socket.io
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, 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.
if you have Node.js's npm installed,
npm install socket.io
love the Ryan Dahl guy. Today's work, annotated the whole thing. His video is the best intro to node.js. Node.js Video Tutorial by Ryan Dahl, with Annotation
my copy of the node.js doc. New is the left side persistent list of node objects. Node.js v0.11.10-pre Manual ＆ Documentation
Variable assignment returns a value.
// variable assignment returns a value var xx; console.log(xx = 3); // 3
So, variable assignment can be chained.
var xx; var yy; console.log(xx = yy = 3); // 3 console.log(xx); // 3 console.log(yy); // 3
var name1, name2, name3 …;
// declare variable, use 「var」 var x; var y; // multiple variables can be declared on the same line, separated by comma var a, b, c;
Multiple variables can be declared and assigned at the same time.
// declare variable and assign var x = 4; // declare variable and assign multiple variables var a = 1, b = 2, c = 3;
When a variable is declared but not assigned, the default value is
When a variable is not declared nor assigned, and you try to access it, you get ReferenceError.
var x; console.log(x); // prints 「undefined」 console.log(y); // ReferenceError: y is not defined
Several tutorials on web server and networking. Btw, don't use Apache. Apache is dinosaur. Use nginx ＆ node.js.
- Testing Server Performance Using Apache Benchmark Tool
- Apache HTTP Server Tutorial
- Tech Humor: Apache vs Node.js vs NGINX 📺
- Apache Rewrites History: Why is it Named “Apache”?
- Blocking Image Leechers in Apache
- How to Enable HTTP Server gzip Compression
Search Unicode Characters
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 Characters ☯ ☭ ⚡ ∑ ♀ ♂ ♥ 😄
web UI/UX design is like fashion industry. Each year, grave words are given about the kick-ass-ness of certain design, but after few years, it's all forgotten.
whoever moved the reload ⟳ button into the URL bar is a idiot. Was it Apple Safari who started this?
updated with new syntax coloring, a formal language approach to computer language documentation.
do you understand the lang well before you use frameworks?
// example of array splice, 3 arguments form var uu = [0,1,2,3,4,5]; var rs = uu.splice(2,3, "a"); // start at index 2, removed 3 items, add "a" console.log(uu); // [ 0, 1, 'a', 5 ] the new value console.log(rs); // [ 2, 3, 4 ] removed items
Intro to Event in GUI Programing (updated)
How to Create and Update a Website Logo (Favicon) (minor update)