Friday, September 25, 2009

Dictionary Mac Tip

A few people I know have recently switched to using Macs, so I thought I would try to put up Mac related tips for them here on my blog. I'll try to do one each week, but... we'll see :).


One cool feature of Mac OS is the ability to use the dictionary to lookup words in many applications (any that use the basic mac text rendering - so not office for example). I find this useful when reading web sites and when writing documents. Try hovering the mouse over any word and pressing Command + Control + D. You should get a drop down that shows you the words details from the dictionary. The drop down also lets you look the word up in the thesaurus.

Friday, September 11, 2009

SDL + Objective-C Garbage Collection

Today I had another try at getting a version of SDL 1.2 with support for garbage collection. I got a bit further this time... I managed to get SDL to compile for 10.5 (and 10.6 Snow Leopard) with gc support turned on. My games run with the new framework as long as -fobj-gc isn't supported or required by the application... The games start with garbage collection, but don't it seems that there is an issue loading LiveType.

I'll have to look into it again later... but if you have any ideas let me know! (happy to provide compiled SDL framework for anyone interested in helping)




Wednesday, September 09, 2009

Setting the title of a slide...

I've been playing around with two different presentation tools and found the different approaches to scripting to be quite interesting. The two scripts are shown below.


tell application "A"

set title of (current slide of first slideshow) to "Hello World"

end tell



tell application "B"

activate

set theIndex to slide index of slide of view of active window

set selectedSlide to slide theIndex of active presentation

set content of text range of text frame of shape 1 of selectedSlide to "Hello World"

end tell


The two scripts both set the title of the current slide to "Hello World". Its interesting to note that while "B" has more features the script is quite brittle, things like selecting the slide in the outline cause it to fail to select the current slide.

and the moral of the story is... "don't over engineer your code... keeping things simple with clean abstractions is always better"