Problems, difficulties and frustrations

June 8th, 2009 by Michael Guterl

After reading The Simplest Thing that Could Possibly Work I couldn’t stop thinking about how Ward Cunningham describes the difference between problems and difficulties.

A friend of mine once said that there are problems and there are difficulties. A problem is something you savor. You say, “Well that’s an interesting problem. Let me think about that problem a while.” You enjoy thinking about it, because when you find the solution to the problem, it’s enlightening.

And then there are difficulties. Computers are famous for difficulties. A difficulty is just a blockage from progress. You have to try a lot of things. When you finally find what works, it doesn’t tell you a thing. It won’t be the same tomorrow. Getting the computer to work is so often dealing with difficulties.

As a software developer I love to solve problems, yet I become frustrated when dealing with difficulties. The more I think about it, I feel like frustration is a better word than difficulty.  In fact, one of the definitions for frustration from Apple’s Dictionary is:

frustration |frəˈstrā sh ən|

the prevention of the progress, success, or fulfillment of something

I don’t mind slowing down, but I hate stopping progress.  As I work through practicing TDD/BDD, I find that being able to slow down and take baby steps allows me to reduce the number of frustrations in my day.  I shudder any time I have to touch code without tests/specs because I am afraid I’m going to break something and not know it.  I’m not sure how I lived without tests, I know I spent a lot of time clicking around doing testing in the browser.

Saving time [and sanity] with AppleScript

May 31st, 2009 by Michael Guterl

Depending where I am at I have three possible monitor configurations for my MacBook.

  1. External display only
  2. Laptop display only
  3. External and laptop display

Each time I change between these three workspaces I have to manually move the windows to the correct position for that particular configuration.  This can become extremely annoying, especially when you’re as OCD as I am.  I can’t even contemplate how much time I’ve wasted putting each window in its “perfect” position…

After many searches I came across exactly what I was looking for: http://www.jonathanlaliberte.com/2009/02/04/restore-previous-display-window-positions-applescript

Usage

  1. Download the script here
  2. Open it with Script Editor
  3. Remove references to applications you aren’t using
  4. Save as an application with the name of the layout in the Applications fold
  5. Use Spotlight to run the app

I use the same script for each layout, I just save it under a different name. Problems

  1. Certain applications don’t seem to work (TweetDeck)
  2. Applications with child windows require slightly more work (see Firefox example code)
  3. The application has to be running or it errors

Todo

  1. Start the application if it is not running
  2. Loop through all open applications eliminating manual configuration

Source

property numFFWindows : 0
property FFPos : {}
property FFSize : {}
property numTermWindows : 0
property TermPos : {}
property TermSize : {}
property iTunesPos : {}
property iTunesSize : {}
property EmacsPos : {}
property EmacsSize : {}
property TweetDeckPos : {}
property TweetDeckSize : {}
property iCalPos : 0
property iCalSize : 0
property AdiumContactsPos : 0
property AdiumContactsSize : 0
property AdiumIMSize : 0
property AdiumIMPos : 0
property OFPos : 0
property OFSize : 0
 
display dialog "Set Window Position or Save Window Position?" buttons {"Restore", "Save"} default button "Restore"
set theResult to result
 
tell application "System Events"
	if (button returned of theResult is "Restore") then
		-- Restore Settings
		if (numFFWindows > 0) then
			tell process "Firefox"
				repeat with i from 1 to numFFWindows
					set position of window i to (item i of FFPos)
					set size of window i to (item i of FFSize)
				end repeat
			end tell
		end if
		if (numTermWindows > 0) then
			tell process "Terminal"
				repeat with i from 1 to numTermWindows
					set position of window i to (item i of TermPos)
					set size of window i to (item i of TermSize)
				end repeat
			end tell
		end if
		if (iTunesPos is not {0, 0}) then
			tell process "iTunes"
				set position of window 1 to iTunesPos
				set size of window 1 to iTunesSize
			end tell
		end if
		if (EmacsPos is not {0, 0}) then
			tell process "Emacs"
				set position of window 1 to EmacsPos
				set size of window 1 to EmacsSize
			end tell
		end if
		if (iCalPos is not {0, 0}) then
			tell process "iCal"
				set position of window 1 to iCalPos
				set size of window 1 to iCalSize
			end tell
		end if
		if (OFPos is not {0, 0}) then
			tell process "OmniFocus"
				set position of window 1 to OFPos
				set size of window 1 to OFSize
			end tell
		end if
		if (AdiumContactsPos is not {0, 0}) then
			tell process "Adium"
				set position of window "Contacts" to AdiumContactsPos
				set size of window "Contacts" to AdiumContactsSize
				repeat with i from 1 to (count windows)
					if ((window i) is not (window "Contacts")) then
						set position of window i to AdiumIMPos
						set size of window i to AdiumIMSize
					end if
				end repeat
 
			end tell
		end if
 
	else
		-- Save Settings
		tell process "Firefox"
			set numFFWindows to count windows
			set FFPos to {}
			set FFSize to {}
			repeat with i from 1 to numFFWindows
				set end of FFPos to (position of window i)
				set end of FFSize to (size of window i)
			end repeat
		end tell
		tell process "Terminal"
			set numTermWindows to count windows
			set TermPos to {}
			set TermSize to {}
			repeat with i from 1 to numTermWindows
				set end of TermPos to (position of window i)
				set end of TermSize to (size of window i)
			end repeat
		end tell
		tell process "iTunes"
			set iTunesPos to position of window 1
			set iTunesSize to size of window 1
		end tell
		tell process "Emacs"
			set EmacsPos to position of window 1
			set EmacsSize to size of window 1
		end tell
		tell process "iCal"
			set iCalPos to position of window 1
			set iCalSize to size of window 1
		end tell
		tell process "OmniFocus"
			set OFPos to position of window 1
			set OFSize to size of window 1
		end tell
		tell process "Adium"
			set AdiumContactsPos to position of window "Contacts"
			set AdiumContactsSize to size of window "Contacts"
			set AdiumIMPos to {}
			set AdiumIMSize to {}
			repeat with i from 1 to (count windows)
				if ((window i) is not (window "Contacts")) then
					set AdiumIMPos to (position of window i)
					set AdiumIMSize to (size of window i)
				end if
			end repeat
		end tell
	end if
end tell

Ubuntu 8.10 Server Setup (Rails)

April 19th, 2009 by Michael Guterl

I spent the first half of today moving my server from Debian 4.0 to Ubuntu 8.10.  It was a fairly painless process and I decided to record the route I took for configuring everything.  There are many options out there for quickly getting a Rails environment up on Ubuntu and this is a conglomeration of many ideas.

You can either continue reading or view the gist directly.

Read the rest of this entry »

Revamped blog

April 19th, 2009 by Michael Guterl

I’ve changed my blog from mephisto to wordpress.  I decided to be really lazy and not migrate any of the content from the mephisto blog.  Oh well, there wasn’t that much useful stuff there anyway…