Archive for the “Cocoa” Category
Recently I was contracted to write some software, and it’s just now been released. It’s called GrabUp. Basically, the whole purpose here is for zero-click sharing of screenshots. GrabUp is a daemon that sits in the background and waits for you to take a screenshot, then it instantly uploads it to the GrabUp servers and puts the URL on your clipboard. It has a nice status item to let you know when it’s done. If you have GrabUp running and you want to share an image, just take the screenshot and then paste the URL anywhere. So far, GrabUp has been seen in TUAW and we also got a rather nice blog post reviewing it.
1 Comment »
I just released a new version of SafariSource which supports Safari 3.0 last night. This morning I received a Czech localization from Jakub Formanek, so I just released SafariSource v1.7.1. with the new localization.
So if you’re using Safari 3.0, or if you’re Czech, go ahead and download SafariSource. If you’re using Safari 2.x, please let me know it still works as I can’t test that with 3.0 installed.
No Comments »
Method Swizzling is one common technique of people writing hacks, such as Safari Plugins.
Unfortunately, it’s always suffered from a flaw, wherein swizzling inherited methods affects all
classes which inherit that method (including the base class), rather than the intended subclass.
This problem is discussed on the CocoaDev Method Swizzling page.
As part of writing YubNubSearch, I decided to solve this problem.
First I looked into dynamic subclass generation + posing. Unfortunately, this has a big problem. In
this technique, calling the original implementation would naturally be done through a [super foo] call.
Unfortunately, when the compiler sees super, it hardcodes a reference to the superclass at which to
start the search. This means you cannot write this code in, say, a category on NSObject, then pull up the IMP
into a dynamically-generated subclass and have it work. So that throws out that idea.
The other idea I had, which I eventually went with, was to copy inherited methods into the subclass that you
wish to swizzle, before swizzling. It turned out to be fairly easy, and still has the same semantics as the old,
flawed technique for calling the original implementation.
You can download my implementation here.
No Comments »
I just polished up my SIMBL plugin for release. It’s called YubNubSearch and it
allows you to use YubNub as your default search engine in Safari.
You can get it here.
No Comments »
(This post was adapted from an email I sent to Mike Solomon).
Objective-C has a method caching mechanism that optimizes for the case where
a small number of methods are called repeatedly on one (or more) objects of a
given class. This happens very often; for example, if you iterate over an array
to gather the results of performing an operation on each element, you’re going to
be calling the same method on a bunch of instances of the same class. And in fact
the -[NSEnumerator nextObject] method itself will also be cached.
The fact that method caching exists is common knowledge. However, what isn’t generally
known is how that caching is implemented, and what it means for you if you want to
hack around on the internals of a class.
(more…)
No Comments »
Earlier today Yahoo! finally released Yahoo! Messenger for OS X 3.0 beta 1, with an incredibly positive reaction from the general public. This is the app that I’ve spent the last 8 months working on, and I’m really proud to have finally released our first public beta. Even if you don’t use the old client, you should check it out. It’s a 100% rewrite in Cocoa, with a brand new spiffy UI, Growl support, avatar support, and more.
No Comments »
With the availability of a universal SIMBL plugin I’ve now released a universal version of SafariSource. Download here.
No Comments »
Posted by: Kevin Ballard in Cocoa, Programming, tags: AppleEvents, dashboard, DVDPlayer, iLife, iPhoto, iTunes, iWork, Keynote, OS X, QuickTime, rcd, Remote Control
I just stumbled across something interesting today while poking around rcd (the daemon that farms out remote control events). If you send the NSDistributedNotificationCenter notification name @"com.apple.dashboard.dismiss" (no object or userInfo dictionary) then Dashboard hides itself. That’s pretty neat!
On a side note, it turns out there is no way to hack rcd to farm remote control events out to non-Apple programs. It has all the appleevents and such that it uses hardcoded in. I was really hoping they did something like implement a generic remote control AE that they sent to any app that cared, but no, if you’re not iTunes, DVDPlayer, iPhoto, QuickTime Player, or Keynote, you won’t see hide nor hair of the events.
Update: Turns out there’s a companion @"com.apple.dashboard.awake" notification as well that, you guessed it, brings Dashboard forward.
No Comments »
Ok, I just released SafariSource v1.5. This version adds a preference pane to Safari’s preferences that lets you control the syntax highlighting. It also adds the option to use italic/underline/bold in addition to colors and the ability to change the base font/size.
This update was a real pain to do. I ran into a memory corruption bug that I spent hours trying to track down. A couple hours ago I finally discovered the cause. I was using a header file class-dumped from Jaguar’s AppKit and apparently Panther added 2 new ivars to NSPreferencesModule. What I didn’t expect was that my definition of NSPreferencesModule was taking precedence over AppKit’s definition, so when I allocated the memory for my subclass it wasn’t large enough and whenever those 2 extra ivars were written to it was writing to memory that wasn’t owned by my instance and that was the memory corruption. Simply class-dumping a new header file and using that magically solved the problem.
Anyway, enjoy :)
No Comments »
I always thought that Safari’s source view was pretty dull and uninteresting and that they could have done better with it. Well, last night I finally decided to do something about it. After spending a couple hours looking over the disassembly of parts of Safari (to figure out where best to patch it) and then spending many more hours actually writing an HTML syntax colorizer I have a working SIMBL plugin that adds syntax coloring to Safari’s source view. I think it works quite well, although I admit I should add a preference pane to control the colors (it’s harder than you’d think to add a preference pane to Safari, which is why I don’t have it done for this release). If you want to download SafariSource (my plugin), you can get it here.
If you don’t like the existing colors you can always change them with a few terminal commands. Simply go in the terminal and use the following commands:
defaults write com.apple.Safari SafariSourceTagColor -array red green blue
defaults write com.apple.Safari SafariSourceAttributeColor -array red green blue
defaults write com.apple.Safari SafariSourceStringColor -array red green blue
defaults write com.apple.Safari SafariSourceEntityColor -array red green blue
defaults write com.apple.Safari SafariSourceIgnoreColor -array red green blue
defaults write com.apple.Safari SafariSourceDocTypeColor -array red green blue
defaults write com.apple.Safari SafariSourceProcessingInstructionColor -array red green blue
Most of those should be obvious what they affect. The SafariSourceIgnoreColor one affects the color used for the contents of <style> and <source> tags.
Anyway, if you have any feedback on SafariSource, feel free to send it to me.
No Comments »
|