Categories
Python

Converting journal entries from Outlook to MacJournal

I wrote a Python script to convert a journal file export from Microsoft Outlook to one which can be read by MacJournal.

It requires the Python module csv (included with Python 2.3 or later)

Run the script like so:

./outlook2macjournal.py [input_file] [output_file]

If no input or output files are listed, it will use the following defaults:

Outlook (input): @exchange_export.csv@
MacJournal (output): @macjournal_import.txt@

You can click here to download the Outlook to MacJournal Python script.

Categories
Misc Technology

Ditching Zope and Plone for simplicity and creativity!

To be fair, I had found a theme plug-in that was a template which could be used to create your own theme. I knew that I could do it, but also knew that it was going to take time. For the photo gallery, I couldn’t find exactly what I wanted, but knew that it was a combination of my old photo gallery (which didn’t run on the current Plone) and two other gallery plug-ins I had found.

I was dishearted because I knew that to find a solution to the data issue was going to take even more time; time I didn’t really want to spend. The theme was going to take time, the photo gallery was going to take a lot more, but this data problem could be the grand-daddy of all timesinks. I weighed a lot of factors in my decision: from the cost of hosting, to the flexibility in changing user interface, available themes, etc.

The decision to switch to an application running on my desktop means that I can no longer edit my site anywhere in the world using a web browser, but I really never did anyway. And, because the sites created by RapidWeaver are static and not dynamic, I can put them just about anywhere, including a server residing at home.

I think that Zope and Plone are amazing pieces of software, but together they comprise a full content management system and they were overkill to run my small web site.

Categories
Technology

Eeny, meeny, miny, moe, which DVCS should I let go?

A critical tool in a programmer’s chest includes a version control system (VCS) to keep track of software changes. I was initially going to install the Subversion VCS for my new projects, but decided to look around for other alternatives. Over the past couple of days I have found out that there is a lot of activity going on in this historically stagnant part of computing.

My search for alternative version control systems (VCS) started after I had successfully hacked my NSLU2 network appliance so that I could install on it a very popular open-source VCS called Subversion. I managed to get everything installed, however, during configuration I began to have doubts about using it. There were more setup options for Subversion than I wanted to mess with and, with every one, I had to go a little deeper to fully understand how the system worked so that I knew how I wanted it to work. I had been hoping for something more plug-n-play because I’m probably going to be the only person using it. Thus began the hunt for other alternatives.

While poking around the ‘Net, I had run across several different open-source projects focusing on version control, but didn’t really think much of them. Of the names I did see, none stuck out like CVS and Subversion; after all, they were the only real version control systems, right?

Guess again! As I dug deeper I was surprised to find that there is a lot of activity going on in the world of version control. I found over ten different projects all involved in developing what you might call a “modern” version control system! Some of them are Bazaar-NG, DARCS, Monotone, Arch, Git/Cogito, Codeville, Mercurial, and SVK.

The main idea behind many of these new systems is to change the repository model from having a central repository and server to a distributed one where every “checkout” of the source code can be its own repository and server, thus imparting the name of distributed version control systems (DVCS). One of the interesting aspects of these new systems is that they give software developers more flexibility in how they can share code amongst themselves.

Of the projects which I found, I’ve narrowed my options to three: DARCS, Mercurial, and Bazaar-NG. I’ll tell you more about what I decide later, but I will leave you with some of the important pages that I read.

h3. Resources

Project sites
• “http://bazaar-vcs.org/”:http://bazaar-vcs.org/
• “http://darcs.net/”:http://darcs.net/
• “http://www.selenic.com/mercurial/”:http://www.selenic.com/mercurial/

Thoughts from others
• “http://jaortega.wordpress.com/tag/version-control/”:http://jaortega.wordpress.com/tag/version-control/
• “http://blog.ianbicking.org/dvcs-mini-roundup.html”:http://blog.ianbicking.org/dvcs-mini-roundup.html (don’t miss the comments)
• “http://mark.stosberg.com/Tech/darcs/cvs_switch/index.html”:http://mark.stosberg.com/Tech/darcs/cvs_switch/index.html

Comparisons
• “http://better-scm.berlios.de/comparison/comparison.html”:http://better-scm.berlios.de/comparison/comparison.html
• “http://zooko.com/revision_control_quick_ref.html”:http://zooko.com/revision_control_quick_ref.html
• “http://bazaar-vcs.org/RcsComparisons”:http://bazaar-vcs.org/RcsComparisons

Categories
Apple

Teaching an older Macintosh how to use large, modern hard drives.

When I received the hard drive I put it in my FireVue, an external firewire enclosure I bought many moons ago from a company called Granite Digital.

…The punch-line to this story is that all computers and hard drive hardware having a controller based on a communication protocol known as ATA-5 can only address up to 128Gb of data (or 137Gb, depending on if you say toh-may-toh or toh-mah-toh).

…A newer drive protocol called ATA-6 has been out for a few years and current hardware based on this version can address as much as 2 terabytes of information! … Because this is a newer protocol there is a lot of computer hardware out there which has this 128Gb issue, including my beloved FireVue which I purchased around 2001.

…Looking at Apple’s web page on PowerMac specifications, I can see that Harold, my ‘newest’ computer, was first introduced in September 1999 and was phased out 1 year later; this was well before the June 2002 cutoff.

…After I purchased the software, a quick installation and a reboot I could instantly see the larger drive on my computer and Disk Utility didn’t have any more issues formating or partitioning the drive.

…After I installed it, my computer could see all 250Gb, but Disk Utility still couldn’t format or partition the hard drive.

…As it turns out, the older enclosures based on ATA-5 can see hard drives larger than 128Gb using their firmware update.

…So, I’m going to move my smaller drives to the two swappable trays that I have for my firewire enclosure, put my two large drives inside of my PowerMac and rely on the ATA-6 software to do it’s thing.

Categories
Geek

Freezing away my Nokia woes

The biggest problem which still plagues my Nokia 6600 is that the phone is difficult to turn on after it has been turned off. When I try to turn it on the backlight will illuminate, but the boot sequence stops there (eg, the Nokia symbol won’t show, etc).

…I won’t go into too much detail about why I decided to put my phone in the freezer, though the seed was planted after a conversation with my friend Simon regarding my phone issues.

…A couple of days later, I was ready to try and reformat the internal memory to see if that would cure my reboot problems. I turned off the phone to start the process, but I then remembered that I had forgotten to synchronize the latest changes in my address book with my computer.

…Just to make sure it wasn’t a fluke, I turned the phone off and on several times and it booted without any problems (though the display/CPU were a little sluggish because of the cold).

In the end I was able to make a final backup and do a synchronization before I started doing other radical fix-it things with my phone.

As final words I will say that there was a little more condensation buildup on the phone than I felt comfortable with only because moisture and electronics don’t mix. So midway through the process I started to put the phone in a plastic Zip-lock bag and squeezed out most of the air to keep the condensation to a minimum.

Categories
Programming

Template Method pattern handout now available

I have posted a PDF of the handout I made for my design patterns workgroup. The information came mostly from the O’Reilly book Head First Design Patterns.

The layout and typography are roughly based on the format of the book as well.

You can “click here to download the Template Method handout (pdf)”:/wp-content/uploads/2010/07/template_method.pdf.

Categories
Usability

Even the usability of a book can suck!

A small group of us at work are still making our way through the O’Reilly book Head First Design Patterns. We’ve all been very excited to apply what we’ve learned, even after the very first pattern. They’re thought provoking, fun, interesting, and powerful. Our application design mojo has increased already, even when not using a pattern because we’ve learned a lot of the why as well as the how.

I wanted to start checking out more patterns because I was jazzed, so I borrowed the book which has greatly helped (started?) the design-patterns revolution – Design Patterns: Elements of Reusable Object Oriented Software written by “The Gang of Four”.

To make a long story short, it is a very dry, un-inspiring, un-appealing textbook. It doesn’t engage the senses and is devoid of personality. I even had trouble bridging the information in this book with what I had already learned in my study group, and I thought I knew the patterns pretty well. It’s really awful.

Why are the books so different? In the Head Start introduction they listed examples of things they did to aid learning like using fun pictures, emotional content, humor, conversational style, content to work both sides of the brain, and even considering different learning styles – ideas borrowed from current findings from learning research.

This all comes down to factoring in the human element, similar to what you would do when working on the user experience and usability for a web site, etc. The extra thought done up front has huge benefits. In this case we learn with half the effort and have fun while doing it. It doesn’t really feel like learning and it leaves us more time to do actual programming.

Categories
Geek

Nokia 6600 Resurrection

I have reason to believe that my mobile phone is dying, but I hope not. I bought my Nokia 6600 about 1.5 years ago and, up until 2.5 weeks ago, it has been a very dependable phone.

Symptoms

• The Message application crashes every time when trying to display the ‘My Folders’ area of Messages. I get the error “App. closed mce !”.

• The phone won’t boot up when I put in a freshly recharged battery, though the backlight will come on like it’s trying. Sometimes it takes 20 attempts before the Nokia logo will appear (the logo signals that the phone is booting up). Also I’ve found that, when there are these startup problems, the phone won’t charge when the power adapter is connected directly to it.

The interesting thing is that once I am able to get the phone to boot, it will continue to run like normal until the battery is drained. However, if the phone is switched off when the battery starts to drain, the phone will never boot back up with that battery. The phone will also charge the battery when in this situation.

Possible Causes

I think there are two things going on:

• Old batteries

I’m starting to think that my two batteries are getting old and don’t have the maximum voltage that for which they are rated. I have the original and also bought a spare almost exactly one year ago from Malcomwireless.

I theory is that that the phone the circuitry can’t power up unless there is sufficient voltage. Consequently it takes several tries to get the phone to turn on.

I wish that I had my voltmeter handy to test this.

• Memory issues

I initially thought that the crashing Messages application was due to the fact that I had saved too many messages in the ‘My Folders’ area on the external memory card. Even though I had over 300 messages in a single folder, this doesn’t seem like a lot because the phone has a somewhat ‘modern OS’ on it – Symbian Series 60. I checked the manual for folder limits, but there was nothing written.

All this seemed to have happened all at once.

Conclusion

I will rebuild it – better, stronger, faster.

Categories
Programming

Design Pattern: A decorator in the wild

I’ve been looking over a lot of Javascript code lately, mostly in the various AJAX libraries. It’s been interesting to see the ways in which the different projects are using the language to enable them to coexist peacefully.

Though, one such example I found was a simple function that I found at “Simon Wilson’s web site”:http://simon.incutio.com/. It solves the problem of having several Javascript modules fighting for the coveted @onload@ event in the <body> tag. I say coveted because there is only one of these events on an HTML page, and it is very important because this event is called only after the entire page is loaded. For a Javascript module, this is a good time to do an action like initialization because it guarantees that any called functions will be able to work on on a complete set of HTML tags, Javascript modules, images, etc.

h3. The Past

Before the widespread use of Javascript, the @onload@ function would simply be set in the HTML @@ tag on a page.:



   .
   .

And if there were several methods to be called, you could make the @onload@ function more generic by using it to call other methods:



   .
   .

But this only works well if you are the creator of all of the code which goes into a site.

h3. The Present

Now that we’re seeing a ton of development happening on the HTML-side of things, especially from the AJAX-world, it’s certain that folks will start using multiple Javascript modules on their sites and that some of these modules will want to get their piece of the @onload@ event.

However, a problem arises if a module isn’t careful about how it sets the @onload@ event. If it uses basic Javascript syntax it would effectively wipeout any previously defined @onload@ functions:

Enter in “Simon’s addLoadEvent function”:http://simon.incutio.com/archive/2004/05/26/addLoadEvent which uses Javascript closures wrapped in a decorator-like fashion to allow more than one function to be assigned to the ‘onload’ event at runtime.

This is the code listing pasted from Simon’s site:

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
addLoadEvent(function() {
  /* more code to run on page load */
});

However, I will note that this solution is not a pure example of the decorator pattern because:

  1. The definition from my Head Start book states “The Decoration Pattern involves a set of decorator classes that are used to wrap concrete components.” In this example the concrete component, the very innermost function, is of the same class as the closure decorators – a function – and not of a separate object type.

  2. Also the function objects get called themselves rather then a separate method on a class object. However, I think this would be ok if you consider each function having an equivalent to Python’s @call@ method. This method would then be the common interface between the objects.

In any event, pure Decorator or not, this is a clever way to use Javascript to solve this web problem and at least deserves a Decorator Honorable Mention.

Categories
Programming

My first `case` statement in 60 months.

The first time flipping through my O’Reilly Javascript Definitive Guide, I was pleasantly surprised to read that Javascript had a @case@ statement. I’m not sure why I was surprised, but I guess I forgot about it considering that I have been programming in Perl[1] and Python for so long.

The other day, I came across a @case@ statement while glancing through some Javascript code from another company. This time I made a mental note to use it the next time that I could.

Well, my chance arrived yesterday while doing a project for work. Our designer had wanted to place bounding corners at certain sections on the page. I was going to position a @

@ at the corner of each section and then turn off the appropriate borders to give it the look he wanted. I had named each @

@ corner using a suffix which described its location (eg, tl – top left) and wanted to think of a way to map that name to the borders which were to be showing.

Here is the incomplete code using a @case@ statement. I think it is more concise and easier to read than if it had been written using @if@ statements.

My First Javascript Case Statement:

this.corner_suffix = ['tl','tr','br','bl'];

for( i = 0; i < this.corner_suffix.length; i++ ) {

  // the first character takes care of top/bottom borders
  switch ( this.corner_suffix[i].charAt(0) ) {
    case 't':
      // set top location, turn off bottom border
      break;

    case 'b':
      // set bottom location, turn off top border
      break;
  }
  // the second character takes care of left/right borders
  switch ( this.corner_suffix[i].charAt(1) ) {
    case 'r':
      // set right location, turn off left border
      break;

    case 'l':
      // set left location, turn off right border
      break;
    }
}

I was happy to have rediscovered the @case@ statement and found that it was very natural to write it once I had remembered the rules for @break@ and @default@. It’s like meeting an old friend: you get along instantly and continue without missing a beat.

fn1. I stopped programming in Perl sometime in 2002. I see that there is now a module called Switch, released sometime in 2002, which emulates a @case@ construct.