Archive

Archive for July, 2007

NANOWEB, a web server written entirely in PHP

July 15th, 2007 No comments

NANOWEB is a http server written entirely in PHP 4.3. It does not need apache or any other server software to work, just the php4 binary.

As commented on the online manual, the installation was really easy with the command line tool handling the task. Though the configuration was a bit tough for me. Not that the configuration syntax, but finding the files was a bit confusing. Though only later on I came to know about the nanoweb-nanoconfig, an ubunty fiesty package which helps configuring nanoweb using a web interface.

Though the feature list is long, the full power can be achieved only in an os where php can provide the POSIX fork() call. I could find this enough for demonstration purposes, but for real heavy work, I still depend on a different application server.

Categories: Code Snippets Tags:

The Power of Google Gears (Part 1)

July 13th, 2007 No comments

by Jack Herrington
Web application development is the perfect 95 percent solution. It’s very easy to develop a simple HTML frontend to something like PHP or Rails, to deliver data to and from a MySQL database. You can even give it a more desktop feel by using Ajax tools. But that last five percent, the ability for desktop applications to work offline, was missing from the web world until the release of Google Gears.

Read the rest of the article

Categories: Code Snippets Tags:

How ’bout writing a JavaScript template engine ?

July 1st, 2007 No comments

Yea! a minimalistic one, without much xBrowser checks, would be as follows,

function render(o){
	if(!o.o) return;
	var rv = document.createElement(o.o);
	if(o.p){
		var pC = o.p.length - 1;
		for(var i = 0; i < pC; i += 2){
			rv.setAttribute(o.p[i], o.p[i+1]);
		}
	}
	if(o.c){
		var cC = o.c.length;
		for(var i = 0; i < cC; i++)
			rv.appendChild(render(o.c[i]));
			}
	if(o.txt)
		rv.innerHTML = o.txt;
   return rv;
}


Now what the heck is written above ? no wonder, it is just a recursive function which can handle json page structures. Only thing is that the page structuring can go heck and complex, though the renderer is too simple with only just a handful of statements. The var names are intentionally kept at a minimum to make the function lighter.
Read more…

Categories: Code Snippets, Javascript Tags: