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.

Alaska-bound

May 19th, 2009, 9:46 pm PDT by Greg

Having comfortably adjusted to pacific time, Kat and I are headed out again. This time is much more low key: we leave for an Alaska cruise on Saturday.

My parents came along with this idea some time last year. They have done the Alaska cruise before and wanted to take us with them. Fine by me.

I guess I don’t have much to say about the cruise other than “we’re going”. With the China trip two three weeks ago, I haven’t had much mindshare for the cruise. Plus, there isn’t much to plan: get on the boat and figure it out from there.

I’m planning to rent a 70–200mm lens for the cruise (since I don’t have a decent long lens). That should keep me occupied for a while, and get some nice pictures of the glaciers, etc. That was lens #2 on my recent Lens Wish List. I already bought lens #1, the 4.5mm fisheye. This is my attempt to stop myself from actually buying the zoom: I can play and get it out of my system.

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.

Pictures!

May 2nd, 2009, 6:13 pm PDT by Greg

We have posted pictures from our trip! They are organized by city, which seemed to make the most sense to me.

Note that they are (almost) all geotagged, so you can click the left-side links “View Album on a Map” or “View in Google Earth” on the album (or any subalbum) to see the pictures geographically. This was done with a handheld GPS and some cleverness. The tags seem to generally be within about a few metres of the true location where the photo was taken.

I’ll explain all of the geotagging stuff in a later blog post.

Edit: By the way, I rolled over the odometer on my Rebel XT on the trip: I took img_9999.jpg, then img_0001.jpg in the mini-three gorges. Ten thousand pictures on that camera over its lifetime. It now officially owes me nothing.

We’re back!

May 1st, 2009, 8:35 am PDT by Greg

We got back to Vancouver yesterday afternoon, safe and sound. That is all.

I temporarily blocked access to our “china” gallery while we get the photos up. Don’t want anybody getting an incomplete experience. 🙂

Xian Day 2

April 29th, 2009, 6:02 am PDT by Greg

Today, we started with the Shaanxi History Museum.

I’m sure the museum was just fine but we (and the rest of our group) have pretty much lost the thread, and were too tired to give it much thought. It was a traditional “here are a bunch of old things” museum, and was just organized chronologically. That wasn’t enough to really keep our attention.

Compare the Shanghai museum: that collection was organized by topic (coins/money, ethnic minorities in China, …) so you could digest one part of the story at a time.

Then to a government jade store. The most interesting thing there was a realization that we all knew was coming: the older lady in our group had bought a jade pendant that she was very pleased with at the hotel store in Shanghai. Today she learned that she overpayed (or possibly that it was fake/crappy: we haven’t heard). She was pissy for the ride back to the hotel.

We had the afternoon off, so Kat and I explored the city a little. That was nice, but we were both eventually debilitated by allergies (first time on the trip, at least) and slunk back to the hotel.

Today, we take the long journey home to Vancouver and real life. Bugger… I have to finish the prep for the workshop I’m giving on Friday.

Xian Day 1

April 28th, 2009, 9:03 am PDT by Greg

Today, we started late and went to the Terracotta Army site.

I don’t have too much to report from there. They claim that the site (presumably the whole first emperor’s tomb complex) is the “8th world wonder”. If the scope of the thing is as they say (1/10th currently excavated), I could totally buy that.

This evening, we went to the local opera. Not as good as the Shanghai Acrobats; better than the Peking Opera.

In exchange for a short post, I have posted a bunch more pictures.

Three Gorges Day 3

April 27th, 2009, 5:58 am PDT by Greg

On the 27th, we started with a side trip to see the Snow Jade Cave at Fengdu. Considering that pretty much every nightmare I have involves confined spaces, I enjoyed it. (I’m not actually claustrophobic, I just dream that I am.) The geology in the cave was really pretty cool: hopefully some of the pictures come out well.

In the afternoon, there was kite flying from the top deck of the boat. Watching 20 kites fly above a cruise ship is really quite pretty. Several kites were lost to overhead powerlines (by others) and one just got lost overboard (by Kat): I prefer to think of these as a free kite for some kids downstream somewhere.

On our last night on the boat, I slept badly, snored, and kept Kat up. Good times.

Today we disembarked, took a quick tour of Chongqing. Chongqing is the largest city in the world if you count like the Chinese government (or 5 million if you count the people that live in the “city” part of the city), and we had like two hours to look at it.

Then, to Xian where we are now. Tomorrow, we see the Terra Cotta Army.

Three Gorges Day 2

April 27th, 2009, 5:38 am PDT by Greg

We didn’t write anything while we were on the boat, because the Internet was rety much intolerable. Now that we’re back on dry land, it’s time for a quick rundown. Recall that we were on the cruise up the Three Gorges.

On the 24th, we really just got through the locks at the dam and cruised up the river. At the end of the day, there was a “crew cabaret”. I was expecting an ironically funny variety show, but it was actually pretty good: much more entertaining than the Peking Opera. After the show, they announced that the dance floor was open. As the cast went out to find people to get the dancing started, one of the girls grabbed me. Against my will, I was dragged up on stage, only to find that they had started playing the Macarena and that I was trapped. Do you have any idea how goddamned long the Macarena is? Then, they shouted “everybody stay in the circle” and played the Chicken Dance. Kat was properly amused.

On the 25th, we look an excursion to see the Lesser Three Gorges. Most notably, Kat was the first to spot monkeys that live wild along the gorges.

After lunch, the boat cruised through the Qutang Gorge, which is pictured on the 10 Yuan bill. That makes three of the currency images we have seen: the 1 yuan in Hangzhou, and the 100 yuan from Tiananmen square.

In the afternoon, we took an excursion to Baidi Cheng, the White Emperor City. It occurred without incident.

I spent much of the evening sitting in the top-floor lounge pretending to read while I watched a scene unfold around me. The only occupants were four guys playing Mahjong, the girl at the bar, and me. Then, we were joined by a group of Chinese guys who had been drinking in the dining room since dinner. They were very… boisterous.

As the evening went on, we were joined by another girl at the bar. Then, a guy in a security uniform. Then the hospitality manger, another security guy and the cruise guide. I didn’t get much reading done. Every little while, the bar girl would come over and apologize for the noise, but I was just waiting for the fight. Apparently the evening ended without incident at about 1:30. I was later told that this group (of maybe eight) had 7 bottles of wine in the restaurant before they came up and 48 bottles of beer after they came up (although they may not have drank all of them). Beer bottles here are probably 1.5 times ours.

Three Gorges Day 1

April 24th, 2009, 1:27 am PDT by Greg

We’re on the boat, heading up the Yangtze. If you’re reading this, then the boat’s GPRS-based Internet must have been enough to get the blog post up.

Yesterday, we started in Shanghai. We made quick stop at a government silk factory. We saw how they get threads out of silk worm/moth cocoons (boil, then grab the thread and pull: the whole thing is one thread) and how two-larvae cocoons can be stretched into silk comforters (wet, grab corners, and pull). It was actually kind of interesting in a the-more-you-know kind of way.

Then, the flight to Yichang, which is the site of the Three Gorges Dam project.

In Yichang, we were met by out guide Alan, who was our guide for about 4 hours. We went to an embroidery store (holy crap, embroidery is high-maintenance) and dinner. After dinner, and after our driver changed the flat tire on our van, we headed to the boat.

We’re on the Century Sky for four nights. It’s apparently the largest cruise ship on the Yangtze, and I think the concierge-guy said it was the largest riverboat in the world. So far, it seems like a damn nice way to travel. It’s about half full, and the staff apparently outnumber the guests (160-something:150-something).

Oddly, probably half of the people on the boat are French Canadian. It hadn’t occurred to me that I’d be trying to recall my French at the same time I’m trying to pick up a word of Mandarin a day. There’s no way there’s room for three languages in my brain: I’m ignoring the French problem. 🙂

This morning, we took a side-trip to the dam itself. This morning was the second foggiest day in the history of the world, so it wasn’t as spectacular as it could have been. [KS: The last time I was here the weather was warm and clear on the river, but the haze up at the dam was just as thick as today’s fog. I’m pretty sure this is a clear as it gets up here.] Once it is totally completed, the dam will have 32 generators, the locks and a ship elevator. Construction on the ship elevator and the last 6 generators is currently underway. As I type this, we’re waiting to enter the first of the locks to head up into the reservoir and continue upstream from there.

I’m not going to bother posting pictures today: no point in taxing our feeble Internet connection. [edit: the connection is extremely slow: this may be our last update from the boat.]

« Previous Entries   Next Entries »