Sunday, August 27, 2006

Formatter for Mail Forwarding

24 hours is equivalent to a day's time. and there is this email which I had received lately; after being forwarded a couple of times. meaningful it was, it should suffer the same fate once more, to be relayed to a bigger mass. but should I? well, nice stuffs are meant to be shared but it had been tormented by too many '>' characters; reading it proves to be difficult.

since it was hazy outside, my run was ruined. doing something helpful (but boring to many) might be the way to pass time. and there it was, the commencement of operation "symbolRemover" (it could have been named to someone i admire. 'operationCameronDiaz0' or 'missionJuliaRoberts5'? kind of strange? a proper name deemed more appropriate).

for convenience, java was used; eclipse was the IDE. as with most projects, technical difficulties were encountered. For example:

1) to use the split function (in the String class) for regex ".", one actually has to use the "//." character so that java can perform the correct recognition.
2) windows actually uses "/r/n" instead just "/n" to represent the newline character.. this caused difficulties in pattern recognition
3) care must be taken for the encoding of characters. For .txt files, characters are encoded in the form of bytes (8 bits for x86 machine on english windows); while for java, a char is represented by 16 bits (wide character). Usage of the wrong form (or encoding) can cause strange behaviours.

the eclipse project, .java, .class, .txt test and result (wordWrap required -> use view source) files can be downloaded at their respective links. its made open source. Hm.. under the GPL. Do feel free to use/distribute it. and if you like the program, still, no need to donate. :)
To be frank, its not perfect, for the if-else statements lack intelligence, but still, it helps to eliminate most manual jobs.

well, do have fun and enjoy!

(note that setting of environmental parameters are necessary for the files to run in all directories... i will put the screenshots in my next blog entry in time to come. also do note that the file works fine on windows only because of the "\r\n" newline character. last but not least, to run the program, use the following command:

c:/blahBlahBlah/> java symbolRemover yourFileName.txt

A new file named "yourFileNameMod.txt" will be created in the same directory.)

and yup, that's it, enjoy and gd nite... else, tmr will be a bluey monday...

Saturday, May 27, 2006

ShoutBox

The shoutbox is up! :)

Thanks to Winston for the overview and Brett for his open source code. Without their support, it would not be done this quickly.

Being my first time dealing with open source code and creating database on the unix server, the process has been relatively smooth. Installation was clear cut with detailed instructions. Database setup had been logical/'guess-ible'; involving 1)database creation, 2)user account creation 3)linking these two together. And voila, it's ready!

Well, well... Improving its appearance was a minor hiccup. I was naive to think that only the .css file had to be changed, which was wrong of course. In fact, different files were modified. For example, to change the title from '::shoutbox' to 'shoutbox', shoutbox_langpack_english.php had to be edited. To make the help menu show up correctly in white background, 'text=#FFFFFF' was adjusted to become 'text=#000000' in shoutboxhelp.php. To align the textfields and buttons left, one has to blah blah blah blah. La la la la disables the smileys' help. And so on....

And so on...

Thursday, May 25, 2006

Blogspot and HTML

Registered this blogspot account yesterday and I should really put something here...

Standing at a programmer's point of view, this is real cool! I love the way in which users are given the flexiblity to customize their HTML template. For those who might not have realised it, the original template has been coded using Cascading Style Sheet (CSS) and this ensures that the pages will show up almost identically in both Firefox and Internet Explorer, and hence erasing the necessity to write browser specific codes.

Being a coding nerd, I started off by modifying the right side bar, such that my favourite links show up. Although I am not too familiar with the HTML syntax, however, only copy-and-paste actions are needed; understanding is not essential. (This technique was actually learnt from Martin, a friend of mine while I was doing industrial attachment in Switzerland. He is one of the most efficient people whom I have ever met and most of the time, he just make things work by trying, without indulging into the unforgivable details.)

And today, I have manufactured my own email picture. This will allow my email address to be displayed (for those who happen to love and/or hate my blog entries) and at the same time, keeping away email mining 'bots'. (Some side notes: While surfing the web, please ensure that the URL you click on is linked to the desired site. For example, an URL like this can be tricky http://www.linux.org. Well, be careful of phishing...)

So, what will be next? Perhaps coding my own shout box and linking it to onmousedown.com, if I have time that is...