Posts tagged coding
How to get logged-in username in Hudson?
Mar 3rd
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>”.
Virus group 29A disbanded – who’s next?
Mar 10th
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.
Chess UCI protocol tracer utility
Jan 4th
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.

[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:

[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]
WP-Mollio comment_form hook fix – HowTo?
Mar 10th
If you are using WP-Mollio theme in your Wordpress site, I’d suggest adding the comment_form hook in to your comments.php. Only if you have this statement, the plugins like “Subscribe-to-comments” will work.
How to add this hook?
- Open comments.php
- Find the lines of code shown below. You will find it near the end of the file.
<p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /></p>
</form>
<?php // if you delete this the sky will fall on your head
endif; ?>
- Add <?php do_action('comment_form', $post->ID); ?> just above </form> ending tag. Save the file.
This will allow all the plugins that depend on comment_form hook to work properly.
Windows Beginner Developer Learning Center – Gr8 idea!
Mar 2nd
Microsoft has come up with a website totally dedicated to getting the programming newbies up and running (Of course, using MS technologies! :p )
BDLC covers both web and desktop applications. The best part is, it doesn’t assume any prior programming knowledge. I am pretty sure this is a great resource and is gonna boost the Windows developer base exponentially!
Some interesting topics from BDLC
- Web as a platform. The absolute basics of browsers, HTTP et al
- Kids corner
- RSS reader project
- ASP.NET events and postbacks
I have bookmarked some for my wife to go through, this weekend. I am pretty sure I will be directing her to this site more often from now!!
Workplace redefined!
Jan 29th
I have rearranged my monitors, this time to make it easier for me to read lengthy contents
I got this idea from Adam Nathan’ s Channel 9 interview. He was demonstrating his WinFX based Hearts game and was actually going through the code using this setup.
Though I find this setup good for reviewing/coding/reading long documents, it actually a pain with Windows. There is a noticeable time lag in repainting windows, by my ATi driver. I am actually planning to go back to my old setup!
J2EE newbie!!
Sep 26th
Lately, I am doing a lot of Java / J2EE stuff, since Sudha is in to those technologies. Though I am one of those persons who would prefer to sweat it out with C / Assemly rather than making use of all the making-life-easier goodies offered by Java and related frameworks, I have to admit that my respect for J2EE framework is growing as I learn more about it. It is actually a breeze churning out a quality web application using Struts — I was able to do that in 45mins, from scratch to deployment! Thats a pretty impressive figure for me…I don’t know if web applications of enterprise quality can be done using Microsoft technologies the same way Java technologies allow you to do, I am not an expert in it. But, if any of you have personal experience in these, I’d love to hear your views.
Yesterday, we decided to create our own custom tag library. Sudha wrote a prime number generator tag, a simple TLD and the corresponding taglib entries in web.xml. When deployed, it threw an exception “tag-class not found”. What the heck? Then we noticed our DTD was specifying a wrong version. After a quick fix, we deployed it again. Now, it threw an exception that said “PrimeTags definition not found”. It seemed that the server (weblogic) couldn’t find PrimeTags.class, our Tag handler class. We had it under /WEB-INF/classes. What could be wrong? We wrapped that tag handler in a package and redeployed the same. Now we got another error – “Bad class file. Current version is 49.0, expected is 48.0″, a quick search in Google told us that we are trying to mix java1.5 & java1.4 compiled binaries. Resetting the java_home / path variables to point to jdk1.4 solved the problem!!
Now the question is, why couldn’t the server pick up our class file when not packaged??
Dumb Code – 1
Apr 27th
Recently, I was helping a friend debug an application debugger. In one of the report/UI modules, he had to log the date execution started + more process meta info. For date conversion, instead of using one of the inbuilt CRT functions, with the true spirit of a good (!?) programmer, he decided to implement it himself. When I saw the code, I couldn’t help asking him “How many years have you been programming?”!! Check out this so called production-quality (??) code…
define MONTHS_SIZE 12
typedef struct __monthNoPair
{
char *strNoMonth;
char *strMonthName;
} monthNoPair;
More >
