Monday, June 15, 2009

Coding is better with java ... the coffee, that is.

Ah... a non-tech, short post. This morning I started implementing some numerical experiments. Sitting in my favorite coffee shop drinking the best brew I know - that I call perfect conditions for coding. And, as always, Python is your friend (Java is a coffee type, not a programming language... ).

So what did I do in the coffee shop? I wrote a small reporting tool to compute total hours spent on different projects as registered in the timereg tool I described previously. The tool is very simple; I just read the timereg log into a Python list using the readlines command and exploit the structure. I make two lists; one for project names and one for hours spent. Each time a project name is encountered that I haven't seen before when iterating over the readlines list, I add it and also add the number of hours spent in the first instance of this project. Then, just keep adding for each project:

for k in readlineslist:
if k[0] in names:
for z in range(0,names):
if readlineslist[z]==k[0]:

Get the picture? Of course I write off everything to a text file for billing purposes.

Well, time to hit the road to the real office. Enjoy your day and happy pythoneering!

No comments:

Post a Comment