Friday, December 07, 2007

Google Chart API

Google have just announced their Chart API.  This is freakin' awesome!  Anyone can now embed charts into their web pages (yes, even your blogs!) by whacking in a well-constructed url.

Here's a quick chart I whipped up that shows average maximum temperature for each month:

Nice, eh?

Friday, November 16, 2007

Don't share intermediate directories

OK, I've been bitten by this issue twice.

Take care when setting the intermediate directory (Project->Properties->Configuration Properties->General->Intermediate Directory) for Visual C++ projects.

If you have multiple projects that use the same intermediate directory you are likely to run into problems. 

Specifically, if you're using a multi-core machine to build projects that share an intermediate directory and those projects happen to build in parallel the second project will fail when it tries to delete the files in the intermediate directory.

One way to ensure this never happens is to set the intermediate directory to $(ProjectName)_$(ConfigurationName).

This is particularly nasty because if you create two vcproj's in the same directory this will happen with the default parameters.

Monday, August 20, 2007

My code's compiling...

The biggest problems with Moore's law and the power of PC's these days is that compilation time is constantly decreasing.


xkcd knows what I'm talking about...


Thursday, August 09, 2007

Mac Mini upgrade...finally!

Amongst the fanfare of the Apple iMac range overhaul I didn't initially catch that the Mac Mini has also been upgraded! I've been waiting for this for a long time so I can use one as a front end for my MythTV system.


Not only have the processors and RAM been upgraded (Core 2 Duo 1.83 or 2.0 GHz, 1Gig RAM) but the price has come down too.


Now is the right time to buy.

Tuesday, August 07, 2007

Firefly (aka mt-daapd)

Firefly is a wonderful implementation of a DAAP server. What is DAAP I hear you ask? It's an audio streaming protocol introduced by Apple to allow you to stream music from one PC to another over a network. In simpler terms it lets you host all your music on your server and play them through iTunes (or some other apps).

Unfortunately, the version of Firefly in the Ubuntu repositories is a little old and stopped working for me when I recently upgraded my iTunes. Upgrading it wasn't as easy as normal in Ubuntu so I thought I'd list the steps I took:

  • Uninstall the old version
    • sudo apt-get remove mt-daapd
  • Delete configuration files and the database as they appear to be incompatible (YMMV).
    • sudo rm /var/cache/mt-daapd/songs.db
    • sudo rm /etc/mt-daapd.conf
  • Download a recent build
    • wget http://nightlies.mt-daapd.org/dl.php?FILE=mt-daapd_0.9-svn-1586_feisty_i386.deb
  • Install package
    • dpkg -i mt-daapd_0.9-svn-1586_feisty_i386.deb

Now reconfigure Firefly. There's probably a much better workaround than deleting the config files and the database but Firefly is so easy to set up that it's not worth figuring it out!

Thankfully, I can now, once again, play my music through iTunes from my Ubuntu server.

Mac Defect: Samba mounting

I've found a workaround to what appears to be a bug in the OSX Finder. When you mount a network drive (over samba) sometimes the drive appears, then promptly disappears. Attempting to mount the drive again results in the error "Volume already mounted". Dang.

The workaround is to "Go to Folder" (Shift-Apple-G) and enter "/Volumes". You should find your network drive there.

Chicken of the VNC - Slow connecting to Ubuntu

Chicken of the VNC is undoubtably one of the coolest-named apps around. And, in most situations, it's the best VNC client on the Mac. But it has some serious issues when connecting to my Ubuntu (Feisty Fawn) server - it's slow to the point that it's unusable.

Twiddling with the various options doesn't make a difference. No idea what's causing the issue; if anyone can enlighten me I'd appreciate it!

In the meantime I use the venerable VNCViewer. It hasn't been updated in years but it connects to my server just fine (although it does drive CPU usage high).

Monday, July 30, 2007

dm_mirror and LVM's pvmove

To allow LVM's pvmove command to work you need support for dm_mirror in the kernal. Simply enter the following at a terminal:



modprobe dm_mirror



The error I received when I didn't have that module loaded was:



mirror: Required device-mapper target(s) not detected in your kernel



If you use LVM regularly you may want to add support for this at startup; there are a few ways you can do this but I choose to add to the modules list at /etc/modules. (Just use vim and add "dm_mirror" to the end of the file.) I'm on Ubuntu (Feisty Fawn) so YMMV.


BTW, for conveniance, there's no difference between "-" and "_" in module names. dm_mirror and dm-mirror are interchangeable.

Sunday, May 13, 2007

Ubuntu and MythTV notes

I've been wanting a particular server PC for a long time now; a PC that I could use to record TV, be the main storage area for all of my data (especially music and photos), remotely trigger downloads and perform backups from. Installation of this PC is well underway but I wanted to post about a couple of stumbling blocks I had in case others were having them (or unless I had to go through it again!).

Background: The two major software choices I've made were to use Ubuntu for the OS and MythTV for the TV recording. I've been very happy with both decisions; highly recommended.

The vast majority of users will find Ubuntu amazingly simple to install. I had a couple of slightly unusual requirements however...

I wanted to use a filesystem called LVM. The main benefit for me with LVM is that you can add extra storage space whenever you want. LVM abstracts the logical mapping of mount points from the physical hard disks and partitions. An example: Today I may have a mountpoint at /var/mydata and it may be mapped to a partition on my current 320 Gig HD. Tomorrow I could drop another 500 Gig HD in and add some (all if liked) of it to /var/mydata.

In the Windows world this would be like having a 320 Gig drive appearing as C:/ then adding another 500 Gig drive to it. [I've been told Vista has some support for this kind of thing - can anyone confirm?]

It's a very useful feature (and Unix OS's have had it since '98) particularly for a server where my storage needs are going to be ever-increasing.

Unfortunately there is a problem with LVM under Feisty Fawn, the latest version of Ubuntu. LVM, as installed when using apt-get, seems to be located in the wrong place. Thankfully John has written up a simple work-around. It may also be related to another defect with the libdevmapper package. Either way it's easy to fix with those two references.

Installing MythTV is remarkably easy under Ubuntu, just follow this guide. Unfortunately my capture card (a Leadtek WinFast 1000 - basically a bog-standard DVB card) didn't work straight-up. It wasn't being properly detected in the MythTVconfiguration. Turns out that for some reason I was missing a couple of required kernal modules. Again, hitting the Internet quickly gave me a pointer in the right direction. dvb_core and cx88_dvb were the culprits; adding them with the following commands:

sudo modprobe dvb_core
sudo modprobe cx88_dvb

solved the issue. Of course, resetting the PC would mean that these modules would be missing next boot so I also had to add them to /etc/modules.

They were the biggest stumbling blocks (though installing shepherd - a wonderful EPG for Aussies - took some trial-and-error!). I've now got a stable system that I can record TV (remotely if I like using MythWeb) easily. I've still yet to shift all of my data to the box nor are backups happening yet, but it's just a matter of time.

Check out Ubuntu and MythTV, I've had a good experience with both of them!

Wednesday, April 18, 2007

Google to release online Powerpoint competitor

Google just announced that presentation software will be added to their online Docs and Spreadsheets package "this summer". So it won't be long before they have all of the major building blocks that defined Microsoft's Office package - available from a web interface.

The really exciting part of this news for me though was that the software was acquired from a company called Tonic Systems. Tonic is "based in San Francisco and Melbourne, Australia"!
As a keen software dev in Melbourne I'm shocked and disappointed that I hadn't even heard about these guys...someone needed to throw me a frickin' bone here... ;)

[Although Tonic's webpage has been replaced by a Google announcement you may still be able to get at the old page - ironically - by using Google Cache.]

I'm really looking forward to using this application!

Thursday, March 01, 2007

Hotspotr - Community WiFi Cafe Hotspots

Hotspotr is a sweet mashup that displays cafe's with wireless using Google Maps.  It's community driven, so go enter more for Melbourne!

Friday, February 16, 2007

Switched to Google Reader

About three weeks ago I migrated from Bloglines to Google Reader. I'd checked out Google's offering some time ago but found it lacking, particularly given that I was such a Bloglines devotee having used it for years

Turns out that the more recent version of Google Reader is fantastic!  So much so that I've made the complete switch.  Apart from now being as stable and up-to-date as Bloglines, Reader has a much better (and prettier) interface and has a killer feature up it's sleeve; your unread blog posts are protected from aggregator and/or browser crashes.

Here is the scenario:  You go away for a day (or three) and come back to read your blogs.  You put aside and hour (or three) and start to delve into the 900 new posts that have accumulated.  It's at this point that Bloglines blows.  If you choose the regular option and read all of your new posts ("A") then Bloglines tries to download them all into your browser - all at once. 

More often than not something goes wrong and the download doesn't complete.  Occasionally the browser presents problems (huge memory consumption, high CPU usuage or, sometimes, a crash) as it tries to render the humungous page of posts.  So, with large numbers of new posts, there's a very real chance you're going to lose them all.  They disappear into the darkest depths of the blogosphere.  You see, Bloglines marks them as read once the download begins.  Anything goes wrong, kiss new posts bye-bye.

Google Reader is smarter.  Instead of downloading them all at once it fetches 20 at a time with AJAXy goodness.  When you approach the bottom it grabs the next 20.  When each entry is highlighted (when it has focus, or as you thump on the "j" key) it is marked as read.  Simple.  Slick.  And not even a browser crash will cost you more than 20 unread posts.  Very slick.

Google Reader isn't perfect and Bloglines is still a great web app but for now I'm a very happy Google Reader fan.

Now, if you're not using a blog aggregator then get on to it!  Everyone will be soon, simply because it's the best way to absorb information that is of relevance to you.  I can recommend Google Reader.

Tuesday, February 06, 2007

Google Maps down under

Sweet, Google has just announced extended support for the Google Maps Australia site. You can now perform business searches and get driving directions.

Now, if they could just add the Google Maps road information to Google Earth...

[BTW, until they do, you can use this tip as a workaround; it will download the correct 'tile' from Google Maps and semi-transparently overlay it in Google Earth.]

Monday, February 05, 2007

make_pair is your friend

One common newbie code smell I've seen a lot of recently is the unnecessary definition of a typedef for a pair of items:

typedef std::pair <Type1, Type2> myPairForMap;

typedef std::map  <Type1, Type2> myMapType;

...

myMapType m_Map;

The idea is that you can do this:

m_Map.insert( myPairForMap(foo, bar) );

What many people seem to not understand is that there is a more elegant way - use std::make_pair:

m_Map.insert( std::make_pair(foo, bar) );

make_pair is a templated function that returns a pair of items.  It's a simple function so I'll repeat it here in its entirety:

template <class T1, class T2>

pair<T1, T2> make_pair(const T1& x, const T2& y) {

    return pair<T1, T2>(x, y);

}

See?  It detects what types you're passing in and returns a pair containing the items.  No need to define the pair typedef.