Posts belonging to Category Uncategorized



Playing a sound file in Quartz composer.

I recently created a quartz composer patch which will play a sound file in a Quartz Composer composition. It is very useful for playing a short sound file for a sound cue to an event or a basically any sound you want to include in a composition.

I created this patch for a toddler’s game in which the screen contains a bunch of objects which the toddler removes by moving the mouse over the objects.  As each object is removed a very short sound file is played to give a audio cue that the object has been saved. It is also used in another animation to play a bubbles sound when fish are swimming by. I do offer it for sale along with support for a very reasonable $2.99.  I made a short YouTube video to give some idea of what is does.  It can be found here available here. It can be purchased here


Objective-C Proper Class init

Proper Objective-C init for classes.

- (id)init;
{
if ((self = [super init]) == nil)
return nil;

[***initialize any necessary code];
return self;
}

SerialChannel channel changing software updated

Recently I updated my SerialChannel and SerialChannelIR applications for EyeTV and Directv.  These new versions provide several new features as well as bug fixes and performance improvements.  SerialChannel now supports cable boxes in addition to Directv.  It also overs a new ethernet connection options which allows a user to change the channel through an ethernet connection.  The latter option allows the Mac to be located in another room away from the directv box without running wires. To get more info go to www.cooldvr.com

Learning C programming with Cocoa

After almost 12 years of C  programming under my belt I often find myself answering questions from people asking me how to get started.  Most will ask what I think is the one single book to read when learning how to program in C or do I need to know C before I learn other C languages such as Objective C and C++.  There are many avenues to learning how to write in C which can often leave a new comer feeling overwhelmed. However, I think there is one approach that works well and provides a step wise approach to learning C.  Oddly enough, it does not envolve learning traditional C directly.  Learn to program in Apple’s Cocoa language and ease into traditional C.

For the most part, there is not one book.  Usually it takes 3 or 4 really good books to get a handle on C programming. Each book provides its own unique aspects to teaching, skipping some topics while covering other in depth.  One of the things that I like about using Cocoa as a starting point is instant gradification.  Using Cocoa(R) Programming for Mac(R) OS X (3rd Edition) as a learning tool can provide the new comer with a good sense of how programming works.

Cocoa is apple’s native way to program for the Mac.  Cocoa utilizes Objective-C as its underlying language.  Objective C is a Object oriented sub set of C much like C++.

While Cocoa is a great language it is almost impossible to be really good at it or any C dialect without knowing C.  So Why learn Cocoa First?  In short Arron Hillagas’s Cocoa Programming on Mac OS X

One of the things you will notice is that there are not a lot of books on Cocoa. However, the completeness of Cocoa(R) Programming for Mac(R) OS X (3rd Edition) and the style of Cocoa makes it easy to learn and deduce.  The Cocoa language is so well done syntactically it is very conducive to teaching and Aaron’s book is it’s perfect complement. In my opinion there is not one single book on any language that is as complete from beginner to intermediate as this book.  When you read the text and follow the examples to the end it will leave you comfortable with the language and wanting to learn more into the intermediate level.  With all that said, there are a few must have books that build on the knowledge learned from Aaron’s book.

If you are interested in learning C through Cocoa here is a list of books I would recommend (In order of learning level). Go here for an easy link to each.

  • Cocoa(R) Programming for Mac(R) OS X (3rd Edition)
  • Learn Cocoa on the Mac (Learn Series)
  • Programming in Objective-C 2.0 (2nd Edition) (Developer’s Library)
  • Learn C on the Mac (Learn Series)
  • Cocoa Programming
  • Connecting EyeTV to DirectTV, Dish Network, Sky and Other Set Top Boxes

    If you are looking to connect your Mac’s EyeTV application to a set top box such as Directv, Dish Network, Sky Boxes or virtually any other box there are several low cost options that make it easy.

    If you have Directv you have two options

    1.  SerialChannel.  SerialChannel provides a reliable and clean installation. It works through a serial or ethernet connection that connects to the usb or data port of your Directv box.

    2.  SerialChannelIR. SerialChannelIR is an Universal IR blaster solution for the mac.  It uses USB-UIRT and an IR blaster cable connected to the front of your box to mimic your box’s remote to change channels.

    Which ever one you choose will provide a seamless channel change from EyeTV to your box.

    If you have Dish Network or virtually any other box use SerialChannelIR.

    If you have a standard Sky digibox, Sky+, Sky HD, Foxtel iQ (but not Foxtel iQ2) or Foxtel Pace 420 you also have two options.

    1.  SerialChannelSky.  SerialChannelSky provides a reliable and clean installation.  It works with Dusky-control hardware to change the channels on your box.

    2.  SerialChannelIR.

    See www.coolDVR.com to get more info.

    Mythv and Pretty File Names For Recordings

    When you record something on mythtv it creates a entry in the database and names the resulting recorded file.  However, if you were to look in the recordings directory you would see that the given name is a bit hard to figure out.  In this post I will show you how to create a directory that holds links to these files with user friendly names.  In Mythbuntu there is a script which does most of the work for us. We’ll then share that directory on a network via SAMBA and NFS

    1.  On your myth box open a terminal window (or ssh into the myth box).

    2.  Change directory to /home/mythtv and create a directory called readable-recordings.

    prompt$ cd /home/mythtv

    prompt$ sudo mkdir readable-recordings

    3.  Change directory to /usr/share/doc/mythtv-backend/contrib and locate the file named mythrename.pl.gz.

    prompt$ cd /usr/share/doc/mythtv-backend/contrib

    Unzip the file:

    prompt$ sudo gunzip /usr/local/bin/mythrename.pl.gz

    Make the file executable:

    prompt$ sudo chmod a+x /usr/local/bin/mythrename.pl

    Move the file decompressed file to /usr/local/bin:

    prompt$ sudo mv /usr/share/doc/mythtv-backend/contrib/mythrename.pl /usr/local/bin



    4.  Run the script with the –link option:

    prompt$ /usr/local/bin/mythrename.pl --link /home/mythtv/readable-recordings

    The files in the readable-recordings directory should be easy to read with the proper episode name and title of the recording.

    5.  Setup the script to run automatically.   This script works great but does not run automatically so we need to schedule it with cron to do this hourly.

    prompt$ sudo nano /etc/crontab

    Create the following entry to run the script every hour:
    0 * * * * /usr/local/bin/mythrename.pl --link /home/mythtv/readable-recordings

    5.  Sharing the readable-recordings. From the MythUbuntu Control Center select services from the right side menu.  You should see options to enable NFS and SAMBA sharing directory.   Then go to the desktop Applications –>System–>Shared Folders.   The shared folders application will appear with functions locked.  Click on the unlock button to allow editing.  Create an entry for the readable-recordings directory for SAMBA and one for NFS.  **Note if you are going to NFS share with a OS X box you will need to edit the /etc/exports file to include the insecure option.

    Restart Samba:

    prompt$ sudo /etc/init.d/samba restart

    Restart NFS

    prompt$ sudo /etc/init.d/nfs-kernel-server restart

    You should now be able to mount the shared file system from the network

    SerialChannelSky Eyetv solution for Sky boxes ready to go.

    For many of you who have emailed me to have SerialChannel support the Sky boxes, SerialChannelSky is complete and can be found on www.cooldvr.com soon. SerialChannelSky uses a usb dusky-control box to control the Sky box.  SerialChannelSky is snow leopard compatible. I would like to thank the developer of dusky-control (dusky-control.com) for his support in making this software possible.  It is his hardware that SerialChannelSky relies on to make the magic happen.  If you have any questions feel free to email me at tomhoh@mac.com

    Finding the right Mouse

    I have never been a connoisseur of input devices. However, recently I had to spend time trying to find something more acceptable. Over the years I have used whatever Apple supplied with their systems. My last few purchases have come with the wireless mighty mouse and I have to say it does not live up to the Apple standard. I currently own three of them and I can say the quality of the mighty mouse is not up to par. In fact one of the mice the middle track ball does not scroll downward (and it is not a preference setting). The mice seem clunky and sluggish and they are very picky about the surface they track on. As a programmer this is very frustrating. I typically have a desk full of opened reference books as well as other items which i use as a mouse pad for which the mighty mouse simply will not track on. I am forced to clean a spot off some where so that the mouse will work. The battery usage on this mouse is also ridiculous. It eats batteries like crazy. This problem is not isolated to only one of them. After dealing with this for well over a year I finally had enough. I recently purchased a logitech mx60 wireless mouse and it is worlds above the mighty mouse. It has a very comfortable feel and tracks on any surface. There is very little lag when it tracks. It also sports a very long battery life enhanced with a small power button of the bottom to make it last even longer. Most reviews for this mouse has been very positive. If you are looking for a good mouse for your mac give this one a try. See the link below.

    The First Blog

    Well here is my attempt to blog my experiences with cooca as well as some general ramblings about programming in general.