David Grant's blog

Maven is Amazing

After 2 senior developers recommended maven over ant and another told me he was planning on switching to it (from ant) for his next major project, I knew I would eventually try it when I had the chance. Today I was forced to try it because building my project with ant started becoming a total nightmare. I had added a dependency to my project and now the ant script failed. Time to modify the ant script. Said dependency had some dependencies of it's own. Not only that but one of the dependencies was an internal project and did not have an ant build of it's own so no Jar. So it looked like I was going to have to write an ant build for the dependency or put a hard link to it's output class path (created by Intellij IDEA) or use IDEA's jar maker utility. All of those are crappy workarounds. I like automated one like calls like "ant deploy" that will build, test, package and deploy my app to a tomcat server. I was fed up; there has got to be a better way.

So I tried Maven and it is amazing. I just converted a bunch of projects to use maven and it is so much better than ant. It follows the "convention over configuration" and DRY (don't repeat yourself) philosophies very nicely. It just works. No need to tell Maven where your source is and where you want it to build to. Just use the standard maven directory structure. No need to tell Maven what your classpath is for unit tests or compilation. Deploying builds to a remote or local repository is easy. Running unit tests and generating reports is easy, with no extra code in the build file required.The best part is that it fetches dependencies from a server (or the local repository cache) and fetches dependencies recursively. Building projects will be so much easier now and will save so much time. No more writing ant builds and no more copies of junit or log4j all over the place. In fact, never download any jars, ever again. Another bonus: it can generate an IDEA module file or modify an existing one. I've tried this for all the projects and it works perfectly.

So Maven is awesome, and Ant, well...Ant is dead to me.

Geocoding for Canadian Addresses Now in Drupal

What a pleasant surprise to find that my patch for geocoding of Canadian addresses for the location module was committed to CVS only a couple days after being submitted. So now geocoding for Canadian addresses works with the new location and gmap modules in Drupal 5.x. bdragon, the maintainer of the gmap module also threw in geocoding of Canadian addresses using Google as well.

Tags:

Donald Trump on Bush and the Iraq War

"Well, I think Bush is probably the worst president in the history of the United States," says Trump:

Obviously it is no secret that many people share his opinions and so no surprises here, but I think it's a good sign that an interview like this is being shown on mainstream CNN news from a public figure like Trump (who isn't the Dixie Chicks and isn't Michael Moore).

$10 Linux Distribution Donation Challenge

Someone named Thomas Cort had a create idea. For everyone to donate $10 to their software distribution for each installation they have. It got me thinking...I have been using Gentoo for almost 5 years now and I don't think I have given them a penny yet. I have done some volunteering, submitting patches and new ebuilds and such (my bugs), but no cash donations. Considering that Winblows costs well over $10 and I have been using Gentoo for 5 years for free, I am getting a good deal. Gentoo has been getting bashed around a bit lately too...so I feel bad for it. Gentoo is an excellent quality distribution with great developers and this $30 USD donation I just made is my endorsement.
[img_assist|nid=228|title=|desc=|link=node|align=left|width=200|height=166]
I, too, would like to challenge everyone who uses a Free / Open Source operating system to make a $10 donation to their software distributor for each installed system they have.

Cucumis - Free Online Language Translation by Humans

I heard about this translation site called "Cucumis" a long time ago. I recently received an email from someone in Cuba. Although I could understand it I felt there were a couple subtleties I was missing, but couldn't remember what that damn site was. I googled and googled and couldn't find it.

Google Translate butchered it by the way: "Hello friends I hope esten either, here all or, that so cold the cuentanos something, we had a client to vancouver by many days, good we wished much luck and successes him..."

The other ones weren't very good either. The email was far too casual and slangy. Even I did I better job than Google Translate with my limited Spanish training.

Eventually I found Cucumis' website by searching Techcrunch for anything translation-related. I found it, so techcrunch must have been where I saw it originally. The way cucumis works is this: you earn points for translating things for other people, and in exchange you can spend those points by asking others to translate things for you. Within an hour someone had translated the Spanish into perfect English: "I hope you are okay, everybody here is okay, how is the cold weather? Tell us the news. We had a client from Vancouver for many days. Well we wish you good luck and success..." Notice how the meaning of the last sentence is totally different, which is one of the things I wasn't sure about in my own translation.

In an effort to return the favour and earn back the points that were deducted from my profile for having my friend's email translated, I searched for any translation requests from French->English but didn't find any. Cucumis is a France-based site so that might explain why. Among the languages they support? Klingon. No High Elvish though.

Upgraded to Drupal 5

I just upgraded to Drupal 5. Seemed to go fairly smoothly except for a few glitches involving the location module. What a PITA is was though. I took my old site's mysql database dump, copied into a local Drupal 4 installation, disabled all modules, dumped the database, copied it to a local Drupal 5 installation with all my modules installed, then started enabling modules 1-4-ish at a time, and running update.php after each, making sure that the schema upgrades worked properly. Then finally, grabbed the mysql dump, uploaded it to my web host, checked out my Drupal 5 installation from my subversion repository, and imported the sql dump to a new database. Then tested.

So this is my first post with Drupal 5. Uh-oh, looks like the collapsible regions of this form are not working... I hope that's easy to fix.

Update: looks like it was an easy fix. Just had to refresh pages in the browser.

Tags:

Recently Updated Drupal Modules Feed Part 2

A while back I created a recently updated drupal modules feed. I used RSSxL. This sucked wind because it would only scan the first 20kB of the page it was scrapping so it would miss tons of drupal module updates. I recently tried Dapper and was really impressed. It could take any webpage and allow me to click on divs and construct an RRS feed. It wasn't flexible enough though and was difficult to use. Part of the difficulty was probably because Dapper is a web app.

I recently discovered OpenKapow and they took a different approach, making a desktop Java application instead. It is hugely flexible and easy to use. I got a feed up and running much quicker than I did with Dapper. Here it is: Drupal Recently Updated Modules Feed. Since OpenKapow is so powerful I think it will be possible to add the entire description of the module (for modules with more than one paragraph) along with the links to the updated versions and what not.

Ugly Bit-Wise Arithmetic

I just had a WTF moment today. If I ever see code like this again I swear I will go postal:

answer = new long[(size + 0x3F) >>> 6];

one simpler ways to write this would be:

answer = new long[size/64 + 1];

This is java by the way, not C.

Tags:

New Theme

I got pissed off at that crappy old sands_css theme I was using. I realized it wasn't working in Konqueror properly (and therefore probably screwed up in Safari as well). Anyways I always thought it looked kind of ugly so I just switched quickly to some random theme I found in 5 minutes on Drupal's theme page. It's a lot nicer and it has 3 columns so all those widgets in the sidebar are now all closer to the top of the page.

Tags:

Peru - Here we Come (and thanks kayak.com)

We just booked a flight to Peru on Monday. According to Google Earth's "ruler" feature, it will officially be the furthest I have ever flown, just a bit further from Vancouver to Lima that it is to London, England (as the crow flies). But if we go to Puno, Peru to see Lake Titicaca that will be the furthest I have ever been from home (prior to that, the furthest ever was Munich, Germany).

I really want to thank kayak.com for helping me find the flight that worked best for us. Kayak.com recently added a "my dates are flexible" feature. This was something I really wanted for a long time. Especially with long haul flights some flights are only on certain days of the week to certain destinations. For example you can't get from Lima to Vancouver on a Sunday or Monday with Air Canada. We ended up going with a United flight and saved about $450. I probably would have never found those flights because I never use the sites that they were being sold on (Orbitz and cheaptickets.com). I sometimes check expedia.ca but they didn't have the United flights. Anyways, Kayak.com is SO awesome, you should try them out and tell all your friends. I have no affiliation with them, I just want them to stay in business.

Tags:

Robotic Beer-Launching Fridge

I saw this robotic beer-launching fridge video on hacked gadgets and liked it so much I thought I would re-post it here. See the video below, and here's the original website.

My GMail is Locked Down

[img_assist|nid=215|title=GMail Lockdown Screenshot|desc=|link=node|align=right|width=300|height=119]
All of a sudden I was logged out of GMail and when I refreshed the page, I got this message about "unusual usage of your account."

I do use checkgmail and I sometimes have GMail open on two different browsers, one at home and one at work. Never caused any problem before. I think I'll fill out their form.

Tags:

Fast Python Script to Get Photos off an iPhoto CD

My uncle came over with a CD of photos from his trip to Peru. I am pretty sure the CD was created with iPhoto as there was an iphoto.xml file in the root of it. Anyways the first problem I had was viewing the pictures after mounting the CD. The file sizes were all weird (too small considering the camera that was used to take them) and some file names were duplicated. Trying to open them up with kuickshow or imagemagick did not work. Then I remembered that this happened before when we got our photos from our wedding photographer (also a Mac user). The solution is to not use the "auto" filesystem type, but to use "iso9660" instead. I forgot to check what the "mount" command actually said it had mounted it as, but mounting it manually from the command line with the "-t iso9660" option fixed it (my fstab has "auto" for the cdrom filesystem type). After fixing that, the filenames of all the photos were unique and the file sizes seemed more reasonable (~2.5 MB).

The second problem was that the photos were not stored in a flat hierarchy in one single directory, there were stored in the year/month/day directory hierarchy. kuickshow, an excellent image viewer/slideshow program, did not want to handle these directories recursively. So I had to whip up a quick python script. I knew I probably could have done it in bash too. But I don't know bash and it's not as readable. Relies too much on special punctuation to do things, kind of like perl. I hate the [-e and [-n kind of stuff, and the dollar signs. So ugly. Here's the quick script:

#!/usr/bin/env python
import os
from os.path import getsize
import shutil
dir='/mnt/cdrom/'
dest='~/tempphotos'
for root, dirs, files in os.walk(dir):
    for file in files:
        fullpath=root+'/'+file
        destpath=dest+'/'+file
        if getsize(fullpath) > 200000:
            shutil.copyfile(fullpath, destpath)

It worked great. Pythonistas will not be too impressed by this 10-liner. I'm mainly just showing that for those who have never used Python or those who have only used Python a little. It makes a great bash replacement, better than Perl because you can read it again later and actually understand it. I have used for many other such tasks, most of them more complicated than this one.

The getsize(fullpath)>200000 was to filter out the thumbnails which iPhoto also included on the CD. The fact that it included thumbnails is the dumbest thing in the world by the way. If you are exporting files on a CD one would expect that the person who exported it was going to give the CD to someone else and that someone else might not have iPhoto, so the thumbnails become totally useless. In my opinion, thumbnails are something should be filed away in a hidden cache directory on the user's hard drive, and not seen anywhere else. GIMP used to put thumbs in a .xvpics folder, something else uses ThumbsDB (Windows?). Picasa (correctly) puts them somewhere where I can't see them.

The only other problem was that stupid iPhoto had duplicated some photos so they appeared twice. I realized afterwards that some folders had a thumbs directory and an originals directory, and some originals in the the directory itself. This might have been because there were modifications to the original so the originals were copied automatically to a sub-folder before being modified.

Almost Ready to Upgrade Site to Drupal 5.0

A while ago I mentioned that I was waiting for a few modules to be ported to Drupal 5.x before I upgrade this site to Drupal 5.0. Well the final two modules, gmap and location were ported recently and I started creating a Drupal 5.0 installation in my subversion repository and starting testing. Everything has gone smoothly so far, including many schema upgrades by the various modules. My map of authentic Mexican restaurants in Vancouver also loads much faster now under Drupal 5.0 and the new gmap module. I also like the new default theme, Garland, that comes with Drupal 5.0. I like using default themes because it always themes all the elements correctly, provides for easy upgrades when the next version of Drupal comes out, and I just don't have time to invest in my making my own Drupal template that actually looks any better than the default. This site should be running Drupal 5 within a couple of weeks.

Tags:

He-Man Sings

I saw this "He-Man sings 'what's going on'" video when it first came out and recently discovered it again. I was a huge He-Man fan when I was a kid. I enjoyed seeing my old friends Man-At-Arms and Skeletor. The over-dubbing and editing is masterfully done. Love the IM chatting between He-Man and Man-At-Arms and Skeletor's entrance.

If you get really nostalgic you might enjoy watching the intro:

I can't believe I actually watched that show.

Tags:

Pages

Subscribe to RSS - David Grant's blog