Programatically adding Applications to the Login Items
July 28th, 2008
Its taking some kicking around, but here is the fruit of my labour… using core foundation over the RC bridge.
require 'osx/cocoa'
loginItems = OSX::CFPreferencesCopyValue(
"AutoLaunchedApplicationDictionary",
"loginwindow",
OSX::KCFPreferencesCurrentUser,
OSX::KCFPreferencesAnyHost)
application_path = File.expand_path("~/path/to/your.app")
application_hidden = false
loginItems << OSX::NSDictionary.dictionaryWithObjects_forKeys(
[ application_path, application_hidden ],
[ :Path, :Hide ])
# puts loginItems
OSX::CFPreferencesSetValue(
"AutoLaunchedApplicationDictionary",
loginItems,
"loginwindow",
OSX::KCFPreferencesCurrentUser,
OSX::KCFPreferencesAnyHost)
OSX::CFPreferencesSynchronize("loginwindow",
OSX::KCFPreferencesCurrentUser,
OSX::KCFPreferencesAnyHost)
With any luck this might help someone :-)
Checking Network Connectivity with Ruby
July 25th, 2008
I’ve just been playing around with a few things and stumbled accross a really neat ruby lib called ‘timeout’. I used it to make a quick check for network connectivity like so:
require 'timeout'
require 'socket'
begin
timeout(10) do
TCPSocket.new("www.rubyforge.org", 80)
end
puts true
rescue
puts false
end
For so few lines thats a really neat; I thought so at least! :-)
Great guide for people interested in Scala
July 17th, 2008
I just came across a great Scala presentation from JavaOne. If your not looking at learning Scala, then this presentation will give you a whole heap of reasons to get up and do something about it.
Download the article from here
The Website Is Down!
July 9th, 2008
A friend of mine sent this to me – anyone working in IT will appreciate the funny side of this!!
Bongtastic load testing!!
July 8th, 2008
My mind escapes me at this late hour on a Tuesday eve, but Im fairly sure i’ve blogged about the httperf tool from HP Labs before.
Anyway, if I havent, thats a different story, as today, I want to point you good reader to the wonderfull tool that is Bong
httperf has somewhat cryptic command syntax, and bong is a really nice wrapper around it which make leveraging the full power of httperf a breeze.
Check out the Bong home page for more info – I’ll put up a quick tutorial when its not so late and my brain is functioning properly.