Twitter Updates

Friday, 17 July 2009

Applescript What Property?

My apple script (applescript) just made a massive leap forward or at least my unerstanding of how people go about figuring it out. I never could work out how people new what all those scriptable properties where called until now.

Open Script Editor (/Applications/AppleScript/Script Editor.app) may be open a script you have been writting / downloaded.

The really clever bit:
from Script editor File-> Open Dictionary
Now choose the application you are scripting and you will get a browsable searchable list of properties that the script can get and set!

Monday, 13 July 2009

Desktop Background

A nice background to help organise your icons:

http://www.flickr.com/photos/gr/182329376/in/set-72157594188036656

Friday, 10 July 2009

Amazon Store

Just got my amazon associate store setup, not quite complete yet.
http://astore.amazon.co.uk/morgue-21

Thursday, 9 July 2009

Amazon.co.uk lists

Amazon seem to hide the link to create lists for list mania so here it is:
UK: http://www.amazon.co.uk/gp/richpub/listmania/createpipeline
US :http://www.amazon.com/gp/richpub/listmania/createpipeline

Body Of Secrets

Body of Secrsts
ISBN:0099427745
About £9

Very interesting book on the history of the NSA and GCHQ.

Monday, 6 July 2009

Disable jqs.exe on Windows

In my windows task manager I noticed a process called jqs.exe which had over 5,000,000,000 I/O Read Bytes the most out of any process on my computer by a factor of 4.

It is a java quick launch application which constantly brings a small part of java back in to main moemory. Sine I do not run java applications that often I do not mind a little bit of lag and followed the instructions here [1] to diable it

[1] http://jsbi.blogspot.com/2009/05/what-is-process-jqsexe-and-how-to.html

Saturday, 4 July 2009

Ruby Parsing Command Line Options

Ruby has built in methods for dealing with parsing command line options, it is called optparse.

optparse rdocs

some optparse examples

A Small example (cut down from the above) showing most common requirments.
Also on github.


#!/usr/bin/env ruby

require 'optparse'
require 'optparse/time'
require 'ostruct'
require 'pp'

class OptparseExample


#
# Return a structure describing the options.
#
def self.parse(args)
# The options specified on the command line will be collected in *options*.
# We set default values here.
options = OpenStruct.new

options.verbose = false
options.time = 0
options.delay = 0
options.leftovers = nil


opts = OptionParser.new do |opts|
opts.banner = "Usage: example.rb [options]"
opts.separator ""
opts.separator "Specific options:"

# Boolean switch.
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
options.verbose = v
end

# Cast 'time' argument to an integer.
opts.on("-t", "--time [TIME]", Integer, "Begin execution at given time") do |time|
options.time = time
end

# Cast 'delay' argument to a Float.
opts.on("--delay N", Float, "Delay N seconds before executing") do |n|
options.delay = n
end

# List of arguments.
opts.on("--list x,y,z", Array, "Example 'list' of arguments") do |list|
options.list = list
end

opts.separator ""
opts.separator "Common options:"

# No argument, shows at tail. This will print an options summary.
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end

# Another typical switch to print the version.
opts.on_tail("--version", "Show version") do
#puts OptionParser::Version.join('.')
puts "Version 0.1.0"
exit
end
end

options.leftovers = opts.parse!(args)
options
end # parse()

end # class OptparseExample

options = OptparseExample.parse(ARGV)
pp options
puts ""
puts ""
puts options.leftovers