1. It seems like I've been waiting all my computing life for VDUs to exceed 200 DPI . Well, that's an exaggeration. I've been waiting for it for about as long as I was first exposed to system-wide vector-based  type rendering, in the late 1980s. So I'm understandably excited about Apple's new "retina" MacBook Pro , with it's display of ~220 DPI.


    Why care so much about DPI? It's all about the text, in particular the inherent problems with clearly scaling non-rectilinear strokes.  Text is the fundamental component of everything I do with computers. It always has been, and it seems likely that it will long continue to be. As a floppy haired, slack-wristed aesthete, I really care that the text, which I will be staring into for hours, is clear and beautiful.


     The LCD screens used for most modern displays are constructed from a mesh of tiny discrete transparent shutters , which work in combination to make up pixels, which are the smallest visual element that can be addressed on a bitmap display. Typically these pixels are nearly square, and they are arranged in a 2D matrix of perhaps a few million elements. That may sound like a lot, but it's coarse enough to introduce perceptible distortion into lines that are not perfectly rectilinear.


    One of my favourite things about Mac OS X, and it's upstart little brother, iOS, is the respect their type-generating software applies to letterform. Typefaces render very faithfully, regardless of scale, and pains are taken to smooth out the curves, using anti-aliasing techniques, that detect the staircasing edges of lines, and soften them into their background with gradual shading. This works very well, but it's not un-noticeable; there's a soft-focus effect that gives a fringey halo to certain text shapes; you become inured to it over time. Other GUI systems tend to adjust the letterform to make the text better align to the pixel grid, it's common for people who aren't habituated to the Mac to comment about the degree of blur.


    Things are much better than they used to be. Way back in the day, when outline curved rendering was just too computationally expensive to be routine, everything on-screen was painted as a copy of a pre-drawn bitmap , and blocky graphics were everywhere, particularly once scaling and translation was applied. We peered at them on our tiny goldfish-bowl CRT monitors. Outline font rendering was a specialist feature of certain software packages or dedicated computer systems, perhaps not even rendered online. The fanciest workstation computers had gigantic 20" CRTs , and all vector graphical engines like Display PostScript . It seemed reasonable then to expect the exponential improvements in technology to scale this up to at least print-quality DPI, and the costs to come down.


    The costs did come down, and the computers continued their frantic pace of improvement, but something appeared to lock mainstream display rendering at somewhere around 100 DPI for over a decade.  I think it was a combination of factors.


    There was the move away bulky from beam scanning phosphor dot CRT monitors, which are theoretically capable of precise drawing at a perfectly graduated range of resolutions, over to the more space and power efficient LCD displays, with the aforementioned discrete physical pixel elements. Fifteen years ago I had a 19" ADI multisync CRT monitor, and the effective resolution of my computer display crept up as I upgraded my graphics card and display, and the monitor kept  pace. For the last ten years, I've been using a nice 23" HP widescreen LCD , and my desktop resolution has been locked at  1920x1200 that corresponds to the mechanical pixel array of my screen.


    LCD screen technology manufacturing is closely tied to flatscreen television production, where the standard vertical resolution has settled on 1080 pixels, which is marketed as ' High Definition ' which is actually pretty low definition if you stop to think that cheap desktop computers were routinely rendering higher than that years before its roll-out.


    The system software used on desktop computers, made optimisations and took short-cuts based on the average dot pitch, using fixed bitmaps for painting GUI elements, making assumptions about proportions and spacing of on-screen elements that entrenched and subsequently proved remarkably hard to shift.


    The turning point seems to have come with the iPhone 4 , and it's "Retina" display, with a DPI count of 326 - close to that of low-grade print - on it's highly saturated backlit LCD screen. Text looks fantastic on this generation of iPhone, still to me the nicest display of this type I've seen. This was followed up by the slightly coarser (264 DPI)  Retina iPad model a couple of years later, with a and as of last week, the still slightly astonishing Retina MacBook Pro.  Seems like the high DPI era I've been waiting for is here!


    And yet I'm not going to buy a Retina MacBook Pro. I did give it some excited thought. I rushed right out to Apple Covent Garden after the announcement, and fondled one for a little bit, and decided it's not really for me. Experience has taught me to steer wide of a 1st iteration Mac Platform, especially one where Apple seems to be pushing the hardware design into some advanced new shape. There's often early adopter trouble. A couple of early warning signals jump out at me from the start. Pushing that many pixels around is really going to need some grunt work. I have my suspicions about cooling; why the big air vents down the side, why devote five minutes of the keynote describing a cunning new fan design? It's a Mac, I want no fans. Steve always wanted No Fans . It's too big and heavy for me, and yes of course, it's really expensive.


    I ordered a new generation 13" MacBook Air . It will replace my current laptop, a last generation 13" MacBook Air. Which replaced my previous laptop, a 13" MacBook Air from the year before. Seems I have a MacBook Air habit .


    The wedge-shaped MacBook Air is iterating rapidly to converge upon my ideal computer. Light enough to move around without becoming a burden. A full scale keyboard that I enjoy typing upon, as an emacs -wedded touch typist prone to RSI. Enough pixels on the screen to productively juggle the magical 3 window pattern I tend to adopt for work (an editing window, a reference window, and a command shell). Enough power that I don't need to worry about where my next charge point is. And the 13" display has fairly small pixels (~128 DPI). Smaller text isn't as legible as I'd like, mind you, and some of the GUI elements are a bit small. It would be nice to have more CPU cores. Like I say, iterating rapidly...


    200+ DPI displays are clearly here to stay. Where Apple plant their flag, all the OEM PC hardware makers ineveitably follow. Microsoft Windows , which to me increasingly looks like it's playing catch-up, seems to me, looking from the outside, to be more completely resolution independent than either of Apple's operating systems at this point in time, so that shouldn't be a hold-up to broader deployment any more. Production will simplify. Costs will fall with scale. 


    I had been planning on buying a nice external display, probably an Apple Thunderbolt , because they make lovely docking stations for Thunderbolt-equipped laptops, but that's a foolish idea now. It seems sensible to bet that there will be a high-DPI equivalent along within a couple of years, and monitors are a long term investment. I can wait. 


    We seem to be at something of a transitional phase for the personal computer at the moment. It seems likely that the future of the Mac is some kind of convergence point between the iPad, the retina MacBook Pro and the MacBook Air, but I can't quite figure out what shape that thing will take. I am typing this final sentence on my box-fresh, just powered up, 2012 MacBook Air, with it's new Mac smell, and it's LCD screen cleaner than I will ever be able to polish it; already I am day-dreaming about it's replacement.

    posted by cms on
    tagged as
  2. tee hee hee

    elfm.el is a rudimentary last.fm radio client implemented within emacs lisp. I wrote this at work to present at our internal "Radio Hackday"; dedicated to encouraging staff to experiment with the radio services and API , and make something with them in a day and a half for show-and-tell. Kind of 20% time distilled right down to an essence.


    I wasn't sure if I was going to have enough time to contribute anything, so I wanted to focus on something I could hack on by myself, because I didn't want to hold a team back if I got called away. So I picked something jokey, inessential, yet hopefully thought-provoking, as per my usual idiom.


    I had a real blast participating. I don't usually get time to attend things like proper hack days, being all old and family-bound. I really enjoyed the atmosphere of inspiration and industry. All the other hacks were amazing, and waiting for my turn to demo I felt quite embarrassed about my stupid cryptic toy, but it worked perfectly in the spotlight. I got almost all the laughs, and all of the bemusement I was aiming for.


    The code is here . It is awful. I haven't written any coherent lisp on this scale for many years. It uses too many global variables and special buffers. It doesn't scrobble. I had to rewrite all my planned asychronous network event machine halfway through implementation, when I re-discovered the lack of lexical closures in elisp. ( I've been reading too many common lisp books in the interim, I suspect ). I think there's enough of the germ of a useful idea in there that I might just clean it up and try and extend it into a proper thing.


    I built and run it using GNU Emacs 23.4.1 . I used an external library for HTTP POST , which I found on emacswiki ( HTTP GET I glued together using the built in URL libraries). I've also put a copy of the version I used in the distribution directory. I used mpg123 for mp3 playback, which I installed using Mac Ports . The path to mpg123 is hardcoded in the lisp somewhere, probably inside play-playlist-mpg123.


    Here's my demo script, which I evaluated in a scratch buffer. Evaluating these forms in sequence will authorise the application, tune in the radio, and then fetch a playlist of five tracks and start playing them.


     ;;;; -----DEMO , this example code is out of date, see README 

     ; will open a browser to authorise application

     (authenticate-app) 

     ; authenticate a user session

     (start-user-session) 

     ; tune the radio to this URL

     (radio-tune "lastfm://user/colins/library/") 

     ; refresh the playlist 

     (get-request (get-playlist-url)) 

     ; filter the playlist response to sexps, play the list

     (play-playlist-mpg123 (reduce-playlist)) 

    There is only one playback control at the moment; stop, which you can manage by killing the buffer lastfm-radio which has the playback process attached to it.  You can retune the radio with any lastfm:// URL format ,  by re-evaluating radio-tune, and then refreshing and playing the playlist i.e. repeating the last three steps in sequence.


     The internal hackday was a cracking idea. Most of the hacks were focused around radio enhancements with broad-ranging appeal, the vast majority of them looked practically useful. I suspect most of the work will filter out into site and product updates. In addition to this, and perhaps more valuably, it worked really well as a community exercise, evolving knowledge-sharing, cross-team working, and enthusiasm, and converting them into inspiration, craft, and art. More of this sort of thing, everywhere!


    Updated



    I've iterated on the original hack quite a lot to make it slightly less brain-damaged, and a bit cleaner to import into anyone else's emacs. Updated code is here and so is a README file with updated running instructions. It's still not really in a usable state for anyone else, but it's amusing me to fiddle with it, and I vaguely plan to get it to a releasable alpha state, at which point I will publish a repository.

    posted by cms on
    tagged as
  3. My friend Jim won 15 quid by solving the New Scientist Enigma Puzzle. The really neat thing is he did it 32 years after the fact. Read all about it here , in his own words.


    Would anybody with a working BBC like to contribute a real world run time for his BBC BASIC based solution?


    Jim runs the Enigmatic Code blog about his hobby of solving New Scientist's Enigma puzzles using short python programs, which anyone can play along with at home.

    posted by cms on
    tagged as
  4. I was churlishly unimpressed by the iTunes "12 days" Christmas promotion this year. However whilst subsequently browsing the iTunes Store home page I did find one app that impressed me enough to blog about.


    There's a store section called " Apps Starter Kit " which lists a dozen or so applications that Apple are promoting as "must have" installs for new iOS users. I installed a handful of these to my iPhone 3GS, but the one that has most impressed me so far is the iOS edition of DragonDictate .


    It's a "split brain" app, by which I mean it uses "the cloud" to perform the text-to-speech conversion. So far I have been quite impressed with the accuracy of the process, in fact I have created this blog post by dictating while walking the dog, with just a little editing afterwards for tidy up and to add hyperlinks. I suppose it is a little like a poor man's edition of Siri, minus the pretend A.I. and the search and reminders integration.


    You can get text by dictating into a text box within the application and there is a quick menu of options that allow you to create an SMS or an e-mail or copy the text to the system clipboard easily for use in other applications. This collaboration isn't too clunky and although dictating text into your phone is a little stilted it doesn't seem to be significantly less effective than my relatively crappy typing on the iPhone on-screen keyboard.


    The app was free, presumably it's intended as a promotional device to introduce users to the Dragon family of software applications. Obviously there are some privacy concerns raised by having the voice processing performed on a remote server, but the terms and conditions include a privacy policy which guarantees to preserve your anonymity and keep your data private. The application did even prompted me to ask if I wanted all of my contact names uploaded to the remote service for greater the use of name recognition, and took pains to explain that this would only include name fields from my contacts database and no other personally identifying information or contact details.


    I am not sure I would make a habit of using it for writing long articles or even blog posts like this but I think it could prove to be quite useful for such purposes as short e-mail replies or even sending SMS messages in situations where it's inconvenient to type.


     

    posted by cms on
    tagged as
  5. Hello there, old friend #movingin

    Of course, I bought and read the Jobsography , Kindle edition, naturally. While I'm not sure I identify with all the howling fanboys' anguished reviews, given my role as super-NEXTSTEP-fanboy  I was a bit disappointed, although not particularly surprised, at the relative lack of NeXT content. So I was overjoyed when this 1986 PBS documentary , featuring NeXT in it's pre-launch startup guise, popped up in it's wake. The linked blog post also contains the NeXT stevenote, from the eventual product launch.

    posted by cms on
    tagged as
  6. The perfect laptop at last

    Of course it's not actually running NEXTSTEP. Of course, in a sense it is. Just like your phone.


    Thanks to ebay. I like the fact that the sticker arrived with a little template indicating the correct 28° of jaunt. I ignored it of course, and just lined it up by eye.

    posted by cms on
    tagged as
  7. Mr. David Hepworth , of the lovely Word Magazine (I subscribe !), a usually reliable, and always interesting cultural commentator just blogged a piece about the reactions to the untimely passing of ex-Apple CEO  Steve Jobs . I think his assessment of Mr Jobs' cultural impact is wrong. I was going to present my reaction in place on his blog, although it did seem to grow a little too long for the commentary section, and I subsequently found out that his blogger site seems to be set up disallow comments from people who aren't logged in to a Google account, which I object to, somewhat dogmatically. So I decided to post my piece here, and link back to his , which is more in keeping with my own views about how the Web ought to run.


    I don't disagree fundamentally with the tone of the piece. I do share his unease over the now seemingly mandatory broadcast grief marathons that accompany any death in the public eye, and I find an unpleasant hint of infantile narcissim in the fetish relationship between the user and product celebrated with the mass parades of public Apple evangelists and their iDevices, which might be a cousin to the sentiments he expresses about toys and proportional responses.


    This attempt to sum up Mr. Jobs as a super-skilled marketer I think underestimates the scale, and perhaps also the nature of Mr. Jobs' contributions, some of which are subtle, many of which may look obvious, but usually only by hindsight. Even if his role was solely as a provoker, and curator of works; and I doubt it was, the truth is rarely that neat - he seems to have his fingerprints near the genesis of a string of transformational products, which do seem to fulfill the cliche of yes, changing the world.


    Start at the beginning: His role in realising the portable microcomputer as a packaged appliance, something like a food processor, that people could be taught to directly integrate into their homes and offices. The Apple II barnstormed this market. I am not so sure as most other commentators that this idea was an obvious, archetypal product simply waiting to happen. Putting computers in your house, I think, is a fundamentally odd idea, albeit one that we have now fully naturalised. In 1976 it must have been almost schizophrenic.


    Refining this idea into the Macintosh and Lisa, a specifically pioneering further insight was that a then unusual  square pixel bitmapped display would better lend itself to curve plotting. This gave us the WYSIWYG relationship between the graphical computer and the laser printer , computer typography and thereby re-shaped the primary means of production for print and graphics.


    The post-Apple "wilderness years" are particularly interesting. At NeXT they pioneered software controlled automated computer assembly and production, I've heard it said maybe a decade ahead of everyone else. I think they made a lot of mistakes, but I also think these lessons learned were invaluable later on. More significantly, the NeXT system software placed an elegant emphasis on "object-oriented programming", carefully enveloping the tedious nuts and bolts of interfacing with electrical computer hardware with well chosen software 'components'; tidy abstractions that lead to a system that was significantly easier to port to new hardware configurations, and simultaneously could be more-easily programmed at a higher level, without resorting to so much specialist understanding of specific hardware.


    The significance of the work at NeXT will not be fully realised until later in his career, but as an intriguing footnote, it is on a NeXT workstation that a British scientist called Tim Berners-Lee develops some applications and protocols he calls the "World Wide Web". Mr Berners-Lee is on the record noting that the unique NeXT development tools allowed him to easily connect abstract layers to form useful application prototypes in the space of a couple of months.


    Steve's other business during those years was Pixar . You don't have to study the history of cinema over the last two decades too hard to detect just how fundamentally Pixar shaped mainstream family movie making.


    Then he returns to Apple and begins that now over-documented turnaround from prodigal son and failing company, to pin-up CEO and spectacular media and financial success. It's worth pointing out that the portablility of the NeXT system software allows them to insinuate it into Macintosh entirely. Next the iPod, and then we get iTunes, and the 'iTunes Store'.  And then the same elegant software evolves to pocket phones, where the relative ease of programming buoys up the freshly invented 'App market'. And a finely edged production control builds an on-demand production, supply and retail operation that is the envy of the rest of the industry.


    I'm not a professional writer as Mr. Hepworth is. I hope I don't read like I'm elegising him mawkishly like some Princess Di or Jade Goody for the "Facebook generation", or lionising him in super-human terms as though he's some over-egged digital Da Vinci, or Newton. I never met him. I'm not laying flowers anywhere. I'm sure that a huge part of his success was through fortunate timing, and developing good taste and keeping good company, but this is surely true of many whom history accounts amongst the Great, perhaps even of most. What a C.V. though!


    These things are not a competition you can score, and yet I don't think most Word Magazine readers would rush to disagree with the suggestion that Steve's musical idols like Dylan or the Beatles "changed the world". I'm comfortable suggesting that to a subsequent generation, with it's own new media of choice, Steven P. Jobs influenced and changed the world to an arguably similar degree.

    posted by cms on
    tagged as
  8. I've been having persistent niggles with my home router / 802.11x base station / DSL modem. It's a D-Link DSL-2740B , itself bought as a replacement for my ISP-provided machine, an O2 wireless III (a re-badged Thomson SpeedTouch) which proved itself a low performer at both wireless and routing, and particularly dismal at doing both simultaneously.

    I picked up the D-link cheaply, in a clearance bin in John Lewis. In most respects it has been a splendid replacement for the O2. WiFi is fast, routing is consistent, ADSL sync is better. However, it does have one stupid bug. It can't do DHCP reliably. After a certain period, it starts sending out broken leases to clients; either issuing them with IP addresses that are already in use, or more commonly issuing a working address, but nullifying the nameserver settings. A reboot will restore sanity, but involves an irksome couple of minutes of network outage. Afterwards it is only a matter of time before the problem re-emerges, noticeably quicker if there's an increased rate of new leases issued, such as a group of visitors armed with smartphones popping in.

    I'm consistently amazed at how flawed home router appliances are. How anyone 'normal' is supposed to cope with these things, I have no idea. I've updated the firmware to the last available revision, fiddled with the limited options in the admin interface, to little avail. Web searches turn up a few people commenting on the same problem, but no solutions offered. This leaves me with three straightforward, yet unappealing options.

    1. Buy another router. Either another toy one, which seems likely to smuggle in some fresh nugget of buried failure, or buy something more professional, and hence eye-wateringly expensive
    2. Set up static configuration for every client. Seems a stupid solution in 2010 for a primarily wireless network
    3. Disable DHCP on the router, and add another, more reliable DHCP server to the network


    Option 3 initially seems least aggravating. In the past, my strategy for service infrastructure has always been using home servers, with some form of UNIX. These days though, I'm trying to minimise the number of computer-type devices I have to keep running 24/7. I no longer find any joy in being a home UNIX administrator, and it's nice to correspondingly reduce power consumption, fan noise, and cabling. So the idea of setting up a computer just to act as a DHCP controller is slightly repellant.



    The only machine tethered to the network is a modest, first-generation, G4 mac mini . It's chief use in the past was as a basic freeview PVR, using Elgato eyeTV , but the London flat's TV reception is too poor for this, so it mostly acts as an AFP -capable network interface to my firewire Drobo . It's a very old, low power machine, but would certainly be capable of acting as a DHCP server.

    It wasn't immediately obvious how best to do this. Obviously I could install any of the common free UNIX DHCP software, using MacPorts , or homebrew , or fink , or even just hand rolling something from tarballs, but all of these come with overheads, adding dependencies, requiring build tools, and subsequent package management, and all the little bits of service glue needed to make it run neatly as a daemon. Experience has shown me that integrating third-party UNIX services into a vanilla Macintosh can get fiddly, fast.

    There's no obvious DHCP server component on desktop OS X, but there's a latent capacity somewhere, demonstrated by 'Internet sharing', which lets you easily set up a Macintosh with a network connection as a basic router. After a little bit of poking around with this, and some internet searching, I discovered that this facility is part of the bootpd service. It's documented, and after a little trial-and-error, I figured out a way to run a DHCP server facility only, using just the built-in Apple utilities.

    Here's an overview of my network configuration
    • The D-link router provides NAT routed internet via O2 ( actually Be ) ADSL 2+ with a static IP.


    • The private subnet is 192.168.1.0/24


    • The router's internal address is set as 192.168.1.1


    • The mac mini is connected to the router via wired ethernet with an address of 192.168.1.4, and runs headlessly.


    • Everything else connects to the D-Link router wirelessly, using a mix of 802.11n and 802.11g




    Here's how to set up bootpd to act as a DHCP server for this network.



    First, configure the mac mini to have a static IP. Using screen-sharing from another Mac ( Cmd-K, vnc://192.168.1.4 ) to configure the network interface in system preferences.








    Next, configure your computer to also have a static address on the same subnet. If you get something wrong, and need to troubleshoot settings, you'll still need to be able to connect between the router, the mini and your workstation. I picked 192.168.1.111, as being well outside the range of anything I'd expect to be routinely allocated.

    Now you need to produce your bootpd config file ( /etc/bootpd.plist ). Unfortunately this means an XML property list. Every time I feel smug about how the Macintosh is re-invigorating UNIX with the old, crufty bad bits removed, I ought to remind myself about the maniacally stupid idea that is XML plists. Instead I thank my stars that I have a capable text editor. It's not that fearsome a property set, and is well explained in the man page , so you could build one by hand. An alternative approach, the one I used, would be to set up internet sharing temporarily on the mini for an interface you're not using; I chose firewire. Take a copy of the /etc/bootpd.plist file this will create, e.g. / etc/bootpd.plist.template , and then disable internet sharing again, which will remove the /etc/bootpd.plist file if it still exists. Now rename your template back to /etc/bootpd.plist and edit it.

    The options are all well documented, and it turns out that you need hardly any of them to get up and running.

    The key options are


    • dhcp_enabled: an array of network interface device names to answer dhcp requests on - I just have en0, which is the built-in ethernet
    • Subnets: an array of property dictionaries, that represent networks we're interested in serving. We only want a single dictionary for 192.168.1.0/24.
      • net_address: , is the network address - 192.168.1.0,
      • net_mask: the netmask for our subnet range - '255.255.255.0',
      • dhcp_router: default gateway address - 192.168.1.1
      • net_range: an array of strings representing the bounds of a pool of addresses to allocate from - 192.168.1.12 to 192.168.1.254
      • allocate: a boolean that is set to indicate that we're interested in issuing addresses for this subnet
    <ul>

    Most of the other defaults are sensible. I've kept all the other values that were generated for my template. Here's what I have in my file.


    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Subnets</key>
    <array>
    <dict>
    <key>_creator</key>
    <string>cms</string>
    <key>allocate</key>
    <true/>
    <key>dhcpdomainname_server</key>
    <string>208.67.222.222,208.67.220.220</string>
    <key>dhcp_router</key>
    <string>192.168.1.1</string>
    <key>lease_max</key>
    <integer>3600</integer>
    <key>lease_min</key>
    <integer>3600</integer>
    <key>name</key>
    <string>192.168.1</string>
    <key>net_address</key>
    <string>192.168.1.0</string>
    <key>net_mask</key>
    <string>255.255.255.0</string>
    <key>net_range</key>
    <array>
    <string>192.168.1.12</string>
    <string>192.168.1.254</string>
    </array>
    </dict>
    </array>
    <key>bootp_enabled</key>
    <false/>
    <key>detectotherdhcp_server</key>
    <integer>0</integer>
    <key>dhcp_enabled</key>
    <array>
    <string>en0</string>
    </array>
    <key>replythresholdseconds</key>
    <integer>4</integer>
    </dict>
    </plist>


    Next, create two empty files that bootpd expects to use. ' /etc/bootptab ', for any static address maps, and /var/db/dhcpd_leases , which will be a persistent database for issued leases. Now connect to the router, and disable it's DHCP server.

    The bootpd binary lives at /usr/libexec/bootpd . If you run it from a terminal with a -d flag, it will stay in the foreground and emit debugging info to stdout. You'll need root privileges for it to run, I just used sudo /usr/libexec/bootpd . Now request a dhcp address from a different network client. I used an iPad. It's a good idea to make a note of the network MAC address. If everything is working, you should see some output acknowledging the request, and then some more as a lease is issued. The client should then configure it's network interface with all the settings from your Subnet definition above. If it doesn't, and the output isn't helpful enough, there's also a further -v switch for more verbose logging.

    Initially I had trouble getting any leases issued although all requests were logged fine. It turned out I'd misconfigured the netmask when I set up the static address for the mini. If the network details don't match the defined subnet exactly, then bootpd will just fall back to default behaviour for the subnet, which is to just observe. Once I fixed that, things started working as they should. By default, a line is written to logs in /var/system.log for every request recieved, and one for every lease issued.

    The remaining task is to configure the service to run as a daemon from launchd. Luckily, there is a launchd profile for bootpd present, /System/Library/LaunchDaemons/bootps.plist .

    You can install this persistently into launchd like so

    sudo launchctl load -w /System/Library/LaunchDaemons/bootps.plist

    Running sudo launchctl list should then show a com.apple.bootpd service enabled. If for some reason you need to disable it once again, you can uninstall the service using

    sudo launchctl unload -w /System/Library/LaunchDaemons/bootps.plist



    posted by cms on
    tagged as
  9. The other day at work , prompted by a shoutbox conversation with one of our users , I did a little bit of exploring some of the artist catalogue data. The idea was to find band names that were repeating words, such as ' Talk Talk ' and ' The The '. Coincidentally, I had a freshly installed database server with just this sort of information on it, and needed a good excuse to stress test it a little. PostgreSQL's regular expression support is brilliant , and it was a very trivial exercise to quickly knock up a query that returned promising data. In the process of refining it, I got a chance to play around with the Hadoop cluster. I wrote the whole thing up over on the company blog, if you'd like further details. Fame fame fatal fame, it can play hideous tricks on the brain, as the song goes .

    posted by cms on
    tagged as
  10. Yesterday at work , I had to clean after up a particularly freaky Slony-I replication fault. I still haven't managed to understand quite what went wrong there. So this morning, I arrived at work in full diagnostic mode, jokingly grumbling about 'howfuckedismydatabase.com'. Laurie was particulary amused by this curmudgeonly joke, and we bantered about it. I pitched a few ideas about how such a joke site might operate, and we left it there and moved on.

    Except Laurie didn't. Despite my attempts to dissuade him, he registered the domain, and started knocking together some pages based on the earlier jokes. I chipped in a couple more suggestions, and suggested some error messages, and within twenty minutes or so he had an operational site . Then we shared it with a couple of like-minded people, and left it be. A few of the other people at work passed it around, and a couple of people submitted it to reddit.

    Within an hour or so things had started to really snowball. One of the reddit submissions gathered hundreds of upvotes, and for a period of time we were the number one story on hacker news . Laurie added a twitter button and a comment form to the site, and retweets and emails started accumulating fast. By mid-afternoon the site was approaching 200 hits a second, which it handled with aplomb, because he had coded it efficiently, and
    configured the server sensibly.

    It felt great to watch so many people comment positively about some of my dumb jokes, pretty much in real time. It gave me a really direct experience of something I'd always innately understood about the internet, but had not yet witnessed close to home; the ability to quickly reach an appropriate audience for almost any content, regardless of how specialised. Our little shared joke quickly reached out to thousands of people, who found something within it they also related to. This really amazes me.

    It also showed me something about my own character. While I was perfectly happy to joke about the idea, it needed somebody like Laurie, with the skill and enthusiasm to pick up on it and make it into something tangible and exciting. I'd instinctively shied away from broadcasting it further than my desk, and my initial reaction was that developing it any further would be a waste of time and money. I was very wrong about that, it turned out to be an interesting experience, and enormous fun. I think this means I should endeavour to be a little less cynical.

    posted by cms on
    tagged as
  11. I ran into some problems while I was trying to install python bindings for the Growl notification framework on my MacBook Pro. My Mac is running the current release of Snow Leopard ( 10.6.4 ) and I'm using a python.org installed binary package of python, under /usr/local/python. Building using distutils and the supplied setup.py failed, seemingly because the compiler was unable to find quite routine include files, such as stdarg.h and float.h .

    /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory


    This error message both confused and perturbed me, because stdarg is a fairly fundamental component of a working C library, and I am pretty certain that my compiler isn't that fundamentally broken.

    Picking apart the build output from the generated Makefile, I see that it is setting the -isysroot gcc flag, to /Developer/SDKs/MacOSX10.4u.sdk/ . I presume this is because the python installation is built to use the OS X 10.4 compatability SDK. This is why it's pulling in /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h . That header is a stub, and included the following stanza



    /* GCC uses its own copy of this header */
    #if defined(GNUC)
    #include_next


    #include_next is a gcc extension to cpp, and instructs the preprocessor to start searching for the include file again starting with the next directory on the include path after this one. Standard libraries like stdarg and float can be quite compiler specific, and as the comment indicates, GCC is expected to have it's own copy of this header file, which would be put away somewhere under /usr/lib/gcc .

    At this point, a nagging memory of building cocoa apps with XCode resurfaced, suggesting that the 10.4 SDK isn't compatible with gcc-4.2 ( the system default gcc under snow leopard ). GCC 4.0 is supplied though, for use with building against legacy SDKs. On this whim, I tried exporting CC=/usr/bin/gcc-4.0 and rebuilding, and everything worked as it should.

    From inspection, it seems like the snow supplied leopard python is built to use 10.6 SDKs and gcc-4.2 and may well be a more sensible python to use. Further googling ducking , turned up this bug report .

    posted by cms on
    tagged as
  12. There's a handy little command line tool nestled away inside Apple's system WiFi framework.

    Apple80211.framework/Resources/airport

    It doesn't come with a man page, but --help will print a usage guide.


    posted by cms on
    tagged as
  13. Leopard introduced a number of system level changes to font handling. There'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'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 - before leopard these could be easily found under /Library/Caches/com.apple.ATS - now they're squirreled away under /var 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.

    There's a command line utility provided, called ' atsutil ' which offers a user interface to these features. It has a fine man page .

    To purge the font caches, which will fix persistant text rendering problems, you use the command atsutil databases -removeUser

    To display the list of System protected fonts use the command atsutil fontprotection -files .

    To globally disable the font protection feature, use the command atsutil fontprotection -off . Re-enable it with the -on switch.

    Don't remove system protected fonts , unless you are replacing them with a workable substitute.

    posted by cms on
    tagged as
    1. Obtain S60 smartphone. I'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 'Bluetooth-console'. Ensure the Mac is paired with the phone.

      4. In a terminal, run ' screen /dev/tty.Bluetooth-console '

      5. Set your Mac's bluetooth to 'discoverable'

      6. Launch the Python application you'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.

      7. Meanwhile, back on the Mac: a python shell will start in your screen session after a small delay.

      8. In the python session, " import audio "

      9. In the python session, " audio.say('I never realised my phone had a built-in speech synthesizer') "

      10. Fall over in astonishment.
    posted by cms on
    tagged as
  14. 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'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're engaged by something, within the computer, verging upon a liminal state.

    It's a slightly amusing quirk, but when I think further about it, I find plenty of reasons why it perhaps ought to work.

    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 has most of the technology needed to be a wireless optical mouse.

    Most but not all. I'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'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.

    posted by cms on
    tagged as
  15. 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'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 f -keys. Initially I thought this may be a problem with the fn key that is the toggle, but eventually the keys f1 - f9 stopped working entirely. This was irritating, but didn'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.

    The next key to go was the right Shift key. Although, of course there's a left Shift key, for a touch-typist, this was a little harder to ignore. Although I find much to admire about Apple's current laptop keyboard design, unfortunately user-repairability isn't one of its many blessings. There's no simple way to get into the top casing on a polycarbonate MacBook, it's an expensive specialist job for a service centre.

    Sensibly I'd followed my own advice when I purchased this laptop, and bought it from the always-wonderful John Lewis with their standard two-year full warranty 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'd be able to take it with me on my trip to North America , 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.

    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.

    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've got a real Apple Store in Bristol , I think AppleCare is probably a good deal.

    I figured I'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 'unibody' Macbooks didn't really suit, as I've probably got as many firewire devices as USB. Also, my recent work had been feeling the strains of my Macbook's 13" screen and modest integrated graphics chipset. And so I'm typing this update from my new 2.8GHz, 15.4" MacBook Pro .

    It's mostly a great upgrade. On the positive side, it's pretty and slim, and I'm remembering just how right the 15" widescreen form is for me. The screen is brighter than anything I'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'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's super-fast, of course; the new CPU, memory bandwidth, and fast hard drive all combining to ensure that as yet, I've not seen any performance stalls when many simultaneous processes grow busy.

    It'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'd have thought, it's undeniably worse than my gloss MacBook.

    Then there are more straightforwardly negative negatives. Like many people, I've found trouble with the Apple mini DisplayPort to DVI connector - the integrated NVidea 9400 graphics adaptor can't drive my 23" TFT without sparkly artefacts, I have to run it through the additional 9600 GT GPU to get a useful picture. It'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's slightly heavier than a MacBook, and the battery life is probably less, it'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'm not sure I need a wired ethernet anymore.

    Not only that, but shortly after I'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 '09 would ship a mere handful of days after my new machine was dispatched. I think I'll still enjoy all the other Pro upgrades though, and they did offer recent purchasers like me the chance to upgrade the iLife suite for just a nominal cost.

    Overall I'm happy, and I'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'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.

    posted by cms on
    tagged as
  16. Ever wondered what your most used shell commands are? Here's a very silly way I knocked up to find out mine.

    history|perl -anle'$C ++;END &#39|head -10

    Some people would have you believe that perl is difficult to read.

    posted by cms on
    tagged as
  17. 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 ' Unable to close due to unfinalised statements ' then it might be a file permissions problem.

    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.

    posted by cms on
    tagged as