Posted by dacc
on March 24, 2009
Problem
We’re working on a project at Rieke Lab that has some staunch video timing and reliability requirements. We need to deliver frames without any underruns, and to know the exact moment they’re actually displayed on the screen. This requires that our rendering code runs strictly between refreshes, and that the back buffer is swapped in at the right moment.
Cocoa, OpenGL, and CoreVideo are the tools we picked, and it’s been tricky setting them up and understanding their roles. Hopefully this post will save someone the effort of getting them working together.
There is a CoreVideoOpenGLView subclass of NSOpenGLView attached to this post that I believe achieves our aims while drawing full-screen 2D animations.
Read on for details…
Continue reading…
Posted by dacc
on February 27, 2009
I wanted to make an status indicator bar in Cocoa that I could switch between green, yellow, and red. Here’s how to do it with the NSIndicator control.
First add the control in Interface Builder and configure it as so:

Now you can use a call like the one below to change its color:
[statusIndicator setIntValue: 1]
Here is each value you can use and the corresponding status bar:
Posted by dacc
on February 25, 2009
I’ve been struggling to make the XML build logs in our CruiseControl Dashboard legible, and finally ended up going with an XSLT transform via Greasemonkey.
Even this took a little doing, and so I thought I would share how to perform an arbitrary XSL transform on a loaded XML/XHTML document with a userscript.
Continue reading…
Posted by dacc
on February 20, 2009
I needed to get mod_xslt working under Leopard to pretty up some raw XML CruiseControl logs, and it took a while to get things to build. We’re pretty married to the system Apache, as we use Apple’s groupware and authentication facilities. I ended up having to install some deps, add an include, and hack some Makefiles.
Here’s how…
Continue reading…
Posted by dacc
on January 19, 2009
Update!
We wrote a containers.Map backed list class. Build up the list using the “append” method, and then assign the values to a cell array using “toCell” to iterate them (don’t use valueByIndex). Building up the list is still slow, but iterating is lightning fast! You’ll also need this noop Null class.
As of 2008b Matlab only has one abstract data type built-in: containers.Map. I needed a typical List class, and thought I’d back it with a cell array ala Java’s ArrayList. I was surprised to find that accessing a cell as the property of an object was a huge performance bottleneck.
Mathworks has this to say about passing behavior:
“In the case of passing structures or cell arrays, only the field or cell data being modified by the function will be passed “by value”. When the function returns, (assuming that the modified structure or cell array is returned as an output argument of the function) the calling workspace’s copy of the structure or cell array is replaced by the function’s copy such that only the changed fields are altered. This is done to make copying more efficient.”
Are my slowdowns due to some unnecessary copying? Or is it just the overhead of making method calls? Here are some simple benchmarks:
Continue reading…