Category: Macs

One of the first posts I wrote for this blog, back in 2007, was about how to write and compile C programs using Mac OS X. That post was a result of me doing C programming in my first year of university, and since then plenty of things have changed. Not only have I finished university, but the basic procedure for installing Xcode has changed as well.

I thought I’d write a new tutorial updated for the more recent versions of OS X.

  1. Install Xcode from the Mac App Store
  2. Install the extra Command Line Tools from within Xcode by navigating to Xcode > Preferences > Downloads
  3. Create a new Xcode project by navigation to File > New > Project
  4. From the template list, under OS X, select Command Line Tool and choose Next
  5. Fill out the required forms, and under Type choose C
  6. Save the project to your computer
  7. Open main.c and write!

It’s possible that by default the toolbar won’t be shown to click Compile + Run, so you can press Cmd+R to do that directly.

The method in the original post continue to work, as long as Xcode installed as described above. Comments on that post provide additional information, like this one from mvdhoef:

instead of resorting to the default a.out you can use gcc the way it was meant to be used!!!
…………………….
gcc -o -Wall name file.c
…………………….
where name is the name of the program gcc will create,
file.c is the file and perhaps extension of the code you have created.

-o is to open new/rewrite in this case name (*if name already existed, it would overwrite without a second thought)
-Wall is another option which tells gcc to show all errors it encounters during compiling. (*this is optional)

Don’t forget to slack off while your code is compiling.

Tagged with: , ,

Earlier I wrote an Applescript that goes online to TV.com and finds the episode titles for TV show video files. While that seemed to work properly, TV.com changed their format and my Applescript went kaput. Since I really wanted to have this process automated, I wrote a bash script to do the same thing with the command line.

The result is a Ubuntu bash script that renames all the formatted files in a folder with the actual episode titles. Right now it requires Linux because it uses wget and XMLStarlet to download the file data, but I may release an additional script that works with other systems.

The entire script is made possible by the excellent XML feed service by TVRage.com.

Download the script

Prerequisite

XMLStarlet
XMLStarlet is a small command-line utility that can process XML files and text. It is required to traverse the XML structure of the TVRage.com data. To download this utility in Ubuntu, simply use the repositories.

sudo apt-get install xmlstarlet

Usage

Change paths where appropriate.

  1. Save the script to a known folder, change into that folder, and make it executable by issuing the following command
    chmod a+x ./tvrenamer.sh
  2. Change the current directory to the folder that contains the video files.
    cd Television/Season\ 1
  3. Rename all the files in the folder to use the format SxxExx.extension
    S08E01.avi
    S08E02.avi
    S08E03.avi
    S08E04.avi
    S08E05.avi
    S08E06.avi
    S08E07.avi
    S08E08.avi
    S08E09.avi
    S08E10.avi
  4. Call the script and append the name of the show to the end of the command.
    /path/to/script/tvrenamer.sh Simpsons
  5. Watch as the shows all magically change their name.
    Downloading show data for 'Simpsons'...
    Downloading episode guide...
    Simpsons - S08E01 - Treehouse of Horror VII.avi
    Simpsons - S08E02 - You Only Move Twice.avi
    Simpsons - S08E03 - The Homer They Fall.avi
    Simpsons - S08E04 - Burns, Baby Burns.avi
    Simpsons - S08E05 - Bart After Dark.avi
    Simpsons - S08E06 - A Milhouse Divided.avi
    Simpsons - S08E07 - Lisa's Date with Density.avi
    Simpsons - S08E08 - Hurricane Neddy.avi
    Simpsons - S08E09 - El Viaje Misterioso de Nuestro Jomer (The Mysterious Voyage of Homer).avi
    Simpsons - S08E10 - The Springfield Files.avi

If you wish to access the script simply by typing the name (tvrenamer, for example) simply issue the following two commands:

cp /path/to/script/tvrenamer.sh /usr/local/bin/tvrenamer
sudo chmod a+x /usr/local/bin/tvrenamer

From this point, you simply need to use tvrenamer "TV Show".

The script reads all files in the folder, but will only rename files that are in the S**E** format. TV show titles must have escaped spaces to properly search for the show, or be surrounded in ” quotes.

Tagged with: , , , ,

aboutSLIt’s now been close to three weeks since Snow Leopard arrived in stores, and the Internet has now had a chance to go through the entire system and find the good, the bad and the barely changed. I’ve been using it since that time too, and like some of the subtle changes. Since Engadget, Gizmodo and even David Pogue have all weighed in with lengthy reviews, I’m going to avoid that here. Instead, I’m going to go through some of the changes I’ve seen and whether I think it’s worth the $35CAN upgrade fee.

This is the first of 3 operating system comparisons. Windows 7 and Ubuntu 9.04 will be up shortly.

The Improvements

I was pleasantly surprised at how easy it was to upgrade my MacBook from 10.5 to 10.6. I inserted the DVD while logged in, the menubar and Dock faded away and I returned 50 minutes later to my original desktop. There were options for installing additional languages, printers or Rosetta, but the default installation seems to provide all the required data, with the notable exception of Rosetta. If you still run PPC based applications, be sure to click that checkbox.

animatedwifiAfter it was installed, I took a look around and found very few changes to the interface. Sure, Stacks can now scroll when using the tile arrangement, and some menubars have more function, but by and large, the upgrade is behind the scenes. The Airport menu is slightly animated when not connected to a network, as shown on the left. Doing an option+click on the menu items now brings up a condensed system preference panel with the most important functions front and centre. The Sound menu item brings what is probably the most convenient small update, with the ability to choose the audio input and output on the computer with entering System Preferences.

Snow Leopard also seems to change the behaviour of computers exiting from sleep as well. On my MacBook, sleeping the computer for an extended period of time (about 2 hours or so) sometimes causes it to go into deep-sleep mode. That means when it wakes again, you must load the contents of RAM from the hard drive, which can take an extra 30 seconds or so. I’ve yet to determine if this is a change to the OS itself, or simply a flaw with my computer.

Ideal customer

Apple has taken a new strategy here with Snow Leopard. By keeping the interface familiar and improving the underlying technology, they allow users to gain familiarity with the software. As a $35 CAN upgrade, it is easy to recommend, but for regular users of Leopard who use their computer more for email and web than pushing the boundary of computing, it’s probably not all that necessary.

Interestingly, I think Snow Leopard works better as an upgrade for those users still running pre-Leopard installations. As a move from Tiger, or even Panther, SL offers many new features that make computing much, much easier. I’m excited about the new applications that will be released shortly that take advantage of this new technology — it just looks like I’ll have to get a new computer to fully use all the new tools.

Tagged with: , , , , ,

Not much comes close to setting the interwebs ablaze than an Apple keynote. Fanboys everywhere were glued to their computer screens yesterday to learn what new things would come out of Cupertino this summer. While the WWDC is a developer’s conference, there were many intriguing announcements that are of interest to the general Mac-using public.

Here are some of the big points from the keynote yesterday:

iPhone 3G S
The iPhone 3G — and, it could be argued, the iPod Touch — have been fairly revolutionary for mobile computing. Apple tries to continue that with the iPhone 3G S, which they are touting as the most powerful iPhone yet. According to the keynote, nearly all the standard operations done on the phone are faster and more responsive. Things like launching messages, webpages and basic applications all seem to be quicker. Hardware wise, a new 3 megapixel, autofocusing camera makes an appearance, which even includes video recording. Hardware encryption and voice recording were also added.

Prices vary by carrier, naturally, but Apple’s price is $199USD for 16GB storage, and 32GB goes for $299USD. Is it worth it? While I don’t use an iPhone myself, I think the benefits over the iPhone 3G are subtle, but if you jumped in with the original iPhone, or have even held off purchasing the phone since the beginning, now is certainly a great time to join the party.

iPhone OS 3.0
The big deal of the keynote was more detail about the iPhone 3.0 software. Since the entire convention is for developers, most of the announcements were for the SDK included in the new software. The biggest news is that the new software includes support for copy and paste right on the phone. Additionally, landscape mode has been added to multiple applications, Find My iPhone and an undo function have been added. The latter is available just by shaking the phone — sort of like an Etch-A-Sketch function, and Find My iPhone is a feature of MobileMe that enables users to track their phone should they lose it, and optionally wipe the data remotely should it be stolen.

Phil Schiller and Scott Forstall (those taking Steve Jobs’ place presenting the keynote) had a few digs at AT&T about functions added to iPhone 3.0, that may not be available from AT&T until later. Tethering is a feature many people have asked for, now that most phones are connected to the internet with a speed almost equal to a home DSL line. It is a way of connecting the phone to a computer through USB or Bluetooth so that the phone can be used as a modem to get the computer online. The other jab at the American provider was that multimedia messaging service won’t be able to share your photos, videos and sounds with other people until later in the summer. This feature, which is available on nearly every other handset in the world, will finally bring the iPhone on part with what can be considered an essential service.


New MacBook Pros
In what I thought was a somewhat unusual move, Apple announced that the 13″ aluminum MacBook would now be a MacBook Pro, making the white polycarbonate model the only remaining MacBook. Besides the natural speed increases, the hardware changes made to the whole line were SD card slots instead of ExpressCard and a new, longer-lasting internal battery that cannot be removed. The battery situation is one I think may see some strong opposition. For a computer that is a “pro machine”, where the user is in the field for a long time, the inability to swap out a battery and get another 4 hours could be frustrating. The fact that all the previous MacBooks could have batteries swapped while the computer is sleeping means that with enough batteries, users can work continuously. Fortunately, though, I think that the power and design of the computers mean that the batteries may be an afterthought.

Snow Leopard
My personal favourite announcement of the keynote was the announcements about the newest Cupertino cat, Snow Leopard. As previously shown, Snow Leopard foregoes hundreds of new features in favour of making OS X faster, smaller, more efficient and more stable. The big news was the addition of technology to take advantage of multi-core processors and advanced GPUs. Grand Central Dispatch makes it very easy for developers to use every ounce of power from advanced Intel CPUs. This is because early versions of OS X were not optimized for multithreading, preventing software from using all available horsepower. To take advantage of GPUs, Apple has spearheaded an initiative to create a new language that threads operations in a way that GPUs can handle. Best of all, nearly all the major manufacturers have jumped on board.

Breaking from tradition, Apple has decided that this new upgrade should be available for $29USD for Leopard users, making it the cheapest 10.x upgrade yet. A family pack for 5 users will be available for $49USD, which is a full $150 off the Leopard price. If a value pack is available with a Snow Leopard license, iLife 09 and iWork 09 for ~$100, I know where I’ll be when it’s available in September.

As we’ve come to expect from Apple’s keynotes, a wide array of new products and services will be available from Apple this summer, making it yet another exciting time to be a fan of the fruit company.

Tagged with: , , , , ,

I think something might be wrong. Let’s hope actually finding something on the computer takes less time.

For the record, 124,392 hours is the equivalent to 14 years, 2 months, 12 days and 10 hours.

Tagged with: , ,