Posts Tagged “Programming”
TinEye is a cool reverse image search engine. It lets you take an image and search for it on the web, even finding uncropped, expanded, or unwatermarked versions of the image. Sadly, while TinEye provides plugins for both Firefox and Chrome, they don’t provide one for Safari. Because of this, I have written my own extension. Just install it, then right-click on any image and you should see “Search Image on TinEye”. You can get it here.
Comments Off on TinEye Safari Extensions
Last week I pushed out a major rewrite of FontLabel. This new version includes a category modeled after UIStringDrawing that enables you to draw text in custom fonts in your own
drawRect: methods. It also includes accurate font metrics and uses more of the built-in UILabel properties. Contributions are welcome!
2 Comments »
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.
3 Comments »
I’ve just pushed a new version of SafariSource out the door which is once again compatible with Safari Tidy. Please let me know if you have any problems. You can download it here.
Note that this requires version 0.2.5 of Safari Tidy, which was just released today.
Comments Off on SafariSource v1.7.4 compatible with Safari Tidy
tcltumblr 0.1 is available for immediate use. It is a Tcl library that provides access to the Tumblr API.
Comments Off on tcltumblr 0.1
Update: This code was written pre-Leopard, and as such doesn’t run under ObjC 2. See JRSwizzle for an updated version that runs under Leopard and Snow Leopard.
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.
6 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.
5 Comments »
As of this afternoon, I am now an official committer for MacPorts.
For those not in the know, MacPorts (née DarwinPorts) is an open-source package manager for Darwin
(although it should work with other *nixes, it’s really intended for Darwin). I’ve been
using it for quite some time, and even contributed a few Portfiles a while ago. Well, I
started poking at it again recently, and then jmpp on #macports convinced me to
apply for a commit bit.
Now I just gotta do something to justify this shiny new bit.
Comments Off on Newest MacPorts committer
(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
-[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.
Read the rest of this entry »
Comments Off on Objective-C caching and Method Swizzling
Ironcoder 0x2 wraps up in a few hours, and this time the API was CoreGraphics. As soon as I heard this, I knew I wanted to do something with window mesh deformation. What’s that? Why, it’s the private CoreGraphics call you can use to do the effects such as the Genie minimize effect, though I believe it’s new in 10.3. It’s a function called CGSSetWindowWarp(), and it’s extremely poorly documented.
First, some history. CoreGraphics has a bunch of private calls that range from applying transitions to windows (such as the cube effect seen in Apple Remote Desktop and Quicksilver) to managing virtual desktops to setting alpha levels on groups of windows system-wide. As far as I am able to ascertain, Richard Wareham did the bulk of the work to expose these calls, as part of development on his Desktop Manager program, the most well-known virtual desktop solution for OS X. He released a file named CGSPrivate.h that contained these basic calls, so others could use it. Since then, more private calls have been discovered, and among them were CGSSetWindowWarp().
Read the rest of this entry »
Comments Off on CGSSetWindowWarp explained