skip main content

Archive for February, 2009

Experiments in Cocoa #2 TellyBox

posted by Duncan at 3:26 pm on February 23rd, 2009

After my first foray into Cocoa development, which involved Radio, I decided to take what I had learnt and move into TV. Tellybox is the result. It’s a Cocoa desktop app that’s a wrapper for the BBC iPlayer live and catchup service for a day. I’m quite pleased with how it turned out.

[BY THE WAY] This is a personal learning project, and not affiliated with the BBC in any way. It (and I) only use publicly available information, in order to try and inspire people to just build cool stuff. If you think you could do better or have ideas in improving the app, please let me know. I’d love to hear from you.

Download TellyBox via it’s github project page.
TellyBox - A Mac app that lets you watch the telly

Below I’ve briefly noted the various features, and what areas of Cocoa I had to learn to implement them. I ‘ve added a long list of resources at the bottom, which have and continue to, prove very useful when developing in Cocoa.

1. Select your Favourite Station – You can select which channel you’d like to watch from the Watch menu. This involves reading in some .plist configuration data and displaying it in an NSMenu. The menu is drawn with code, and once understood, meant building and manipulating all the other menus was a breeze.

Tellybox station selection

2. Choose your viewing size – You can choose from a list of 5 sizes to view from. These sizes can be chosen from the View menu or the shortcuts 1-5. This sizes as well as the location of the display window are remembered when you quit the application. The resizing is using NSWindows setFrame:display:animate: to make it look pretty and is using NSUserdefaults to manage the remembering of the size and origin of the window.

Tellybox viewing sizes

3. The day schedule – Here you get a list of what’s on the day you are watching, and what is available to watch again. It also marks where you are in that day. I still need to work on updating this schedules as currently it only loads when you first start viewing, so won’t change automatically over time. The schedule data comes from BBC Programmes via XML and is parsed using NSXMLDocument. It uses the same caching policy as the BBC site.

Tellybox schedule

4. Growl Support – The app has Growl Notification support. If you have growl installed you will get notifications about what you’re watching. This was implemented with the growl documentation and uses the Growl Application Bridge.

Growl Support

5. Preferences – You can change a few preferences at the moment. One is the default Network that gets shown when you start the application. The other is whether you would like to receive automatic updates and how often you would like to check whether they’re available. The former uses NSUserdefaults and Cocoa Bindings. The latter uses the popular and amazing Sparkle update framework.

Tellybox - Preferences

Here’s a list of useful resources I’ve used to get to this point:

Finally a few things that don’t work so well. Well one at the moment really, and that’s guidance. I haven’t quite worked out how to get the iPlayer guidance stuff working in Tellybox, which means if the show you want to watch again has a guidance rating then the only way you can watch it, is to go to the web version. I’ll keep trying though.

I think that’s it. Hope you like it. I’m really enjoying Cocoa development at the moment and look forward to my next personal project.

Rubber Faced Freaks

posted by Duncan at 10:23 pm on February 5th, 2009

Looking through my photos I re-found a group I created at the beginning of 2006 called ‘Rubber Faced Freaks‘. It was created after some photos friends and I took one holiday. Loads of new people have joined! and have added their own funny photos.

If you want a good laugh it’s worth a look, and maybe add you own.

Rubber faced freaksMy mother must be so proud…

Oh, and the instructions, should you feel the need:

  1. Relax your face
  2. Hold your camera in front of your face
  3. Shake your head left and right
  4. Take the photo
  5. Admire

Deploying WordPress to SliceHost using Capistrano and Git

posted by Duncan at 12:00 pm on February 1st, 2009

Skip straight to the how-to if you don’t care about an introduction.

This post has been in my drafts folder for about 6 months, and I intended to be much more detailed, but I don’t think I’m gonna ever get round to it, so here is the shortened version.

I did a post a while back on how to deploy WordPress to TextDrive using Capistrano, which people seemed to find useful. I still use WordPress, and I still find Capistrano perfect for deployment in this situation. They’re the only two constants though, as I have now changed hosts, changed source control systems, oh and Capistrano has jumped up a major release and many minor releases, so the interface is slightly different.

I moved over to SliceHost because I wanted the control that virtual hosting gives you, and those guys are cheap, as well as having an awesome service thus far.

The actual installation of Apache, MySQL and PHP is quite simple through YUM and well documented via the Slicehost support area so I won’t repeat this. I also moved over to Git a while back, after researching distributed source control systems, and playing with Mercurial for a while. Git just seemed to tick more boxes for my current needs both at work, and home play.

1. Assumptions

I have based the post on the fact I choose to put all the sites I deploy in a my home directory. Some other assumptions are:

  • You have Apache, MySQL and PHP installed
  • You have an account on the machine with sudo access
  • You have a Git installed on the machine you will be deploying from

Now you need to organise your wordpress source into this structure:

README
Capfile
public/
    + index.php
    + wp-admin/
    + wp-xxxx
     etc ....

2. Configure Capistrano

You can download my basic Capfile that should help get you started. The only things you will need to change are :domain and :user. For example, for my site I may use:

set :domain, "whomwah.com"
set :user, "websites"

This would mean that I can normally access my server using:

ssh websites@whomwah.com

3. Initialise your Git repo

I kind of expect you to have already done this, but if you haven’t, change into the root directory (The one with the Capfile in it) and run:

git init
git add .
git commit -a -m 'initial import into Git'

4. Deploy

You should now have enough initial information to let Capistrano deploy WP to your server. First though, you need to run the Capistrano setup command to stick a bunch of folders on your server ready to hold your site. This is a good test command too as it lets you know if you have setup your :domain and :user ok.

cap deploy:setup

If that went ok, then you can now run the mighty:

cap deploy

That’s it! you should now have your blog deploying to your server.

5. Apache setup

All you need to do now is setup Apache to point to the folder. You can use this vhost file. Rename it and edit it’s contents to suit your site, then stick it in your

/etc/httpd/conf.d/

folder. Restart Apache:

sudo /sbin/services httpd restart

Now browse to your sites url and to the admin area and setup your blog as per the WordPress instructions. Best of luck!


back to the top