<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>KernelCrash &#187; Mac</title>
	<atom:link href="http://www.kernelcrash.com/blog/category/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kernelcrash.com/blog</link>
	<description>the difference that is no difference makes no difference</description>
	<lastBuildDate>Sat, 12 Nov 2011 01:40:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Upgrading to Snow Leopard</title>
		<link>http://www.kernelcrash.com/blog/upgrading-to-snow-leopard/2010/04/27/</link>
		<comments>http://www.kernelcrash.com/blog/upgrading-to-snow-leopard/2010/04/27/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 05:27:26 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/?p=534</guid>
		<description><![CDATA[Yes, I know Snow Leopard has been out for ages, and I did actually purchase the &#8216;real&#8217; install DVD for it some time ago, but well &#8216;Leopard&#8217; seemed to be working fine on my Macbook, and well I&#8217;m very cynical of these claims that &#8216;upgrading is easy and trouble free&#8217;. However, I bought a Hitachi [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, I know Snow Leopard has been out for ages, and I did actually purchase the &#8216;real&#8217; install DVD for it some time ago, but well &#8216;Leopard&#8217; seemed to be working fine on my Macbook, and well I&#8217;m very cynical of these claims that &#8216;upgrading is easy and trouble free&#8217;. However, I bought a Hitachi 5K500.B 500GB drive recently as either an upgrade for the 160GB drive in the macbook or as a replacement for the original 80GB drive in my R60. </p>
<p>Given that I had a new (larger) drive. I thought I&#8217;d play with how well Time Machine and the Migration Assistant work. So as a test I setup a large mount point on a linux box and shared it out using Samba to the Macbook, then did the defaults command below to enable a samba share as a Time Machine destination:</p>
<blockquote>
<pre>defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1</pre>
</blockquote>
<p>I also did the mucking around with hdiutil to create the necessary sparsebundle (if you google for &#8216;TMShowUnsupportedNetworkVolumes hdiutil&#8217; you&#8217;ll find a heap of references). It takes a long time to do the first backup. I then set it to &#8216;manual&#8217; mode so it&#8217;s not doing continual backups. Then I did one last Time Machine backup and shut the Macbook down (running Leopard).</p>
<p>Now I swapped in the 500GB drive. Put in the snow leopard DVD, held down &#8216;c&#8217; and let it boot up off the DVD.  Then formatted the drive, and installed Snow Leopard (I picked a different account name than the one I used on my Leopard install, as Migration Assistant will complain later on if you try to restore into the account you are currently logged in as). Once I had SL installed, I then did a &#8216;connect to server&#8217; in finder to mount my Samba share, then you need to click on the sparsebundle that you see, and your time machine backup should now be mounted. Now you can run &#8216;Migration Assistant&#8217;. Tell it you want to restore from a &#8216;Time Machine&#8217; backup, then you should see your time machine backup to choose, then you get some screen with a few tick boxes and you have to wait while it says &#8216;Calculating&#8217;. I just left everything ticked and let it chug away restoring (it takes some time). Eventually, I just restarted, logged in as the username I used to use and voila it all looked suspiciously like my old Leopard setup.</p>
<p>The first thing I wanted to make sure was working was Mail. I started it up and it gives you some messages saying it needs to re-import everything and away it goes. Now, I use Mail.app as my main mail client, and I have an IMAP server that it connects to. I have some anal security in place for the IMAP server, so when Mail was restarted after the re-import I didn&#8217;t let it connect properly to the IMAP server. I then started going through my Inbox to see whether it looked OK. Everything seemed to be there, but I had a weird problem when I clicked on attachments. They would never load. There&#8217;d be some delay and then a popup highlighting there was a permission problem. This led to much trawling through Apple discussion threads and trying various things, but I could not get attachments to display. I just received that error instead</p>
<p>So I switched back to the original 160GB drive for a while. Then I tried again, clean format of the 500GB drive, installed SL, then this time I upgraded to 10.6.2, then did the Migration Assistant restore. No luck. Still had the same permission problem.</p>
<p>So by this time I was getting frustrated with Snow Leopard, so I thought I&#8217;d try to just put Leopard on the 500GB drive. Rather than use something sane like Carbon Copy Cloner or similar I thought I&#8217;d see how good a full restore from &#8216;Time Machine&#8217; would go onto the 500GB drive. So with the old 160GB drive containing leopard, I did another Time Machine backup to the Samba share, shut down, swapped in the 500GB drive and booted off the Leopard install DVD that came with the macbook. Booted off the DVD, formatted the 500GB drive, then chose the option to restore from backup. This is where I learnt that the Apple install DVDs cannot mount a Samba share (or any kind of smb based share). They can mount a afp share though. So I thought, I&#8217;ll install netatalk on my Debian Lenny server that was running Samba, and just get it to share out the same mount that Samba was sharing. </p>
<p>This is when I discovered that the Debian Lenny version of netatalk cannot deal with encrypted passwords. Guess what OSX will only connect to? Yep, it only connects to a netatalk server that can do encrypted passwords (there is actually a defaults &#8216;switch&#8217; that will allow you to connect to a netatalk user ; defaults write com.apple.AppleShareClient afp_cleartext_allow -bool true, but alas I could not get that to work from the shell environment offered on the install DVD), so then I ended up recompiling netatalk on Debian Lenny to handle encrypted passwords, which goes somehting like this;</p>
<blockquote>
<pre>$ sudo apt-get install libdb-dev
$ sudo apt-get install cdbs
$ sudo apt-get install libcrack2-dev
$ sudo apt-get install dh-buildinfo

$ cd debtmp
$ mkdir debtmp
$ sudo apt-get source netatalk
$ sudo apt-get install libcups2-dev
$ sudo apt-get build-dep netatalk
$ cd netatalk-2.0.3
$ sudo DEB_BUILD_OPTIONS=openssl fakeroot debian/rules binary
$ sudo dpkg -i ../netatalk_2.0.3-11+lenny1_amd64.deb

sudo afppasswd -ac
sudo afppasswd myuser</pre>
</blockquote>
<p>You might need to tweak some of the other files under /etc/netatalk too. </p>
<p>OK, so now using the notes on mounting <a href="http://veys.com/2009/08/16/restoring-from-a-samba-based-time-machine-backup-kinda/">here</a>; I could mount my Time Machine backup from the Leopard install DVD;</p>
<blockquote>
<pre>mkdir /Volumes/tmachine
mount -t afp afp://username:password@server.hostname/tmachine /Volumes/tmachine
</pre>
</blockquote>
<p>So then I kicked off my restore. Maybe 5 or 10 mins later the restore had encountered an error. I honestly can&#8217;t remember what it was. The discussion threads I found when googling for the error hinted that it has something to do with using the wrong install DVD (ie. one that came with a different Mac). I was definitely using the DVD that came with my Macbook, but I thought since I had the Snow Leopard DVD as well, then surely a full restore of a Leopard backup using the Snow Leopard boot DVD would end up with a Leopard system. So I did that, mounted the afp share OK, then started the restore &#8230; which continued just fine. Odd.</p>
<p>So that chugged away, and eventually I had a Leopard system on a bigger drive. I opened Mail.app, and again it said it needed to reimport Mail (just like for Snow Leopard). It chugged away for a bit, and then I had my Inbox open and it looked intact. I then found some of the messages with attachments I had had trouble with before and tried to open them. Instead of getting a permission error, I received no message at all &#8230; and in fact nothing happened (ie. my attachment still did not display). Hmmmm. Odd.  It&#8217;s about now that I somehow realised that by blocking access to my IMAP server, I was preventing it from grabbing the attachment. This is probably obvious, but I imagine that Mail.app downloads attachment when you first click on them, and then caches them in the ~/Library/Mail\ Downloads directory, so that normally you&#8217;d be viewing the cached copy. However, I know that Time Machine ignores most cache directories in order to save space &#8230; so after my &#8216;fresh&#8217; install plus restore, the cache directory was empty. I guess I was able to confirm my theory quickly by simply allowing my connection to my IMAP server to work (I noticed after I did this that there is a lot of activity in the &#8216;Activity&#8217; window regarding caching etc.)</p>
<p>So after all that hoopla about Mail attachments, I thought I&#8217;ll reinstall Snow Leopard again. So same deal as before; boot off the SL DVD, format the 500GB drive, let it install SL, get it booted, perhaps upgrade to 10.6.3 or whatever, then use the Migration Assistant to restore from my Time Machine backup. This time when I ran Mail.app I let it connect to my IMAP server, and attachments worked as expected. All good</p>
<p>Apart from my funny Mail.app issue (which was sort of my fault), I was quite impressed with the whole Time Machine backup/restore. I am often asked by family or friends about &#8216;backing up their Windows PC&#8217;, and well there are a bunch of ways to back things up &#8230; but I always think a backup is only as good as your ability to restore it. My thoughts were that I could probably talk someone through doing a full restore of a Mac using a Time Machine backup &#8230; over the phone (maybe not from my convoluted AFP/Samba shared Time Machine server, but from a local USB drive). I am sure there are Windows products that claim to do something similar, but an enticing thing is that Time Machine is pretty much supported &#8216;out of the box&#8217;. </p>
<p>My upgrade was not all good. I have several vmware fusion guests on my Macbook, and when these were restored on the 500GB drive, all of them seemed to have very scary filesystem errors (the ones you get when there&#8217;s been some serious corruption). I thought maybe this was to do with Time Machine, but I ended up using my crazy rsync backups to restore from as well &#8230; and I still had the same filesystem errors. In the end, I booted back up off the 160GB drive in the macbook, and went through every Vmware guest and told them to power down (pretty much all of them were just &#8216;suspended&#8217;), then I did my rsync backup again, and restored them with the 500GB drive inside. And now they all work and have no filesystem errors. Obviously there is some strange inconsistency that occurs with the guest &#8216;state&#8217; information during the upgrade to Snow Leopard.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/upgrading-to-snow-leopard/2010/04/27/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Macbook memory upgrade</title>
		<link>http://www.kernelcrash.com/blog/macbook-memory-upgrade/2009/04/01/</link>
		<comments>http://www.kernelcrash.com/blog/macbook-memory-upgrade/2009/04/01/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 01:21:06 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/?p=226</guid>
		<description><![CDATA[Well, I recently decided to upgrade my Macbook to 4GB of RAM. I can get by with just 2GB, but I had an excuse to spend some money before March 31. Anyway, I thought I did the right thing. I bought some Hynix RAM. I keep reading forum posts about Apple using Hynix in most [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I recently decided to upgrade my Macbook to 4GB of RAM. I can get by with just 2GB, but I had an excuse to spend some money before March 31. Anyway, I thought I did the right thing. I bought some Hynix RAM. I keep reading forum posts about Apple using Hynix in most of their machines (and indeed the existing RAM in my Macbook was Hynix brand). I also knew that the Penryn Macbook I have takes DDR2-667 SODIMMs. But I went and searched online and was going to buy some Hynix 2GB DDR2-667 SODIMMs from an online retailer, when I noticed that they also had &#8220;Hynix 2GB DDR2-800 SODIMMs &#8216;for Mac&#8217;&#8221;. Those words &#8216;for Mac&#8217; are compelling when you know from past experience that laptops can be very fickle when it comes to RAM.</p>
<p>So I bought the Hynix DDR2-800 memory. I put it in and my poor Macbook would not boot at all. I put the old 1GB DDR2-667 SODIMMs back in and it worked again. Then I tried one of the old 1GB DDR2-667 SODIMMs and one of the new 2GB DDR2-800 modules and it booted up and worked fine. I also tried the other 2GB DDR2-800 modul with one of the old 1GB DDR2-667 modules and it also worked. In both cases the &#8216;About this Mac&#8217; screen also said it had 3GB of RAM.</p>
<p>So I trawled google and the general view is that Penryn Macbooks cannot use two DDR2-800 SODIMMs. They can use one DDR2-667 and one DDR2-800 SODIMM, but somehow the chipset does not want to play if two DDR2-800&#8242;s are inserted. Grrrrr.</p>
<p>So I&#8217;ve returned the memory, and I bought some Kingston memory (the 4GB kit ; KTA-MB667K2/4G )  instead which even the Kingston site says is the right memory for my Macbook. And suffice to say the new memory works perfectly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/macbook-memory-upgrade/2009/04/01/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mailtags</title>
		<link>http://www.kernelcrash.com/blog/mailtags/2009/03/26/</link>
		<comments>http://www.kernelcrash.com/blog/mailtags/2009/03/26/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 03:52:08 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/?p=213</guid>
		<description><![CDATA[As part of my effort to practice &#8216;Gettings Things Done&#8216; I bought the Mailtags plugin for Mail.app. Of course, my GTD efforts are wavering a bit as the year progresses, but there are some things about Mailtags that are quite novel. A lot of people told me &#8220;You should get blahblah GTD app to do [...]]]></description>
			<content:encoded><![CDATA[<p>As part of my effort to practice &#8216;<a href="http://www.davidco.com">Gettings Things Done</a>&#8216; I bought the <a href="http://www.indev.ca/MailTags.html">Mailtags</a> plugin for Mail.app. Of course, my GTD efforts are wavering a bit as the year progresses, but there are some things about Mailtags that are quite novel. A lot of people told me &#8220;You should get blahblah GTD app to do GTD properly&#8221; (eg. Omnifocus, iGTD or one of the others). I&#8217;m a bit hesitant to just get dependent on &#8216;yet another app&#8217;, and I spend a lot of time looking at email, so I thought &#8216;why can&#8217;t i get Mail.app to help me do my GTD stuff&#8217;</p>
<p>Mail.app has a few interesting features out of the box that are quite helpful like being able to write arbitrary Notes or ToDos that end up in your inbox somewhere. I don&#8217;t use the todos, but I do like the Notes. I feel more confident that I&#8217;ll find a note later if I write it in Mail.app than if I just write a little text file and leave it somewhere in my home directory. Sure there is spotlight to help find stuff, but Notes in Mail.app are effectively right in front of you &#8230; and you can have them appear in your Inbox if you need a more visual reminder.</p>
<p>So what does mailtags do that I like? These are the main things for me;</p>
<ul>
<li>It&#8217;s easier to highlight messages with a colour. Mail.app can already do this, so long as you have a mail rule doing it, but sometimes you just  want to make a message &#8216;stand out&#8217;</li>
<li>You can have a &#8216;Keywords&#8217; column in the main message list and that can show @Followup, @Action, etc (you can add user defined ones, but the basic ones are like GTD)</li>
<li>You can attach arbitrary notes to a message and use them to change the subject of a message in the message list. Its such a weird thing to want to change the subject of a message, but I find it quite useful. Usually I use it to write in the next action for a task. For example, I get an email in from a client asking &#8216;Can you confirm next Monday to see if we&#8217;ll go ahead with the outage&#8217;. Now I could get off my arse and add an entry to my calendar, but for some reason I just change the subject to [ Confirm with Peter on Monday 23rd] (and I actually put the square brackets in to signify to me that the subject is changed &#8230; even though Mailtags changes the subject to italics anyway). The attached notes actually &#8216;stick&#8217; to a mail thread, so if I reply to the email in question, then get another reply back, the note is attached to the new reply as well.</li>
</ul>
<p>The main downside of Mailtags is the cost. I ummed and arrred for quite some time before spending the US$30 on it. Here in NZ thats quite a bit. But in the end it&#8217;s quite useful</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/mailtags/2009/03/26/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding another id_rsa key in Leopard</title>
		<link>http://www.kernelcrash.com/blog/adding-another-id_rsa-key-in-leopard/2009/03/19/</link>
		<comments>http://www.kernelcrash.com/blog/adding-another-id_rsa-key-in-leopard/2009/03/19/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 04:04:30 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/?p=204</guid>
		<description><![CDATA[Just a quick tip. If you use more than one id_rsa key for sshing around the place, you can add the second key into your keychain with something like: ssh-add -K ~/.ssh/my_other_key Be careful if you have the macports version of openssh installed as well. The -K option is specific to Apple&#8217;s ssh-add. Dave Dribin&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick tip. If you use more than one id_rsa key for sshing around the place, you can add the second key into your keychain with something like:</p>
<p>ssh-add -K ~/.ssh/my_other_key</p>
<p>Be careful if you have the macports version of openssh installed as well. The -K option is specific to Apple&#8217;s ssh-add.</p>
<p><a href="http://www.dribin.org/dave/blog/archives/2007/11/28/ssh_agent_leopard/">Dave Dribin&#8217;s blog</a> has a decent discussion about the weird ssh-agent stuff that goes on in Leopard. Mostly I find it annoying, but I suppose Leopard is trying to be helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/adding-another-id_rsa-key-in-leopard/2009/03/19/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating from Thunderbird to Mail.app</title>
		<link>http://www.kernelcrash.com/blog/migrating-from-thunderbird-to-mailapp/2009/01/23/</link>
		<comments>http://www.kernelcrash.com/blog/migrating-from-thunderbird-to-mailapp/2009/01/23/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 20:12:14 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/?p=112</guid>
		<description><![CDATA[After several years of using Thunderbird as my email client, I thought I&#8217;d try moving to the native Mail.app on the Mac. There&#8217;s nothing particularly wrong with Thunderbird, but it&#8217;s 2009 and I&#8217;d like to change. If I were to point to one thing in Thunderbird that annoys me, it would be the slowness of [...]]]></description>
			<content:encoded><![CDATA[<p>After several years of using Thunderbird as my email client, I thought I&#8217;d try moving to the native Mail.app on the Mac. There&#8217;s nothing particularly wrong with Thunderbird, but it&#8217;s 2009 and I&#8217;d like to change. If I were to point to one thing in Thunderbird that annoys me, it would be the slowness of full text searching when you have thousands of messages. In contrast, using Spotlight to search for mail in Mail.app is very fast.</p>
<p>I&#8217;ve also switched from using POP3 to IMAP. I run my own mail server, and in the past it was just easier to run a POP3 server &#8230; and it also kept the disk usage down on my server. However, I&#8217;ve always wanted to try IMAP, but was put off by the idea that IMAP clients needed to be connected to a server to be fully functional. Maybe I was wrong, but Mail.app doesn&#8217;t seem to have any issues with being disconnected.</p>
<p>It hasn&#8217;t been plain sailing so far. I had a fair bit of trouble setting up <a href="http://www.dovecot.org/">dovecot</a> to work right. I also converted from old mbox mailboxes to Maildir ones to try and increase performance when the inbox becomes larger (I&#8217;m actually starting with an empty remote inbox &#8230; and just importing the old Inbox from thunderbord as a local folder).</p>
<p>For dovecot I needed to<a href="http://www.jucktmich.net/?p=18"> follow these notes about dovecot and Mail.app</a>. And then I also discovered the problem of incompatible mbox files from Thunderbird (the symptom being that only part of a thunderbird folder would import). There is <a href="http://www.macosxhints.com/article.php?story=20040609231712503">a python script for fixing thunderbird mbox files</a> so they&#8217;ll import into Mail.app without issue (the clean_moz ref in that post). I also had some strange problems regarding the IMAP prefix. It seems a  lot of people get these messages. I just deleted everything and started again. It&#8217;s been fine since.</p>
<p>I&#8217;m now up to a week since I migrated. Everything seems to work OK. The main issues/points being;</p>
<ul>
<li>If you have multiple identities and you create a New message, the Sender and Signature aren&#8217;t linked. I have to keep on updating these drop downs.</li>
<li><span style="text-decoration: line-through;">If I want to search all my mail I seem to have to use spotlight. The search box in Mail.app seems to only search the folder you&#8217;re looking at &#8230; unless I&#8217;m missing something</span>. (Update: looks like I hadn&#8217;t waited long enough for the all the indexing to take place)</li>
<li>I have 50000+ messages in various folders and using Spotlight to search them all is fast.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/migrating-from-thunderbird-to-mailapp/2009/01/23/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shut up Alex</title>
		<link>http://www.kernelcrash.com/blog/shut-up-alex/2009/01/21/</link>
		<comments>http://www.kernelcrash.com/blog/shut-up-alex/2009/01/21/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 01:41:06 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/?p=115</guid>
		<description><![CDATA[Since getting the macbook I&#8217;ve been using iChat as my jabber client. It works fine. I&#8217;ve also turned on text-to-speech using the Alex voice for when new messages come in to a chatroom. I find I can then &#8216;listen in&#8217; on chatroom discussions without having to have the chat window visible anywere. And the &#8216;Alex&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>Since getting the macbook I&#8217;ve been using iChat as my jabber client. It works fine. I&#8217;ve also turned on text-to-speech using the Alex voice for when new messages come in to a chatroom. I find I can then &#8216;listen in&#8217; on chatroom discussions without having to have the chat window visible anywere. And the &#8216;Alex&#8217; voice is such a major improvement over most computerised voices &#8230; that it doesn&#8217;t end up irritating me (however, it would be nice if Leopard came with a female equiv. of Alex, or some non-American accents).</p>
<p>Anyway, having &#8216;Alex&#8217; chattering away is fine most of the time, but whenever someone posts a URL into a chatroom it becomes very irritating when Alex decides to spell out the whole thing. For example;</p>
<blockquote><p>aytch tee tee pee colon slash slash double-u double-u double-u dot kay eee arr en eee ell see arr ay es aytch dot see oohh emm &#8230;..</p></blockquote>
<p>Of course you can mute your overall sound quite quickly &#8230; but ultimately you just want to temporarily mute the speech volume only. Of course, inside the preferences for iChat, under Alerts is the &#8216;Speech Volume&#8217; slider. Just slide that to zero and the speech goes away. Of course, that takes a bit of point and clicking &#8230; and usually I can&#8217;t be bothered.</p>
<p>So I thought Applescript might be the solution. I&#8217;d never looked at Applescript before, so there was a bit to learn.</p>
<p>Ultimately I came up with this script;</p>
<blockquote><pre>set front_app to (path to frontmost application as Unicode text)
tell application "iChat"
   activate
end tell
tell application "System Events"
   tell process "iChat"
      keystroke "," using {command down}
      click button "Alerts" of tool bar 1 of window 1
      tell slider 1 of group 1 of group 1 of group 1 of window 1 to set value to 0
      keystroke "w" using {command down}

   end tell
end tell
tell application front_app
	activate
end tell</pre>
</blockquote>
<p>This works with Leopard at the moment. The key line is the &#8216;tell slider&#8230;&#8217; line that sets the value to zero. If you want to change the volume back to something more normal, you just use a decimal number less than 1.0. For example;</p>
<blockquote><p>tell slider 1 of group 1 of group 1 of group 1 of window 1 to set value to 0.6</p></blockquote>
<p>which sets the speech volume to 60%</p>
<p>So I&#8217;ve just saved two scripts to ~/Library/Scripts;</p>
<blockquote><p>SpeechVolume60.scpt<br />
SpeechVolume0.scpt
</p></blockquote>
<p>One sets the volume to 60%, the other to 0%. Then I just have some hotkeys set up in <a href=http://www.red-sweater.com/fastscripts/index.html>Fastscripts</a> to call them. So as soon as I hear Alex starting to pronounced his http&#8217;s, I just hit the hotkey to shut him up. Then set the volume back to 60%.</p>
<p>Note: For reference I found the <a href=http://developer.apple.com/samplecode/UIElementInspector/index.html>UIElementInspector</a> particularly useful in working all this out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/shut-up-alex/2009/01/21/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rewriting an app in Objective C/Cocoa</title>
		<link>http://www.kernelcrash.com/blog/rewriting-an-app-in-objective-ccocoa/2008/10/06/</link>
		<comments>http://www.kernelcrash.com/blog/rewriting-an-app-in-objective-ccocoa/2008/10/06/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 04:42:23 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/rewriting-an-app-in-objective-ccocoa/2008/10/06/</guid>
		<description><![CDATA[Well, after my mad dash to port my procedural C program to a very basic Cocoa App in Xcode, I had a look at the code and thought &#8216;what a mess&#8217;. So, given that I&#8217;m trying to learn to program for the Mac, I thought I would start rewriting the entire app using Objective C [...]]]></description>
			<content:encoded><![CDATA[<p>Well, after my mad dash to port my procedural C program to a very basic Cocoa App in Xcode, I had a look at the code and thought &#8216;what a mess&#8217;. So, given that I&#8217;m trying to learn to program for the Mac, I thought I would start rewriting the entire app using Objective C and the various Cocoa frameworky things &#8230; so that it at least looked and operated like a &#8216;normal&#8217; Mac app.</p>
<p>This has turned out to be much harder than the simple port I did earlier. A few key considerations;</p>
<ul>
<li>I don&#8217;t really know any OO language very well, so I am learning and doing in Objective C as I go.</li>
<li>I&#8217;m not familiar with using any other GUI development environment for building an app &#8230; so I&#8217;m not entirely familiar with some of the &#8216;click and drag&#8217; concepts in Xcode (actually Interface Builder). There are quite a lot of things you generally should do &#8216;graphically&#8217; using &#8216;Interface Builder&#8217; &#8230; and I get the impression that the authors of various Cocoa programming books assume that you&#8217;ve probably used some other OO based GUI design tool.</li>
<li>There are quite a lot Cocoa concepts that I&#8217;ve never come across before such as Bindings, delegates, notifications.</li>
<li>And keeping track of retain counts is a big issue for me.</li>
</ul>
<p><strong>Configuration</strong></p>
<p>My old app just read in a text file line by line and pulled out variable=value type lines in order to set various configuration options for the program. Of course, I wanted to rewrite this so that I had a proper preferences panel. This took me a long time. The basic stuff is relatively easy; ticking checkboxes, entering a value into a field etc. Even setting it up to read/write this stuff to a user defaults database is easy too.</p>
<p>But my app had a list of servers it connected to (one or more), and for each server you had a username and password and some connection details. This seemed a perfect fit for an onscreen table in a preferences panel. This is an NSTableView in Cocoa speak. And there is this magic thing called &#8216;Bindings&#8217; to allow you to have a table on screen linked directly into an array of objects (each server line being some custom server object). With every column of your table having regular text, this is easy to do and there are quite a few examples on the net, but I wanted one table column to have a checkbox in it, and another field was for passwords, so I wanted that field to show asterisks onscreen.</p>
<p>Using Interface Builder I somehow got the column with the checkbox to have a checkbox in it&#8230; but honestly I can&#8217;t remember how I did it and haven&#8217;t worked out how to do it again (suffice to say, the way to do this stuff in Interface Builder does not seem that logical or easy to me). But the password column had me baffled for days. I never found an example on the net of how to do it (maybe I didn&#8217;t look hard enough), so I came up with some workaround solution that used delegate functions to erase the contents (visually) of the password column when a special &#8216;hide passwords&#8217; checkbox was ticked.  That took quite some time to work out the delegate function and then how to make the delegate function work out which column it was on and so on.</p>
<p>I always thought the password thing &#8216;must be simple&#8217; since Interface Builder has a NSSecureTextField that does exactly what I want &#8230; but for a simple standalone input textfield. Eventually I had another go and finally got it work;</p>
<ul>
<li>In Interface Builder, have your NSTableView on screen and click on the column that you want passwords to appear in. You&#8217;ll need to click multiple times until just the works &#8216;Text Cell&#8217; at the top of the column are highlighted in white by themself (ie. you don&#8217;t want the whole column highlighted, you just want a small white rectangle around the words &#8216;Text Cell&#8217;)</li>
<li>Then bring up the object inspector thing (cmd-shift-i I think), and click on the tab towards the right that has an &#8216;i&#8217; in a circle.</li>
<li>It should say &#8216;Class Identity&#8217; near the top.</li>
<li>Now change the Class in the &#8216;Class Identity&#8217; section to &#8216;NSSecureTextFieldCell&#8217;</li>
</ul>
<p>Thats it.</p>
<p><strong>Delegates</strong></p>
<p>I find I end up using delegates a lot. A good example is the &#8216;windowShouldClose&#8217; delegate function. Basically, I had an issue where if you closed the preferences panel, sometimes all my updates to my server list table didn&#8217;t go through. So I wanted some way to write out the user data stuff when you clicked the close box on the preferences window. This is where delegates comes in. I needed my preferences controller object thing to be a delegate of the NSPanel for my preferences. But I guess the problem for me is always what thing am I delegating from and what thing am I delegating to? and what delegate functions will work in the delegate. Sure the developer docs do list the delegate functions for each class &#8230; but it still takes some trial and error to work it all out. I just put a lot of NSLog statements everywhere.</p>
<p><strong>Notifications</strong></p>
<p>These are actually really useful. I end up having objects way down the object tree from my document controller class that need to communicate status info back to the document class (eg. socket connection has failed). Having no background in OO programming I have no idea of how you are &#8216;meant&#8217; to pass status info back &#8230;. but notifications are great as its all asyncronous and you don&#8217;t need timer events in your event loop looking for status info. I&#8217;m still not sure if this is the right way to do things&#8230; but it does seem to simplify my code a lot.</p>
<p><strong>Retain Counts</strong></p>
<p>I realise that with Leopard I now no longer have to worry about retain counts, but given that iphone app development still requires it (and I&#8217;d like to give iphone app development a go) I thought I should at least force myself to keep track of retain counts. Having said that, every couple of days I find some crazy bug in my app relating to over releasing of objects. Part of my problem has always been the mix of objects that I allocate and keep track of and so called Foundation classes that use an autorelease pool. When I first started, I wondered why the NSString class had seemingly duplicate methods. For example the initWithFormat and stringWithFormat methods;</p>
<p>NSString *a = [[NSString alloc] initWithFormat:@&#8221;count = %d&#8221;,n ];</p>
<p>NSString *a = [NSString stringWithFormat:@"count = %d",n];</p>
<p>These two lines do much the same thing except the first one creates an object that you allocate and manage whereas the second one (I think) allocates an object but shoves it in the autorelease pool. Putting it in the autorelease pool means that if the retain count goes to zero on that object and the autorelease pool is being flushed (which happens at the end of the event loop for most programs) then the object can just disappear. I have been bitten by this many times. An object which I thought should still be around ends up being flushed. I find these problems  quite difficult to trace and diagnose. I have gotten to know the &#8216;Instruments&#8217; tool, but it only helps so far. I need to learn a bit more about the best way to manage retain counts.</p>
<p>Overall, I am &#8216;getting there&#8217; slowly. There is still a lot of old C code in my program. A lot of stuff still using C strings where I probably should be using NSStrings to avoid bounds problems in the future. But those sorts of things can wait. In some cases using the Cocoa stuff makes some problems a lot easier. For example, my original program contained a double fork in order to get a spawned process to be independent of my program (I wanted to make sure the spawned program could still keep going if my program ended).  This double fork was reasonably complicated and I also needed to communicate to this program at a singular point. Now, I just use openFile: withApplication: from the NSWorkspace class and it does away with my double fork entirely.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/rewriting-an-app-in-objective-ccocoa/2008/10/06/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Porting to Mac OS X</title>
		<link>http://www.kernelcrash.com/blog/porting-to-mac-os-x/2008/09/18/</link>
		<comments>http://www.kernelcrash.com/blog/porting-to-mac-os-x/2008/09/18/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 02:43:37 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/porting-to-mac-os-x/2008/09/18/</guid>
		<description><![CDATA[In my spare time I like to program. Usually in C &#8230; which a lot of people find bemusing.  My rationale is I spent my teenage years hacking assembly code on systems like the Amiga, so moving to C is like moving to a &#8216;high level language&#8217;. I never quite hopped on the Object Oriented [...]]]></description>
			<content:encoded><![CDATA[<p>In my spare time I like to program. Usually in C &#8230; which a lot of people find bemusing.  My rationale is I spent my teenage years hacking assembly code on systems like the Amiga, so moving to C is like moving to a &#8216;high level language&#8217;. I never quite hopped on the Object Oriented bandwagon &#8230; so I&#8217;m kind of stuck in my old procedural ways.</p>
<p>I have one program I&#8217;ve been working on lately that is getting more complicated. For most of it&#8217;s life it&#8217;s been &#8216;command line only&#8217;. It creates multiple threads , opens lots of socket connections, spawn&#8217;s external subprocesses too. It&#8217;s been quite a learning curve to get it to work. Lately, I&#8217;ve started adding features to it to open a GUI window to provide status info. My first attempt was to simply add in some Xlib calls (yes Xlib <img src='http://www.kernelcrash.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) to basically do the bare minimum to get a window up. That worked OK on linux, but I&#8217;d already ported the command line version to run on OSX &#8230; and the Xlib version did not really work on OSX.</p>
<p>So I thought &#8216;How hard would it be to turn my program into a Cocoa program?&#8217;. Cocoa is of course the main GUI enviornment on the Mac. In my earlier porting experience, I aas simply treating OSX as &#8216;another unix&#8217; to do the bare minimum to port my program at a command line level. Using Cocoa was a whole different ball game.</p>
<p>So I thought I&#8217;d have a go. It&#8217;s quite a steep learning curve going from &#8216;procedural C programmer using vi as a development environment&#8217; to &#8216;Using Objective C with Cocoa on the XCode development environment&#8217;.</p>
<p>I of course tried to make a very simple first app using an XCode tutorial. That proved a problem as a lot of the tutorials on the net are for XCode 2.x (rather than 3.x that is out now), and Apple have changed the Interface Builder enough to make all the old tutorials very difficult to follow.</p>
<p>But I persevered. I ended up getting the book &#8216;Cocoa Programming for Mac OS X&#8217; which is actually a very well written book.  That kind of gave me enough info to get some of the basics of Objective C (I still have a lot to learn).</p>
<p>After 2 days hacking at my code, I now have a working program. I thought it would take quite a bit longer. I still don&#8217;t have a clue when it comes to some of the philosophical arguments about object oriented programming &#8230; but ultimately I just want a &#8216;first pass&#8217; that sort of works.  Memory management is probably rubbish, and I don&#8217;t fully understand how the event loop is meant to work .. and I know I have a delegate set up &#8230; but I don&#8217;t really understand what a delegate is.</p>
<p>I guess working in XCode was actually moderately fun. It at least told me about the 170 warnings in my program (I really do leave a lot of unused variables all over the place).  Debugging info was OK &#8230; but ultimately debugging multithreaded stuff is very difficult at the best of times.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/porting-to-mac-os-x/2008/09/18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Media Centres and failing disk drives</title>
		<link>http://www.kernelcrash.com/blog/media-centres-and-failing-disk-drives/2008/09/07/</link>
		<comments>http://www.kernelcrash.com/blog/media-centres-and-failing-disk-drives/2008/09/07/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 22:39:59 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/media-centres-and-failing-disk-drives/2008/09/07/</guid>
		<description><![CDATA[For a long time now, I&#8217;ve used an old (black) xbox running XBMC as a media centre in my lounge room plugged into the TV. I just stream content to it, so it only has a little hard drive in it. Cost-wise its hard to beat, and XBMC has been updated enough over the years [...]]]></description>
			<content:encoded><![CDATA[<p>For a long time now, I&#8217;ve used an old (black) xbox running XBMC as a media centre in my lounge room plugged into the TV. I just stream content to it, so it only has a little hard drive in it. Cost-wise its hard to beat, and XBMC has been updated enough over the years to keep up with the myriad of funny codecs out there. I also find the component output of the xbox is quite nice compared to all the other options I&#8217;ve tried.</p>
<p>But the xbox is getting old, and the main thing it can&#8217;t do is very high resolution stuff, especially high resolution H264 content.</p>
<p>I did look at using the bottom half of a Thinkpad T40 as a media centre, but that never worked out very well. So I thought I&#8217;d try the mac mini. I&#8217;ve had the mac mini about a year now using it in my office, but since I bought the macbook the mini gets less and less use. So, even though it seems a waste to sit the mini under the TV, I thought I&#8217;d try it for a while.</p>
<p>I also thought I&#8217;d upgrade the mini from Tiger to Leopard first. I thought I&#8217;d do a clean reformat install, so found a 200GB drive I had, put it in a USB enclosure, told the mac mini to do a Carbon Copy of its internal 80GB drive, and then went and installed Leopard.</p>
<p>My goal was to use the Migration Assistant to migrate data back &#8230;. but I put that on hold, and just set the thing up to run FrontRow. One thing that works much nicer in Leopard is NFS mounts, specifically automounts. I used to manually run a script in Tiger to mount NFS mounts as it never seemed to work the way i wanted. So in Leopard I just put some symlinks under ~/Movies to /net/&lt;fileserver&gt;/movies and it all just worked fine.</p>
<p>I discovered a program called the <a href="http://appletv.nanopi.net/">&#8216;Sapphire Browser&#8217;</a>. It&#8217;s a plugin for FrontRow that I think was originally developed for the Apple TV but also works on Leopard FrontRow. Anyway, it sort of indexes your media collection and adds in coverart and movie/tv descriptions. It mostly works for me. I think it really doesn&#8217;t like my NFS mounts, as I find it very difficult to update the information. The whole concept is similar to the &#8216;Library&#8217; functions in XBMC. It all looks pretty &#8230; but I always wonder whether it&#8217;s that useful from a useability perspecpective.</p>
<p>I&#8217;m connecting the mac mini to the TV with a DVI to HDMI cable, and audio is just out the headphones socket of the mini to the TV (which has left and right audio next to the HDMI input as an option). It works well enough. On my TV, the HDMI is forced to 1280&#215;720, even though the native resolution of the TV panel is 1368&#215;768, so when looking at text its not as crisp as perhaps the VGA input (I should try VGA for comparison). Quality wise I still think the component output of the xbox is slightly better. I can now play 720p stuff OK, though I do see the occasional glitch in playback of these. I need to investigate further whether this is because the data is via NFS or just an issue with FrontRow.</p>
<p>I&#8217;ve also added the Mini in to my Harmony remote. That took a while to get sorted. It works OK, but I haven&#8217;t worked out a way to simulate pressing the play/pause button for 5 seconds in order to make the mini go to sleep.</p>
<p>Anyway, I eventually got round to grabbing my Carbon Copy of the mac mini&#8217;s disk to take a look at (It&#8217;s a seagate 200GB IDE drive). I first tried connecting it to my macbook via the USB enclosure. It would not mount at all. I eventually plugged it into my linux server directly and it found lots of bad sectors on it. I tried Seagate&#8217;s seatools and it too found lots of bad sectors. Not good. How on earth could I lose two disk drives so close together? This one was in constant daily use until I bought that 750GB drive. Then it sat in one of those shipping case things on the floor for the last couple of weeks.</p>
<p>I ran some dodgy sector recovery type programs (I never know what these things are really doing) and they seemed to recover some sectors. And now I&#8217;ve just been running some deep surface scan type recovery thingee program (which seems to take a good 12hrs to run). It actually looks a lot better than it was. With my 300GB drive that died, it got progressively worse over a few days. This one seems to be getting better. Given that my USB enclosure cost $20, I really wonder if its a case of a very dodgy power supply.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/media-centres-and-failing-disk-drives/2008/09/07/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another macbook keyboard</title>
		<link>http://www.kernelcrash.com/blog/another-macbook-keyboard/2008/08/14/</link>
		<comments>http://www.kernelcrash.com/blog/another-macbook-keyboard/2008/08/14/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 08:23:06 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/another-macbook-keyboard/2008/08/14/</guid>
		<description><![CDATA[So I&#8217;ve been using my Macbook for several weeks now with the keyboard in a somewhat bastardised form. To recap, the keyboard on my refurb&#8217;d macbook seems to work ok if I type slow, but is complete rubbish missing lots of keystrokes if I type fast. I took it to an Apple service centre and [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been using my Macbook for several weeks now with the keyboard in a somewhat bastardised form. To recap, the keyboard on my refurb&#8217;d macbook seems to work ok if I type slow, but is complete rubbish missing lots of keystrokes if I type fast. I took it to an Apple service centre and they seemed to think there was nothing wrong with it, then I came up with a hack whereby I popped all the keytops off and stuck little bits of cardboard under the keytops to sort of give each key a bit more height and sort of make it push down a bit further when I press a key.</p>
<p>The &#8216;jammed in cardboard&#8217; hack worked mostly OK. It was never perfect.</p>
<p>Meanwhile, I ordered a 2nd hand Macbook keyboard off ebay. I ordered a &#8216;version 2&#8242; keyboard with the silver connector as that is what I&#8217;d read is required for a core 2 duo macbook.</p>
<p>Well the keyboard arrived today. One key thing is that even though it&#8217;s a &#8216;version 2&#8242; keyboard, it&#8217;s actually for an older &#8216;core 2 duo&#8217; Macbook than my model. The one that originally came with my Macbook has the Previous, Play|Pause and Next logos on F7, F8, F9:<br />
<img src="http://www.kernelcrash.com/blog/wp-content/21.jpg" alt="21.jpg" /></p>
<p>Whereas the keyboard I bought doesn&#8217;t have those special keys at all. Mine has F3, F4, F5 as the mute, softer, louder buttons, F6 has the numlock light on it, etc;</p>
<p><img src="http://www.kernelcrash.com/blog/wp-content/1.jpg" alt="1.jpg" /></p>
<p>So I&#8217;ve just put the new keyboard in (those ifixit guides sure are handy). So does it work better? Well, yes it does. I still miss the odd keypress, but generally the keys have a better positive key feedback (and I don&#8217;t need my little bits of cardboard either). And most impressive is that you can repeatedly tap the capslock key and the LED does actually turn on and off with each keypress. What a feature!!! <img src='http://www.kernelcrash.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  The keyboard still suffers a bit from the missing first key syndrome, but it&#8217;s much much better than the old keyboard. It&#8217;s no thinkpad keyboard, but it&#8217;s a big improvement.</p>
<p>So, while I am pissed that Apple seem to think there is nothing wrong with the other keyboard, I am much happier with this 2nd hand one.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/another-macbook-keyboard/2008/08/14/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

