DevOps: It’s the culture, stupid!

Posted by chetan on October 26, 2013

Last week saw the return of DevOpsDays to New York and like many who attended, I went into day one without a solid definition for, or real understanding of, what “DevOps” actually means. Does it mean wearing both dev and ops hats? Is it a new team outside of the existing dev and ops teams? Is it a tool?

Continue reading…


Hooking app exit in Firefox extensions

Posted by chetan on February 10, 2010

I’ve spent the last few days since joining Better Advertising working on a new feature for a Firefox extension called Ghostery. We’ll be announcing the new feature soon, but until then I thought I’d share some of what I’ve learned so far.

I’ve never worked on an extension before but as it turns out, it’s really quite easy to pick up; some fairly simple XML (aka XUL) for composing the UI and JavaScript for the rest. One of the trickier bits has to do with scope. After doing some testing I figured out that the entry point into an extension is via the browser window; that is, your extension code will be executed each time you open a new window and that means that all your code is basically scoped to a single window.

In developing the new Ghostery feature I needed a way to run some code when the user quits Firefox. Luckily, the extension architecture is extremely flexible (if poorly documented at times) and I didn’t have to jump through any hoops to do it. Almost anything, it seems can be either chained or hooked in some way. In this case, the nsIObserverService gives us access to the necessary shutdown event to which we can attach an observer using a simple interface.

The problem, then, was that since our code is run every time a new window is created, I needed a way to register the hook only once to avoid firing multiple times on exit. My first thought was to try to register the hook outside of the window scope (e.g. using a different chrome overlay) but that appeared to be a dead end. Using a globally scoped variable as a lock was also a dead end. In the end I settled on something I already knew how to use: preferences. Essentially, I created a simple lock around a preference variable which, while I don’t need to store it between sessions, is in fact a global storage area that can be accessed from different windows.

Check out the code below for an example implementation. I left out the actual preferences code since it’s not crucial to understanding the solution.


Writing command line interfaces for Spring apps

Posted by chetan on June 29, 2009

I recently needed to script some tasks for a Spring-based app at work so we could shove it into a crontab. It proved to be much easier than I thought.

You can use your spring.xml config file for wiring up your beans as usual, but rather than deal with various property files you can easily override properties on the fly using system properties. See the following example:

In your spring.xml make sure you have this line:

1
2
3
4
5
6
7
8
9
<bean id="propertyConfigurer" 
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <!-- Allow properties to be overriden via 
         system properties -->
    <property name="systemPropertiesMode" value="2" />
    <property name="locations">
        <list> [...snip...] </list>
    </property>
</bean>

Then you can override your aliases either using standard java properties (-Djdbc.url=”mysql://…”) or via your program’s own command line arguments, which is the route I ended up going.

CommandLineParser parser = new GnuParser();
Options options = new Options();
Option brokerOption = new Option("b", "broker", true, "broker uri");
brokerOption.setRequired(true);
options.addOption(brokerOption);
CommandLine line = parser.parse(options, args);
System.setProperty("jms.broker.url", line.getOptionValue("b"));

Pointless rewrite? Probably.

Posted by chetan on August 06, 2008

Del.icio.us (sorry, it’s just plain old “Delicious” now) 2.0 finally launched a few days ago and the response so far has been mixed. But now that the dust has settled some, it’s time to think about just how we got here and if it was really worth all the trouble.

According to the official blog post, the new and improved Delicious brings us speed, usability, and oh so good looks among other features and it was a long time in the making. The Yahoo acquisition was announced on Dec 9, 2005 and the new site finally went live a little over two and a half years later on July 31, 2008. So why did it take them so long?

A key change as a result of the Yahoo! acquisition was their decision to rewrite the whole thing in PHP using the Symfony framework, for no other reason than that it’s the current corporate standard at Yahoo!. Oh, and, coincidentally, Yahoo! Bookmarks was also built on PHP+Symfony.

So now it starts to make a bit of sense: you take a system being actively used by millions of users around the world and you start over from scratch with the goal of building it bigger and better, toss in a couple of hot buzzwords to meet Web 2.0 compliance guidelines, and before you know it 2 years have gone by.

I find it very hard to believe that with all the talent and the thousands of man years combined software development experience over there, that no one understands the pros and cons of rewriting vs refactoring a code base, especially given the enormous success of the service and the relatively trouble-free history as compared to, say, Twitter.

At the same time, I understand it all too well. From where I sit, and having been involved in a similar situation in the past as well as with my current employer, the decision to move to PHP was clearly not based on a cost/benefit analysis of maintaing the current system. In fact, I wonder if they even understood what the real problems, if any, were with the existing system before deciding to not just rewrite it, but write it in another language.

Moving to another language is a pretty drastic step to take and will rarely solve your problem.


Suits suck

Posted by chetan on February 21, 2008

I still intend to finish the series of posts I started earlier, but this quote pretty much sums it up:

In this regard management is also to blame, especially when it comes to dysfunctional schedules, wrong incentives, poor hiring, and demoralizing policies.


If you’re not outraged, you’re not paying attention

Posted by chetan on February 14, 2008

Is just getting the job done always enough? One of my personal philosophies is that if you’re not learning, you’re not improving. If you’re not improving, then what have you really accomplished? In fact, there’s a pretty good chance that you’ve even gotten worse, if only because everyone else has gotten better. It’s like a television or movie series that comes back year after with the same old, tired formula. No better than previous iterations, and doesn’t even meet the expectations set by its predecessors. Think Bond, James Bond.

Continue reading…


Go to sleep

Posted by chetan on February 12, 2008

“Commitment means being prepared to do extra things, going the extra mile”

Without a commitment from all the concerned parties, how can one expect any enterprise to be successful? Be it business, government, military or otherwise.

My group has shown it’s commitment time and again, but we haven’t seen the same from others. How do you find the motivation to stay committed in a situation like that?

I think I’ll just go to sleep instead.


What we do

Posted by chetan on January 13, 2008

according to steve:

what we do


Aren’t you on vacation?

Posted by chetan on December 31, 2007

It’s strange. Just because I’m back in New York for a couple of weeks before I go back to India, everyone just assumes that I’m here on vacation. If it was any other time of the year, I’m almost positive that I wouldn’t get this reaction at all. Stranger still, most of the people asking the question aren’t off either. What gives?


And you may find yourself in another part of the world

Posted by chetan on December 16, 2007

Ever have a moment where you suddenly stop and ask yourself: how did I get here, to this exact moment in time?

For me it’s almost an out of body experience where I look [down] at myself in a particular instant and I try to work backwards to the events that led up to it. It seems to be happening a lot, of late, and it always comes back to the same question. Two weeks ago, I was sitting in the domestic terminal at the Bombay airport, reading a book of no consequence and listening to my iPod while waiting for my flight to Pune when I suddenly looked up and thought to myself, “what the fuck am I doing here? How the hell did I get here?”

It happened again yesterday. I was sitting in my hotel room, eating a fabulous lunch (brunch, really, but it was 3pm; scrambled eggs, french toast, hash browns, chicken sausage, and hot chocolate) and looking out the window, out over the gloomy sprawl of Chennai before me, when it came up again: “what the fuck am I doing here? How the hell did I get here?”

There’s an obvious answer (I’m here for Operative as their resident software ninja, blah, blah) but that’s not good enough. It doesn’t really answer the question as to why I’m here, in the here and now. Even more, I can think of lots of reasons that I shouldn’t be here; why I should be somewhere else, doing something else. And only a few reasons (e.g., conscious decisions I’ve made) for being here.

And yet here I am.