Showing posts with label web development. Show all posts
Showing posts with label web development. Show all posts

Saturday, July 26, 2008

GZip testing

A nifty online test tool for GZIP compression testing, along with some sample codes and methods to enable GZIP compression for your site/pages. ;)

http://www.gidnetwork.com/tools/gzip-test.php
http://www.desilva.biz/php/zlib.html

-------------------------------------

On Apache, if zlib is installed, we can use just a simple code snippet to enable GZIP compression:



Really simple right?

Thursday, May 29, 2008

URI / URL Parsing Using RegExp in JavaScript

Sometime back when I was writing a web crawler in JavaScript, I had to parse URIs into their constituents. And for that task I modified Flog's URI Parser class for my needs.

Well, as part of the licensing, and for sharing of information, I thought I'd post the JavaScript code here.

function UriParser(uri){
//define class (for use with prototype.js) to do URI parsing
//modified from FlogUriParser found at http://www.flog.co.nz/index.php/journal/prototype-uri-parser-class/
this._regExp = /^((\w+):\/\/\/?)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#;\|]+)?([;\|])?([^\?#]+)?\??([^#]+)?#?(\w*)/;
this.username = "";
this.password = "";
this.port = "";
this.protocol = "";
this.host = "";
this.pathname = "";
this.url = "";
this.urlparamseparator = "";
this.urlparam = "";
this.querystring = {};
this.fragment = "";
this.results = null;

this._getVal = function(r, i) {
if(!r) return null;
return (typeof(r[i]) == 'undefined' ? "" : r[i]);
};

this.parse = function(uri) {
var r = this._regExp.exec(uri);
this.results = r;
this.url = this._getVal(r,0);
this.protocol = this._getVal(r,2);
this.username = this._getVal(r,4);
this.password = this._getVal(r,5);
this.host = this._getVal(r,6);
this.port = this._getVal(r,7);
this.pathname = this._getVal(r,8);
this.urlparamseparator = this._getVal(r,9);
this.urlparam = this._getVal(r,10);
this.querystring = this._getVal(r,11);
this.fragment = this._getVal(r,12);
return r;
}

if(uri) this.parse(uri);
}

Wednesday, February 20, 2008

Top-10 Application-Design Mistakes

For those who're involved in (web-related) design in any way, some really good tips here.

Wednesday, February 06, 2008

New project?

Will be trying to do up a simple mailing list program for use, and also for practise. Maybe I'll post up the process and the documents generated in the process, if anyone is interested in looking at how (badly) I do it this time ;P