imapsync migration

May 21st, 2009, 5:29 pm PDT by Greg

A quick technical note… I just want to get this down so it’s findable later.

I was trying to move my mail from FASnet to the new Zimbra server. The Zimbra wiki suggests imapsync to migrate mail from one IMAP server to another.

When I tried that, imapsync insists on spidering every folder on the source server to see what’s there. Since FASnet is set up in its own particular fashion, that means it will look through every file in my home directory. That’s a lot of load on the IMAP server and something that caused the system admins to ask me nicely to stop.

To prevent the spidering, I replaced this line in the imapsync script:

my @all_source_folders = sort $from->folders();

with this:

my @all_source_folders = ();

As long as you specify a --folderrec (or --folder or --subscribed) and no --include, it will still work just fine. My command line was:

./imapsync --host1 imap.css.sfu.ca --user1 ggbaker --host2 imapserver.sfu.ca --user2 ggbaker --noauthmd5 --folderrec mail --exclude old --prefix1 mail --prefix2 fasnet 2>&1 | tee log

Everything seemed to work, and it looks like I have my email moved over. The line in the imapsync summary “Total bytes skipped: 36444” worries me a little. I wonder what those bytes were.

Geotagging

May 15th, 2009, 1:28 pm PDT by Greg

Astute observers (or people I told about it) will have noticed that in our gallery of China pictures, clicking the links on the left “View Album on a Map” and “View in Google Earth” do cool stuff.

I promised I would write about how I did that, so I will. There are obviously other ways to geotag photos, but this is what I did.

The Gear

Before the trip, I had the realization that I didn’t have to get some kind of GPS receiver that connected to my camera: any GPS data was enough, as long as it was timestamped. The photos I take are timestamped, so if the GPS data is too, I can connect the two and figure out where pictures were taken (assuming the GPS and camera are close to each other).

So, before the trip, I picked up a eTrex Venture HC. It claimed to be high-sensitivity, so that sounded good. Also, it was on the cheaper side of GPS receivers and it records the track data I needed.

I had the GPS on a lot over the trip, and I think I ran through 4 pairs of AA batteries the whole time. That’s quite reasonable to my mind.

The cameras were my Rebel XT and Kat’s SD800. Basically, it can be any Digital camera with its clock set reasonably accurately.

On the Trip

When we were about to arrive somewhere, all I had to do was flip on the GPS and throw it back in my camera bag. Then, take some pictures. When leaving, turn the GPS off.

The GPS records its position (“tracks”) until I turn it off. (It’s important with a Garmin GPS to not “save” the track: that throws away critical time info.) Just turn it off when done.

Processing

The data can be pulled off the GPS to a GPX file with its own software or GPSBabel. Photos come off the camera in the usual fashion.

I couldn’t find anything I liked to get the GPS data and the camera time stamps together, so I did what I always do in these situations: I started writing Python. The job was basically to read the GPS data, read the timestamps from JPEG files, interpolate the GPS data, and write the position data back to the JPEG.

I threw what I have on SourceForge as “Geotag Merge“. I haven’t “released” it yet, so you have to grab the Subversion repository if you want to play. Sooner or later, I’ll find some best-practices for packaging Python-based applications and I’ll do a beta release.

I added the Gallery2 GPS module to my gallery to make it all work.

An Example?

Okay, look at this picture which, according to its time stamp, was taken at 2009-04-19 14:20:08 (Beijing time) = 2009-04-19 06:20:08 UTC. Looking in the GPX file extracted from the GPS, I see these entries:

<trkpt lat="40.360190626" lon="116.013850048">
  <ele>829.274414</ele>
  <time>2009-04-19T06:19:48Z</time>
</trkpt>
<trkpt lat="40.360201774" lon="116.013833955">
  <ele>829.274414</ele>
  <time>2009-04-19T06:20:11Z</time>
</trkpt>

Like all good XML, this is minimally-human-readable: two observations separated by 23 seconds, with latitude, longitude, time, and elevation.

So, I deduce that the picture was taken in between these locations (and in fact very close to the second). A quick linear interpolation, and we decide that the picture was taken at 40°21’36.72″N 116°0’49.81″E (and 829.27 metres above sea level). This is then written back as part of the image’s EXIF tag, and it can be picked up by any geotagging-aware photo viewer.

Everything that’s wrong with Java

March 22nd, 2009, 4:52 pm PDT by Greg

I’m in the process of learning the Java Spring web framework (motto: there’s nothing another XML configuration file can’t fix). This has turned out to be a bit of an exercise in frustration: I have always had trouble dealing with Java tech because of their jargon-filled docs. Actually, it’s not even the jargon per se, it’s that the jargon is all Java-specific.

An example: the term “servlet container”. A “servlet container” is a web server that can run a servlet. That’s all. There’s no need for a new term: just say “web server that can run a servlet” or even “servlet implementation” and you’ve removed a whole layer of jargon that people have to learn.

As I was exploring Hibernate (which can integrate with Spring) today, I went to the Hibernate home page and realized I had another example of why I hate the Java ecosystem. Their front page contains this description of what Hibernate is:

Hibernate is a powerful, high performance object/relational persistence and query service. Hibernate lets you develop persistent classes following object-oriented idiom – including association, inheritance, polymorphism, composition, and collections.

Well… I suppose that’s pretty informative if you’re willing to parse through the overly-dense sentence structure and already know how the Java world uses all those terms. And, the page contains this diagram:

hibernate_stacks

Riiiiight. That totally clears things up. Perfect for first-time visitors.

Now, compare a similar (but admittedly less-powerful) Python technology: the home page for SQLObject. They have this description:

SQLObject is a popular Object Relational Manager for providing an object interface to your database, with tables as classes, rows as instances, and columns as attributes.

I’d be hard-pressed to come up with a more clear and concise description of ORM than that. It’s followed by a dozen-line code example of how to work with SQLObject in Python which more-or-less demonstrates exactly what the tool does, how it does it, and what it can be used for.

Basically, the message I get from the Hibernate front page: “boy, this sure looks enterprisey“. From SQLObject: “oh, I see what this tool is for”.

Just to be a little constructive, let me take a shot at rewriting the Hibernate intro:

Hibernate is a powerful Object-Relational Mapper for Java: it lets you save object instances as rows in a relational database, and retrieve them later. Hibernate supports most object-oriented programming techniques, including association, inheritance, polymorphism, composition, and collections.

Okay, that’s off my chest. Bring on the Java fanboys…

Twitter

January 29th, 2009, 10:35 am PST by Greg

Okay, I give up: I’m going to start Twittering. I have created an account (@ggbaker) and everything.

Given that I can’t usually be bothered to update my Facebook status, I don’t know how this is going to go. I figure if a few people are following it, that might motivate me.

Time Lapse Movie

December 15th, 2008, 1:32 pm PST by Greg

We had our first (annual?) holiday open house on Saturday. We had a good turnout: thanks to everybody that came. I think the whole thing was a success.

There was food, and Kat has promised she will blog about that sometime soon.

For me, the conversation piece was the camera on a tripod in the corner. It was hooked up to my laptop and taking an image every 30 seconds (then displaying it). The setup was based on somebody else’s instructions on creating a time lapse movie in a similar way.

I wasn’t entirely sure what I was going to do with these pictures. I thought that a time lapse movie of the party might be cool. I thought it might accidentally capture some good images. What I didn’t realize was that neither Kat or I was going to have a chance to take any pictures anyway, so these were almost the only ones that we would have.

I have gone through the pictures in a cursory way and posted some (along with the few pictures we did take by hand) in our gallery.

I did put the frames together into a time lapse movie (that link is about 24MB; I also did a smaller 12 MB version, or use the direct link to the movie if you’re having plugin problems, or the Facebook version if all else fails).

I’m actually pretty happy with how the movie turned out. I kind of wish I had left the camera running until we had really finished the cleanup that night (with the last frame being lights-out, say), but that didn’t seem as important as actually cleaning stuff up at the time.

Camera Setup

I played with the camera settings for a while before I got it rolling. What I ended up with was the smallest image the camera would take (about 2 MP), my Sigma zoom at 18mm, ISO 1600, auto white balance, auto exposure (most shots were around f/2.8 and 1/30 s), manual focus at about 3 m (depth of field was surprisingly good for the wide aperture), LCD image review off (to save battery).

If I was doing it again, I might lock the white balance and aperture, just to keep everything in the video as consistent as possible.

I swapped out the battery in the camera twice during the day. I’m not totally sure that was necessary, but I didn’t want to take the chance of it running out.

The net result was 1800 exposures in 15 hours: almost as many as I usually take in a year.

Computer Setup

When I had the idea, I thought I was going to have to do some low-level USB hacking, but it turns out gphoto2 will do exactly what I want. The script to start it was this: (gphoto does die occasionally, which is why it’s in the loop)

#!/bin/sh
INTERVAL=30

killall gvfsd-gphoto2 2>/dev/null # kill program hogging the camera
gphoto2 --set-config /main/camera/setcameratime=1 # set time from computer

while true ; do
  killall gvfsd-gphoto2 2>/dev/null
  gphoto2 \
    --set-config flashmode=0 --set-config beep=0 \
    --capture-image --interval ${INTERVAL} --hook-script hook
  sleep ${INTERVAL} # keep going if gphoto dies
done

And the script “hook” that just bumps the display:

#!/bin/sh
if [ $ACTION = "download" ] ; then
  gqview -r $ARGUMENT # press "f" for full screen
fi

I did have a small problem with gphoto and the Rebel XT which was fixed with a one-line patch. Also, the original instructions above are pretty liberal with the bitrate: I encoded with 1000 and 500 bps for the large and small movies. I also had to crop the frames from the Rebel’s 3:2 aspect ratio to the 4:3 of your average video.

Wanted to Buy: New MythTV Frontend

October 26th, 2008, 9:33 pm PDT by Greg

At some point in the not-too-distant future, I’d like to replace my Myth frontend. I have been doing some thinking about what I really need for this computer, which sits with my home theatre equipment and makes me watch the TV I want to watch.

The current incarnation has a single Hauppauge tuner card for recording. I also have a dual-tuner card in my main computer for a total of three. The magic of MythTV means that I can watch any recordings on the frontend.

I am now starting to think that I don’t really need to record on my frontend. I could do all of the recording on my main computer, and just do playback on the frontend. That would eliminate the need for much storage on the frontend, so I could eliminate the hard drive altogether and just have a few gigs of flash for the operating system. Everything else could be on a network share.

I don’t have any immediate plans to go to high definition, so the processor needs for playback-only would be pretty minimal by modern standards. A little Atom processor should do it. The Atom + motherboard should sip little enough power that it can be passively cooled, if the case is right.

So, my list of requirements becomes:

  • Intel Atom or similar low-power processor.
  • digital video output (DVI-D or DVI-I or HDMI) and digital audio output (S/PDIF coax or fiber).
  • a motherboard that can boot from USB (or a CF card or something).
  • some kind of remote control input. I haven’t quite worked this one out yet: it could just be a serial or USB port with some generic IR receiver.
  • a nice little case that blends well into a home theatre rack.
  • no fans, hard drive, or other moving parts.
  • ethernet.

I have looked around, but can’t find anything that hits all of the key points there. (Some of the contenders I have looked at are Shuttle and Hush. The picoPSU could figure into the plan too.)

Anybody have any suggestions?

Centre channel problem solving

August 11th, 2008, 4:31 pm PDT by Greg

As part of our recent move, I have had no choice but to buy a new TV. There is a built-in nook for a flat screen to sit. I had a 27″ CRT. The options were to bring the old TV and have it sit awkwardly in the room taking up a bunch of space, or buy a new flat screen.

So, I bought a new TV. Like I said: I clearly had no other choice. The TV was to be mounted on a big heavy-duty arm, so it could be swung a bit to see from the kitchen. No problem, since there was a big chunk of wood behind the nook designed exactly for this purpose: it would hold the weight of a big friggin’ TV.

While mounting the TV, Oli and I learned that the big chunk of wood in question wasn’t quite as high up as we would have liked. We ended up mounting it as high as we could, but that still didn’t leave enough room below for my centre channel:

argh!

So, this left me with a conundrum: where exactly am I going to mount the centre speaker for the home theatre? Before I get into the options, two important facts about a centre channel need to be reviewed. (1) The centre channel I have is from the same speaker series as the rest of the speakers, so it is acoustically matched. Having a distinctly different speaker could sound funny (e.g. sounds moving left to right sound different for part of their journey), so keeping this speaker would be ideal. (2) The centre channel needs to be horizontally aligned with the screen so the dialogue (which is what it makes its living doing) seems to come from the people speaking.

Many options, with varying degrees of insanity have been considered:

  1. Below the TV in the nook. Ideal, but it won’t fit there. Stupid mounting bracket isn’t height adjustable.
  2. Above the TV. This would meet both of the criteria above, but Kat is (for some reason) not thrilled about the idea of hanging the speaker above the TV by fishing line (or maybe I shouldn’t have led with that implementation). To be fair, this would look stupid, and it would block the accent light above the TV.
  3. Beside the TV, in the nook. It won’t fit there. Off-centre
  4. Beside the TV, outside the nook. This is the current solution because it’s easy. It’s annoyingly off-centre and ugly, but it fits and it works. The cable to the speaker could be hidden with a subtle hole drilled in the cabinet behind.
  5. In the stereo component cabinet. This has the problems of the above, but it would probably echo like crazy (since the speaker is rear-ported). It eliminates the need to do any drilling, though.
  6. Behind the TV, facing up. Even I didn’t think this was a good idea long enough to say it out loud. It wouldn’t fit anyway and would probably sound like ass.
  7. Having established that there is no good position for the current centre channel, I looked into buying something new. The first option there was a new thin centre channel that would fit below the TV. Nice idea, but I can’t find any that are decent, so criteria (1) would be blown out of the water.
  8. I could buy a whole new set of sub-sat speakers. These sets include tiny main speakers that can’t produce much bass and a wider-range subwoofer that takes up the slack. These would probably fit, but don’t sound great, and getting anything decent would involve more money than I want to spend. It would also negate the money spent on the very nice speakers I already have.
  9. The TV has built-in speakers. I could run the centre-channel line-level out from the receiver to them. It would probably sound horrible, but it would be cheap and inconspicuous.
  10. Yes, this idea is strange. I buy a left-right pair of small bookshelf speakers and use them together as the centre channel. I think I can split the speaker cable and connect it to both speakers, tucking one in to either side of the screen. This should fool the ear into perceiving the sound as coming from halfway in between the two and I’m optimistic that I can find a decent pair of speakers that is small enough and will match my current set.
  11. Same as above, but mounting the pair of speakers above the TV on the edge of the cabinet. This would relax the size restriction on the speakers.
  12. And after all of this, I started to think “no really… is there no way to get the TV up three inches?” The mount isn’t height adjustable, and the bracket on the mount can only attach to the TV in one position. Or can it?

    I think I can get a metal plate that’s the same width and a bit taller than the mounting bracket, and bolt it in between the bracket and the TV. The TV would be able to bolt on a few inches higher than the original holes, so it would sit that much higher.

For the more visual among us, here is an illustration of the options. The red ones use the current speaker; the blue ones use something else:

centre channel placement

So, after 11 insane options for how to deal with the speaker, I’m likely going to ignore them all and just fix the mounting bracket to do what I wanted it to in the first place.

Finally, we get to the real question here: Does anybody know where I can get a 9×12 inch piece of steel plate?

Edit: Pictures of the implementation of option 12.

Gaming

July 10th, 2008, 4:33 pm PDT by Greg

With my study leave coming up, I expect to have more free time on my hands. Don’t worry, watchers of the public purse: I do have a bunch of work stuff to do over the year, but that’s another blog post.

I think I need to reacquaint myself with PC gaming. I have a (slightly) old Athlon 64 system that isn’t actually being used right now with 1 GB RAM and 320 GB of hard drive. I figure this can be turned into a reasonable gaming rig with a minimal investment.

I would probably drop in a new processor (like the Athlon 64 X2 5400+) and new video card (perhaps an ASUS N7600GS). That would be enough to run the kind of games I’m actually interested in: Portal, Spore, SimCity Societies, Civilization IV. I likes me a good god-game. I really don’t care much about online/multiplayer gaming: I don’t need some 14 year old kid using the word “pwn” at me in my leisure time.

I’d need to get another keyboard and mouse, since USB+DVI KVM switches are unpleasantly expensive. (It’s probably harder to do the switching for USB than old PS2 connections. Don’t forget about buying cables with those too.) I can hook up to the VGA input on my LCD and switch the display that way.

After about $250, I should be ready to go. I can get a Windows XP license from work as long as I promise that it has something to do with teaching (which it undoubtedly will, regardless of the initial plan).

Why I Hate my iPod Touch (and you shouldn’t buy an iPhone)

July 8th, 2008, 8:08 pm PDT by Greg

I have ad an iPod Touch since Xmas. As most of you know, it’s pretty much a first gen iPhone without the phone part. I actually hate it a little bit: allow me to summarize.

User Interface

Yes, I know this device is sold as having god’s-own user interface. I disagree. The interface is very pretty, but not actually as functional as it could be.

Part of the problem might be that I use my iPod primarily as a music player. It’s crazy I know, but what I mostly want to do with my digital music player is play music. The problem is that the interface of the music player actually sucks a little.

The only way I can think to illustrate this is by comparing what can be done in the various player modes it has. You can hold the thing vertically so it displays in portrait mode, horizontally for landscape mode, or double-click the menu button when it’s locked to bring up some controls there. Here is a summary of what you can do in each mode:

iPod Touch Interface Capabilities
Feature Portrait Landscape Locked
Next song (shuffle) Y Y
Next artist/album Y
Adjust volume Y Y
Move within song Y
Pause/Play Y Y Y
Coverflow UI Y

This is the kind of inconsistency that should make anybody who has taken a usability course cringe. It means I have to hold my device in a certain way to actually use it the way I want.

In all cases, most of the device’s big, luxurious screen is taken up displaying information I don’t care about in the slightest: the cover art (or background when locked). Even if I had all of the cover art there (it seems to be displayed only for songs purchased from iTunes: songs I have ripped and have perfectly good metadata for have nothing), I don’t want to look at it. Coverflow is sexy to be sure, but it’s not actually displaying anything useful to me. Think of all the useful information that could be there if they had chosen function over form. Or the buttons to touch could have been bigger and easier to hit.

Lock-in

As I mentioned earlier, Apple’s hamfisted attempts at vendor-lockin are a big deal for me.

First is the locking of the device itself: no software can be installed on this device that has really cool UI and portable computing potential. In order to install your own software, you either have to be a registered developer (I think) or do a jailbreak and risk Apple bricking your phone (or committing a criminal act if C-61 passes). [UPDATE 07/10: I’m reminded by an Apple announcement that by this I mean “unapproved software” in this paragraph.]

This is just unacceptable stupidity: on the Touch, there’s no conceivable reason to not have designed the OS to isolate applications from each other (so a junky app can’t crash the whole device), and then allowing installation. For the iPhone, the additional argument of junking up the carrier’s network is also used and is also crap: other phones allow software installation and the mobile networks haven’t been brought to their knees.

Now we move from this (which is annoying and shortsighted) to Apple’s cartoonishly evil behaviour: cryptographically signing the song databases. This makes it effectively impossible to use any software other than iTunes to put music on the device (or sync contacts, calendar, etc.).

I don’t have a Windows or Mac computer easily accessible, so here’s how I sync music to my iPod: (1) take my work laptop home and boot into Windows; (2) install iTunes if it’s not there already; (3) connect it to my network and make sure the music is being shared properly from my main computer; (4) import that music into iTunes; (5) connect the iPod and pray that it actually works. This seems to actually happen about as often as I visit the dentist, and it’s about as pleasurable.

Backlight

This is a small niggle, but the backlight on the display doesn’t turn off when playing music. On my old 4th generation iPod, the backlight would go off after 10 seconds or so to save power. On the Touch, it sits there draining battery until I lock the screen.

Voice/Data Plans

This doesn’t really have anything to do with my iPod, but it is relevant to iPhones. There has been great furore over the plans that Rogers has introduced to go with the iPhone.

On this point, however, I have no issue. Unlike many of the petition signers, when the plans were announced, I did not weep openly or consider self-immolating in front of a Rogers kiosk.

Yes, the Rogers plans are worse than the plans from AT&T in the US. But if my memory and this chart are correct, they are an order of magnitude better than previous data plans. I’ll take that as a win for Canadian wireless-fu, and leave it there.

And they are not offering unlimited data plans. I agree wholeheartedly with Allen on this one: there are no unlimited plans anywhere, so get over it.

Anyway…

Yeah, the iPhone is pretty, but I don’t think it’s worth trampling your own mother in the crowd to get one… or even paying the sticker price.

I’ve said before that I am quite enamoured with my Blackberry. I also considered the HTC Touch but obviously haven’t used it enough to give a good review.

And, there’s so much shake-up on the way for the handset makers that it might be worth waiting: Google’s Android OS, the OpenMoku phone shipping, the LiMo Foundation. All good news for people that actually think they should be in control of the device that they bought.

The iPhone plans are out!

June 27th, 2008, 5:32 pm PDT by Kat

Yippee! The plans are not as expensive as I thought they would be.

$60 a month gets you 400 MB, 150 weekday minutes and 75 text messages.

I’m a little upset that I have to pay an extra $7 a month for call display, but whatever.

I figured the data portion of the plans wouldn’t be unlimited like the US plan, but since Rogers has dropped the price of their data plans, the monthly cost of having a functioning iPhone isn’t astronomical. I’m also secretly happy that I’ll have more data than Greg. Heh.

« Previous Entries   Next Entries »