<?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>beatworm.co.uk &#187; computers</title>
	<atom:link href="http://beatworm.co.uk/blog/category/computers/feed/" rel="self" type="application/rss+xml" />
	<link>http://beatworm.co.uk/blog</link>
	<description>Colin M. Strickland</description>
	<lastBuildDate>Sat, 31 Jul 2010 08:27:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Airport command line</title>
		<link>http://beatworm.co.uk/blog/computers/airport-command-line/</link>
		<comments>http://beatworm.co.uk/blog/computers/airport-command-line/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 19:46:41 +0000</pubDate>
		<dc:creator>cms</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://beatworm.co.uk/blog/?p=1004</guid>
		<description><![CDATA[There&#8217;s a handy little command line tool nestled away inside Apple&#8217;s system WiFi framework.
 Apple80211.framework/Resources/airport
It doesn&#8217;t come with a man page, but --help will print a usage guide.
]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a handy little command line tool nestled away inside Apple&#8217;s system WiFi framework.</p>
<p> <code>Apple80211.framework/Resources/airport</code></p>
<p>It doesn&#8217;t come with a man page, but<code> --help</code> will print a usage guide.</p>
]]></content:encoded>
			<wfw:commentRss>http://beatworm.co.uk/blog/computers/airport-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Font caching and system font protection in Leopard</title>
		<link>http://beatworm.co.uk/blog/computers/font-caching-and-system-font-protection-in-leopard/</link>
		<comments>http://beatworm.co.uk/blog/computers/font-caching-and-system-font-protection-in-leopard/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 10:51:28 +0000</pubDate>
		<dc:creator>cms</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://beatworm.co.uk/blog/?p=995</guid>
		<description><![CDATA[Leopard introduced a number of system level changes to font handling. There&#8217;s a system daemon, fontd that handles runtime font registration. Some of the new features that are implemented include on-demand font activation, on a per-application basis and system font-protection, which guards against removal or disabling certain fundamental system fonts.
There&#8217;s a couple of situations where [...]]]></description>
			<content:encoded><![CDATA[<p>Leopard introduced a number of system level changes to font handling. There&#8217;s a system daemon, <em>fontd</em> that handles runtime font registration. Some of the new features that are implemented include on-demand font activation, on a per-application basis and system font-protection, which guards against removal or disabling certain fundamental system fonts.</p>
<p>There&#8217;s a couple of situations where you might need to interface with the font registry database. Sometimes the system font caches can become garbled, and require a manual flush &#8211; before leopard these could be easily found under <strong>/Library/Caches/com.apple.ATS</strong> &#8211; now they&#8217;re squirreled away under <strong>/var</strong> and managed by fontd. Font protection might stop you from legitimately manipulating certain font files; in a prepress environment you might need to replace one of the magic System protected fonts with a custom version.</p>
<p>There&#8217;s a command line utility provided, called &#8216;<strong>atsutil</strong>&#8216; which offers a user interface to these features. It has a <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/atsutil.8.html">fine man page</a>.</p>
<p>To purge the font caches, which will fix persistant text rendering problems, you use the command <code>atsutil databases -removeUser</code> </p>
<p>To display the list of System protected fonts use the command <code>atsutil fontprotection -files</code>.</p>
<p>To globally disable the font protection feature, use the command <code>atsutil fontprotection -off</code>. Re-enable it with the <code>-on</code> switch.</p>
<p> <strong>Don&#8217;t remove system protected fonts</strong>, unless you are replacing them with a workable substitute.</p>
]]></content:encoded>
			<wfw:commentRss>http://beatworm.co.uk/blog/computers/font-caching-and-system-font-protection-in-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More debian package disambiguation</title>
		<link>http://beatworm.co.uk/blog/computers/more-debian-package-disambiguation/</link>
		<comments>http://beatworm.co.uk/blog/computers/more-debian-package-disambiguation/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 13:08:00 +0000</pubDate>
		<dc:creator>cms</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://beatworm.co.uk/blog/?p=982</guid>
		<description><![CDATA[I can&#8217;t ever remember the name of the Debian package for the library manpages, I often have the same trouble recalling the names of the OpenSSL development packages in Debian.
The openssl binary and man pages are in the openssl package.
The SSL shared libraries are in the libssl package. Similarly, the SSL headers and library man [...]]]></description>
			<content:encoded><![CDATA[<p>I can&#8217;t ever <a href="http://beatworm.co.uk/blog/computers/note-to-self/">remember the name of the Debian package for the library manpages</a>, I often have the same trouble recalling the names of the OpenSSL development packages in Debian.</p>
<p>The <em>openssl</em> binary and man pages are in the <strong>openssl</strong> package.</p>
<p>The SSL shared libraries are in the <strong>libssl</strong> package. Similarly, the SSL headers and library man pages are in the <strong>libssl-dev</strong> package. </p>
<p>Now I can <del datetime="2009-11-17T13:05:33+00:00">google</del> bing for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://beatworm.co.uk/blog/computers/more-debian-package-disambiguation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stupid phone tricks</title>
		<link>http://beatworm.co.uk/blog/computers/stupid-phone-tricks/</link>
		<comments>http://beatworm.co.uk/blog/computers/stupid-phone-tricks/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 11:14:54 +0000</pubDate>
		<dc:creator>cms</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://beatworm.co.uk/blog/?p=929</guid>
		<description><![CDATA[1. Obtain S60 smartphone. I&#8217;m quite fond of my Nokia E51
2. Install Python for series 60 on your phone.
3. On a nearby OS X Leopard notebook, setup  a new bluetooth serial port, type RS232. ( System preferences -> Bluetooth -> Advanced ). Call it something like &#8216;Bluetooth-console&#8217;. Ensure the Mac is paired with the [...]]]></description>
			<content:encoded><![CDATA[<p>1. Obtain S60 smartphone. I&#8217;m quite fond of my <a href="http://europe.nokia.com/find-products/devices/nokia-e51">Nokia E51</a></p>
<p>2. Install <a href="http://opensource.nokia.com/projects/pythonfors60/">Python for series 60</a> on your phone.</p>
<p>3. On a nearby OS X Leopard notebook, setup  a new bluetooth serial port, type RS232. ( System preferences -> Bluetooth -> Advanced ). Call it something like &#8216;Bluetooth-console&#8217;. Ensure the Mac is paired with the phone.</p>
<p>4. In a terminal, run &#8216;<code>screen /dev/tty.Bluetooth-console</code>&#8216;</p>
<p>5. Set your Mac&#8217;s bluetooth to &#8216;discoverable&#8217;</p>
<p>6. Launch the Python application you&#8217;ve just installed on your phone. Select Options -> Bluetooth Console -> Other. Choose your Mac, and then select the Bluetooth-console serial port as the device.</p>
<p>7. Meanwhile, back on the Mac: a python shell will start in your screen session after a small delay.</p>
<p>8. In the python session, &#8220;<code>import audio</code>&#8221;</p>
<p>9. In the python session, &#8220;<code>audio.say('I never realised my phone had a built-in speech synthesizer')</code>&#8221;</p>
<p>10. Fall over in astonishment.</p>
]]></content:encoded>
			<wfw:commentRss>http://beatworm.co.uk/blog/computers/stupid-phone-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things that should exist #93</title>
		<link>http://beatworm.co.uk/blog/computers/things-that-should-exist-93/</link>
		<comments>http://beatworm.co.uk/blog/computers/things-that-should-exist-93/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 17:15:28 +0000</pubDate>
		<dc:creator>cms</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://beatworm.co.uk/blog/?p=822</guid>
		<description><![CDATA[I often travel with a laptop. I almost invariably travel with a charged mobile phone.  I enjoy using the fancy multi-touch trackpad in my MacBook Pro, but an odd thing happens sometimes when I&#8217;ve put my phone down nearby on the desk; I reach automatically to try and use the phone as a computer [...]]]></description>
			<content:encoded><![CDATA[<p>I often travel with a laptop. I almost invariably travel with a charged mobile phone.  I enjoy using the fancy multi-touch trackpad in my MacBook Pro, but an odd thing happens sometimes when I&#8217;ve put my phone down nearby on the desk; I reach automatically to try and use the phone as a computer mouse. One of those amusing peculiarities of muscle-memory  and reflex that can surprise, when you&#8217;re engaged by something, within the computer, verging upon a liminal state.</p>
<p>It&#8217;s a slightly amusing quirk, but when I think further about it, I find plenty of reasons why it perhaps ought to work. </p>
<p>External mice are more useful than trackpads, although not enough use to me to justify carting one around. My phone is palm-sized, about the ideal weight, is already paired with my laptop over bluetooth, has clickable buttons all over one face, and an optical camera on the reverse. In short, it already <em>has</em> most of the technology needed to be a wireless optical mouse. </p>
<p>Most but not all. I&#8217;m a bit dubious about whether it could be done in software alone. I doubt that the lens will focus well enough to motion tracking without a special surface, and it&#8217;s completely lacking the light source, but it is almost tempting enough to try.  It might be feasible with some sort of very recognisable surface, perhaps a monchrome checkerboard grid, which would be very easy to render and print.</p>
]]></content:encoded>
			<wfw:commentRss>http://beatworm.co.uk/blog/computers/things-that-should-exist-93/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>And I&#8217;m back, to attack, with a new Mac</title>
		<link>http://beatworm.co.uk/blog/computers/and-im-back-to-attack-with-a-new-mac/</link>
		<comments>http://beatworm.co.uk/blog/computers/and-im-back-to-attack-with-a-new-mac/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 19:49:59 +0000</pubDate>
		<dc:creator>cms</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://beatworm.co.uk/blog/?p=749</guid>
		<description><![CDATA[So much for my new year resolution to write more often.
Just before I went away for Christmas, my trusty white MacBook had developed a bit of a problem with it&#8217;s keyboard. Initially this manifested as the function keys intermittently losing the ability to switch between special Mac control keys, such as brightness, eject media and [...]]]></description>
			<content:encoded><![CDATA[<p>So much for my new year resolution to write more often.</p>
<p>Just before I went away for Christmas, my trusty white MacBook had developed a bit of a problem with it&#8217;s keyboard. Initially this manifested as the function keys intermittently losing the ability to switch between special Mac control keys, such as brightness, eject media and what-not and normal user-programmable <em>f</em>-keys. Initially I thought this may be a problem with the <em>fn</em> key that is the toggle, but eventually the keys <em>f1</em>-<em>f9</em> stopped working entirely. This was irritating, but didn&#8217;t really render the machine unuseable. Most of the time I use it with an external keyboard, and luckily all the defunct keys functions were duplicated in software. </p>
<p>The next key to go was the right Shift key. Although, of course there&#8217;s a left Shift key, for a touch-typist, this was a little harder to ignore. Although I find much to admire about Apple&#8217;s current laptop keyboard design, unfortunately user-repairability isn&#8217;t one of its many blessings. There&#8217;s no simple way to get into the top casing on a polycarbonate MacBook, it&#8217;s an expensive specialist job for a service centre. </p>
<p>Sensibly I&#8217;d followed my own advice when I purchased this laptop, and bought it from the always-wonderful <a href="http://www.johnlewis.com">John Lewis</a> with their standard <a href="http://www.johnlewis.com/Technology/Laptops/Laptops/SubCategory.aspx">two-year full warranty</a> on electrical goods. I was coming up very close to the two-year anniversary, which fell within the first week of January, itself another lucky stroke, as it meant that I&#8217;d be able to take it with me on my <a href="http://beatworm.co.uk/blog/travels/merry-christmas/">trip to North America</a>, where hopefully it would hold up well enough to let me edit photos, communicate, and act as an additional entertainment for any idle moments. It managed the job fine, and as soon as I was back in the U.K. I packed it off to John Lewis for maintenance, which is something that they arranged with their usual attention to customer service. More thumbs up for John Lewis.</p>
<p>Which left me Mac-less, save for my rather under-spec G4 mini, which can barely read mail and a web-page at the same time, under Leopard. And so no blogging. </p>
<p>The two year mark was also my planned point for a new machine upgrade. Buying a machine for work, I was able to take advantage of the Apple Developer Program hardware discount.  Sadly this means abandoning John Lewis to purchase direct, but now we&#8217;ve got a <a href="http://www.apple.com/uk/retail/cabotcircus/">real Apple Store in Bristol</a>, I think AppleCare is probably a good deal.</p>
<p>I figured I&#8217;d be needing a machine with better graphics hardware, to better make advantage of the already signposted future directions in OS X technology. The new <a href="http://www.apple.com/uk/macbook/">&#8216;unibody&#8217; Macbooks</a> didn&#8217;t really suit, as I&#8217;ve probably got as many firewire devices as USB. Also, my recent work had been feeling the strains of my Macbook&#8217;s 13&#8243; screen and modest integrated graphics chipset. And so I&#8217;m typing this update from my new <a href="http://www.apple.com/uk/macbookpro/features-15inch.html">2.8GHz, 15.4&#8243; MacBook Pro</a>.</p>
<p>It&#8217;s mostly a great upgrade. On the positive side, it&#8217;s pretty and slim, and I&#8217;m remembering just how right the 15&#8243; widescreen form is for me. The screen is brighter than anything I&#8217;ve ever seen, and makes other LCD displays, including my expensive monitor look washed out and dull by comparison. The new glass front is dramatically easier to clean than any laptop screen I&#8217;ve owned. The extra-large button-free trackpad is brilliant, and even the gimmicky sounding gestures have proven to be almost practical enough for regular use. The unibody shell seems rigid and light, and bringing across the now-standard Apple keyboard hardware makes a brilliant switch from the old silver PowerBook G4 style, which I frankly hated. It&#8217;s super-fast, of course; the new CPU, memory bandwidth, and fast hard drive all combining to ensure that as yet, I&#8217;ve not seen any performance stalls when many simultaneous processes grow busy.</p>
<p>It&#8217;s not perfect of course. Some of the positives are also negatives. The glass fronted screen is considerably more reflective than the previous gloss models, and while in practice I find that I mostly  mind this far less than I&#8217;d have thought, it&#8217;s undeniably worse than my gloss MacBook. </p>
<p>Then there are more straightforwardly <em>negative</em> negatives. Like many people, I&#8217;ve found <a href="http://www.pcadvisor.co.uk/news/index.cfm?newsid=109960&#038;spotlight=2030:b">trouble with the Apple mini DisplayPort to DVI connector</a> &#8211; the integrated NVidea 9400 graphics adaptor can&#8217;t drive my 23&#8243; TFT without sparkly artefacts, I have to run it through the additional 9600 GT GPU to get a useful picture. It&#8217;s too pretty, in as much as it makes me fret about the wear and tear that will inevitably mar its looks over time; surely computers should be tools not jewellery? It&#8217;s slightly heavier than a MacBook, and the battery life is probably less, it&#8217;s too hard to say, the calibration as yet seems to be a bit iffy with estimates. I miss the inbuilt LED charge gauges on the battery which allowed one to check the power without having to connect the battery up, so handy when travelling with two or more. I also miss the ports on the left hand side, and find the supplied ports a bit stingy; surely they could have squeezed a couple more USB slots and a firewire 400 in somewhere? I&#8217;m not sure I need a wired ethernet anymore.</p>
<p>Not only that, but shortly after I&#8217;d ordered it, Apple saw fit to announce an update to the polycarbonate MacBook line, giving it a memory bus and GPU boost to inject some of the performance I was lacking, and keeping the essential firewire port in place. And then they announced iLife &#8216;09 would ship  a mere handful of days after my new machine was dispatched. I think I&#8217;ll still enjoy all the other Pro upgrades though, and they did offer <a href="http://www.apple.com/uk/ilife/uptodate/">recent purchasers like me the chance to upgrade</a> the iLife suite for just a nominal cost.</p>
<p>Overall I&#8217;m happy, and I&#8217;m sure all the wrinkles will be ironed out, as I adjust to life with it. It ought to keep me in the manner to which I&#8217;m accustomed for the next couple of years, at least. What was that they said about never buying the first iteration of a new Apple product line? Oh.</p>
]]></content:encoded>
			<wfw:commentRss>http://beatworm.co.uk/blog/computers/and-im-back-to-attack-with-a-new-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 10 UNIX commands</title>
		<link>http://beatworm.co.uk/blog/computers/top-10-unix-commands/</link>
		<comments>http://beatworm.co.uk/blog/computers/top-10-unix-commands/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 12:41:13 +0000</pubDate>
		<dc:creator>cms</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://beatworm.co.uk/blog/?p=645</guid>
		<description><![CDATA[Ever wondered what your most used shell commands are? Here&#8217;s a very silly way I knocked up to find out mine.
history&#124;perl -anle'$C{/\d+\s+sudo/?$F[2]:$F[1]}++;END{print map{qq&#124;$_\[$C{$_}]\n&#124;} sort{$C{$b}$C{$a}}keys%C}&#39&#124;head -10
Some people would have you believe that perl is difficult to read.
]]></description>
			<content:encoded><![CDATA[<p>Ever wondered what your most used shell commands are? Here&#8217;s a very silly way I knocked up to find out mine.</p>
<p><code>history|perl -anle'$C{/\d+\s+sudo/?$F[2]:$F[1]}++;END{print map{qq|$_\[$C{$_}]\n|} sort{$C{$b}<=>$C{$a}}keys%C}&#39|head -10</code></p>
<p>Some people would have you believe that perl is difficult to read.</p>
]]></content:encoded>
			<wfw:commentRss>http://beatworm.co.uk/blog/computers/top-10-unix-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django + SQLite , unfinalised statements on close</title>
		<link>http://beatworm.co.uk/blog/computers/django-sqlite-unfinalised-statements-on-close/</link>
		<comments>http://beatworm.co.uk/blog/computers/django-sqlite-unfinalised-statements-on-close/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 10:04:09 +0000</pubDate>
		<dc:creator>cms</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://beatworm.co.uk/blog/?p=618</guid>
		<description><![CDATA[If you have a Django 1.0 deployment configured to use sqlite3, and are struggling to understand sporadic eruptions of what are clearly exceptions thrown by closing a database cursor with uncommitted work; either manage.py commands on the shell, or page requests to the application generate  stack traces centered around messages like &#8216;Unable to close [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a <a href="http://djangoproject.org">Django 1.0 </a>deployment configured to use sqlite3, and are struggling to understand sporadic eruptions of what are clearly exceptions thrown by closing a database cursor with uncommitted work; either <strong>manage.py</strong> commands on the shell, or page requests to the application generate  stack traces centered around messages like &#8216;<em>Unable to close due to unfinalised statements</em>&#8216; then it might be a file permissions problem.</p>
<p>In my case, neither my developer shell account, nor the user id of the running apache httpd processes had write permissions to the directory with the sqlite3 database file. Not immediately apparent from the wording used in the error messages. </p>
]]></content:encoded>
			<wfw:commentRss>http://beatworm.co.uk/blog/computers/django-sqlite-unfinalised-statements-on-close/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using categories on Objective C classes in a static library</title>
		<link>http://beatworm.co.uk/blog/computers/using-categories-on-objective-c-classes-in-a-static-library/</link>
		<comments>http://beatworm.co.uk/blog/computers/using-categories-on-objective-c-classes-in-a-static-library/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 12:03:31 +0000</pubDate>
		<dc:creator>cms</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://beatworm.co.uk/blog/?p=608</guid>
		<description><![CDATA[I have some Objective C classes that I&#8217;ve built for use in a project. They are model and utility classes, and have no direct UI responsibility. To aid in automated testing and debugging, I&#8217;ve built them as a project that creates a static library. The project has a test target that runs suites of automated [...]]]></description>
			<content:encoded><![CDATA[<p>I have some Objective C classes that I&#8217;ve built for use in a project. They are model and utility classes, and have no direct UI responsibility. To aid in automated testing and debugging, I&#8217;ve built them as a project that creates a static library. The project has a test target that runs suites of automated unit tests, and a library target that builds a C-style static library archive binary. The install configuration of this target copies the library to <em>$HOME/lib/</em>, and the class headers to<em> $HOME/include/$LIBNAME.</em></p>
<p>This way when I use these classes in another project, I can just <em>#import</em> the headers in the sources, add the static library to the project frameworks list, add the include and lib directories to the compiler and linker search paths in the XCode target inspector, and build as normal. Build times are reduced, base classes are frozen in a stable, well tested implementation, code re-use is easier, everybody wins.</p>
<p>Recently I broke this happy pattern, a little perplexingly, with what I thought was a fairly innocuous piece of refactoring. I noticed that one of my classes was rather a simple set container, and its implementation really little more than a thin wrapper around <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/Reference/Reference.html">NSMutableArray</a>, with only a trivial specialisation of behaviour.  As it was only used within a parent class structure, with no interface outside the library innards, it seemed a bit of overkill to have it implemented as a sizeable class. The special behaviour really boiled down to maybe two additional methods on top of the normal array interface.</p>
<p>I first refactored it to be a subclass of NSMutableArray, but that actually introduced more complexity. NSMutableArray is implemented as <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_9.html">a class cluster</a>, with an abstract API around a private hidden shadow class. In order to subclass it, you are expected to provide your own implementations of a subset of its interface. In my case, this would have made for more code than the class I was trying to replace.</p>
<p>Of course, Objective-C allows you to define <a href="http://thaesofereode.info/clocFAQ/#categories">categories</a> on any existing classes. Categories allow you to formally define and implement additional methods onto an existing class definition at compile time. I could re-implement my class as a tiny category on NSMutableArray, removing lots of my code, and reducing the size of my library footprint and perhaps add some value by introducing NSMutableArray&#8217;s extensive interface.</p>
<p>Surprisingly, it wasn&#8217;t plain sailing. Coding up the category, and tweaking the library to use NSMutableArray in place of the now-redundant class was straightforward. Once the updated code passed the original test suite, it was deployed as a library. The first time I built a project using it, it crashed on startup, with an unhandled exception. I cleaned all targets and rebuilt. Same problem. I checked the library headers to confirm that the new data structures were properly defined on include. No problems there, but still a hard crash on initialisation.</p>
<p>The system logs had an entry for the crash;  <strong><em>selector not recognized</em></strong> attached to symbols that were recognisably the new array methods from my category. Running <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/nm.1.html">&#8216;nm&#8217;</a> against the library file showed the symbols present, and correctly defined as a category on NSMutableArray. I  was stumped. After a bit of googling, I came up with the correct solution.</p>
<p>It turns out that in order to link against a static library that contains Objective C categories, you need to <strong>pass the linker a special flag, &#8216;-ObjC&#8217;.</strong> Adjusting the build settings of my project to include this flag in the <strong>&#8216;Other linker flags&#8217;</strong> entry of the target inspector fixed it so that the symbols are correctly resolved at runtime. Here is the official word, <a href="http://developer.apple.com/qa/qa2006/qa1490.html">Technical Q&#038;A QA1490.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://beatworm.co.uk/blog/computers/using-categories-on-objective-c-classes-in-a-static-library/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iTunes automation, revisited</title>
		<link>http://beatworm.co.uk/blog/computers/itunes-automation-revisited/</link>
		<comments>http://beatworm.co.uk/blog/computers/itunes-automation-revisited/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 11:15:23 +0000</pubDate>
		<dc:creator>cms</dc:creator>
				<category><![CDATA[computers]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://beatworm.co.uk/blog/?p=570</guid>
		<description><![CDATA[Apple released iTunes version 8 this week, which introduced some excellent new features, such as Genius playlists, but broke the fancy perl script that I wrote to rotate my music library on my iPod touch.
While revisiting this, I took the opportunity to re-implement it, aiming to fix a few of it&#8217;s faults, most specifically the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://news.bbc.co.uk/1/hi/technology/7607280.stm">Apple released iTunes version 8 this week</a>, which introduced some <a href="http://www.apple.com/itunes/whatsnew/">excellent new features</a>, such as Genius playlists, but broke the fancy <a href="http://beatworm.co.uk/blog/computers/scripting-itunes-for-the-ipod-with-perl-and-macglue/">perl script </a>that I wrote to rotate my music library on my iPod touch.</p>
<p>While revisiting this, I took the opportunity to re-implement it, aiming to fix a few of it&#8217;s faults, most specifically the <em>terrible</em> performance. I decided to use <a href="http://www.python.org/">Python</a> this time around, chiefly because of the existence of <a href="http://appscript.sourceforge.net/">appscript</a>, an apple event bridge with a nice syntax. Python&#8217;s object and sequence semantics are a <em>slightly</em> better fit with AppleScript&#8217;s data models, and appscript should be a more optimal solution than <a href="http://search.cpan.org/~cnandor/Mac-Glue-1.30/Glue.pm">Mac::Glue</a> for sending lots of messages iteratively. </p>
<p>I&#8217;ve also improved the actual command recipe, using &#8216;duplicate&#8217; rather than &#8216;add&#8217; to build the playlist seems more efficient.  Also the overhead of having to periodically build glue modules with the &#8216;<em>gluemac</em>&#8216; tool is removed. Sadly appscript isn&#8217;t shipped with OS X, but installing it ( at least on Leopard ), is as simple as &#8216;<em>sudo <a href="http://peak.telecommunity.com/DevCenter/EasyInstall">easy_install</a> appscript</em>&#8216;.</p>
<p>The concept behind the tool is the same : use a nominated playlist to synchronise the albums with the iPod,  and pick a random set of albums from buckets organised by album rating. Currently it&#8217;s set to shuffle in 10 &#8216;2 star&#8217; albums, 20 &#8216;three star&#8217; albums, and 30 &#8216;four star&#8217; albums, selected from a &#8216;just music&#8217; smart playlist that filters the master library, removing all spoken word, and podcasts and other miscellany from the pool. </p>
<p><a href="http://beatworm.co.uk/iPodTouch.py">Here&#8217;s the source</a>. I&#8217;m far less experienced at python than I am perl, so I wouldn&#8217;t claim it was a particularly idiomatic solution. It does run many times more quickly than the perl / Mac::Glue solution, taking a minute or so, rather than the best part of an hour. I would put all the performance gains down to the AppleEvents bridge , appscript interface, and using more efficient apple event set operations, rather than iterating over individual data.</p>
]]></content:encoded>
			<wfw:commentRss>http://beatworm.co.uk/blog/computers/itunes-automation-revisited/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
