Monthly Archives: July 2013

Time Management – The Pomodoro Technique

This isn’t a programming post but it is something that is important to developers: time management.

It can be difficult to “get in the zone” and stay there for a length of time because of general distractions in the office – phone/email/IM/etc. Some things are out of your control but I have found a time management method that works quite well when I am tackling larger tasks and not putting out fires: the Pomodoro Technique.

Basically, the Pomodoro Technique is breaking up your work into 25 minute coding blocks that are separated by 5 minute breaks. After 4 of those 25 minute “pomodori” blocks of work you take a longer 15 minute break. I use the term “break” pretty loosely because I generally take that time to check email and IM and respond to anything that needs my attention.

This doesn’t work EVERY day – some days you are jumping around to many small tasks and can’t take advantage of it, or there’s a lot of email or IM activity that you need to be a part of. But, when you are working on tasks and can temporarily limit communication distractions I have found this regular cycle of uninterrupted work followed by dedicated time for email to be a surprisingly productive idea (considering how simple it is).

There are a variety of timers available for absolutely everything (you can give it a go right from your browser with a site like Tomato Timer). However, I’m rather taken by the desktop app Tomighty as I can set it in the system tray and forget about it until it notifies me that the pomodori (or break) is over.

tomighty tomighty-break

Another ColdFusion SerializeJSON Bug

Adobe recently released ColdFusion 10 Hotfix 11 and it fixed Bug #3338825! I am positively ecstatic because invalid JSON causes me a lot trouble. This hotfix even addresses two other JSON serialization issues and so it appears to be good news all around.

However, it did not address Bug #3337394 in which the string “No” is turned into a boolean false. (“Yes” also returns a boolean true for good measure). This bug is still considered “Unverified” although it was filed in September 2012 (Test case below)

A colleague came across another SerializeJSON() bug today that I thought I’d share because I seem to spend a lot of my workday Regexing the input to or output from this function to clean up what it incorrectly handles. [It can’t handle the truth!]

It’s filed as Bug #3596207 and this is its test case showing a numeric string with a trailing period being returned as an integer with a trailing decimal point:

SerializeJSON({a: "1."});

Output (not valid JSON)

{"A":1.}

Expected Output

{"A":"1."}

Test Case Showing Both Issues

SerializeJSON({a: "1.", b: "no", c: "yes"});

Output (not valid JSON)

{"A":1.,"B":false,"C":true}

Intended Output

{"A":"1.","B":"No","C":"Yes"}

Adobe has made some good progress with the latest hotfix but there are some serious bugs left in functions that have been neglected for some time now. SerializeJSON(), for instance, debuted in CF8 almost six years ago and after that amount of time these very basic serialization test cases should not fail.

Fixing CFPOP

Some of my ColdFusion projects involve receiving A LOT of email via¬†CFPOP. It’s perfect for the job about 95% of the time. However, that remaining 5% failure rate reveals glaring inadequacies that I have spent significant amounts of time trying to work around.

I generally use CFPOP in a try/catch and fall back to either of the following solutions for troublesome messages.

CFX_POP3
If you’re running CF on a 32bit Windows server… $40 makes all your CFPOP troubles go away in an instant. The CFX_POP3 custom tag is an absolute bargain because it works with rare character sets, poorly named attachments, special characters, etc. Not once have I seen it fail for attachment filename or character encoding issues.

Limitations
1. Only runs on 32bit Windows servers
2. Seems to choke on large attachments (10MB+)

POP CFC
The POP CFC project is run by the creator of the CFX_POP3 tag and it contains some handy functions that use underlying Java methods for getting mail from a server and parsing through it. These functions are great for processing messages with oddly-named file attachments that will break CFPOP.

Notes
1. Supports the same character sets as CFPOP.

If you’re using CFPOP or POP CFC, I highly recommend setting up JCharset to allow processing of some of the more “unique” character sets out there. I’ll go over that in more detail in a future post.