Code

How to get logged-in username in Hudson?

Quick background

Have you ever thought your manager keeps shelling out more on your plate other than the officially tracked tasks? Do not feel bad. You are not alone :)

My manager recently asked me to clean up the build server we use for our project. To put simply, it was a mess. I ended up deciding to start from scratch. Looking around, we quickly zoomed in on Hudson. A great build/CI server. Met literally all my requirements (one of which is extensibility – with the source for Hudson available as open source, we could not have asked for more!).

After many Hudson code changes and UI customizations, we now have a great CI server up and running. One of the code changes I did is to a plugin called email-ext. This enables customizing many aspects of e-mail notification that gets triggered. Unfortunately the stock plugin missed one important thing (at least to us!) – no way to get the user name who triggered the build.

I added a new variable called BUILD_USER to email-ext. When used in the email-ext mail template, this will get replaced by the user who triggered the build. Our server is plugged in to our corporate active directory and this plugin will pick up the logged in user name.

You will find the source code and binaries down below. Note that this is based off 1.3.4.2 Hudson code and is running in our snapshot very well. YMMV and do enough testing before putting in production. Do send me any bugfixes you make, I will make them available for download.

How to use this?

Copy the HPI file to your Hudson web apps folder. Restart Hudson. Go to <your job> => Configure. Scroll down to “Editable EMail Notifications” section. Click on “content reference” help to make sure BUILD_USER is showing.

See the highlighted text shown below.

Any instances of BUILD_USER will be replaced by the current logged in user. In case of timer activated builds BUILD_USER will show “timer”. In case the build trigger reasons cannot be found out, BUILD_USER will be replaced with “<unknown>”.

More >

No..not another Wordpress version!!

I logged in to my blog account 2 days back, after a verrry long time (I blame my project move in the professional world). I was surprised to find out so many things have happened in the Wordpress world. A new version has been released, many more vulnerabilities have been found and fixed…WAIT…a NEW version?? NOOOO! It feels like I just updated to a new version…is there a new one already!???

Wordpress is churning out new versions faster than my C2Duo / Vista machine can boot :P Don’t believe me? Look at these dates:

Wordpress version Release date
1.5 (Strayhorn) mid-Feb 2005
2.0 (duke) Dec 2005
2.1 (Ella) 22 Jan 2007
2.2 (Getz) 16 May 2007
2.3 (Dexter) 24 Sep 2007
2.5 (Brecker) 29 Mar 2008
2.6 (Tyner) 15 Jul 2008

 

More >

WinSAG: Windows GUI for Simian (& other tools)

WinSAG_Star Recently one of my peers inherited some legacy code from an Israel team. It had around 800 C/C++ language files and 30 ASM files. The task for my peer was to somehow make sense out of it and port that to an embedded environment with a big size restriction. The size of the code had to be reduced by at least 40%. Just to get him started on that, I thought of developing a new tool that could find the code duplicates. A quick Google search revealed the excellent Simian. Since, it met all our needs, my colleague has decided to buy a license to the tool and use it for his needs.

I spent a day trying out all it’s options. They have a neat ANT task, as well as an Eclipse plugin for Java developers, while nothing for any of the VisualStudio.NET IDEs! There is a command line tool though, thankfully. I put together a small GUI front end for this tool. Check it out if you are interested. Note that this tool was put together in a very short time and so didn’t go through any proper testing & I don’t intend to put it through one, in the near future. I have used this in my house for 2 days now and it hasn’t crashed yet.

This tool is in public domain and totally free. You can do whatever you want to with the source, though a line of credit will be nice. A post card or an email will be appreciated too. You cannot hold me responsible for any damage caused by this tool or the source code :)

 WinSAG MainScreen

More >

Cascade Virus: Down the memory lane.

I have always been fascinated with computer virii. My first exposure to computer virii was back in 1994, when my 360KB floppy disk got infected by STONED. The hype around virii was so much and I was so misinformed, I kept that infected disk in the jacket, away from all other diskettes I owned for 2 weeks!! No, I am not kidding.

Gokul, (owner of Port Bit Systems/Trichy, who was my first computer teacher) looked like a hero to me, when he could magically clean the infection by running a command line DOS McAfee. Man,those days were cool! Later when I started learning x86 assembly and DOS internals, I got fully absorbed in to the wonder world of DOS virii. (I still have the first DOS anti-virus program I wrote – "(C) Brain" remover – somewhere in my old HDD). "Computer Viruses: Prevention, detection and cure" by Rajneesh Kapur was my first viruses book; An excellent one! This is out of print now, can’t even find it in the original publishers site.

One virus I fondly remember to this day, is the famous (!?) CASCADE virus (a.k.a Raindrop/17xx). This virus was a non-overwriting, resident COM infector. When triggered it made the characters in the screen fall in to a nice heap at the bottom. (Remember, we were in the command line mode then!). It was kind of cool to see this cascading action.

Cascade was the first virus to use encryption. The virus consisted of two parts – the virus body and an encryption routine. The latter encrypted the body of the virus so that it appeared different in every infected file. After loading the file, control was transferred to the decryption routine which decoded the virus body and transferred control to it. Unlike future polymorphic viruses, Cascade encoded only the body of the virus. The size of the infected file was used as the decryption key. Since the decryption routine remained unchanged, antivirus programs detected the virus with ease.

If you have never seen the virus in action, look at the screen shots below:

Cascade Virus: DOS command line

More >

Virus group 29A disbanded – who’s next?

29A Labs

Couple of weeks back, 29A officially shut down business. 29A’s published work was one of the best (IMHO) sources for cutting edge virus technologies. Their e-zines provided a sampling of what was happening in the Virus underground during that period.

This was the last message posted by VirusBuster in their site:

I tried to contact ValleZ for some time in order to take a decision together about the future of 29A with no luck therefore I decided to take the decision alone. And my decision is that 29A goes officially retired. I feel this is fair because I am kinda the alpha and the omega of the group. 29A was born in Dark Node, my BBS, and I am the last active member of the group. My last words as 29A member are for all the people that worked hard to make of this group the best one: Thank you very much! Regards, VirusBuster/29A

29A has left the building!

Kind of sad.

I came to know of 29A when I was in my 2nd year UG, around 1997. 29A was a new group then (If I am right, the group formed only in the mid of 1996). BTW, if you are wondering why they named it so, 29A is the hex representation of 666 decimal.

More >

Yahoo vs Google: why Yahoo lags behind?

You wanna know why Yahoo lags behind Google? Look at the image below that I took from Yahoo’s careers site today (WW10.4). It shows all open reqs, sorted by date (descending).

YahooAlgorithmWrong

As you probably noticed (follow the arrows please! :P ), the sort hasn’t happened properly. How did the coder miss this? No unit tests funda in Yahoo engineering?? How did the QA team allow this page to go online?

More >

Chess UCI protocol tracer utility

I have this bad habit of starting coding on some application, bringing it to an alpha-ready stage, dropping it and moving on to the next one. Fortunately I don’t do this in my day job, else I’d have got the boot long time back.

Couple of months back, I was working on a chess application. I will not be able to discuss it further here, as I still think that app idea is a good one and is highly marketable. My chess GUI had to support UCI engines. UCI (Universal Chess Interface) is a protocol used by Chess GUI to talk to chess engines (see Figure 1). There are other GUI <-> Engine protocols, like Winboard, but UCI is an effort to create a standard. Since my software had to support all the existing UCI engines, I decided to understand the UCI protocol fully. I looked around for some way to capture the UCI transactions that go in between the GUI and the engine, but couldn’t find any tool to do that. So I wrote my own.

Gui 2 Engine

[Figure - 1]

In the attached file, you will find uciplug.exe, the main UCI tracer application. Tracer is a simple pump, which works as shown in Figure 2:

Gui 2 Tracer 2 Engine

[Figure - 2]

It acts like a network repeater, by passing on everything it gets (either from the engine, or from the GUI) to the corresponding recipient, the only difference being it also logs that message to a file. Multiple instances can be used for running more than one engine simultaneously.

Download

[Download not found]

 

More >

Good programmer = Sense of humor + Programming skills

I was trying to setup a debug machine today. My setup required a specific version of BIOS; I booted in to DOS and tried flashing the new version. The flash went on well and during the verification phase, the tool found couple of invalid regions. It automatically tried erasing/flashing again. I was impressed; “Good. The programmer is smart enough to implement this auto-retry option, else It’d have taken ages to find out this data region corruption”, I thought and was silently thanking that programmer. It was premature, immediately the tool stopped and showed me the following screen.

[Snapshot: Tool output]
Flashing Error

[Close up of the message]
Flash Error Closeup

The tool very helpfully said “Your platform is dead & have a nice day!”. “Have a nice day”??? Though, now I need to take the flash, go to the lab and program it using a flash programmer, I couldn’t help laughing at this cheeky message! :)

Thamizmanam plugin updated

I have uploaded the latest version of the plugin here. This version extends support to Blogdesam.com aggregator, apart from Thamizmanam.com. From the options page, now the user can choose the aggregators he/she wants to include.

Coolcode.cn (Wordpress plugin) site down!

Today morning I was surprised to see a couple of mails complaining that the videos I posted earlier here and here are not working! I checked them last night (ok…at 1am..technically it is today morning!) and they were fine. I use the excellent coolplayer 9.3 plugin in my Wordpress blog. I logged in to my account and checked the coolplayer options. They looked fine, anyway I didn’t change any of these things and they were working fine yesterday. So, what’s wrong?

Click to enlarge

Then, I noticed that the RPC server ping was not working. As you can see from the picture (click to enlarge, the RED ones are the errors), the coolcode.cn is returning a 503. My page just gets blocked for 19-20seconds, trying to get the rpc.php in coolcode to work! The site is obviously down and has taken all my videos down with it, I wonder how many more sites are also affected by this!

Man, how I wish I had installed the RPC server in my machine :-( I couldn’t find a mirror with that zip anywhere. Till I setup my own RPC server, please do bear with the slow loading speed. Thanks.

Update (Mar 16,07 02:07pm IST): Hooray….the site is up and I have downloaded the needed zips :)

Update (Mar 16,07 03:00pm IST): Ok, I have the RPC setup in my machine now. No more worries.