Bed's Stuff - Articles in Tech Talk category

Windows 7 vs OSX Leopard

For nearly the last year I've been using my Mac Book Pro with OSX Leopard as my primary operating system, which replaced years and years of Windows XP. I still had to run XP for work development, which I did in a virtual machine. A few months ago I had to move the VM to Vista to help ensure our application compatibility. So now the Windows 7 public beta was available, I decided to try it out as my work VM. Of course I have a handy backup of my old Vista VM - just in case. However after a week of use, I don't think I'll need the backup. Windows 7 should really be called Vista SP2 and it optimises and polishes off the Vista core. In-fact I would say now that Windows 7 finally catches up to OSX, in terms of being a polished, good looking, efficient, practical modern operating system. Having said that, I will not be moving back to the windows platform as my primary operating system any time soon. I really prefer OSX, and here's why...

Font Rendering

When I first moved to Macs, I thought "everything looks better, text is easier to read without straining my eyes". So I googled and found that there's a ideological difference with how Microsoft and Apple go about rendering their fonts. To get a clear understanding of the differences see "Font smoothing, anti-aliasing, and sub-pixel rendering". Personally, after over ten years of viewing fonts the Microsoft way, it took less than a month to become used to and much prefer Apple's way.

fonts

Task Management

Finally, Microsoft have realised the advantage of a combined application launcher and switcher. The new taskbar acts very much like the Dock now - and personally I think this is a great thing. Icons stay in the same place. Apple dock gives a dot under or next to running applications, while the TaskBar draws a box around running applications. Microsoft have this new 'jumplist' feature - but this has always been present with the Dock by right clicking the app icon to access application specific functionality. However the OSX dock can contain 'stacks', or folders. Just drop a directory on it and you've got an easy menu heirachy, this is not possible with the new windows 7 taskbar.

OSX Dock

Windows 7 taskbar

As for switching tasks, on the OSX side you have exposé, which will display all windows so you can …

Read More

Turning a protected RTSP stream into an iTunes PodCast (with linux and OSX)

A friend of mine does a radio show interstate that interestsme. Unfortunately, being a late night show (midnight) and interstate, for me to listen to this live would require me being awake a t 4am or so. Due to record label copyright permissions, this show is not available as a podcast download - its only available for live or delayed streaming. Undeterred, I wanted to automatically grab the stream and make it available on my iPhone for listening when it suited me, while out and about.

Getting the stream as a file with linux

The availability of the delayed stream, means this problem can be tackled with a cronjob on my gentoo linux server. This particular stream is served with the Real Time Streaming Protocol which means all we really need is the live555 media libraries. For Gentoo this was as easy as issuing "emerge live" as root on the commandline. For Ubuntu this would be "apt-get install liblivemedia-utils".

Then its as simple as calling openRTSP with the stream url. ie:

openRTSP -4 -a -t -d 3900 rtsp://streaming.server.com.au:80/streaming.server.com.au/name.mp4 1>name.mp4

This will write the audio stream  as a file.

The next step is to automate this process with a script being launched by cron. In this case, the name of the stream is in the format radioshow_YY_MM_DD.mp4. So my script will grab today's stream.
radioshow.sh:

1
2
3
#!/bin/sh
filename="radioshow_"`eval date +%Y-%m-%d`".mp4"
openRTSP -a -t -4 -d 7300 rtsp://streaming.server.com.au:80/streaming.server.com.au/$filename > /mnt/download/radioshow/$filename

Since this show is a weekly one, my crontab is setup to download the stream at 1:30pm every thursday.

crontab line: #download behind the mirror every thursday at 1:30pm 30 13 * * 4 /home/bed/radioshow.sh

Converting to a PodCast with OSX

Once we have the files, I wanted to put it in my iTunes library flagged as a PodCast. A commandline tool AtomicParsley enables us to set the appropriate mp4 tags so iTunes sees the file as a PodCast, however AtomicParsley doesn't like the mp4 tags created by openRTSP. To get around this we can load our file in QuickTime, and then re-export it to mp4. This will now be a file with mp4 tags that AtomicParsley can modify. We can then execute the following …

Read More

Backing up an OSX profile to a linux server with rsync

TimeMachine is some nice software, but its overkill for me. I've previously written about this and how I put together a rsync solution and why I did so. In the case that anyone might be interested in doing the same, here is my setup.

Linux Server
I have a gentoo linux server, but this should be a mostly generic rsync server setup. My rsyncd.conf looks like this

# /etc/rsyncd.conf
# This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid
use chroot = yes
read only = no
uid = bed
gid = bed
hosts allow = 192.168.42.0/24

[bed-backup]
    path=/mnt/backup/bed
    comment = Beds Backup

and of course rsyncd is in my /etc/init.d and starts automatically at boot.

OSX

I have a simple bash script that I can run that will backup the contents of my home directory, called backup_bed.sh. This will turn sleep off, make sure the network is available (as the machine may have been woken from sleep) and then do the backup.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
#Bed's rsync backup script

echo `date` Beds Backup > last_backup.log
echo `date` ------------- >> last_backup.log
echo `date` Script Starting at `date` >> last_backup.log

# turn off system sleep
pmset -a sleep 0 2>&1 >> last_backup.log
echo `date` Turned off sleep >> last_backup.log

echo `date` ------------- >> last_backup.log

# wait for network to show up
pingcount=0
trycount=1
failflag=0
while [ $pingcount -eq 0 ]
do
    echo `date` Waiting for network... $trycount >> last_backup.log
    pingcount=$(/sbin/ping -c 3 -o bedentoo | grep "received" | awk -F',' '{ print $2 }' | awk '{ print $1 }')
    trycount=`expr $trycount + 1`
    if [ $trycount -eq 11 ]
    then
        echo `date` network fail - giving up >> last_backup.log
        failflag=1
        pingcount=-1
    fi
done

if [ $failflag -eq 0 ]
then
        #do rsync
        echo `date` RSync started.  >> last_backup.log
        /usr/bin/rsync -a -x -S -v -v --progress --exclude-from=/Users/bed/scripts/backup_excludes.txt  /Users/bed/ bedentoo::bed-backup 2>&1 >> last_backup.log
        echo `date` RSync finished.  >> last_backup.log
fi

#turn system sleep back on
echo `date` ------------- >> last_backup.log
pmset -a sleep 30 2>&1 >> last_backup.log
echo `date` Turned on sleep for …

Read More

Backups

Before becoming a Mac-convert, my backup procedure was almost non-existent. Every six to twelve months I would burn a CD or DVD with my most important stuff on it. I've been rather lucky that I've never had a hard-drive failure - its happened to most people I know at least once.

After turning to the Apple-Dark-Side they made it too easy. To not do a backup really required effort. Stick a USB drive in, turn on Time Machine... and you have a regular automatic backup procedure.

Of course I didn't want to backup to USB drive. I have my and K's stuff to backup, and an Ubuntu file server with a nice 400GB drive to hold the files (lets not discuss off-site backups, move along...). Now while Time Machine supports backing up to a network drive, they limit it to Apple's own products, or a drive hosted by Mac OSX 10.5. Capitalistic goals aside, there is a very good reason for this. Apple added some extensions to AFP to safely handle network dropouts during the backup process. These extensions are required to safely protect your backups from becoming corrupted.

Now if you are pretty confident that your network isn't going to drop out during a backup, you can configure Time Machine to allow an unsupported network drive, and backup to your SMB shared network drive. Easy. So thats what I did.

This has worked flawlessly with K's iMac. My MacBookPro however, was more complicated. Because its a laptop, I often run on wireless when I'm downstairs in-front of the tv. When I go upstairs, I'll plug in the Ethernet for optimal speed and turn off wireless. Of course I never paid attention to see if Time Machine was currently working when I did this. It was often running and every so often I would corrupt my backup sparseBundle and had to start all over again.

So I finally gave up on Time Machine for my laptop. I still wanted the automated backup however - but I don't care about incremental backups, I've never (famous last words maybe...) wanted to go back to a previous version of a file. I just care that the current version is backed up in-case my drive dies.

This is where I love that the best computer UI is built on-top of the best OS core... unix. A simple installation of rsync on my Ubuntu file server …

Read More

About

Andrew Bednarz - otherwise known as Bed, is a Technical Director at Shadowboxer. Husband. Father. Nerd. Former and occasional software engineer. An optimisitic pessimist 🤘