Archived Posts from this Category

Eclipse + Mac OS X 10.5.8 + Java SE 6 => 64 bits

Posted by Jim DeLaHunt on 31 Aug 2012 | Tagged as: robobait, software engineering

I recently had an adventure trying to get a plugin, PDT, installed into my Eclipse software development environment. Diagnosis was hard, and the conclusion was non-obvious, though in hindsight, reasonable. It is that if you want to use an Eclipse plug-in that requires Java SE 6 on a Mac OS X 10.5.8 computer, you will need the 64-bit version of Eclipse.

Let me explain.

Continue Reading »

Canada Post and USPS rate cards

Posted by Jim DeLaHunt on 31 Jul 2012 | Tagged as: Canada, USA, robobait

Canada Post and the US Postal Service raised their postage rates in January, and I’ve just got around to updating my handy Canada Post and USPS postage rate quick reference card on this blog. The Canada Post rate increases were effective January 16, 2012, and the USPS increases were effective January 22.

My Canada Post and USPS Postage Rates project page,, will have links to download the latest charts as I update them.  The spreadsheet source file for the charts is also there. Both are licensed CC-BY-SA, so please feel free to re-use and modify them (as long as you attribute my work and share your product as freely).

Heads up: Canada Post has already received approval for first-class mail rate increases in 2013 and 2014. Both Canada Post and USPS offer “perpetual” or “forever” stamps, which are worth first-class basic domestic postage, whatever the price may increase to.


Ads Factory “GoogleX, GoogleY” means (lat, long) not (horizontal, vertical)

Posted by Jim DeLaHunt on 30 Jun 2011 | Tagged as: CMS, Joomla, robobait, software engineering, web technology

I want to pass along a tip about confusing field names used in the Ads Factory component for Joomla for geographic data.  I encountered this while customising this component for a client. At first I thought it was a bug, but now I think it’s just an odd naming convention.

Ads Factory, by Romanian developers The Factory,  is a commercial component for Joomla 1.5 which lets you add classified ads to your Joomla site. (My client had me working with version 1.x on Joomla 1.5, but I see there is also a version 2.1 of Ads Factory which is Joomla 1.6 native.) There are quite a few places where Ads Factory includes geographic information: each user record can record a latitude and longitude for that user; each ad can record a latitude and longitude for the advertised merchandise; and there is way to make a “radius search”, i.e. find all ads within a given distance of a user-specified location.

These latitude and longitude values are stored in database fields with name suffixes “X” and “Y”. The user’s latitude and longitude are stored in fields “GoogleX” and “GoogleY” of the Ads Factory user table. Similarly, but not completely consistently, the ad’s latitude and longitude are stored in fields “MapX” and “MapY” of the Ads Factory ads table. The confusion comes in understanding which field stores the latitude, and which stores the longitude.

Latitude is, of course, the signed number of degrees north of the equator of a point on the earth’s surface. It ranges from +90.0 (the North Pole) to 0.0 (the Equator) to -90.0 (the South Pole). Thus, it’s a vertical coordinate. Longitude is the signed number of degrees east of the 0° meridian (roughly Greenwich, England). It ranges from +180.0 to -180.0. My part of North America is 122-123° west of Greenwich, so we have longitudes of -123.0 to -122.0 or so. It’s a horizontal coordinate. This is a well-established convention in many mapping standards.

Tidy Cartesian mathematicians like me use the convention of (X,Y) coordinates, where X is the horizontal coordinate and Y is the vertical coordinate. This is a well-established convention in geometry and graphics (though there are some exceptions).

My first interpretation of Ads Factory field names like  “GoogleX” and “GoogleY” was to interpret them according to the Cartesian convention: X is horizontal, and so stores longitude, while Y is vertical, and so stores latitude. Thus (MapX, MapY) would be (longitude, latitude), the opposite of what one expects from mapping. Odd. I was surprised to find some parts of the code storing latitude in X (the horizontal coordinate!) and longitude in Y (the vertical!), which was surely a bug. I was horrified when it appeared that every part of this code had the same bug!

Then I understood the convention. Ads Factory’s developer appear to have used the (X, Y) convention to indicate just the order of the coordinates, but not their Cartesian meaning.  (MapX, MapY) means (latitude, longitude), as is conventional in mapping.  X is the vertical coordinate, Y is the horizontal coordinate, in the Ads Factory context. If you remember that X means “first”, not horizontal, and Y means “second”, not vertical, the Ads Factory field names are self-consistent, and the code uses them correctly.

I haven’t seen any Ads Factory documentation which explains this, so I hope this note will help some of you Ads Factory enhancers who are using these fields.

Postscript: what did my client ask me to do with Ads Factory for their site?  Modify the radius search to search around the user’s latitude and longitude, instead of a location the user enters. Also, to sort the keyword and category search results by distance from the user. Quite straightforward to do, though it requires customisations to the Ads Factory code that have to be re-done everytime one upgrades the Ads Factory component.

USPS rates updated on USPS and Canada Post Rate Cards

Posted by Jim DeLaHunt on 21 Apr 2011 | Tagged as: Canada, USA, robobait

Last January I got around to introducing my handy Canada Post and USPS postage rate quick reference card on this blog. On April 17th, 2011, the United States Postal Service put new, higher postage rates into effect. I’ve revised my rate cards to reflect the new USPS rates.

Continue Reading »

How to resolve EasyEclipse error ‘Eclipse… requires plug-in “system.bundle”‘

Posted by Jim DeLaHunt on 31 Mar 2011 | Tagged as: robobait, software engineering, web technology

I use the EasyEclipse distribution of Eclipse, the free (libre) software development environment. I just figured out how to fix an obscure error message:

Eclipse Web tools editors (2.0.1) requires plug-in "system.bundle"
Eclipse Data Tools (1.5.1) requires plug-in "system.bundle"

When I would start up EasyEclipse (version 1.3.1 for Mac OS X, with Python, C++, Java, PHP and more support added), it would tell me that I had some outdated components, and offer to update them for me.  But when I opened the menu item Help… Software Updates… Manage configuration, I would get the ominous error alert:

“The current configuration contains errors and this operation can have unpredictable results. Do you want to continue? [Cancel] [OK]”.

I wasn’t able to  find documentation about this problem specifically. (My purpose in writing this is to help others benefit from what I learned.)

Continue Reading »

Handy Canada and US postal rate quick reference, updated

Posted by Jim DeLaHunt on 21 Jan 2011 | Tagged as: Canada, USA, robobait

Living as I do with one foot in the USA and one foot in Canada, I find myself sending letters from Canada to Canada, Canada to the USA, and sometimes carrying mail with me over the border to mail in the USA to the USA.  I have one pile of Canada Post stamps, and another of US Postal Service stamps. But looking up the various postage rates, with their grams and ounces, was a nuisance. I couldn’t find a single rate card which covered both countries succinctly. And with each service raising its prices about once a year, my improvised rate cards were going out of date every few months.

Nearly two years ago I came up with a handy quick reference to current Canada Post and USPS postage rates for basic letters between the USA and Canada. Last spring it was polished enough that I posted it on my web site. I just now updated it to reflect the Canada Post rate increase which took effect on 17. January. You can find it at

Continue Reading »

Transparent PNG images in PHP: imagesavealpha() versus imagecolortransparent()

Posted by Jim DeLaHunt on 30 Nov 2010 | Tagged as: robobait, web technology

Are you using PHP (or libGD) to generate PNG images?  Are you having problems getting your text anti-aliased, and also having your “transparent” colour recognised as transparent?  Well, I had that problem too.  libGD, the component which PHP uses to handle image operations, gives you a choice: you can have anti-aliased text, or a designated colour as transparent… but not both.  Here’s why, and what you can do about it.

Continue Reading »

11 Django gotchas

Posted by Jim DeLaHunt on 31 Aug 2010 | Tagged as: Python, Unicode, robobait, software engineering, web technology

This post has been a long time in the making. A year ago, I started work on my Twanguages code. This was code to analyse a corpus of Twitter messages, and try to discern patterns about language use, geography, and character encoding.  I decided to use the Django web framework and the Python language for the Twanguages analysis code.  I know Python, but I was learning Django for the first time.

Django is really, really marvellous.  When I tried this expression, and got the Python array of records I was expecting,

q2 = TwUser.objects.annotate(ntweets=Count('twstatus')).filter(ntweets__gt=1)

I wrote in my log, “I think I just fell in love. Power and concision in a tool, awesome.”

But Django gave me fits.  It has its share of quirks to trap the unwary novice. Eventually I began writing notes about “Django gotchas” in my log.  Some of them are Django being difficult, or inadequate. Some are me being a clueless novice, and Django not rescuing me from my folly. But all of them were obstacles.  I share them in the hopes of helping another Django novice.

Here are my Django gotchas.  They are ranked from the most distressing to most benign. They apply to Django 1.1, the current version at the time. (As of August 2010, the current version is 1.2.1.) A couple of gotchas were addressed by Django 1.2, so I moved them down to a section of their own. The rest presumably still apply to Django 1.2, but I haven’t gone back to check.

  1. API fails unhelpfully. I wrote a simple query expression like:
    S2 = models.TwStatus.objects.get( key )

    I got a lot of weird errors, e.g. “ValueError: too many values to unpack” (where key is string) and “TypeError: ‘long’ object is not iterable” (where key is long). I had made a mistake, of course; the call to get() should have a keyword argument of “id__exact” or the like, not a positional argument. The correct spelling is this:

    S2 = models.TwStatus.objects.get( id__exact=key )

    The gotcha is that Django’s .get() isn’t written defensively. It isn’t very robust to programmer errors. Instead of checking parameters and giving clear error messages, it lets bad parameters through, only to have them fail obscurely deep in the framework. If defensive programming of the Django API would slow it down too much in production, I’d love to have a debug mode I could invoke during development. Continue Reading »

How to resolve issue: NSLU2 Samba server doesn’t respect file modification times

Posted by Jim DeLaHunt on 28 Dec 2009 | Tagged as: robobait

I just resolved a problem which has been an annoyance for two years. I’m posting the details as robobait in the hopes it will help others.

Our family network includes a Samba file server hosted on an NSLU2 server appliance by Linksys (now a part of Cisco). A long time ago we changed to the Unslung open firmware for the NSLU2 (or “Slug”, as we call it).    It’s a wonderful combination, powered by a rich assortment of free software created by many volunteers. I appreciate their efforts.

But two years ago, I moved my personal computing from a laptop running Mac OS X 10.3 to one running Mac OS X 10.5. On the new 10.5 laptop, I noticed that the NSLU2 failed to respect file modification times. That is, if I had a file created on Dec 1, 2007 on my laptop, and I dragged it to a Samba volume hosted on the NSLU2, then the time stamp on the copied file was changed to the present time. The Dec 1, 2007 modtime was lost. Similarly, if I used touch -t from the Mac OS X command line to change the timestamp on a file hosted on the NSLU2 Samba volume, the operation failed. If I tried  sudo touch -t, that succeeded, just until another client viewed the file — at which point the timestamp snapped to the present again. However, if I copied a file resident on the NSLU2 Samba volume to another location on the volume, the timestamp was preserved.

Continue Reading »

How to resolve “File Creation Error !” from Exact Audio Copy 0.99pb5

Posted by Jim DeLaHunt on 10 Nov 2009 | Tagged as: robobait

I just figured out a solution for a problem setting up a piece of Windows freeware on my computer, and I’m recording it here as robobait so that others can benefit from it.

I use the wonderful Exact Audio Copy (EAC) software to rip my CDs to FLAC files, as part of moving our music collection onto a media server.  I had just uninstalled version 0.99pb3 (this thing has been “pre-beta” and version 0.99 for years!) and installed version 0.99pb5. I set the directory to which EAC writes its extracted files to be on my Samba file server. When I tried 0.99pb5, though, I observed that whenever I tried to copy tracks from the CD, an “Error Message” alert box would pop up, saying “File Creation Error !” What I expected, and what I recalled from using 0.99pb3, was that EAC would write the compressed files happily to the server directory.

The minimal test case to produce the error was to select one track from the CD, and then select the menu item “Action“… “Copy selected tracks” “Uncompressed“. The Windows system in question is a virtual machine running Windows XP on my Macbook Pro laptop.  I had set up EAC’s “Standard directory for extraction” to a UNC server path, let’s call it “\\samba\media\Music\untagged_flac\“.  I observed, by the way, that when I changed the destination directory to be something on my Windows C:\ drive, then EAC wrote the file with no problem. And interestingly, EAC had no trouble writing log files and cue files to the server directory using the UNC path, but it refused to write audio data files.

The workaround which succeeded for me was to map a drive letter to the UNC path. In my case, I mapped the letter “Z:\” to “\\samba\media\Music\“. Then, I set EAC’s “Standard directory for extraction” (under “EAC“… “EAC options“… “Directories” tab…) to “Z:\untagged_flac\“.  Then EAC happily wrote compressed music files to my network directory.

I think this write failure is a regression from 0.99pb3; I recall the UNC path working then. But I haven’t reinstalled 0.99pb3 to prove the point. If you try that experiment, please leave me a comment and tell me what you found.

There are other possible causes for the “File Creation Error !” alert box.  A couple I found were:

May no-one else have to spend the time I spent diagnosing this problem! Happy exact audio copying!

P.S. my thanks to the developers of EAC, and of FLAC.exe, and all the other pieces of software in this marvelous free tool chain.

« Previous PageNext Page »