Griffith's picture

Node.js is an evented I/O framework built on top of Google’s V8 JavaScript engine; its design is influenced by systems like Ruby’s Event Machine or Python’s Twisted. Node’s goal is to provide an easy way to build high performance, real-time and scalable web applications.

JavaScript has traditionally only run in the web browser. In recent years, projects such as CommonJS, Jaxer and Narwhal reflect the considerable interest in bringing JavaScript into the server side as well. In contrast to these concurrency models where OS threads are employed, Node is event-based rather than thread based. Thread based model often has the disadvantage of not scaling well with many long-lived connections necessary in real-time applications, becoming relatively inefficient and complex.
Node takes an alternative approach by telling the OS that it should be notified when a new connection is made, and then it goes to sleep. In the event of a new connection, the callback is executed; each connection is only a small heap allocation. This results in a much better memory efficiency under high-loads than systems which allocated 2mb thread stacks for each connection. Furthermore, Node is free of locks: almost no function in Node directly performs I/O, so the process never blocks. The programmers won’t need to worry about dead-locking the process.

Node’ advantage comes from the fact that most thread based models spend the majority of their time waiting for I/O operations which are much slower than memory operations. Node’s I/O operations are asynchronous, which means that it can continue to process incoming requests while the I/O operation is taking place.

The following is an example of a web server written in Node which responds with “Hello World” for every request.

var sys = require(‘sys’), http = require(‘http’);

http.createServer(function(request, response) {
response.writeHead(200, {‘Content-Type’: ‘text/plain’});
res.end(‘Hello World\n’);

sys.puts(‘Server running at’);

This simple script imports the sys and http modules, and creates an HTTP server. The anonymous functions passed to http.createServer will be called every time a request is made to the server.

Node is a very exciting technology built on top of another powerful technology, V8. It has gathered a lot of attention within the technology community, and with its great module system, there are many third party modules available for just about everything.

Opera unite: Your Browser is Now a Web Server

Ricky Wu's picture

New Opera Unite technique blurs the boundary between client and server after new version of Opera browser released. You can also have your own dedicated web server by walking through few step of simple setting up. With opera unite you need to find web hosting no more but can sharing your files, documents, videos and pictures to anyone who permitted to access you web host. Of course you should open up your opera unite and keep your computer awake to ensure these service continuing.

Opera unite let your PC acts like a client or a server. Not like the traditional installation of  the web server, It simplify the setting steps make user configure their own server more convenient and easy, such like reduce the setting up of port forwarding in traditional network setting. And it has characteristic of cross platform and structure based on open architecture network also reduce the complexity of web service developing for developers.

Opera unite comes with six basic services, File Sharing, Fridge, Media Player, Photo Sharing, The Lounge, and Web server etc. The File Sharing service allows you sharing any type of files with friends no matter how big it is. And you also can make your own access limitation rule to make file sharing more private. You can also browse your music and play it directly through Unite Media Player in anywhere you want the only require is you need to connect to internet. The Lounge creates a chat room that you can host in your computer, Fridge for friends and family to leave virtual sticky notes on. And it provides a more private and secure platform to let people possible to pass instant message without install any instant message applications.

In the future development, Opera Unite provides an open architecture platform that broken old fashioned client-server architecture rule. Maybe the easy to use able to provides an alternative option of peer-to-peer model to online users, even if it will take place the recently centralized peer-to-peer community under development of network in the future. In this architecture, users manage their private information on their own host, so personal information will share with others in more safe and reliable way. For developers, this new technique provides a lower-cost system required method to built-up development environment, and accelerates development cycles for network service development. Besides, the open network architecture has an advantage in flexibility of diversity of service development. For example, if recent online games such like ‘Happy Farm’ reconstruct without centralized model, I think it will become smaller and growth in various way.


Read White Web: Your Browser is Now a Web Server: Opera Includes Opera Unite in Opera 10.10

Cassandra Introduction -- data model


With the more and more data insertions and queries from the database, we may face the situation that we need to scale out the architecture by increasing new machines to handle the amount of data. However, in the traditional MySQL database, it needs a lot of work to add a new machine (i.e. shading, we partition the data into different machines). And sometimes only key-value queries are needed instead of JOIN operation. We can't help but think that if there is an alternative solution for database system scalability. By searching on the internet, we find many distributed key-value database are develop for this situation. Among these database systems, Cassandra is a java-based distributed key-value database which is created by Facebook. It is different from MySQL which contains the JOIN operation, Cassandra is good at dealing with the distributed data. You may view the whole cluster as a big hash table with all fault tolerant and data partition are handle by it. It provides "incremental scalability" (which means you can increase throughput by adding new nodes). And Cassandra also supports "Column" feature, it is more convenient than only key-value database systems.

Let me show you the key elements of Cassandra :

Basic key-value database:

Table['key1'] = value1

With Column feature:

Table['Key1']['column family1']['Column1'] = Vaule1

Data Model:

In Cassandra, it can be thought of as a four or five dimensional hash table. From top to bottom, the hierarchy looks like this.

So the query will look like this:

get <ksp>.<cf>['<key>']['<col>']                             Get a column value.
get <ksp>.<cf>['<key>']['<super>']['<col>']              Get a sub column value.

Key Space:

    In Cassandra, you can define many Key Space. You can think it as the Table in MySQL. It contains {Row, [ColumnFamily]} list. Normally one Key Space per application.


    For row key, you can have data from relative Column Family. The data in each Column Family is sorted according row key's order. The row key does not have to contains data in all column family.

Column Family:

    In Column Family, it contains a list of Column or a list of Super Column. You must define it in config before Cassandra start. And each Column Family is stored in a separate file. The number of column in each column family is unlimited.


    It is the smallest element  of data, and it only contains a name, a value, and a timestamp. You can add new or delete column at anytime.

Super Column:

    Super Column is the container to  contain Columns.


Cassandra use consistent hash to do key distribution and partition. Each node in Cassandra cluster will take a token (0<token<2^32) in the ring. The size of the ring is 2^32. When the key is coming, it will make the md5 hash for the key and find the smallest token which is larger than the key md5. The the key is mapping the correspond node according to the token, so the data will be store in the corresponding node.

Like the following example, the key will be inserted into node 2.

Replicate method:

If you want to store two replicas of data in Cassandra cluster. It will store data in the next two nodes.

Adding a new node:

In consistent hash method, adding a new node will only affect the nodes in neighbors. In this case, we do not need to rehash all data. Some data store in node 1 will now store in new node 4. The new node will choose a token randomly, and find the corresponding location according to the md5 hash. 



David Lee's picture

On June, An open source technology called Docker was strongly introduced by Google uber engineer Eric Brewer, who said that a developer technology hasn’t taken off so enormously since the rise of Ruby on Rails framework. Docker is a Container to package network services, make various tasks isolated on a computer server, preventing them interfering with one another. And much more importantly, this Container can be easily moved to different servers to deploy service without heavily effort.

There is a vision of developers with cloud computing that the internet should be treated as a giant computer which can provide unlimited computing resource. But it is not true. The same service is hard to run on different platforms or hosts. Virtual Machine provide a solution, but it is required to deploy an image of whole the operating system. By comparison, Docker provides an extremely lightweight way to deploy service more quickly and more conveniently.

We must introduce Eric Brewer, one of the elite engineer in Google. In the mid-1990s, as a professor of University of California, Berkeley, Brewer built Inktomi, the first web search engine to run on a vast network of cheap machines, as opposed to one enormously powerful–and enormously expensive–computer server. Over the next two decades, companies like Google, Amazon and Facebook learned on the philosophy of CAP theorem by Brewer, reach to an extreme distance. “He is the grandfather of all the technologies that run inside Google,” says Craig Mcluckie, a longtime product manager for Google’s cloud services.  read more »


Juyun Wang's picture

Sass (Syntactically Awesome Stylesheets) is a CSS3 extension language that contains two syntaxes: Sass (Syntactically Awesome Stylesheets) and SCSS (Sassy CSS). The former has an indented syntax and does not require parentheses or semicolons. Instead, it uses indentation to replace brackets. The latter is similar to the original CSS3 and requires parentheses and semicolons. However, there is no difference in functionality between the two. The choice of which syntax is completely a matter of personal preference, but note that some features do not have the same syntax. You can refer to the official documents before writing.

Sass adds features such as nested rules, variables, mixins, selector inheritance, etc. Below are some examples of SCSS features:

1. Variables
SCSS can define its own variables so that you can assign values like color code, font style and width size. In the past, if you wanted to modify a specific color, you would have to search for the value one by one and change its value. Now, you just need to modify the variable's value.  read more »

CSS3 Gradient Buttons

June Huang's picture

The gradient property in CSS3 allows us to display smooth transitions of colors on page elements without the use of images or JavaScript. This property is now supported by major browsers like Internet Explorer, Firefox, Chrome, and Safari. Below I will demonstrate how to use this property to create gradient buttons.

Button CSS:

.button {

display: inline-block;
padding: 6px 22px;
-webkit-box-shadow: 1px 1px 0px 0px #FFF6AD;
-moz-box-shadow: 1px 1px 0px 0px #FFF6AD;
box-shadow: 1px 1px 0px 0px #FFF6AD;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid #FFCC00;
color: #333333;
font: 14px Arial;
text-shadow: 1px 1px 0px #FFB745;

}  read more »

Google URL Shortener

Juyun Wang's picture

The Google URL Shortener is a service that takes long URLs and squeezes them into fewer characters to make a link that is easier to share, or email to friends. Google provides URL Shortener API for free with a daily limit of 1,000,000 queries.We can use the Google URL Shortener API to programmatically interact with this service and to develop applications that use simple HTTP methods to store, share, and manage short URLs. Below is the example of Google URL Shortener APIwith PHP:

1. Get your API key :
2. Shorten a long URL

To send and get the json data we use the PHP cURL functions.

define ( 'API_KEY', 'AIzaSyB8NLUnMd4Vnhg7ee3FN0EMMXmC5cZlwLA' );
define ( 'API_URL', '' );

if (isset ( $_REQUEST ['url'] ) && ! empty ( $_REQUEST ['url'] ))

$longUrl = $_REQUEST ['url'];

// Create the data
$postData = array (
'longUrl' => $longUrl,
'key' => API_KEY

// Encoded into JSON
$jsonData = json_encode ( $postData );

// Initialize the cURL session
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, API_URL );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_HTTPHEADER, array ( 'Content-type:application/json' ) );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $jsonData );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 0 );

// Execute the cURL session
$result = curl_exec ( $ch );

// Close the cURL session
curl_close ( $ch );
$shortUrl = json_decode ( $result );
echo $shortUrl->id;


We are creating a simple URL Shortener page example:

You can also call this method to expand any short URL, or Look up a short URL's analytics. The Detail can refer to Google URL Shortener API official website:


June Huang's picture

Cookies, in short, are pieces of information that are stored on your computer when you visit a website. Websites use cookies to keep track of your activities on the website, for example, your login state. When you browse through or revisit the website, the website's cookie data are sent back to the website so that certain activity-related information can be displayed to you. Below I shall provide some examples of using cookies and discuss the privacy concerns regarding them.

Websites can use cookies to track user activity, save preferences and gather information about the user. The following are some examples where cookies are used: E-commerce websites like Amazon, use cookies to remember the items that customers put in their shopping carts. In doing so, customers do not necessarily have to log in before they are able to shop on the website. Cookies can be used to store customizations like language, localization settings and interface layout for the users' needs and convenience. Cookies are also commonly used for personalized advertising, for example, advertisements on Google and Facebook. Various information about your interests can be gathered through recent searches and the links you click. Once advertisers learn these information, they can offer advertisements that would appeal to you so that you are more tempted to click on the advertisement.

Although cookies are simply just text files and can be deleted by the user at any time, there are privacy issues associated with some of its uses. Most people are not aware that cookies are used at all and that their personal data are being collected. Even if they did know, they will have no control over what third party websites do with their information. Browsers offer cookie settings that lets users allow or disable cookies for specific or all websites. Disabling cookies for all websites might not be a good idea since some websites require cookies in order to function. Lastly, remember that cookies are not shared between different browsers so you will have to edit the cookie settings individually on each browser.

[1] HTTP cookie. (2012, September 17). In Wikipedia, The Free Encyclopedia. Retrieved 11:14, September 19, 2012, from
[2] How to Enable Cookies. Amazon: Help. Retrieved 16:55, September 19, 2012, from
[3] Advertising privacy FAQ. Google: Policies & Priciples. Retrieved 17:16, September 19, 2012, from
[4] Cookies, Pixels, and Similar Technologies. Facebook: Help Center. Retrieved 17:48, September 19, 2012, from

What's new in Ext JS 4?

Ruby Lin's picture

Ext JS 4 uses MVC architecture. MVC(Model-View-Controller) can organize your code, maintain easy, reduce the amount of codes you have to write, and improve efficiency. It fits big projects.

Here is the folder structure:
















app.js - The Application class contains global settings for your application (such as the app's name), as well as maintains references to all of the models, views and controllers used by the app.

controller - listen for events (usually from views) and take some actions.

model - define a Model for real-world object that we want to model in the system.

store - tell it the Model and the Proxy to use to load and save its data.

view - usually defined as a subclass of an Ext JS component(such as grid, panel).

And Ext JS 4 enables you to load any number of records into a grid without paging. Past load a large amount of records will cause an error: out of memory. The new grid uses a virtualized scrolling system to handle potentially infinite data sets without any impact on client side performance.

Else like: multiple versions side by side, split DOM for high performance, more fantastic charts...etc.

More details can refer to the official website:

Valgrind: the memory error detector

David Lee's picture

C/C++ programming language provide powerful memory operating ability through pointers, and programmers can make efficient and flexible control to low-level memory. However, dynamic memory errors become one of the toughest part to debug. Almost every programmers have suffered segmentation fault or memory leak problem. Those errors which only appear at the run-time and can be detected by the compiler spend a lot of development time. Fortunately, there are many memory profiling tool can help programmers find the bugs effectively. Valgrind, the topic of this article, is one of these convenient tools.

Valgrind is a open source dynamic analysis software, which can be used to detect memory, cache and threading bugs, can use branch-prediction function to profile program performance, or even to plugin external tools to make more detailed program testing. This article only introduces the memory error detection function of Valgrind.

First we need a program to be detected, of course. Suppose we write a source code as follows (this code is cited by the Valgrind website,) and name it “test.c”.  read more »