Author Archive

One problem I find myself having when writing tests is ensuring that no execution ever leaves my little test sandbox. For example, when writing tests for github-gem I keep looking through the code to find every place a function ends up `shelling out` and it's tiresome and error-prone. I finally decided I was going about this backwards. Testing is supposed to find problems for me, right? So why not raise an error whenever `` or Kernel#system() is called and let the tests tell me what else I need to mock?

Put the following code in your spec_helper.rb file and an exception will be raised whenever `` or Kernel#system() is called during a test:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Spec::Example::Configuration
  def add_guard(klass, name)
    guarded = nil
    self.prepend_before(:all) do
      klass.instance_eval do
        guarded = instance_method(name)
        define_method name do |*args|
          raise "Testing guards violated: Cannot call #{klass}##{name}"
        end
      end
    end
    self.prepend_after(:all) do
      klass.instance_eval do
        define_method name, guarded
      end
    end
  end
end
 
# prevent the use of `` in tests
Spec::Runner.configure do |configuration|
  configuration.add_guard(Kernel, :'`')
  configuration.add_guard(Kernel, :system)
end

Note: if you want, you can write :` instead of :'`', but my syntax highlighter here doesn't like that.

Comments No Comments »

I just picked up a new Flip Video and was dismayed to find out that it used a custom app to import its movies, and that this custom app was PPC. I was also dismayed to find out that iMovie ‘08 refuses to import AVIs even if you have the appropriate codec installed. So after some hacking, I put together an Automator workflow that will convert all your Flip videos into DV and import them into iMovie. You can download it here.

Comments 6 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.

Comments 1 Comment »

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 No Comments »

Big news for Mac gaming today. Return to Dark Castle has finally been released for OS X! This game has been in development for about 7 years now, and it should be very familiar to anybody who played Mac games 15-20 years ago. Heck, I’m only 22 and I remember Beyond Dark Castle.

Comments No Comments »

For those interested, I am currently maintaining git mirrors of the MacPorts and TextMate Bundles svn repositories on GitHub. I update these periodically, but at the moment only the master branch is published.

Comments No Comments »

Well, after about 5 hours of hacking, I got a ruby script together to migrate all my data from Typo 4.11 to WordPress, so the site is back from the dead, and now running on an engine that DreamHost is actually happy with.

Update: The conversion script is now available here or at GitHub.

Comments No Comments »

Memory-Usage.png

Can anybody explain what’s going on with that memory usage? I’ve been seeing this for a few months now. These days I tend to restart a handful of apps at least once a day (sometimes more often) to combat this apparent memory problem. I’ve tried just ignoring it, but my system also tends to become less responsive over time, especially when accessing apps that I haven’t used in the last few minutes, so I can only assume that apps are getting paged out frequently. Running sysctl vm.swapusage seems to bear that out as well, at the moment I’m using 1.6GiB and when I checked 2 days ago (before a reboot) I was using close to 3GiB (quitting apps brought that down to about 2.2GiB). Unfortunately I can’t seem to get anywhere on figuring out what’s going on with all this memory. If I run vmmap on one of these processes I just see a lot of malloc blocks.

Comments No Comments »

Lately every day when I come home from work I notice a handful of applications taking up a surprisingly high amount of Real Memory. These apps tend to be Quicksilver, Safari, iScrobbler, NetNewsWire, and GrowlHelperApp. Every day I end up quitting at least 3 apps to free up some memory and it happens all over again.

Right now Quicksilver is using roughly 235MB of Real Memory. Running vmmap on it tells me that almost all of that memory is in the malloc zone, and the vast majority of that malloced memory are freed blocks. So my question is why are my multitudes of freed MALLOC_TINY pages not being reclaimed by the system?

Comments 9 Comments »

I picked up an iPhone on friday and I’ll try and remember to write up my thoughts later, but for now I have a quick tip.

For those of you who are like me and listen to full albums and lament the lack of a Compilations preference for the iPhone, learn to love the CoverFlow view. Since this view is album-centric it handles compilations properly. The only real flaw with this view is it’s ugly if you don’t have album art.

Comments No Comments »