<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web browser &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/web-browser/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Computer Algorithms: Stack and Queue</title>
		<link>/2012/06/05/computer-algorithms-stack-and-queue-data-structure/</link>
		<comments>/2012/06/05/computer-algorithms-stack-and-queue-data-structure/#comments</comments>
		<pubDate>Tue, 05 Jun 2012 09:54:13 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[$_head]]></category>
		<category><![CDATA[Abstract data type]]></category>
		<category><![CDATA[computer algorithms]]></category>
		<category><![CDATA[Data structures]]></category>
		<category><![CDATA[Extinction]]></category>
		<category><![CDATA[FALSE]]></category>
		<category><![CDATA[heapsort algorithm]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[LIFO]]></category>
		<category><![CDATA[Linked list]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Pointer]]></category>
		<category><![CDATA[Queue]]></category>
		<category><![CDATA[Shunting-yard algorithm]]></category>
		<category><![CDATA[Stack]]></category>
		<category><![CDATA[Subroutine]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web browser]]></category>
		<category><![CDATA[web programming]]></category>

		<guid isPermaLink="false">/?p=3173</guid>
		<description><![CDATA[Introduction Every developer knows that computer algorithms are tightly related to data structures. Indeed many of the algorithms depend on a data structures and can be very effective for some data structures and ineffective for others. A typical example of this is the heapsort algorithm, which depends on a data structure called “heap”. In this &#8230; <a href="/2012/06/05/computer-algorithms-stack-and-queue-data-structure/" class="more-link">Continue reading <span class="screen-reader-text">Computer Algorithms: Stack and Queue</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/16/friday-algorithms-a-data-structure-javascript-stack/" rel="bookmark" title="Friday Algorithms: A Data Structure: JavaScript Stack">Friday Algorithms: A Data Structure: JavaScript Stack </a></li>
<li><a href="/2012/06/14/computer-algorithms-linked-list-data-structure/" rel="bookmark" title="Computer Algorithms: Linked List">Computer Algorithms: Linked List </a></li>
<li><a href="/2012/07/24/php-arrays-or-linked-lists/" rel="bookmark" title="PHP: Arrays or Linked Lists?">PHP: Arrays or Linked Lists? </a></li>
<li><a href="/2017/09/14/data-structures-infographic-stack-queue/" rel="bookmark" title="Data Structures Infographic: Stack &#038; Queue">Data Structures Infographic: Stack &#038; Queue </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Every developer knows that <a href="/category/algorithms/" title="Algorithms on stoimen.com">computer algorithms</a> are tightly related to data structures. Indeed many of the algorithms depend on a data structures and can be very effective for some data structures and ineffective for others. A typical example of this is the heapsort algorithm, which depends on a data structure called “heap”. In this case although the stack and the queue are data structures instead of pure algorithms it&#8217;s imporant to understand their structure and the way they operate over data. </p>
<p>However, before we continue with the concrete realization of the stack and the queue, let’s first take a look on the definition of this term. A data structure is a logical abstraction that “models” the real world and presents (stores) our data in a specific format. The access to this data structure is often predefined thus we can access directly every item containing data. This help us to perform a different kind of tasks and operations over different kind of data structures &#8211; insert, delete, search, etc.. A typical data structures are the stack, the queue, the linked list and the tree.</p>
<p>All these structures help us perform specific operations effectively. For instance searching in a balanced tree is faster than searching in a linked list.</p>
<p>It is also very important to note that data structures can be represented in many different ways. We can model them using arrays or pointers, as shown in this post. In fact the most important thing is to represent the logical structure of the data structure you’re modeling. Thus the stack is a structure that follows the LIFO (Last In First Out) principle and it doesn’t matter how it is represented in our program (whether it will be coded with an array or with pointers). The important thing into a stack representation is to follow the LIFO principle correctly. In this case if the stack is an array only its top should be accessible and the only operation must be inserting new top of the stack.<br />
<span id="more-3173"></span></p>
<h2>Overview</h2>
<p>The stack and the queue are somehow related data structures as they represent two parts of somehow identical logics. Thus they are commonly described in pair.</p>
<h3>Stack</h3>
<p>The stack data structure models the real-world stack. You can think of it as stack of boxes one above the other. Thus the only way to put another item into the stack is to put it above all other items (on its top). This operation is often called “push”. In the other hand taking an item from the stack is called pop, and also only the highest item can be “poped”. The following image describes better the structure of the stack and its operations &#8211; push and pop.</p>
<figure id="attachment_3178" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2012/06/1.-Stack-Operations.png"><img src="/wp-content/uploads/2012/06/1.-Stack-Operations.png" alt="Stack Operations" title="Stack Operations" width="620" height="444" class="size-full wp-image-3178" srcset="/wp-content/uploads/2012/06/1.-Stack-Operations.png 620w, /wp-content/uploads/2012/06/1.-Stack-Operations-300x214.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">The operations of insert and delete an item from the stack are commonly called push and pop!</figcaption></figure>
<p>We see here how computer data structures model the real world. The stack data structure indeed makes no exception and models the real-world stacks.</p>
<h3>Stack Implementation</h3>
<p>As I said a stack can be implemented in some different ways. The first approach is to use an array (using the specific language syntax of the programming language of your choice). Here’s the implementation of a stack using an array in <a href="/category/php/" title="PHP on stoimen.com">PHP</a>.</p>
<pre lang="PHP">
$stack = array();

function push($data, &$stack) {
	$stack[] = $data;
}

function pop(&$stack)
{
	$len = count($stack);
	$top = $stack[$len-1];
	
	unset($stack[$len-1]);
	
	return $top;
}

// array()
print_r($stack);

push(1, $stack);
push(2, $stack);
push('some test', $stack);
push(array(25,12,1999), $stack);

// [1, 2, 'some test', [25, 12, 1999]]
print_r($stack);

// [25, 12, 1999]
echo pop($stack);
// 'some test'
echo pop($stack);

// [1, 2]
print_r($stack);
</pre>
<p>However there are much easier ways to do the same thing with PHP since there are lots of predefined functions that work with stacks.</p>
<pre lang="PHP">
$stack = array();

function push($data, &$stack) {
	$stack[] = $data;
}

function pop(&$stack)
{
	return array_pop($stack);
}

// array()
print_r($stack);

push(1, $stack);
push(2, $stack);
push('some test', $stack);
push(array(25,12,1999), $stack);

// [1, 2, 'some test', [25, 12, 1999]]
print_r($stack);

// [25, 12, 1999]
echo pop($stack);
// 'some test'
echo pop($stack);

// [1, 2]
print_r($ret);
</pre>
<p>As in many programming languages here the example makes use of integers but it can be modified to work with more complex data types as objects, mutli dimensional arrays, etc. However we can use a higher level abstraction in order to represent a stack. Here&#8217;s a short example of a stack using pointers. The stack class only holds a pointer to the top of the stack. Thus only the top can be &#8220;poped&#8221;. Also each elements points to its predecessor. Using this abstraction we&#8217;re sure that the programmer can perform only these two operations &#8211; &#8220;pop&#8221; and &#8220;push&#8221;.</p>
<pre lang="PHP">
class Struct
{
	protected $_data = null;
	protected $_next = null;
	
	public function __construct($data, $next)
	{
		$this->_data = $data;
		$this->_next = $next;
	}
	
	public function getData()
	{
		return $this->_data;
	}
	
	public function setData(&$data)
	{
		$this->_data = $data;
	}
	
	public function getNext()
	{
		return $this->_next;
	}
	
	public function setNext(&$next)
	{
		$this->_next = $next;
	}
}

class Stack
{
	protected $_top = null;
	
	public function push($data)
	{
		$item = new Struct($data, null);
		
		if ($this->_top == null) {
			$this->_top = $item;
		} else {
			$item->setNext($this->_top);
			$this->_top = $item;
		}
	}

	public function pop()
	{
		if ($this->_top) {
			$t = $this->_top;
			$data = $t->getData();
			
			$this->_top = $this->_top->getNext();
			
			$t = null;
			
			return $data;
		}
	}
	
	public function __toString()
	{
		$output = '';
		$t = $this->_top;
		while ($t) {
			$output .= $t->getData() . ' ';
			$t = $t->getNext();
		}
		
		return $output;
	}
}

$s = new Stack();
$s->push(1);
$s->push(2);
$s->push(3);

// 3 2 1
echo $s;

$s->pop();
$s->pop();

// 1
echo $s;
</pre>
<h3>Queue</h3>
<p>As mentioned above the queue is somehow related to the stack data structure. However it follows a different principle &#8211; FIFO (First In First Out), which means that the item that has been in the queue for the longest time is retrieved first.</p>
<figure id="attachment_3177" style="width: 618px" class="wp-caption alignnone"><a href="/wp-content/uploads/2012/06/2.-Queue-Operations.png"><img src="/wp-content/uploads/2012/06/2.-Queue-Operations.png" alt="Queue Operations" title="Queue Operations" width="618" height="232" class="size-full wp-image-3177" srcset="/wp-content/uploads/2012/06/2.-Queue-Operations.png 618w, /wp-content/uploads/2012/06/2.-Queue-Operations-300x112.png 300w" sizes="(max-width: 618px) 100vw, 618px" /></a><figcaption class="wp-caption-text">Inserting and deleting from a queue happen in the opposite sites of the queue!</figcaption></figure>
<p>This comes again from the real world, where we can think of a queue of people waiting in front of a movie theater. In this case the person that has waited the most takes its ticket first.</p>
<h3>Queue Implementation</h3>
<p>An array representation of a queue isn’t a difficult task. However the only example of a queue here is using pointers. Indeed the following code syntax is very tightly related to PHP so only the main principles of supporting a queue functionality is important.</p>
<pre lang="PHP">
class Item
{
	public $data = null;
	public $next = null;
	public $prev = null;
	
	public function __construct($data)
	{
		$this->data = $data;
	}
}

class Queue
{
	protected $_head = null;
	protected $_tail = null;
	
	public function insert($data)
	{
		$item = new Item($data);
		
		if ($this->_head == NULL) {
			$this->_head = $item;
		} else if ($this->_tail == NULL) {
			$this->_tail = $item;
			$this->_head->next = $this->_tail;
			$this->_tail->prev = $this->_head;
		} else {
			$this->_tail->next = $item;
			$item->prev = $this->_tail;
			$this->_tail = $item;
		}
	}
	
	public function delete()
	{
		if (isset($this->_head->data)) {
			
			$temp = $this->_tail;
			$data = $temp->data;
			
			$this->_tail = $this->_tail->prev;
			
			if (isset($this->_tail->next))
				$this->_tail->next = null;
			else 
				$this->_tail = $this->_head = null;
			
			return $data;
		}
		
		return FALSE;
	}
	
	public function __toString()
	{
		$output = '';
		$t = $this->_head;
		while ($t) {
			$output .= $t->data . ' | ';
			$t = $t->next;
		}
		
		return $output;
	}
}


$q = new Queue();

$q->insert(1);
$q->insert(2);
$q->insert(3);

// 1 2 3
echo $q;

$q->delete();
$q->delete();

// 1
echo $q;

$q->insert(15);
$q->insert('hello');
$q->insert('world');
$q->delete();

// 1 15 "hello"
echo $q;
</pre>
<h2>Application</h2>
<p>Stacks and queues are widely used in programming. By defining stacks and queues we somehow predefine the way our data structure is accessed, thus we&#8217;re sure that our program will access the data in a specific manner. For instance if we code a queue for a list or upcomming commands, we&#8217;re sure that the most waited command will be executed first. In this case we predefine the order the commands are processed. In the web programming, especially in JavaScript, every developer knows what&#8217;s an event fired in a web browser environemtn. In case of many events, they&#8217;re putted into a queue and they are executed consecutively in the order they were fired by the user.</p>
<p>Another example is the execution stack of most of the programming compilers and interpreters. We know that in a OOP languages, such as PHP for instance, there&#8217;s a stack of function calls. In case of failure we can easily see the &#8220;stack trace&#8221;.</p>
<p>You see how many examples of queues and stacks there are in the real-world programming. These two structures are easy to implement yet very important in order to understand other more complex data structures as linked lists and trees.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/16/friday-algorithms-a-data-structure-javascript-stack/" rel="bookmark" title="Friday Algorithms: A Data Structure: JavaScript Stack">Friday Algorithms: A Data Structure: JavaScript Stack </a></li>
<li><a href="/2012/06/14/computer-algorithms-linked-list-data-structure/" rel="bookmark" title="Computer Algorithms: Linked List">Computer Algorithms: Linked List </a></li>
<li><a href="/2012/07/24/php-arrays-or-linked-lists/" rel="bookmark" title="PHP: Arrays or Linked Lists?">PHP: Arrays or Linked Lists? </a></li>
<li><a href="/2017/09/14/data-structures-infographic-stack-queue/" rel="bookmark" title="Data Structures Infographic: Stack &#038; Queue">Data Structures Infographic: Stack &#038; Queue </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2012/06/05/computer-algorithms-stack-and-queue-data-structure/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Diving into Node.js &#8211; Introduction &#038; Installation</title>
		<link>/2010/11/16/diving-into-node-js-introduction-and-installation/</link>
		<comments>/2010/11/16/diving-into-node-js-introduction-and-installation/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 08:17:32 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Apache Corporation]]></category>
		<category><![CDATA[Apache HTTP Server]]></category>
		<category><![CDATA[application/server]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[classical chat server]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Google Chrome]]></category>
		<category><![CDATA[Google Inc.]]></category>
		<category><![CDATA[Inter-process communication]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[JavaScript programming language]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[normal server]]></category>
		<category><![CDATA[normal web server]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[Push technology]]></category>
		<category><![CDATA[Server-side JavaScript]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[typical web server]]></category>
		<category><![CDATA[Web browser]]></category>
		<category><![CDATA[web developer team]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[web server example]]></category>
		<category><![CDATA[web serving functionality]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">/?p=2037</guid>
		<description><![CDATA[Why I Need Something Like Node.js? First of all the use of some software is needed not because of itself, but because of the need of some specific functionality. In my case this was the need of real time news feed. Of course there is a way to make this without Node.js, as I&#8217;ll describe &#8230; <a href="/2010/11/16/diving-into-node-js-introduction-and-installation/" class="more-link">Continue reading <span class="screen-reader-text">Diving into Node.js &#8211; Introduction &#038; Installation</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/12/02/diving-into-node-js-a-long-polling-example/" rel="bookmark" title="Diving into Node.js &#8211; A Long Polling Example">Diving into Node.js &#8211; A Long Polling Example </a></li>
<li><a href="/2010/11/19/diving-into-node-js-very-first-app/" rel="bookmark" title="Diving into Node.js &#8211; Very First App">Diving into Node.js &#8211; Very First App </a></li>
<li><a href="/2010/01/31/speed-up-the-javascript-it-can-change-dramatically-the-user-experience/" rel="bookmark" title="Speed up the JavaScript. It can change dramatically the user experience.">Speed up the JavaScript. It can change dramatically the user experience. </a></li>
<li><a href="/2010/01/11/what-should-be-optimized-in-one-web-page/" rel="bookmark" title="What should be optimized in one web page?">What should be optimized in one web page? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Why I Need Something Like Node.js?</h2>
<p>First of all the use of some software is needed not because of itself, but because of the need of some specific functionality. In my case this was the need of real time news feed. Of course there is a way to make this without <a title="Node.js" href="http://nodejs.org/" target="_blank">Node.js</a>, as I&#8217;ll describe later in this post, but there are several disadvantages. However to begin from somewhere, let me explain what is Node.js.</p>
<h2>Introducing Node.js</h2>
<p>Perhaps the best way do describe what is Node.js is from its <a title="Node.js" href="http://nodejs.org/#about" target="_blank">about page</a>.</p>
<blockquote><p>Node&#8217;s goal is to provide an easy way to build scalable network programs. In the &#8220;hello world&#8221; web server example above, many client connections can be handled concurrently. Node tells the operating system (through epoll, kqueue, /dev/poll, or select) that it should be notified when a new connection is made, and then it goes to sleep. If someone new connects, then it executes the callback. Each connection is only a small heap allocation.</p>
<p>&#8230;</p></blockquote>
<p>In general Node is a program using the Google Chrome&#8217;s <a title="V8 JavaScript engine" href="http://code.google.com/p/v8/" target="_blank">V8 JavaScript</a> engine, which in turn is a program that can parse and execute code written in JavaScript. V8 is a very very interesting project itself. First of all from Google have developed this engine especially for one of his products &#8211; their browser <a title="Google Chrome" href="http://www.google.com/chrome" target="_blank">Chrome</a>. It pretends to be and by no means is one of the masterpieces of Google. It is fast and reliable engine, written in C++ and JavaScript, as <a title="V8 JavaScript engine on Wikipedia" href="http://en.wikipedia.org/wiki/V8_%28JavaScript_engine%29" target="_blank">Wikipedia&#8217;s page</a> says. Actually this code is open source and can be embedded in whatever application written in C++. Thus you can have in your application a JavaScript engine.<span id="more-2037"></span></p>
<p>Such kind of application/server is Node.js. With V8 embedded into, Node is intended to run on a machine and to serve some requests. Just like a normal web server, but with few differences. First of all Node is not only serving HTTP requests, but also TCP. Well I&#8217;m not so deep into this yet, but so far that works for me. What I need for now is its web serving functionality.</p>
<p>The way Node works, however is different from what we know from every other web server. Here it is a normal server in general:</p>
<p><a href="/wp-content/uploads/2010/11/client-server.png"></a><a href="/wp-content/uploads/2010/11/client-server.png"><img class="alignleft size-full wp-image-2053" title="client-server" src="/wp-content/uploads/2010/11/client-server.png" alt="Client Server" width="600" height="150" srcset="/wp-content/uploads/2010/11/client-server.png 600w, /wp-content/uploads/2010/11/client-server-300x75.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a></p>
<p>Whenever a request comes to the server, it tries to return the response as fast as possible. This is one of the main goals of every web developer team &#8211; to make the application as fast as possible. However in Node the things work different:</p>
<p><a href="/wp-content/uploads/2010/11/node-client-server.png"><img class="alignleft size-full wp-image-2058" title="node-client-server" src="/wp-content/uploads/2010/11/node-client-server.png" alt="Node.js Client Server Application" width="600" height="150" srcset="/wp-content/uploads/2010/11/node-client-server.png 600w, /wp-content/uploads/2010/11/node-client-server-300x75.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a></p>
<p>Here the server doesn&#8217;t return immediately the response, but holds as long as possible until some &#8220;event&#8221; occurs. You can thing of Node as a classical chat server. Until one of the peers doesn&#8217;t write a message, the other doesn&#8217;t receive anything.</p>
<blockquote><p>Some may be confused as how you can use both the typical web server, as Apache, with Node as another web server within the same page. The answer is &#8211; with AJAX. As you know thus you can have only one chunk of your page talking with the server &#8211; in this case the entire page is returned by Apache, but inside the page you can have a chat app using Node as a server, working perhaps on a different port on the same machine.</p></blockquote>
<p>Typically this scenario can be simulated without Node, but as I said, with some disadvantages. Let&#8217;s say you have two browsers and one server &#8211; you can infinitely loop AJAX calls to the server and whenever there is new message on the server return it to the browser &#8211; this is quite inefficient. There are two approaches in this case.</p>
<ol>
<li>You can make those AJAX calls too recently and you can have a call every N seconds. In that case if N is to short you&#8217;ll have too many calls and in case the other peer doesn&#8217;t make anything the server will be unusually loaded with no practical effect.</li>
<li>In the second case you can choose to make N too long &#8211; for instance 20 seconds. This is also bad, because during this period of time the peers may want to interact and chat.</li>
</ol>
<p>In that case Node is a web server, but simply doesn&#8217;t return the response until a specific event doesn&#8217;t occur. How does this look like in a web browser. You may know how looking into the <a title="Firebug" href="https://addons.mozilla.org/en-US/firefox/addon/1843/" target="_blank">Firebug console</a> for every AJAX call you see the request and how many seconds it has taken. If you make an AJAX call to a Node server app the request just doesn&#8217;t respond immediately.</p>
<h2>Installing Node.js</h2>
<p>The process of installation is <a title="Node.js Build" href="http://nodejs.org/#build" target="_blank">described quite well</a>, so I&#8217;m going to describe it in few steps.</p>
<ol>
<li>Download the application from Git, note that V8 is embedded inside. The version while this post was written and of course was stable is <a title="Node.js v0.2.4" href="http://nodejs.org/dist/node-v0.2.4.tar.gz" target="_blank">v0.2.4</a></li>
<li>For those familiar with Unix/Linux systems, there are three simple steps following, however without <a title="Gnu Compiler Collection" href="http://gcc.gnu.org/" target="_blank">GCC (Gnu Compiler Collection)</a> you wont be able to proceed! I&#8217;m writing this especially for the Mac OS users, as they may know there is no built-in GCC there.</li>
<li>./configure</li>
<li>make</li>
<li>make install</li>
<li>make test (optional)</li>
</ol>
<p>This in general is enough. After all that you can write the node command in your terminal. However if there are some problems while compiling it you may refer to Git and the Node community for more help. Don&#8217;t forget that V8 can work only on x86, x64 and ARM architectures.</p>
<h2>Summary</h2>
<p>There are few things that can be summarized now:</p>
<ol>
<li>First of all Node can be a web server, as Apache is, but with the option to respond on event firing.</li>
<li>You can request it either with a web page loaded in your browser or within a chunk of the page via AJAX.</li>
<li>To install Node you need GCC. It comes with V8 JavaScript engine inside, which can run only on x86, x64 and ARM.</li>
</ol>
<p>So far so good! Now we have Node installed, practically useless, because there is no application running on it. In my next post I&#8217;ll describe how to run your first application.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/12/02/diving-into-node-js-a-long-polling-example/" rel="bookmark" title="Diving into Node.js &#8211; A Long Polling Example">Diving into Node.js &#8211; A Long Polling Example </a></li>
<li><a href="/2010/11/19/diving-into-node-js-very-first-app/" rel="bookmark" title="Diving into Node.js &#8211; Very First App">Diving into Node.js &#8211; Very First App </a></li>
<li><a href="/2010/01/31/speed-up-the-javascript-it-can-change-dramatically-the-user-experience/" rel="bookmark" title="Speed up the JavaScript. It can change dramatically the user experience.">Speed up the JavaScript. It can change dramatically the user experience. </a></li>
<li><a href="/2010/01/11/what-should-be-optimized-in-one-web-page/" rel="bookmark" title="What should be optimized in one web page?">What should be optimized in one web page? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/11/16/diving-into-node-js-introduction-and-installation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>HTML5 video support. Detecting, playing and progressive enhancement!</title>
		<link>/2010/02/26/html5-video-support-detecting-playing-and-progressive-enhancement/</link>
		<comments>/2010/02/26/html5-video-support-detecting-playing-and-progressive-enhancement/#respond</comments>
		<pubDate>Fri, 26 Feb 2010 13:31:36 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[Adobe Flash Player]]></category>
		<category><![CDATA[Flash Video]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[HTML element]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web browser]]></category>

		<guid isPermaLink="false">/?p=1154</guid>
		<description><![CDATA[HTML5 video HTML5 is mentioned as entirely new &#8220;thing&#8221; out in the web, but what it actually means is rather a collection of new, unknown for the current HTML version, features. One of the most interesting and used things in HTML5 are the support of a video in a entirely new &#8220;video&#8221; tag. Until now &#8230; <a href="/2010/02/26/html5-video-support-detecting-playing-and-progressive-enhancement/" class="more-link">Continue reading <span class="screen-reader-text">HTML5 video support. Detecting, playing and progressive enhancement!</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/03/04/does-firefox-play-mp4-h-264-within-the-html5-video-tag/" rel="bookmark" title="Does Firefox play mp4 h.264 within the HTML5 video tag?">Does Firefox play mp4 h.264 within the HTML5 video tag? </a></li>
<li><a href="/2010/01/23/youtube-and-vimeo-goes-html5-with-video-tag-usage-catch-them-up/" rel="bookmark" title="YouTube and Vimeo goes HTML5 with video tag usage! Catch them up!">YouTube and Vimeo goes HTML5 with video tag usage! Catch them up! </a></li>
<li><a href="/2010/03/05/video-sites-must-use-mp4-and-only-mp4/" rel="bookmark" title="Video sites must use &#8230; mp4 and only mp4!">Video sites must use &#8230; mp4 and only mp4! </a></li>
<li><a href="/2011/01/27/few-thoughts-on-web-video/" rel="bookmark" title="Few Thoughts on Web Video">Few Thoughts on Web Video </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>HTML5 video</h2>
<p>HTML5 is mentioned as entirely new &#8220;thing&#8221; out in the web, but what it actually means is rather a collection of new, unknown for the current HTML version, features. One of the most interesting and used things in HTML5 are the support of a video in a entirely new &#8220;video&#8221; tag. Until now the playing of a video was either with Flash player or with Quick Time. But in both cases it relied on a third party plugins. Of course normally the question about performance was inevitable. Which is faster? But imagine we didn&#8217;t have the IMG tag? This give you the answer &#8211; using third party plugins always slows down the page, and today most of the web is based on video sharing and therefore the browsers become slower!</p>
<h2>Performance of HTML5 video tag against Flash video players</h2>
<p>As I mentioned above the performance of HTML5 video should be way better than the performance of any Flash video player. To be more precise I&#8217;ll reference an article from <a title="ajaxian" href="http://ajaxian.com/" target="_blank">ajaxian.com</a>, where the author points on his turn an interesting <a href="http://ajaxian.com/archives/i-cant-believe-its-not-flash" target="_blank">presentation</a>. Indeed the performance of HTML5 video was way, way better:</p>
<p><a href="/wp-content/uploads/2010/02/flashhtml5video.png"><img class="aligncenter size-medium wp-image-1155" title="flashhtml5video" src="/wp-content/uploads/2010/02/flashhtml5video-300x224.png" alt="" width="300" height="224" srcset="/wp-content/uploads/2010/02/flashhtml5video-300x224.png 300w, /wp-content/uploads/2010/02/flashhtml5video.png 504w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>But sometimes this doesn&#8217;t resolves all the problems. Normally with this &#8220;new&#8221; technique of putting a video into the page, come some additional issues.</p>
<p>First of all there are many codecs that the browser should support and almost always there is something &#8220;your&#8221; browser don&#8217;t support. That makes the task bigger. Now you should support more and more video file formats for the different browsers. And yet another problem is the detection of this codec support.</p>
<h2>Detection and integration</h2>
<p>Lucky enough, I found a great article and tutorial describing how to integrate HTML5 video with progressive enhancement. First of all you can check for it&#8217;s support than downgrade to Quick Time and Flash and if the client doesn&#8217;t support even that &#8211; render an image.</p>
<p>You can find the source <a href="http://camendesign.com/code/video_for_everybody" target="_blank">here.</a></p>
<p>Thanks to this technique you can fully integrate new video tag into your page. Remember that most of the clients for sure will be happy to watch video in a more user friendly manner.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/03/04/does-firefox-play-mp4-h-264-within-the-html5-video-tag/" rel="bookmark" title="Does Firefox play mp4 h.264 within the HTML5 video tag?">Does Firefox play mp4 h.264 within the HTML5 video tag? </a></li>
<li><a href="/2010/01/23/youtube-and-vimeo-goes-html5-with-video-tag-usage-catch-them-up/" rel="bookmark" title="YouTube and Vimeo goes HTML5 with video tag usage! Catch them up!">YouTube and Vimeo goes HTML5 with video tag usage! Catch them up! </a></li>
<li><a href="/2010/03/05/video-sites-must-use-mp4-and-only-mp4/" rel="bookmark" title="Video sites must use &#8230; mp4 and only mp4!">Video sites must use &#8230; mp4 and only mp4! </a></li>
<li><a href="/2011/01/27/few-thoughts-on-web-video/" rel="bookmark" title="Few Thoughts on Web Video">Few Thoughts on Web Video </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/02/26/html5-video-support-detecting-playing-and-progressive-enhancement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
