Archive for the 'Howto' Category

Using Apple AirPort Disk as iTunes media folder

The problem

For the best part of a year now I have been living in a US apartment away from my desktop computer, leaving me with my MacBook Pro as my only computer for work and media. I bought an Apple TV, which has since become my main device (along with Netflix streaming) for renting movies and watching movies or TV shows that I purchased from iTunes.

For a while now my iTunes media folder has been slowly but surely eating up all of the spare capacity on my MacBook Pro’s 200GB Hard Disk.  Music, apps and movies had taken their toll. The straw that broke the camel’s back was when I started downloading TV shows from iTunes. Before I knew it, my media folder was over 100GB, my HDD was full and I still had two and a half series of The Wire to download from iTunes. Finally, I couldn’t upgrade Xcode 4.

Something had to give!

I had looked at a number of different ways of moving my media folder off of the laptop. I had already moved my 60GB iPhoto library to a 1TB backup USB WD Passport Disk Drive but it was hassle to have to hook it up every time I wanted to use iPhoto, which is not nearly as often as I use iTunes. Dedicated NAS drives and media servers are expensive and take up room, which there isn’t a lot of in an apartment.  So I needed something small, fairly cheap and that didn’t need wires.

I did a bit of digging and noticed that the Airport Extreme Base Station has a USB port and a feature called AirPort Disk. AirPort Disk allows you to share Hard Disks over its zippy dual band 802.b/g/n network. However, Apple do not make any mention of specifically using it to host your iTunes media folder. In fact, when I went to my local Apple store, and explained what I wanted to do, the sales person had never even heard of AirPort Disk! I bought one on the understanding that I had 14 days to try it out and return it.  I plugged it into my LinkSys cable modem/wireless router, configured it in bridged mode and plugged my passport drive into the USB port. Sure enough, the disk appeared in finder as 2 shared disks on my network. I had partitioned the disk into two separate logical drives, one for media files and the other for TimeMachine backups.  The first test was to try using the iPhoto library on the disk and it worked without a hitch, though not quite as fast as when the library is located on the Mac.

Next up was to copy my entire 100GB+ media folder to the passport drive.  To do this I plugged it in directly and copied the files over. It took approx 1 hour to copy the files. Once the copy was complete, I unmounted the passport drive and plugged it into the Airport Extreme Base Station. I fired up iTunes, opened Preferences and changed the media folder location to point to the new location on the new mounted AirPort Disk volume. I restarted iTunes but all of the media was still pointing to the local media folder.  I renamed the folder (not wanting to delete anything in case it didn’t work) and restarted iTunes.  I looked at the location of my iTunes files and strangely enough, they now pointed to the local media folder with the new name!

In the end I finally decided to delete the entire local directory, safe in the knowledge that I had a backup on the passport drive as well as in Time Machine.  When I restarted iTunes, the files were finally pointing to the correct location on my shared volume.

The Big Test

Finally for the big test, watching a movie that was being streamed from my shared disk to my Mac via AirPort Disk and then from my Mac to the Apple TV using Apple’s AirPlay technology. At best it would probably buffer horribly and drop connection occasionally. At worst, I thought it would fail miserably.

The result?

It worked perfectly with almost no noticeable buffering!  Playing, pausing, forwarding and rewinding TV shows works without a hitch.  I have downloaded all the remaining TV shows from iTunes and have been happily watching TV shows streamed from the shared drive ever since.

Conclusion

I had been mainly worried about the speed of the USB drive for streaming 720p movies but I have been knocked out by how fast and reliable the connection and how good the performance has been.

So far there haven’t really been any real issues. Occasionally, I might need to establish the connection between the Mac and the shared disk through Finder or iTunes might complain that it can’t find the media. Not a deal breaker in my opinion.

I guess the biggest problem is backing up media on the wireless drive. I haven’t had a chance to play with Time Machine to see if it can back up shared drives, as my Time Machine is complaining that the latest backup is too big for the 400GB shared drive partition. Something that seems to happen quite regularly for me unfortunately. It is possible to connect a USB hub to the Airport Extreme meaning you could connect multiple disks for backup or extra capacity. You can even connect a USB printer and have it shared on the network. Though I don’t know what affect these would have on performance.

I am really pleased with the result and the added bonus of the faster 802.11n network that I now have being much faster than my old 802.11g network on the LinkSys modem. This allows me to download new media while streaming it to the Apple TV – something I wasn’t able to do with my 802.11g router.

You can even access your AirPort Extreme shared disk remotely via the Internet if you have a MobileMe account but I haven’t looked into that yet.

If you are in need of the space, it might be worth considering trying this but be warned: using AirPort Disk for iTunes is not officially supported by Apple so don’t blame me if it doesn’t work for you or stops working in the future. I have only tried it with a Mac, so I don’t know if it works with MS Windows iTunes software. Also be sure to make multiple regular backups of your media!!

Let me know if you have been using AirPort Disk for iTunes, if you know of any problems that I will likely run into or if you have a better way to store your iTunes media remotely.

Howto: Use the Bullet 3D Physics Engine in Xcode

Its been a while since I added a Howto on here. Hope you find it useful.

The Bullet 3D Physics engine is shipped with the Oolong 3D Engine for iPhone. However, if you just want to use the physics engine in your iPhone app, the following steps should help you to integrate it into your project:

  1. Download Bullet. I got it as part of the Oolong Engine source from Google Code.
  2. Open Xcode Preferences, select Source Trees and add one with Setting Name “BULLET_ROOT” and Display Name “Bullet”. Give it the full path to your Bullet folder.
  3. In your Xcode project, CTRL+Click on Classes folder and select Add Group. Give it the name “Bullet”. Then CTRL+Click the Bullet group and select Get Info. Set the Path Type combo box to  ”Relative to Bullet”. The Full Path should show the full directory path for the Bullet folder.
  4. Select Project/Edit Project Settings from the Xcode menu. Search for “header search paths” in the Build tab and add the full path to your Bullet src. Make sure to check the Recursive checkbox. You will need to do this for Debug and Release build configurations.
  5. In your source code, include the relevant bullet header e.g.

    #include "btBulletDynamicsCommon.h"

    will include everything you need for rigid body dynamics.
  6. Check out the Oolong samples to see how to use the physics engine or head over to the Bullet website for more resources.

Hopefully, I haven’t missed anything out but let me know if you spot something incorrect or can’t get it to work.

Update: 21/07/09: One step I forgot to mention was that Bullet is written in C++. You iPhone application class files will default to Objective-C and so won’t be able to compile. You need to CTRL+Click the class file referrencing the btBulletDynamicsCommon.h header file, select Get Info and change its file type to be Objective-C++. That should allow it to compile properly.

Howto: Mount Windows Filesystem on Linux

It can be very useful to access your Windows filesystem on a dualboot computer (one with both Windows and Linux Operating Systems). Here’s how:

  1. Open a Terminal window and create a directory to mount on to:
    $ sudo mkdir /mnt/win
  2. For an NTFS Windows Filesystem:
    $ mount -t ntfs /dev/sda1 /mnt/win
  3. For a FAT32 Windows Filesystem:
    $ mount -t vfat /dev/sda1 /mnt/win
  4. Go to your mounted folder:
    $ cd /mnt/win

Note: Don’t type the leading $, its the prompt. This assumes that your Windows filesystem is the first partition and is called “sda1″. If not, change the relevant command above to point to the right name. Also, if it’s NTFS, it will probably be read only access so you won’t be able to copy files to it. If this is required, it may be a good idea to creat a separate FAT32 partition that would be accessible to both OSs for sharing files.