Wednesday, August 17

The birth of Jiim

Jiim was born today, a beautiful healthy program weighting approximately 1000 LOCs.
Below is a Jiim prototype session between two IM users (click on thumbnail to enlarge)



Who is Jiim, I hear you ask? In due time, my friends. In due time.

Sunday, August 14

TimeOut JorgeTown

JorgeTown's weekly listings:

  • Monday, 15th - Birthday of The Mayor of JorgeTown
  • Tuesday, 16th - Deployment of Jiim
  • Friday, 19th - Birthday celebration for the Queen Of The Pugh
  • Saturday, 27th - Birthday of big Joseph-The-First

Wednesday, August 10

The Python King - Mayor's pride

Hmm, I have been I noticeably *excited* about this tiny, meaningless XML parser tool I wrote a few weeks ago in Python. After all, it's not like it's my first application -I have done many before.
Maybe it's because it's my first "full fledged" desktop application in like 5 years! Yep, all my development since I left this place in Frankfurt in 2000 has been Web/server-side based. Now it was really cool to play with the
OS API, menubars, toolbars, statusbars, file chooser dialogs, and all that jazz again. (not that this particular application needed all that anyways)




Sooo, the follow up to
1, 2, 3, and 4 looks like the above, though the final codebase only vaguely resembles what I posted then and many lessons were learned in terms of usability.

For example, in the 1st iteration of the tool I tried to keep user intervention to an absolute minimum. In that entry, I mentioned 3 steps: search current folder, search based on username heuristics, and search the whole disk.
Well, I obviously forgot that adventurous, living-on-the-edge users would want to tell the tool where they are keeping their logs, thereby avoiding search altogether. In fact, some users even keep their logs on a different partition (yes bro, I'm looking at you), something I wasn't expecting at all.
Hence, my final iteration of the tool gives users a 'Browse folders' facility.

Internally, the search functionality was also outrageously slow. I blamed it on the Windows API, where search is slow itself, but the truth is that there was room for improvement.
On the final iteration I make intensive use of regexes to prune the search space. Speed gains of over 80% were achieved (yes, the 1st iteration was that slow).

Saturday, August 6

'Cause I'm A Creep

So, have you been naughty recently? Apologise. It can't do you any harm.

Really.

Thursday, August 4

The Myth of Perseus

Hell, I don't like to diss things that are free, but I think I oughta write about this otherwise I'll bottle up a lot of anger and will need radical therapy.
I'll even out my karma by given them a free usability report later :)
So, a few months ago I googled for free-as-in-free-beer, research/student friendly, on-line survey providers. Of all the names found, Perseus seemed to be a popular choice among students and they even have a mouth watering free service to get you started.
I signed up, created my first survey (I promise I won't go into any detail on how long it takes to get one done and how painfully slow their interface is), and published the pilot. When I was ready to go live, I was greeted with the message below for a week, every time I tried to logon:


Huh? Now is this user-friendly quick response or what? A week of this! Now my question is: do they do this to their corporate users, too? I wonder.

So, patient as I am, I did what most people would: I changed provider.
Found QuestionPro and asked myself how come they were not my first choice earlier. More on them later.

Tuesday, August 2

Release The Pressure

How does this sound?

Awesome.

Python For The People - A Wee Secret

Here is a neat way to apply color to text boxes, using the tag_config property and eliminating the need to manually set the background color per text box. First, define your desired color configurations and give them aliases:

txtBox = Text(self, width=80, height=20)
# configuration for red (alias = "r")
txtBox.tag_config("r", foreground="red")
# configuration for blue (alias = "b")
txtBox.tag_config("b", foreground="blue")

This creates a list of alias/configuration pairs associated to the textbox's config object. Next, apply the configuration aliases' to the target text boxes, together with the content to be displayed:

txtBox.insert(END,"I am red ", "r")
txtBox.insert(END,"or I am blue\n", "b")

Smooth.

Monday, August 1

Python for experts - A kind of Magic

This turned out to have a simple and very neat solution, but boy was I struggling before.
The problem was that of calling the default mail client with an attachment ready to be sent, once my program finished parsing the XML log files (the attachment being the statistical analysis file).
Sounds simple? Yeah, right.


First, I struggled to find out how to get that done in VB or C#, replicating the behavior of right-clicking on a file and choosing the 'send to mail recipient' option. A reply from the python mailing-list hinted towards this direction too.
Integrating that with the python code wasn't
much of a problem but the solutions didn't work very well, certainly weren't cross-platform, and were everything but neat.

Then, also from the python-mailing-list came a precious tip: create a MIME encoded .eml file and run it from within python.

VoilĂ !

So, I saved an email draft of my own (with a text file attachment), opened it up, studied its contents, and created a file of my own from within my python program.
Works like a charm.
4-5 lines of code, excluding the .eml-specific content. Check out the recipe for yourself:


try:
  email_output = codecs.open("<filename>.eml", "wb")
  email_output.write(<dump .eml required blurb plus own content>)
finally:
  email_ouput.close()

import os
os.startfile("<filename>.eml')

Launching the file through os.startfile(<filename>) will cause the Operating System to open it with whatever program is associated with that extension, typically the default mail client.





Nice.