1. Fake Jenny : Disappointing, and yet perhaps appropriate, @jennyholzer is not the work of the artist, although they use her words.

    posted by cms on
    tagged as
  2. Eddie Argos , of Art Brut fame, and Mikey Georgeson a.k.a. Mr. Solo a.k.a. Vessel from David Devant and his Spirit Wife have formed themselves a glam rock band - Glam Chops .

    Even better, their first release is a Christmas single : 'Countdown to Christmas / Baby Jesus was the first Glam Rocker' . Better still, they've made it available as a free download 'as an antidote to the credit crunch'. It sounds pretty much like you'd expect, and the first listen brought a seasonal smile to my face.

    posted by cms on
    tagged as
  3. I've only just noticed, but the Matador Records sampler disc 'Intended Play: Fall 2008', which they have made available as a free download , has a sample track from A.C. Newman's forthcoming 'Get Guilty'. Unsurprisingly, I like it. There's some good stuff on the rest of the album too, well worth the download cost.

    posted by cms on
    tagged as
  4. One thing I wasn't expecting, from last month's new Apple hardware announcements, was the new MagSafe 2 power connector . The new Retina MacBook Pro, along with the 2012 " Ivy Bridge " MacBook Airs, have a new MagSafe port, physically incompatible with the previous generation, unless you use a little adaptor widget , which was luckily introduced for sale on the very same day.  


    MagSafe is Apple's name for their clever system of attaching the power line to their laptops to charge. Some say too clever by half. The cable has two pins, arranged as two symmetrical pairs , so you don't need to worry about orientation when you connect it up. The pins live in a little oblong recess, surrounded by a thicker shiny metal lip, which is magnetized. The power socket has the complementary inverse shape and magnet, meaning that they eagerly cup together to form a snug charging connection when introduced. The other significant benefit of this arrangement is the ease of disconnection, nice in itself, with the additional blessing that if some clumsy person, perhaps a passing dalmatian , blunders through your cable while you're tethered to the mains, your computer doesn't fly from the desk and shatter, the magnet just snaps free. I'm a big fan.


    And so, on to MagSafe 2. Essentially it's the same thing, but in a different shape. The pin configuration and spacing seems to be the same, but the magnetic lozenge, and the companion socket have been reshaped to be longer in the lateral plane, and slightly shorter in height. The shape of the connecting plug has returned a the symmetrical rectangular nub, with embedded charge indicator. Reminiscent of the first generations of MagSafe, but Aluminium, rather than white plastic, and slightly longer, making it perhaps a bit more finger friendly. 


    Most commentary I've seen about this form change has settled on the Retina MacBook Pro as the motivation for this change, speculating that the move to thinner unibody laptops requires a thinner connector. I'm pretty unconvinced by that argument. The MagSafe 2 is only a millimetre or so thinner than the previous design. I think that if your design constraint was to shrink the connector, you could make it smaller. Furthermore, the traditional Magsafe port is almost the same height as a USB or HDMI socket, and the Retina laptop case houses these ports, without compromise. I have a different theory about the reasoning behind this new shape.


    I think the most significant change is that the contact area of the magnetic surface has now nearly doubled. It's a lot more grippy than it's ancestor. Anecdotally, over the lifespan of the MagSafe, I've heard complaints from other users about the reliability of the chargers, particularly about cable and connector failure. Having never experienced similar problems with the half-dozen plus MagSafe chargers I've owned, I've puzzled about this. I wonder how many people might be disconnecting their chargers by yanking on the cable. This works as a method of disconnection, but it's not a very sensible approach, it puts a lot of mechanical stress on the junction between the cable and the plug. Do it enough, and you'll eventually break it. The magnetic coupling is most efficient in the horizontal plane. What you ought to do is flick the plug out, by hooking a finger underneath the connector plug, and angling it up away from the socket.


    Apple certainly seemed to recognise that there was a UI problem here. Perhaps an expensive one, if enough customers were returning broken chargers to stores. They even produced a technote about the correct way to disconnect a MagSafe. Then MagSafe plug connectors changed shape over time . The strain relief on the cable junction lengthened, and then the plug changed from the original stubby T-shape, to a longer L-shape, itself subsequently re-inforced with additional strain relief. This connector shape encourages a lower-stress detatchment, but spoils the nice symmetrical property of the plug, because you can now connect it facing forwards, where it will obscure your other ports. MagSafe 2 returns this helpful feature.


    So is reliability a plausible motive for this redesign? I think so. The increased contact area of the magnet in MagSafe 2 makes it quite a bit harder to disconnect by cable-tugging. The larger plug housing is easier to grip with the fingers and angle out. The connector is a sufficiently different shape to visibly distinguish it from it's predecessor. It will be interesting to see if the reliability reports from users  improve. 

    posted by cms on
    tagged as
  5. As I mentioned earlier , just as I was preparing to head out for Release the Bats, an email came in advertising a once-in-a-lifetime, never-to-be-repeated, world-exclusive, miss-it-at-your-peril set of performances by a reformed Sleep , at one of next May's ATP weekenders.

    Now I'm old and cynical enough to realise that very few things are truly never-to-be-repeated one-off exclusive shows in the world of Rock n' Roll, but I am keen on Sleep, and ATP surely know how to run a memorable event. I've always been intrigued by the idea of one of their Minehead weekends, it seems eminently possible that it's a great deal more civilised than the more traditional tents, rain, and cider circuit. It didn't take me that long to make the plunge and book a chalet for two. Team Strickland are going to Butlins !

    Aside from Sleep on the bill, we have long-time house favourites Spiritualized , crazy art-rockers Devo , experimental hip-hoppists AntiPop consortium , post-punk legends Young Marble Giants , and several others I don't yet know adjectives for. The more interesting thing about the lineup is the fact that 50% of the lineup will be chosen by popular vote by the ticket purchasers. That means me!

    There's a cunning twist. No doubt intended to mix things up, and keep it fresh. You're not permitted to vote for acts that have played an ATP UK festival before, at least not initially. This makes life decidedly more tricky. Lots of my no-brainer instant first choices are on the exclusion list. I shall have to work a little harder.

    dEUS and A.C. Newman have to be definite votes. St. Vincent would be good. Angels of Light , Midlake , Wolf Parade, Swan Lake ? Ratatat ? Sufjan might be a populist choice. I'd love to see Morton Valence again. Black Affair or the Aliens ? Maybe I could gamble a vote on a reformed Beta Band. Decisions, decisions...

    posted by cms on
    tagged as
  6. Monolithic : it turns out that a prototype transparent monolith prop from the film 2001 is on display near Tower Bridge.

    posted by cms on
    tagged as
  7. Yet another fancy-dress party. This time to honour Claire's birthday. One thing of note about pirate dressing-up, Goths have an unfair advantage over normal people. Still, not often that happens, I suppose, so fair play to them. My outfit ended up a bit Roger the Cabin Boy. And my monkey had insufficient anchorage, and so listed about a bit, drunkenly. Not my best look, on balance.

    Pirates!

    I blame Johnny Depp. I'm sure pirates used to be far less accessorised.

    posted by cms on
    tagged as
  8. No, Really : Marcel Proust playing Air Guitar with a tennis racket.

    posted by cms on
    tagged as
  9.   Chevalier d'Eon : 18th century cross-dressing French diplomat recently identified as subject of a painting in the National Portrait Gallery.

    posted by cms on
    tagged as
  10. After falling head over heels for the ATP stage roster, and having my mind blown by Shellac at Primavera this year, It took me about five minutes to sign up for this Halloween show, in London with Shellac headlining. Literally five minutes, the serial numbers on my tickets were #00002 and #00003.

    Held at the Kentish Town Forum , which I think used to be the Town and Country club, a venue I was last in to watch the final incarnation of Green On Red in something like '91. Nothing much changed about the place, and I was quite happy to note that there was plenty of milling around room at an event which I think was sold out, indicating a sane crowd capacity limit, a novelty for a London venue.

    A varied lineup of bands, the evening kicked off with Lightning Bolt , an outfit I know very little about. Apparently they played from the stage floor, surrounded by the first 500 punters in the queue. Followed by Pissed Jeans a band I narrowly missed seeing at Primavera , but am moderately curious about them, chiefly due to their revolting name. Sadly I didn't show up until just after they'd finished their set this time, as well. Perhaps I am fated never to see them play.

    There was a nice atmosphere for the themed night. The crowd was mostly dressed up in halloween garb, plenty of monster makeup and fake blood and wounds. Some of them seemed scarily over-refreshed to me, at least for such an early point in the evening. There were monster mannequins propped up about the place, and model ghouls with flashing eyes suspended over the stage. Most of the bands had gone to great lengths with their fancy dress. Mrs. S. was wearing bats in her hair, but I'm afraid that I let the side down somewhat, opting merely for some magnificently spangly silver glitter shoes.

    First act up after we arrived were Wooden Shjips , who played agreeably spacy drony krautrock, which managed to keep my interest through to the end of their set, always a good sign for that style.

    They were followed by Om , who I find marvellously impressive. They didn't seem to feel the need to dress up at all, but this was perhaps mitigated by the fact that their doomy Sabbath sludge metal stylings rather suit the spooky halloween monster vibe without them having to try any harder than usual. The most fascinating thing to me about Om is just how much of a great metal-ish sound they manage to summon up as a duo - just a Rickenbacker bass, vocals, and a tricksy drummer. My attention did wander on occassion, but when I found myself locked into their ponderous form of groove, it was quite captivating. And unlike in Spain, they were all finished by 10 p.m. so I managed to enjoy the full set this time. Exciting Om-related news that reached my inbox just before I set out for the show. Sleep are to reform for a show at ATP:Fans strike back next May!

    Les Savy Fav next, a band I find okay on record, but who have a 'must see' reputation about their live show. They kicked off with a tableaux involving a plague of zombies on stage, battling the band dressed as cops. It was a tad confusing, with plenty of dry ice, but I suspect the cops were overcome, and they then kicked off straight into their set as zombie cops. I can see why they have their live reputation; Tim Harrington is a very unusual looking frontman, and his stage antics are high-energy and engaging, plenty of clambering around the rigging, clothes shredding, fake blood and protracted sojourns into the audience for mass singalongs. Overall, I found them a bit murky-sounding and unconvincing for me.

    Shellac of course played a fantastic set. The vocals were a bit muffled, mostly down to Steve's comprehensive home-made mummy outfit, his entire head was wreathed in bandaging. Backing vocals were also indistinct, yet marvellous, Bob was styled as a Frankenstein's monster-type character, and performed the entire set firmly in character, all his vocal parts were strangulated-larynx monster grunting and zombie moans. Very amusing. I think he even performed an onstage Q & A much like they did in Spain, but kept to this completely unintelligible delivery. And Todd was a superbly convincing vampire, with plenty of finely judged cape theatrics and hissing. Shellac are superb, and are still my favourite live band. Go and see them as soon as you can.

    I can't provide any photos, sadly. In the only negative note of the whole evening, my camera was pinched by some idiot. I think it most likely was pilfered while I was on the night bus back to the hotel, as I wasn't really paying close attention to my belongings by that point. In consolation though, the camera-lifting idiot didn't get the essential proprietary cabling and charging cradle necessary to make their new toy useable, and I got to pick up a new camera the next day from one of the gadget megashops on TCR. I quite fancied an upgrade anyway. Plenty of photos from the show from others , on Flickr.


    posted by cms on
    tagged as
  11. 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
  12. 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
  13. David Cross was in the New Pornographers promo video for 'Use It.' When I went to see David Cross curate his cabaret show last year in London, one of the acts presented was Kristen Schall , who showed a film from her ongoing 'Penelope Princess of Pets' series. Now TNP have a video for Mutiny, I Promise you, featuring Penelope Princess of Pets.

    <embed>

    It's all linked. I henceforth predict the Flight of the Conchords will support the forthcoming A.C. Newman tour.

    Kate was right, that's clearly a cardboard theremin. Not often you get to say that.

    posted by cms on
    tagged as
  14. I'm organizing my photos to make use of some free prints on offer from photobox. Hence I've uploaded a selection of older shots that I'm mulling through. There may be some repeats from earlier posts.
    Older photos

    posted by cms on
    tagged as
  15. 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
  16. If it's the last weekend in May, then it must be time for me to go to Primavera Sound ! Barcelona's premier eclectic music festival, or as I like to call it, only semi-jokingly, my annual trip to Spain to watch Shellac. It seems like I've been going forever now, but when I tally up, I think this year is only my sixth visit. Enough for the memories to blur together somewhat; I'm starting to find navigating around the site confusing; each year there is a gradual migration of stage locations, and a subtle shuffling of stage names.


    PS12d

    You can buy early-bird VIP passes shortly after they confirm the dates for the festival, which is far in advance of any lineup announcement. These sell for around the same price as the eventual full festival pass, but confer various privileges to reward the faithful. This year, I was finally smart and planned ahead. and I got us a pair back in July. Ah, hubris. Subsequently we fell pregnant, and had a baby  just four weeks before the festival, making a mockery of my forward planning, and invalidating our usual routine of attending as part of an extended family holiday. I ended up scaling my visit right back down to a quick in-and-out just across the festival days, and after a couple of potential takers for my second ticket fell through, I ended up attending on my own.

    PS12c

    It turns out Barcelona is still pretty much my favourite place on earth. In a break from the usual routine, I was staying in a hotel out close to the festival site, at the far end of the Avinguda Diagonal , rather than an apartment somewhere more central. The facilities nearby are pretty excellent, if a little characterless, with the large modern Mall development el Diagonal Mar providing pretty much every consumer amenity you might need, including free Wi-Fi. It's still easy to reach central Barcelona on transit during the sociable hours of day, and it solves the problems associated with picking a time to leave the Festival, and locating a means of transport home, once you hit the small hours of the morning on the weekdays. Door to door from the festival to my hotel was a leisurely ten minute walk.

    PS12b

    Once again I had a really good time. I had a few reservations heading in. Last year was a bit crowded, and occasionally hard work. Being on my own was is a bit weird. I've done stints working away from home, but they aren't like this. Luckily I did find some people to talk to at Festival; I enjoyed the chance to spend some time with Matt and Anne , and I also bumped into a few friendly groups by chance; Mike and the Canadian islanders, and those nice chaps from Leicester from the Jeff Mangum queue. Hello to any of you who find your way to reading this!


    The upside of attending on my own, it meant I was able to watch lots of bands. I overdid things  a little on the Thusday, watching upwards of twenty acts in a session stretching from 4pm through to 4am. I subsequently found myself flagging a little through the middle of the session on the Friday, and finally found a happy balance for Saturday. Weather was excellent, probably the hottest Primavera I've attended. I even managed a mild sunburning on the elbows on Thursday, and I rarely sunburn. The VIP passes turned out to be a good bet - subsidised bars, segregated rest and food areas, and easy access to the indoor concert hall for the posh gigs.


    PS12a

    Shellac completely owned it, once again. Year after year, always different, always the same. My other musical highlights were Kleenex Girl Wonder, Spiritualized pulling "Electric Mainline" out of the back catalogue in the middle of a perfect festival setlist, the pro-celebrity karaoke festival of the Big Star's 3rd tribute ( Mike Mills! Norman Blake! Ira and Georgia! Alexis from Hot Chip! ), and I need to pass out a special mention for the marathon Cure set. A bedrock foundation act from my indie disco days, they played a 30-odd song set of old fanservice and hit singles, and I nodded along from the VIP lounge, surprised by how much of it I recognised, given that I own precisely one Cure LP ( Disintegration , naturally ), and one single ( Inbetween Days, I'm predictable like that)


    Here's everything I saw, replete with aribitrary ratings :


    Baxter Dury ★★   Afghan Whigs ★★   Wilco ★★   Franz Ferdinand ★★   Death Cab For Cutie ★   The xx ★★   Spiritualized ★★   La Estrella De David ★★   Pegasvs ★★   Iceage ★   Grimes ★★   Danny Brown ★   A$AP Rocky ★★   Peter Wolf Crier ★★   Field Music ★★★   Kleenex Girl Wonder ★★★   Dominant Legs ★★   Bombino ★★   Lovely Bad Things ★★   Other Lives ★★   The Cure ★★   Afrocubism ★★   I break horses ★★   Dirty Beaches ★   Sleigh Bells ★★★   Nick Garrie (plays "The Nightmare of J.B. Stanistlas") ★★   Jeff Mangum ★★   Big Star's Third ★★★   Picore ★   Orthodox ★★   Sharon Van Etten ★   Justice (live) ★★★   Beach House ★★   Neon Indian ★   Demdike Stare ★★★   Shellac ★★★   The Pop Group ★   Atlas Sound ★★   Michael Gira ★★   Milagres ★★   Jenn Grant ★★   Cadence Weapon ★★


     There weren't too many low-lights. Occasional bar queues. The subsidy at the VIP bars meant that the occasional drink bought outside of those enclosures had a costly sting. A couple of occasions of queuing; to collect the passes, and to get a ticket for, and then gain access to the limited entry Jeff Mangum show. Aggravating cancellations , Björk, Death Grips, Sleep and Melvins - acts I wanted to see, and in the case of Sleep, probably my ideal of the biggest single draw of the festival. Luckily I'm a veteran, pragmatic festival-goer, I don't place too much weight on being able to see individual acts. If I hadn't already seen Sleep at ATP vs Fans:2, I might perhaps think differently.


    Leading up to the festival I had been wondering if it was going to be my last year at Primavera. Logistically it's growing more awkward to arrange, I've been a serial attendee for years, and sooner or later the charm should wear off. The inaugural edition of the Portugese sister festival had been catching my eye, And then everything worked it's usual magic. I plan to head back to Barcelona for 2013 if I can. Maybe I'll see you there.


    posted by cms on
    tagged as
  17. Font Feed is an interesting looking, appropriately stylish, aggregator of things typographic.

    posted by cms on
    tagged as
  18. Restore Bounce Mail : Mail.app lost it's "Bounce Message" command in Lion. Restore it via AppleScript.

    posted by cms on
    tagged as
  19. I have some Objective C classes that I'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'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 $HOME/lib/ , and the class headers to $HOME/include/$LIBNAME.

    This way when I use these classes in another project, I can just #import 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.

    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 NSMutableArray , 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.

    I first refactored it to be a subclass of NSMutableArray, but that actually introduced more complexity. NSMutableArray is implemented as a class cluster , 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.

    Of course, Objective-C allows you to define categories 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's extensive interface.

    Surprisingly, it wasn'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.

    The system logs had an entry for the crash; selector not recognized attached to symbols that were recognisably the new array methods from my category. Running 'nm' 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.

    It turns out that in order to link against a static library that contains Objective C categories, you need to pass the linker a special flag, '-ObjC'. Adjusting the build settings of my project to include this flag in the 'Other linker flags' entry of the target inspector fixed it so that the symbols are correctly resolved at runtime. Here is the official word, Technical Q&A QA1490.



    posted by cms on
    tagged as