Code Syntax Highlight for MediaWiki! (GeSHi)
Posted by mkhairul - January 31, 2007 at 02:01:43 pm - 1 CommentCategories: blog
Yes finally! <code> in Color!
I have been using mediawiki for my resources and reference for quite some time now. But it was all in mono. Black and white.. dull. No line number.. no syntax highlight.
I tried searching for something in mediawiki extension section but nothing!
Googling is always my best bet. Productivity will go down to a crawl if it werent for google! Yeah.. our dependent on google is quite scary.
So anyway I found a nice entry on Swinburne University of Technology wiki entry on using GeSHi on mediawiki.

Mediawiki using GeSHi – Generic Syntax Highlighter
Now all I have to type to use the extension is <code>[php,1] function … </code> and all is good.
Python Ternary
Posted by mkhairul - January 30, 2007 at 03:01:38 pm - No CommentsCategories: blog
I joined an exercise question posted in ITtutor’s Forum a few days back. I’ve posted PHP, ActionScript (with a little frame action, lol), Processing (custom java-based language), and 2 Python Snippet (both valid ternary emulation but latter is more feasible for use than former).
I though about it when I was waiting for the damn bus. I was on my way to buy a new keyboard, the other pc uses USB, which gives me a slight problem when setting up linux metadistro Gentoo. Yes, I’m a gentoo newbie.
So anyway the bus took almost 2 hours of my time. Nearly driving me nuts (steering wheel in the crotch, one of bash quote). I took out my Python Pocket Reference (yes, I bring something to read just in case something like this would happen). And read page by page, list comprehension expressions gave me something work with. But still it cant solve the fizz buzz exercise.
I took my time googling for Python Ternary and found a nice site and in its comments there’s another nice link to Mark Pilgrim’s site.
Well.. thats about solve it.
Fizzle to the wizzle
for x in range(1, 101): print (x % 3 == 0 and x % 5 == 0) and ‘FizzBuzz’ or ((x % 3 == 0) and ‘Fizz’ or ((x % 5 == 0) and ‘Buzz’ or str(x)))
Procrastinating Programmer: From Journeyman to Master
Posted by mkhairul - January 28, 2007 at 12:01:27 pm - No CommentsCategories: blog
From day to day, I try to list things down. Of course, important things are on top all arranged by priorities. As usual, start of a new day, I try to haul my lazy ass off of bed and do some things (that I think might be useful) and try to finish them.
Fire up the browser, the IDE and most importantly.. Winamp. After everything is up, I checked my email then my google personalized homepage (thats 2 tabs). But wait, my firefox comes with a sessionsaver extension. Whats supposed to be 2.. becomes 16 from a previously saved session. Now I have 16 tabs. I skim through the tabs.. looking for something interesting (most of them probably are or else I wouldnt have opened a new tab for it) usually this activity lands me on the personalized page tab. The overview of all the RSS feeds makes me feel like a fly(compound eyes) or some sort of uber leet hacker (which I’m actually not) with multiple terminal screens.
With all the RSS feeds that I’ve been subscribing to, its no surprise that I cant get anything done. Blogs, articles, forums to name a few places that I’d visit before doing anything useful. After half a day of browsing and reading and finally getting sick of it, then I started doing some work.
To start doing some work, I must summon all my deepest and strongest motivation to be able to surface and whip me like a slave master whipping his peons *whips* or maybe a phone call from the project manager asking me "is it done yet?", repeatedly.
As I was doing some work, a quick glance at my watch tells me its already 12 noon the sun is scorching.. I immediately stood up and did some laundry and sweep the dust off the floor.
This kind of behaviour is called structured procrastination. Yes there are types of procrastination (which I just discovered by reading comments from Paul Graham’s article Good and Bad Procrastination on Reddit).
By putting important task or things that need to be done on top of my mind, I tend to avoid it and do things that are 3-4 levels below it. When I started to feel bored like crap (which is going to go to the top of my list on the next thing to do) I avoid it by doing things that matter less (like my "important" work). This my friend, is a PROBLEM. We cannot settle or solve this kind of problem, we just have to MANAGE it.
As my previous boss told me "There will always be problem, its just a matter of handling it". Yeah something like that. There’s some wisdom in it. Structured procrastination just hits it home.
Its sort of like Yin-Yang.. Tai-Chi.. you know.. You can handle it the hard way through disciplined drills.. or embrace it gracefully and manipulate it for your own good. I’m not much of a tough guy or a military man, as a matter of fact.. in City of Villains my character is from the Mastermind class. Yeaahahahaaha! (stupid Enel laughter from One Piece).
Thats it for now. I’m getting tired.
Interview and metaphors
Posted by mkhairul - January 26, 2007 at 09:01:29 pm - No CommentsCategories: blog
I once went on an interview for a Delphi Programmer position but I have no delphi experience on my resume except that I have used delphi once in college while experimenting on it.
So.. the interviewer was a bit skeptical, he should be. How can I prove to him that I can be of any use in this kind of development?
So I explained to him.. it doesn’t matter which language you use. It is a tool. Like driving a car, if you know how to drive one.. you probably can drive most cars. But then the interviewer said, but this is a programming language, this is not some car.. and other stuffs he said that I cant remember. I guess he didn’t understand my point. He did gave me a chance to prove myself.
Paraphrasing.. "Make a delphi program with basic functionality (crud), search of patients data, within one week!". And so I did, about 70% through I stopped to continue on what I see as a more prospective project. The place is quite far.. in Bukit Jalil (TPM). Which is another reason why I decided not to take it. So here I am… without a consistent pay.. doing what I can to survive.. with politics on every corner. *yawn*
Autonomic software, self-aware, reflective oriented + metaprogramming
Posted by mkhairul - January 26, 2007 at 09:01:29 pm - No CommentsCategories: blog
This morning while I was walking from breakfast.. I thought to myself, wouldn’t it be cool if software are self aware of their own state of being.
To do this, we might need another layer of above the programming, scripting whatever type of language we might use. Oh.. thats not self aware.. thats just automated code analysis and code mending. Bah! :\
BUT its a step towards it. I think, therefore I do sums!
IBM Research on Autonomic Computing
Subverting AJAX – CCC
Posted by mkhairul - January 26, 2007 at 05:01:54 am - No CommentsCategories: blog
As defined by Dictionary.com:
sub·vert (səb-vûrt’) Pronunciation Key
tr.v. sub·vert·ed, sub·vert·ing, sub·verts
- To destroy completely; ruin: "schemes to subvert the liberties of a great community" (Alexander Hamilton).
- To undermine the character, morals, or allegiance of; corrupt.
- To overthrow completely: "Economic assistance … must subvert the existing … feudal or tribal order" (Henry A. Kissinger). See Synonyms at overthrow.
This issue surfaces when I was going through AJAX Google Calendar Reader, there’s a link which concerns about security that leads me to the Chaos Communication Congress site and to this paper. Its been slashdotted.
This is the primary reason why not to use AJAX early on in building your applications. We all should be building web application with graceful degradation in mind. AJAX is just a plus, not essential but a bonus. And mind where you use it.
Google Calendar – AJAX!
Posted by mkhairul - January 25, 2007 at 08:01:25 pm - No CommentsCategories: blog
I had wanted to put google calendar list, not very intrusive that is, on my blog. But procrastinating got the best of me.
So anyway.. here I am. Managed to get myself together and pull this off. Not much of an effort. Initially I used AJAX Google Calendar Reader from AJAX PHP magazine. Simple and effective. When browse through google settings there was an embedded feature which I am sure it was not there 5-6 months ago. Maybe I overlooked it.
If anyone wants to implement the ajax thing, dont forget to look at Google Calendar Data API, especially the section on date-range query. You dont want it to list ALL of your entries now wouldnt you.
Oh yeah and about the embedded iframe google calendar, go to your google calendar, on the bottom left Manage Calendars -> Pick one of your calendars(Make sure its have some public properties) -> Click on the HTML button on the calendar address section(picture below). There should be a box with directions to the embedded calendar configuration tools.
Uh yeah.. something like that.
Here’s the result
“Who wants to be a developer?” – d.*
Posted by mkhairul - January 25, 2007 at 11:01:59 am - 2 CommentsCategories: blog
I spent from 2-5 hours per day reading articles and blogs. If its more than 3 hours.. a quick nap is required to continue any further to digest all the stuff thats being read.
Anyway its been quite a while since I browse through d.*. Great post written by Donna L Davis titled Who wants to be a developer?. Also nice comments by Edward G Niles, author of Software Creativity 2.0 (which I tried to search through my local bookstore!).
Cross-Site Request Forgery (CSRF/XSRF)
Posted by mkhairul - January 24, 2007 at 06:01:02 am - No CommentsCategories: blog
As I was reading an entry on Cross-Site Request Forgery on CGISecurity, they didnt put anything about preventing / countermeasures on the entry. There’s a wikipedia entry on it too. It offers a brief explanation on its prevention.
A more detailed explanation on its prevention can be found on a site I stumbled upon for quite some time ago. Improving website security.
CSRF as I see it is a serious threat. Not too long ago a few gmail users account was affected. All the contact and email where affected. Thats fucking dangerous. Must get paranoia mode to kick-in. Backup all stuff burn it to 5 seperate copies and mail it to random states where there’s a friend.. or maybe put it in some deposit box. LoL.
CSRF takes advantage of this era of multi-tabbing browsers!
On detecting file types
Posted by mkhairul - January 23, 2007 at 03:01:47 pm - No CommentsCategories: blog
There’s practically thousands of filetype. Usually the extension gave a hint of what it is. Or if that doesnt I could just type in the extension at Filext.com and its probably there.
What about file that have no extension. Well.. it goes down to the file header data. Unless you can differentiate hex data using you can just popout a hex editor and voila! Identified. Thats like a file lore above 50! (D&D).
So anyway.. a friend of mine gave a file 16MB big.. without any extension and asked me what file type is it. So… I took a shortcut and asked him who gave it to him and why? (so I can deduce the filetype by determining what it is used for, narrowing down my search). The file was given to his friend.. few degrees of seperation… oh well.
I downloaded an app called TrID – File Identifier. Thats the command line version. There’s a GUI version called TrIDNet. Oh yeah, don’t forget to download the file definitions. This aint a heuristic app. LoL.
GimpStyle Theme design by Horacio Bella.


