Mike Austin's Blog

Wednesday, October 31, 2007

Is it a Mac or is it a PC?



It's both! Screen-shot taken from The rise of the employee-owned PC in a world where CIOs are losing control

Default arguments

It surprised me that Ruby let me refer to another argument from a default argument definition. I'm not sure if that's a bad thing, but it's exactly what I wanted. In this case, the idiom is "use the argument, else use the original value:
def add_child( child, origin = child.origin )
child.parent = self
child.origin = origin
@children.push( child )
end
I could have simply used:
child.origin = origin if origin
but that seems less declarative (for lack of a better word). I don't like conditionals :)

Tuesday, October 30, 2007

End of the world?

Tonight, someone jumped in front of a BART train, there was an accident on the freeway, a firetruck at my apartment building, and then an earthquake. Signs of end of the world? Probably not, but strange.

Stupid Shit People ACTUALLY Put On Their Resumes

http://madconomist.com/stupid-shit-people-put-on-their-resumes

Sunday, October 28, 2007

Fun with runtime method names

Executing arbitrary method names makes code so much simpler. You don't have to branch or use lookup tables or any of that. Here's the heart of a simple calculator:
class Calculator
def initialize()
[...]
button_1.action = Action.new( self, :number_pressed, [1] )
button_2.action = Action.new( self, :number_pressed, [2] )
button_add.action = Action.new( self, :operator_pressed, [:+] )
end

def number_pressed( number )
@input += number.to_s
puts @input
end

def operator_pressed( operator )
@value = @value.send( @last_op, @input.to_f )
@input = ''
@last_op = operator
puts @value
end
end

Circuit bending

http://www.youtube.com/watch?v=w6Pbyg_kcEk

I was playing on Ninjam the other day and we had a noise jam:
http://intelligentmachinery.net/

My noise consisted of my Korg Pandora effects pedal and cable. It's not really bending, but but it does create some nice sounds.

The Last Supper in hi-res

http://www.haltadefinizione.com/en/cenacolo/look.asp

I haven't had DSL for a few months and my blog wasn't working. Prepare for a wave of posts :)

Test

test