Portfolio

In this section, you will find some of my work which I have done and can be shown up here. They are either commercials, school work or even just a contribution to the community. In all cases, I reserve the copyright of my own work (exclude the open source code used). If you find them useful and decide to use or modify it, my credit must be acknowledged or remained as it is.
For those downloadable packages, I do not assume any implicit or explicit responsibility for possible damage caused by proper or improper use of them and I do not assure any type of assistance or support. However, if you have any problem or idea, post them in my shoutbox.
It is also not recommended to delete any reference to the authors (me or anyone else) or to the copyright. All the code’s comments from other sources or authors that I reused in my code are still maintained and should not be removed under any circumstances.

CShout 3 Release

The new version of CShout has been renovated quite a lots with many long waited features. As in previous versions, it requires no database but a text file for storing shouts. Following are key important features:

  • Use flat-file database, easy for setup and backup
  • Support emoticons, flooding control (spam protection), bad words filtering.
  • Display timestamp and ip address via tooltip.
  • Timezone adjusting.
  • Allow the admin to delete unwanted shouts on the fly.
  • Search shouts by date, time, shouter, message, and ip address.
  • Page navigation.
  • AJAX-Ready.
  • Support any language/charset.
  • Extremely easy for customising and supporting themes. NEW
  • Support integration with other CMS/Forums where users must log in to shout. Their usernames will be used. NEW
  • Auto-refresh. Easy to turn into a chat box (rev28: allow admin to force this feature always on). NEW

Click here to download the latest package of CShout. Since version 3, CShout’s source code is Subversion controlled at http://code.google.com/p/cshout/source/checkout. View full change log.

If you have any suggestion or have found any bugs, please create a new issue or submit a comment here. For more information, please visit the wiki.

CShout 2.0 Release

This shoutbox completely needs no database at all. It uses a text file as its database. I have created it since I realised that I would need one for my own. Before that, I used the free shoutbox service at http://www.shoutboxes.com from which I adopted the idea. I started with a free tutorial on the internet which was really really basic and simple.
You can download, unrar and enjoy it straight away as well as using it with phpwcms as a mod. I don’t know if this is considered as a mod but it does something different to the orginial copy of phpwcms. It is my little contribution to phpwcms community. This mod will add a shoutbox into your phpwcms site using phpwcms custom replacement tag.
If you would not mind, please let me know the website that you use this shoutbox. Put a link in to my shoutbox so that others can have different live demos of this shoutbox.
Features:
  • Use flat-file database, easy for setup and backup
  • Support emoticons, flooding control (spam protection), bad words filtering.
  • Display timestamp and ip address via tooltip.
  • Timezone adjusting.
  • Allow the admin to delete unwanted shouts on the fly.
  • Search shouts by date, time, shouter, message, and ip address.
  • Page navigation.
  • New version 2.0 implements AJAX.
  • Support any language/charset.
Websites link to this shoutbox:
Websites use this shoutbox:
CShout 2.x
Install instruction:
- Please refer to installation.html in the CShout 2.0 package.
Versions:
2.0: released on 28 September, 2006 with AJAX implementation but still be compatible with browsers that do not support JavaScript or AJAX. It’s now called CShout 2.0
Download CShout 2.0.1
Shoutbox 1.x
Notes:
Version 1.x is out of date and no longer get updated or fixed. It is recommended to install the latest version.REMEMBER that the replacement tag for phpwcms only works with version 1.x, for newer versions please refer to its installation notes. The replacement tag should be decompressed into/phpwcms_template/inc_script/frontend_render then you can use the tag {SHOUTBOX:‹width›x‹height›} in your articles.
Versions:
1.05: released on 17 June, 2006 with bug fixed and new features. Check the change log in the source code. For those who would like to update from old versions, you only need to replace the file shout.php and off you go.
1.02: released on 06 June, 2005 with features added: flooding control, smiley selection panel and paging navigation.
1.01: released on 05 June, 2005 with updating of timezone settings. Now it does not matter where you host your website, just set the timezone setting in the shoutbox to exactly where you are in the world it will tell you the right time of those shouts. Stop the mouse over a shout, it will tell you when and where (date, time and ip address) it was posted.

How to write your own GDownloadUrl function

While doing the javascript calendar with ajax, I figured that I would need a wrapper function like GDownloadUrl() as you may see in Google Map API. The point is how to pass your custom function to this GDownloadUrl() to process returned xml data.

The Code

A few Google searches gave me the idea of how to do it. I would say this function will do exactly what GDownloadUrl does. In that regard, I name it CDownloadUrl.

Now have a look at the code, explanation will be followed.

/*
method : POST/GET
url    : Call url
func   : custom function which is used to process returned data,
take only one parameter
*/
function CDownloadUrl(method, url, func) {
tvar httpObj;
tvar browser = navigator.appName;
tif(browser.indexOf("Microsoft") > -1)
tthttpObj = new ActiveXObject("Microsoft.XMLHTTP");
telse httpObj = new XMLHttpRequest();
tthttpObj.open(method, url, true);
thttpObj.onreadystatechange = function() {
ttif(httpObj.readyState == 4){
tttif (httpObj.status == 200) {
ttttvar contenttype = httpObj.getResponseHeader('Content-Type');
ttttif (contenttype.indexOf('xml')>-1) {
tttttfunc(httpObj.responseXML);
tttt} else {
tttttfunc(httpObj.responseText);
tttt}
ttt} else {
ttttfunc('Error: '+httpObj.status);
ttt}
tt}
t};
thttpObj.send(null);
}

The function will take 3 parameters which specify method (GET or POST), url and a function taking return data as its parameter. I will give a example of this custom function later.

From line 8 to 13, it is all about setting up variables and instantate an XML object depending on the kind of browser (Microsoft or Non-Microsoft).

After openning a connection on line 15, a handler is defined for onreadystatechange event up to line 29.

The handler actually runs as all the operations are completed (readyState = 4). The early version of this handler was like this:

httpObj.onreadystatechange = function() {
tif(httpObj.readyState == 4){
ttfunc(httpObj.responseXML);
t}
};

It lacks of some essential error checking. The handler needs to check if the request was successful (status code 200 means OK), otherwise it will return Error: plus status code.

Now it seems okie to retrieve data, you may get them from responseXML or responseText. By checking its ‘Content-Type’ header, it knows what to return. Finally, it just pass the data to your custom function.

The last statement is just send the request away.

Example

Many people would find it hard to understand the code without some examples. The following will demonstrate how to use CDownloadUrl to request some text and display it into a div element. Assuming the getsometext.php script return some raw text.

document.write('<div id="test">Old text</div>');
CDownloadUrl('get', 'getsometext.php', function(text) {
tdocument.getElementById('test').innerHTML = text;
});

It can be rewritten in another way as below which is clearer and easy to understand.

document.write('<div id="test">Old text</div>');
function showText(text) {
tdocument.getElementById('test').innerHTML = text;
}
CDownloadUrl('get', 'getsometext.php', showText);

That’s it. I hope you understand and apply it into your own application. If you have any questions or comments, please feel free to shout it in my shoutbox or the form below.

Online Picture EXchange

This is an assignment task which was done in PHP and used MySQL as back-end database. Please visithttp://opex.coolersport.info for more information. A demo user has been provided with user for both username and password.

Neuragenix Pty Ltd

Visit Neuragenix’s home page at http://neuragenix.com