Print Color-Coded SVN Status

I’ve been having difficulty in reading SVN status, which tells you which files in a project have been modified, added, or having a conflict with other developer’s changes. Status code in front of each line alone doesn’t help me quickly identifying one status code from another so I wrote a script to color code the lines with different colors according to their statuses. If you’re having the same issue, feel free to use the code below :)

#!/usr/bin/python
"""
 Author: Saophalkun Ponlu (http://phalkunz.com)
 Contact: phalkunz@gmail.com
 Date: May 23, 2009
"""


import sys, os, re

# add more status & color codes
colors = {
    "M": "31",      # red
    "\?": "32",     # green
    "C": "30;41"    # black on red
}

# build a paramter list
parameters = "";
for i in range(1, sys.argv.__len__()):
    parameters += sys.argv[i] + " ";

status = os.popen('svn st ' + parameters);
for line in status:
    passed = False
    # remove newline character from the line
    line = re.sub("\n", "", line)
   
    for color in colors:
        match = re.match(color+(" "*6), line)
        if match:  
            os.popen("echo '\E[" + colors[color] + "m" + line + "\E[m'", 'w')
            passed = True
    if(passed):
        continue
       
    os.popen("echo \"" + line + "\"", 'w')

Let’s Bake Some Cakes

This is a brief note about my reflection on choosing a web development framework.

In the last few days, I’ve been busy looking around for different web development frameworks. I’ve found quite a lot and these are some of the major ones – Ruby on Rails, Symfony, Django, CakePHP, CodeIgniter and Zend Framework. Read the rest of this entry →

Daily Word On Desktop

Mac + GeekTool + www.urbandictionary.com + ruby

Flash Ruby Programming Book

I’m really amazed by the writing style of the author. Check it out. It’s great and it’s FREEEE.

HelloWorld in Cocoa

This is my first Hello World application written in Cocoa framework. It was kinda complicated to get started with Cocoa framework because it has to follow MVC design pattern, which separate the presentation, controller, and the logic apart. It took me half an hour to write while other languages/frameworks take take me at most less than a minute but I guess it is good for developing large applications.