Skip to content

MacRuby, CocoaPods, 10.7, and XCode 4.3

I have a MacRuby project that uses CocoaPods for many of its ObjC dependencies. I had a bit of trouble getting it to run properly with the latest version of Xcode (4.3). This had to do with a recent change I made to MABSupportFolder (use of isEmpty()) which triggered a fairly obscure bugĀ in addition to the new XCode 4.3 organizational structure not being properly recognized at first. The obscure MacRuby bug was being caused by running -count on an NSString. When using MacRuby if you test if a NSString responds to -count using -respondsToSelector: you’ll get true as the response because of Ruby’s String#count method. However, that method requires an argument, but running respondsToSelector:@selector(count) will return true for an NSString…

Continue Reading

Create TGZ Automator Service

With Snow Leopard came some nice refinements to automator actions. However, all existing automator actions had to be recreated as services in order to be accessed through the Finder’s contextual menu. One automator action which I used fairly often was the create tgz workflow. I always found that action to be fairly useful so I recreated it as an action. Another unfortunate change with Snow Leopard was the elimination of input managers. This eliminated the convenient F-Script injection functionality that was present in F-Script anywhere. Luckily this functionality has been recreated using an automator service. Nice work!

Continue Reading

Jump To A HTML Anchor in a WebView

This isn’t something that is as straightfoward as you would think. There is no real ‘cocoa native’ way to acomplish this, and there seemed to be no information anywhere on how to acomplish this until I found this post. So it seems the only way to scroll to an anchor is to resort to evaluating javascript code: [code lang=”javascript”] – (void) jumpToAnchor:(NSString *)anchor { [oWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@”var anchor = document.anchors[“%@”];window.scrollTo(anchor.offsetLeft, anchor.offsetTop);”, anchor]]; } [/code]

Continue Reading

Don’t Forget To Flush…

No, not the toilet, your file streams. I was recently working on a project that involved creating a child process and reading its stdout to update the user inteface. Everything was working great until I sent it off to some testers who reporting that it ‘wasn’t working’ – the interface wasn’t updating correctly. I first thought it was a problem with the shell command itself, maybe it wasn’t performing the operation correctly and thus wasn’t sending the correct message through stdout but as far as I could tell everything was working perfectly. After about 3 hours of banging my head against the wall trying random things I finally thought to flush the stdout after sending my status message. It fixed it!..

Continue Reading

XTrace 1.1

At last XTrace 1.1 is out the door! This has been a long time coming, and has alot of changes & new features: CMD+Shift+C now clears the log window XTrace now automatically starts the trace server Added the Sparkle (auto updating) framework Added the ability to disable wrapping in the log window Added the option for window auto-close (log window will close when the SWF it is connected to closes) New icon thanks to Ale! Log message coloring/formatting thanks to Daniel Giribet Compiled & tested as a universal binary I’ve recorded a quick tutorial on how XTrace works. If you’re new to XTrace, or just want a quick refresher I encourage you to take a look. If you would like to get involved with development, please send me an email!..

Continue Reading

mach_override on Intel Macs

I was disappointed last month when after a hour or two of hacking I couldn’t get mach_override (evil, I know) to work on my new MacBook Pro even though it had been ported to intel macs. I added myself to the procmod group and tried everything that google could come up with, but I could only get it to succesfully override local functions, it wouldn’t override any library/system functions no-matter what i did. Today I’ve found the solution on the ExtendAMac mailing list hosted on sourceforge: this simple post contains a small patch that seems to fix all the issues I’ve been having…

Continue Reading

NSSound+SoundList

It confounds me as to why Apple will provide an easy way to get a reference a standard system sound (via -soundNamed:) but doesn’t provide any easy way to get a list of available system sounds. Well, as you might of guessed, I’ve created a NSSound category that adds this functionality. The code is adapted from this cocoa-dev post. You can download the source files (BSD license) here. On a side note I’ve updated the source code page. The underlying code is now alot cleaner (and renders correctly on IE!) and it uses some of those fancy AJAX transitions.

Continue Reading

Add To Login/Startup Items Functionality

Such a simple piece of functionality, you would assume it would be trivial to implement. As you might have guessed – it’s not. There has been a few hack-ishy ways outlined here but none are complete and easy to integrate into your app. I’ve created MABLoginItems, an easy way to add the ‘add to startup items’ functionality into your application. With one line of code you can add your application to the users login items (you can also remove from login items, and check if the application already exists in the login items). MABLoginItems is released under a BSD license, you can download it here.

Continue Reading