<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>hasseg.org &#187; Featured</title>
	<atom:link href="http://hasseg.org/blog/post/category/featured/feed/" rel="self" type="application/rss+xml" />
	<link>http://hasseg.org/blog</link>
	<description></description>
	<lastBuildDate>Mon, 15 Aug 2011 22:38:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Display Events or Tasks on Your Desktop With icalBuddy</title>
		<link>http://hasseg.org/blog/post/503/how-to-display-events-or-tasks-on-your-desktop-with-icalbuddy/</link>
		<comments>http://hasseg.org/blog/post/503/how-to-display-events-or-tasks-on-your-desktop-with-icalbuddy/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 23:30:38 +0000</pubDate>
		<dc:creator>Ali Rantakari</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Miscallaneous]]></category>

		<guid isPermaLink="false">http://hasseg.org/blog/?p=503</guid>
		<description><![CDATA[I don&#8217;t really have any statistics about this but I&#8217;m quite sure that an overwhelming majority of the users of my icalBuddy program are using it to display calendar data on their desktop via GeekTool. Several tutorials on how to get this done have been written by different people, mainly for relatively non-technical users, which [...]]]></description>
			<content:encoded><![CDATA[<p>
<img src="http://hasseg.org/blog/wp-content/uploaded/2010/07/all-together.png" alt="icalBuddy, GeekTool, NerdTool icons" title="" width="129" height="131" align="right" /> I don&#8217;t really have any statistics about this but I&#8217;m quite sure that an overwhelming majority of the users of my <a href="/icalBuddy">icalBuddy</a> program are using it to <strong>display calendar data on their desktop</strong> via <a href="http://projects.tynsoe.org/en/geektool/">GeekTool</a>. Several tutorials on how to get this done have been written by different people, mainly for relatively non-technical users, which I think is great. The problem seems to be that many people don&#8217;t know how to configure icalBuddy to give them the kind of output they&#8217;d like and end up copy-pasting the commands from these blogs (some of these blog posts also contain <em>outdated</em> information about a bunch of things). Hopefully this short tutorial (and the <a href="/icalBuddy/examples.html">usage examples page</a>) will offer an easy way to make a more informed decision about how to get this done.
</p>
<p><span id="more-503"></span></p>
<h3>Choose Between GeekTool and NerdTool</h3>
<p>
<a href="http://projects.tynsoe.org/en/geektool/">GeekTool</a> and <a href="http://mutablecode.com/apps/nerdtool">NerdTool</a> are two programs that do the same thing: display stuff on your desktop. The choice between which one to use is up to you but allow me to give a few suggestions:
</p>
<ul>
<li><strong>If you want to change the text colors used in the display</strong>, choose NerdTool <em>(as far as I know, GeekTool can only change the default text color but not the actual colors used for &#8220;red&#8221;, &#8220;blue background&#8221;, &#8220;bright green&#8221; etc.)</em></li>
<li><strong>If you want to hack on the program yourself</strong>, choose NerdTool <em>(it&#8217;s open source)</em>.</li>
<li><strong>If you don&#8217;t care about any of the above</strong>, choose GeekTool.</li>
</ul>
<h3>Install the Apps</h3>
<p>
When you&#8217;ve chosen which one you&#8217;d like to use, <strong>download and install it</strong>. <a href="http://projects.tynsoe.org/en/geektool/">GeekTool</a> is a <em>preference pane</em> so it lives in your System Preferences, while <a href="http://mutablecode.com/apps/nerdtool">NerdTool</a> is a regular application which you drag into your Applications folder.
</p>
<p>
In order to install icalBuddy, <a href="/icalBuddy">download</a> the latest version and unzip the package by double-clicking on it. Open the unzipped folder, <strong>double-click on install.command</strong> and follow the instructions (you&#8217;ll have to press return, input your password and icalBuddy will be installed).
</p>
<h3>Figure out Your icalBuddy Configuration</h3>
<p>
So now you need to figure out what to put into the <em>command</em> field in Geek-/NerdTool. <strong>First you need to go to the <a href="/icalBuddy/examples.html">icalBuddy Usage Examples</a> page and browse through it</strong> &#8212; you might find the kind of output you&#8217;re looking for right there, in which case <strong>you can just get the command you see there</strong> <em>(note that some of the examples require you to <a href="http://hasseg.org/icalBuddy/examples.html#Getting+Started+With+Custom+Output+Formatting">add something to the configuration file</a>)</em>.
</p>
<p>
If you&#8217;d like to take some of the examples and modify the output a bit, you can fire up your Terminal.app and start experimenting with <a href="/icalBuddy/man.html">different arguments</a>. In this case the <a href="/icalBuddy/#documentation">documentation links</a> will come in handy.
</p>
<h3>Add Your icalBuddy Command into GeekTool/NerdTool</h3>
<p>
Once you have your command, you can put it into the app by creating a new &#8220;shell&#8221; entry:</p>
<ul>
<li><strong>GeekTool:</strong> Drag the &#8220;Shell&#8221; geeklet icon (see below) onto your desktop. The properties window for this entry should appear.</li>
<p><img src="http://hasseg.org/blog/wp-content/uploaded/2010/07/geektool-shell.png" alt="" title="" width="400" height="263" /></p>
<li><strong>NerdTool:</strong> Click the &#8220;plus&#8221; button (see below) and select &#8220;Shell&#8221; from the popup. A new entry is created into the list above.</li>
<p><img src="http://hasseg.org/blog/wp-content/uploaded/2010/07/nerdtool-add.png" alt="" title="" width="400" height="382" />
</ul>
</p>
<p>
You can then <strong>insert your icalBuddy command into the command field</strong> in whichever app you&#8217;re using (and set the refresh interval in order to specify how often the command should be run):
</p>
<p><img src="http://hasseg.org/blog/wp-content/uploaded/2010/07/geektool-and-nerdtool-command-fields.png" alt="" title="" width="470" height="334" /></p>
<p>
That&#8217;s it. You can then delve into the settings that both GeekTool and NerdTool offer you, like changing the colors and fonts used for the output.</p>
]]></content:encoded>
			<wfw:commentRss>http://hasseg.org/blog/post/503/how-to-display-events-or-tasks-on-your-desktop-with-icalbuddy/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Trash files from the OS X command line</title>
		<link>http://hasseg.org/blog/post/406/trash-files-from-the-os-x-command-line/</link>
		<comments>http://hasseg.org/blog/post/406/trash-files-from-the-os-x-command-line/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:02:10 +0000</pubDate>
		<dc:creator>Ali Rantakari</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://hasseg.org/blog/?p=406</guid>
		<description><![CDATA[I spend a lot of time in the Terminal on my computer &#8212; a lot of things are just better done with a command-line interface than in the GUI. When removing files via the command-line people usually just, well, remove them (with the rm command), but this means that they&#8217;ll be eschewing the Trash, one [...]]]></description>
			<content:encoded><![CDATA[<p>
<img src="/trash/appIcon.png" alt="trash picture" align="right" width="96" height="88" /> I spend a lot of time in the Terminal on my computer &#8212; a lot of things are just better done with a command-line interface than in the GUI. When removing files via the command-line people usually just, well, <em>remove</em> them (with the <a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/rm.1.html">rm</a> command), but this means that they&#8217;ll be eschewing the <a href="http://en.wikipedia.org/wiki/Trash_(computing)">Trash</a>, one of the user-friendliest things (even relatively) modern operating systems have had to offer for a long time.
</p>
<p><span id="more-406"></span></p>
<p>
It&#8217;s obvious we need a <span style="font-family:monospace;">trash</span> command that we can use instead of <span style="font-family:monospace;">rm</span> when we&#8217;re not 101% sure we need to <em>actually remove these files, like, right now</em>. Here are a couple of existing solutions I&#8217;ve found, my impressions of them, and then my version at the bottom:
</p>
<h3><a href="http://www.sveinbjorn.org/osxutils_docs">osxutils&#8217; trash</a> by Sveinbjörn Þórðarson</h3>
<p>
This is what I&#8217;ve used up until now. It&#8217;s a small Perl script that simply manually moves the specified files into the trash folder under the current user&#8217;s home directory:
</p>
<div class="codecolorer-container perl mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># relevant code snippet:</span><br />
<span style="color: #339933;">...</span><br />
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>e <span style="color: #ff0000;">&quot;$ENV{HOME}/.Trash/$path_segs[$#path_segs]&quot;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$path_segs</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">$#path_segs</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">&quot; copy $cnt&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000066;">system</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;mv '$ARGV[$argnum]' '$ENV{HOME}/.Trash/$path_segs[$#path_segs]'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #339933;">...</span></div></div>
<p>
The biggest problem with this is that it moves all trashed files onto the <strong>same volume</strong> instead of using each volume&#8217;s own trash folders (this is not a good idea). It also deals with <strong>filename collisions</strong> manually, which is a bit volatile. The good thing about this is that it <strong>doesn&#8217;t follow &#8220;leaf&#8221; symbolic links</strong>, which is in my opinion the expected behaviour (what if I want to trash the link instead of its target?).
</p>
<h3><a href="http://www.dribin.org/dave/osx-trash/">osx-trash</a> by Dave Dribin</h3>
<p>
This one is a lot better. It&#8217;s a Ruby script that uses the <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/Introduction/Introduction.html">Scripting Bridge</a> to ask Finder to perform all the actual &#8220;heavy lifting&#8221; (e.g. moving the files to the trash) which means that <strong>each volume&#8217;s own trash folders are utilized properly and filename collisions are handled in a standard way</strong>:
</p>
<div class="codecolorer-container ruby mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#008000; font-style:italic;"># relevant code snippets:</span><br />
...<br />
<span style="color:#9900CC;">finder</span> = SBApplication.<span style="color:#9900CC;">applicationWithBundleIdentifier</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;com.apple.Finder&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
...<br />
<span style="color:#9900CC;">path</span> = <span style="color:#CC00FF; font-weight:bold;">Pathname</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>file<span style="color:#006600; font-weight:bold;">&#41;</span><br />
url = NSURL.<span style="color:#9900CC;">fileURLWithPath</span><span style="color:#006600; font-weight:bold;">&#40;</span>path.<span style="color:#9900CC;">realpath</span>.<span style="color:#9900CC;">to_s</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
item = finder.<span style="color:#9900CC;">items</span>.<span style="color:#9900CC;">objectAtLocation</span><span style="color:#006600; font-weight:bold;">&#40;</span>url<span style="color:#006600; font-weight:bold;">&#41;</span><br />
item.<span style="color:#9900CC;">delete</span><br />
...</div></div>
<p>
It also allows you to list all the files that are currently in the trash and empty it (normally or securely). The few minor negative things are the fact that it <strong>follows leaf symbolic links</strong> and the fact that when you try to trash multiple files you don&#8217;t have access rights for, Finder will pop up an <strong>authentication dialog separately for each file</strong>.
</p>
<h3><a href="/trash">my trash</a></h3>
<p>
Due to the few things that I wanted the <span style="font-family:monospace;">trash</span> command to do differently, I wrote my own. In order to make sure that filename collisions are handled in the standard manner and that each volume&#8217;s trash folders are properly used (just like with Dave Dribin&#8217;s script) this one first tries to use the <strong>standard system API</strong> for trashing files, and if that fails due to the user not having the correct access rights, then asks Finder to trash those files (Finder can authenticate the current user as an administrator and move the files into that user&#8217;s trash &#8212; if you simply run this program as root, the files will be moved to root&#8217;s trash, which is not what we want):
</p>
<div class="codecolorer-container objc mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #11740a; font-style: italic;">// relevant code snippets:</span><br />
...<br />
<span style="color: #11740a; font-style: italic;">// first try the standard API function (this should be</span><br />
<span style="color: #11740a; font-style: italic;">// the fastest way, and we get a nice status value</span><br />
<span style="color: #11740a; font-style: italic;">// as well):</span><br />
<span style="color: #11740a; font-style: italic;">// </span><br />
FSRef fsRef;<br />
FSPathMakeRefWithOptions<span style="color: #002200;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#40;</span><span style="color: #a61390;">const</span> UInt8 <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#91;</span>filePath fileSystemRepresentation<span style="color: #002200;">&#93;</span>,<br />
&nbsp; &nbsp; kFSPathMakeRefDoNotFollowLeafSymlink,<br />
&nbsp; &nbsp; <span style="color: #002200;">&amp;</span>fsRef,<br />
&nbsp; &nbsp; <span style="color: #a61390;">NULL</span> <span style="color: #11740a; font-style: italic;">// Boolean *isDirectory</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#41;</span>;<br />
OSStatus ret <span style="color: #002200;">=</span> FSMoveObjectToTrashSync<span style="color: #002200;">&#40;</span><span style="color: #002200;">&amp;</span>fsRef, <span style="color: #a61390;">NULL</span>, kFSFileOperationDefaultOptions<span style="color: #002200;">&#41;</span>;<br />
...<br />
<span style="color: #11740a; font-style: italic;">// if no access rights, construct Apple event describing</span><br />
<span style="color: #11740a; font-style: italic;">// a &quot;delete all items in this list&quot; action and send it to Finder:</span><br />
<span style="color: #11740a; font-style: italic;">// </span><br />
<span style="color: #400080;">NSAppleEventDescriptor</span> <span style="color: #002200;">*</span>descr <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSAppleEventDescriptor</span><br />
&nbsp; &nbsp; descriptorWithDescriptorType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">'furl'</span><br />
&nbsp; &nbsp; data<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>url absoluteString<span style="color: #002200;">&#93;</span> dataUsingEncoding<span style="color: #002200;">:</span>NSUTF8StringEncoding<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#91;</span>urlListDescr insertDescriptor<span style="color: #002200;">:</span>descr atIndex<span style="color: #002200;">:</span>i<span style="color: #002200;">++</span><span style="color: #002200;">&#93;</span>;<br />
...<br />
ProcessSerialNumber finderPSN <span style="color: #002200;">=</span> getFinderPSN<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;<br />
<span style="color: #400080;">NSAppleEventDescriptor</span> <span style="color: #002200;">*</span>targetDesc <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSAppleEventDescriptor</span><br />
&nbsp; &nbsp; descriptorWithDescriptorType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">'psn '</span><br />
&nbsp; &nbsp; bytes<span style="color: #002200;">:&amp;</span>finderPSN<br />
&nbsp; &nbsp; length<span style="color: #002200;">:</span><span style="color: #a61390;">sizeof</span><span style="color: #002200;">&#40;</span>finderPSN<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
<span style="color: #400080;">NSAppleEventDescriptor</span> <span style="color: #002200;">*</span>descriptor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSAppleEventDescriptor</span><br />
&nbsp; &nbsp; appleEventWithEventClass<span style="color: #002200;">:</span><span style="color: #bf1d1a;">'core'</span><br />
&nbsp; &nbsp; eventID<span style="color: #002200;">:</span><span style="color: #bf1d1a;">'delo'</span><br />
&nbsp; &nbsp; targetDescriptor<span style="color: #002200;">:</span>targetDesc<br />
&nbsp; &nbsp; returnID<span style="color: #002200;">:</span>kAutoGenerateReturnID<br />
&nbsp; &nbsp; transactionID<span style="color: #002200;">:</span>kAnyTransactionID<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#91;</span>descriptor setDescriptor<span style="color: #002200;">:</span>urlListDescr forKeyword<span style="color: #002200;">:</span><span style="color: #bf1d1a;">'----'</span><span style="color: #002200;">&#93;</span>;<br />
...<br />
AESendMessage<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>descriptor aeDesc<span style="color: #002200;">&#93;</span>, <span style="color: #002200;">&amp;</span>reply, kAEWaitReply, kAEDefaultTimeout<span style="color: #002200;">&#41;</span>;<br />
...</div></div>
<p>
The difference is that this one <strong>doesn&#8217;t follow leaf symlinks</strong>, and when deleting multiple files that you don&#8217;t have access rights for, Finder will only show <strong>one authentication dialog</strong> (I had to implement this kind of &#8220;manually&#8221; because I couldn&#8217;t find any way to accomplish it with the Scripting Bridge). I also copied the idea and implementation of emptying the trash and listing its contents via the Scripting Bridge from Dave&#8217;s script. This <span style="font-family:monospace;">trash</span> is written in (Objective-)C, <span class="info" title="yeah, I actually only used Objective-C and C because it was at first the only way I knew how to accomplish what I wanted, even though I now know this could've been done adequately with Ruby or Python as well">for all those extra milliseconds that are so goddamn important</span> when waiting for files to be trashed.
</p>
<p>
You can <a href="/trash">go through my trash here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hasseg.org/blog/post/406/trash-files-from-the-os-x-command-line/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Gmail Backups with fetchmail on OS X</title>
		<link>http://hasseg.org/blog/post/161/gmail-backups-with-fetchmail-on-os-x/</link>
		<comments>http://hasseg.org/blog/post/161/gmail-backups-with-fetchmail-on-os-x/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 11:32:13 +0000</pubDate>
		<dc:creator>Ali Rantakari</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://hasseg.org/blog/?p=161</guid>
		<description><![CDATA[I use GMail as my personal email provider, and as much as I like the simple and snappy UI, the conversation views and the filtering and search possibilities, I&#8217;ve grown more and more worried about having all of my (important) mails stored on someone else&#8217;s servers. Now, out of all of the big IT companies [...]]]></description>
			<content:encoded><![CDATA[<p>
<img align="right" src="http://hasseg.org/blog/wp-content/uploaded/2008/08/gmail-backup.png" alt="" title="gmail-backup" width="130" height="124" /> I use GMail as my personal email provider, and as much as I like the simple and snappy UI, the conversation views and the filtering and search possibilities, I&#8217;ve grown more and more worried about having all of my (important) mails stored on someone else&#8217;s servers. Now, out of all of the big IT companies in the world I&#8217;d say I trust Google a heck of a lot more than anyone else, but this doesn&#8217;t mean that I shouldn&#8217;t take into consideration the possibility of something going wrong on their end and as a result some (or Bob forbid, <em>all</em>) of my mails disappearing into bit heaven.
</p>
<p>
The good news is that Google provides a nice, standard POP3 interface for downloading emails from their service, and all of the software required for downloading messages via POP is already installed in Mac OS X Leopard by default. Below I&#8217;ll go through all of the steps it took me to set up periodical and automated GMail backups on my Macbook.
</p>
<p><span id="more-161"></span></p>
<p>
The following were my sources for most of the information presented here:</p>
<ul>
<li><a href="http://lifehacker.com/software/gmail/geek-to-live--back-up-gmail-with-fetchmail-235207.php">LifeHacker: Geek to Live: Back up Gmail with fetchmail</a></li>
<li><a href="http://logicbound.blogspot.com/2007/10/backup-gmail-data.html">Logic Bound: Backup Gmail Data</a></li>
<li><a href="http://bronski.net/data/fetchmail-eng.php">bronski.net: fetchmail &amp; SSL</a></li>
<li><a href="http://lists.berlios.de/pipermail/fetchmail-users/2006-July/000488.html">Matthias Andree and Paul Elliott on [fetchmail-users]: What is a &#8220;local issuer certificate&#8221;?</a></li>
</ul>
<h3>Configure GMail for POP access</h3>
<ol>
<li>Go to GMail&#8217;s <em>&#8220;Forwarding and POP/IMAP&#8221;</em> settings</li>
<li>Set the <em>&#8220;POP access&#8221;</em> setting to <strong><em>&#8220;Enable POP for all mail (even mail that&#8217;s already been downloaded)&#8221;</em></strong></li>
<li>Make sure that the <em>&#8220;When messages are accessed with POP&#8221;</em> setting says <strong><em>&#8220;keep Gmail&#8217;s copy in the inbox&#8221;</em></strong></li>
</ol>
<h3>Configure fetchmail to Download the Messages</h3>
<ol>
<li>Create <span style="font-family:monospace;">~/.fetchmailrc</span> with the following contents (replacing GMAIL_USERNAME, GMAIL_PASSWORD and LOCAL_USERNAME with their real values in your case):</li>
<pre class="prettyprint">
poll pop.gmail.com with proto POP3 and options no dns
user 'GMAIL_USERNAME@gmail.com' there with password 'GMAIL_PASSWORD' is 'LOCAL_USERNAME' here and wants mda "/usr/bin/procmail -d %T"  options ssl keep sslcertck sslcertpath "/Users/LOCAL_USERNAME/.ssl/certs"
</pre>
<p>	This configuration basically tells fetchmail to:</p>
<ul>
<li>Connect to the GMail POP server using the POP3 protocol,</li>
<li>Map your GMail username to your localhost username,</li>
<li>Deliver the downloaded mail into your local system mailbox (mail spool file),</li>
<li>Connect using an encrypted SSL connection,</li>
<li>Strictly check the SSL certificates of the server it connects to against local trusted certificates,</li>
<li>Search for the local certificates in <span style="font-family:monospace;">~/.ssl/certs</span></li>
</ul>
<li>Set the proper rights for <span style="font-family:monospace;">~/.fetchmailrc</span>:</li>
<div class="codecolorer-container text mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; chmod 710 ~/.fetchmailrc</div></div>
<li>Get the pop.gmail.com server&#8217;s SSL certificate from the POP port <em>(note that this should be done using a secure, trusted internet connection &#8212; otherwise it kind of defeats the purpose)</em>:</li>
<div class="codecolorer-container text mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; openssl s_client -connect pop.gmail.com:995 -showcerts</div></div>
<p>From the output of this command, copy the part that looks like this:</p>
<div class="codecolorer-container bash mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #660033;">-----BEGIN</span> CERTIFICATE-----<br />
<span style="color: #7a0874; font-weight: bold;">&#40;</span>a big bunch of characters here<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">-----END</span> CERTIFICATE-----</div></div>
<p>And save it into a file called <span style="font-family:monospace;">~/.ssl/certs/gmailpop.pem</span>.</p>
<li>Download the certificate authority (Equifax) root certificate (for example <a href="http://www.geotrust.com/resources/root_certificates/index.asp">from GeoTrust&#8217;s site here</a>, where it says <em>&#8220;Equifax Secure Certificate Authority (Base-64 encoded X.509)&#8221;</em>), rename it to &#8220;equifax.pem&#8221; and move it to <span style="font-family:monospace;">~/.ssl/certs/equifax.pem</span> <em>(and just like the previous step, this should be done over a trusted internet connection as well)</em>.</li>
<li>Hash the certificates in this directory by running:</li>
<div class="codecolorer-container text mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; c_rehash ~/.ssl/certs/</div></div>
</ol>
<h3>Optional: Specify the Location for Downloaded Messages</h3>
<p>
We&#8217;ve configured fetchmail to send messages to procmail, which will handle the storing of them in a <em>mail spool file</em>. By default this will be in <span style="font-family:monospace;">/var/mail/LOCAL_USERNAME</span>, but if you want to store it somewhere else, you can specify the location in the <span style="font-family:monospace;">~/.procmailrc</span> configuration file. Below is an example (replace LOCAL_USERNAME with your username):
</p>
<div class="codecolorer-container text mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">MAILDIR=&quot;$HOME/.mailspool&quot;<br />
DEFAULT=&quot;$HOME/.mailspool/LOCAL_USERNAME&quot;</div></div>
<p>
I prefer to exclude my mail spool file from Time Machine backups (because it&#8217;s a large file that changes very often which makes it take up a lot of disk space from my backup volume) so I have it located in <span style="font-family:monospace;">~/.mailspool/</span> like in the above example. This is because in OS X <span style="font-family:monospace;">/var</span> is actually a symbolic link to <span style="font-family:monospace;">/private/var</span> and Time Machine has a bug where it&#8217;s impossible to exclude anything from under that path from backups (for example, if I choose to exclude <span style="font-family:monospace;">/private/var/mail</span> in the GUI, it&#8217;ll replace this selection with <span style="font-family:monospace;">/var/mail</span> automatically, and even though <span style="font-family:monospace;">/var/mail</span> is then excluded, it&#8217;ll still back up <span style="font-family:monospace;">/private/var/mail</span>).
</p>
<h3>Download Messages with fetchmail</h3>
<p>
You can now download the mail by running this command (the -v argument is for verbose output):</p>
<div class="codecolorer-container text mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">fetchmail -v</div></div>
<p>Unless you only have a few mails in your Gmail box, this command will initially have to be run several times in a row in order to get all of the messages since it only downloads a few hundred messages at a time. The mail spool file containing all of the downloaded messages will then be found in <span style="font-family:monospace;">/var/mail/LOCAL_USERNAME</span> (or in whichever location you&#8217;ve specified in <span style="font-family:monospace;">~/.procmailrc</span>).
</p>
<p>
It&#8217;s a good idea to set up a launchd job for running this command between regular intervals so that you wouldn&#8217;t have to remember to manually do it yourself. <a href="http://lingon.sourceforge.net/">Lingon</a> is an ideal GUI app for this purpose. My GMail backup launchd job doesn&#8217;t call fetchmail directly, though: it calls this <a href="/stuff/gmailBackupScript/gmailBackupScript.zip">helper Python script</a> that I&#8217;ve written. The script does the following:</p>
<ul>
<li>Runs fetchmail,</li>
<li>Displays Growl messages about the result <em>(success or failure, number of messages downloaded if successful, etc.),</em></li>
<li>Optionally saves fetchmail&#8217;s output into a log file when done.</li>
</ul>
<p>Feel free to use it (remember to set the values in the &#8220;settings&#8221; section before running it, though).
</p>
<h3>Read Downloaded Messages with Thunderbird</h3>
<p>
In <a href="http://www.mozilla.com/en-US/thunderbird/">Mozilla Thunderbird</a>, go to <em>Tools > Account Settings&#8230; > Local Folders</em> to get to the <strong><em>Local directory</em></strong> path. Go into this directory and create a symbolic link there that points to the mail spool file:</p>
<div class="codecolorer-container bash mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">cd</span> PATH_COPIED_FROM_THUNDERBIRD<br />
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>mail<span style="color: #000000; font-weight: bold;">/</span>LOCAL_USERNAME .<span style="color: #000000; font-weight: bold;">/</span>GMailBackups</div></div>
<p>After this you&#8217;ll be able to find your backed up GMail messages in a folder called &#8220;GMailBackups&#8221; under &#8220;Local Folders&#8221; in Thunderbird.
</p>
<div style="height:30px;">&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://hasseg.org/blog/post/161/gmail-backups-with-fetchmail-on-os-x/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Mac OS X Mouse Wheel Support for ActionScript 3 Flash Applications (v.2+)</title>
		<link>http://hasseg.org/blog/post/138/os-x-mouse-wheel-support-for-actionscript-3-flash-applications-v2/</link>
		<comments>http://hasseg.org/blog/post/138/os-x-mouse-wheel-support-for-actionscript-3-flash-applications-v2/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 19:35:41 +0000</pubDate>
		<dc:creator>Ali Rantakari</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://hasseg.org/blog/?p=138</guid>
		<description><![CDATA[So I&#8217;ve finally updated the solution I&#8217;ve made earlier for enabling Mac OS X mouse wheel support in Flex applications to a second version. I didn&#8217;t want to continue adding stuff into the original post, so I decided to write a separate post just for this new version. As you can see from the title, [...]]]></description>
			<content:encoded><![CDATA[<p>
<img align="right" src='http://hasseg.org/blog/wp-content/uploaded/2008/04/as3mousewheel.png' alt='AS3 Mouse Wheel support picture' /> So I&#8217;ve finally updated <a href="?p=3">the solution I&#8217;ve made earlier for enabling Mac OS X mouse wheel support in Flex applications</a> to a second version. I didn&#8217;t want to continue adding stuff into the original post, so I decided to write a separate post just for this new version. As you can see from the title, this version should work in any Flash project you&#8217;re writing in ActionScript 3, as opposed to just in Flex projects. This change was contributed by <a href="http://inreflected.com">Pavel Fljot</a>, and all the other stuff I&#8217;ve added since have been added on top of that. Deployment should now be a lot easier and some features that were missing in the first version have also been added.
</p>
<p><span id="more-138"></span></p>
<h3>Changelog</h3>
<p>
First, here is an itemized list of what has changed:</p>
<ul>
<li><strong>Flex dependencies have been removed, which makes it possible to use this in pure AS3 projects as well</strong></li>
<p><em>This changes the way the support is initialized in AS3, but more about that a bit later. Courtesy of <a href="http://inreflected.com">Pavel Fljot</a>.</em></p>
<li><strong>States of modifier keys (i.e. ctrl (or command in OS X,) alt, shift) are supported</strong></li>
<p><em>These can be accessed via the ctrlKey, altKey and shiftKey properties in the MouseEvent object, as usual.</em></p>
<li><strong>The initialization of the code on the JavaScript end requires much less effort</strong></li>
<p><em>You basically just have to include the one JavaScript file on the page and that&#8217;s it.</em></p>
<li><strong>An another method of determining which object on the Stage should dispatch the mouse wheel event has been added</strong></li>
<p><em>Read more about this below. Courtesy of a similar solution from <a href="http://blog.pixelbreaker.com/flash/as30-mousewheel-on-mac-os-x/">Gabriel Bucknall</a>.</em></p>
<li><strong>Is enabled for Safari for Windows</strong></li>
<p><em>For some mysterious reason the mouse wheel won&#8217;t work in Flash when accessed with the Windows version of Safari, so this solution will now enable itself for that browser. Courtesy of <a href="http://inreflected.com">Pavel Fljot</a>.</em></p>
<li><strong>Can be enabled for any number of different Flash objects on the same page</strong></li>
<p><em>As long as the JavaScript file is linked on the page and the Flash apps have initialized the AS3 end of the code, they should be supported.</em></p>
<li><strong>The JavaScript code is encapsulated inside one top-level function</strong></li>
<p><em>This is a much more elegant solution on the JavaScript end. Courtesy of a similar solution from <a href="http://blog.pixelbreaker.com/flash/as30-mousewheel-on-mac-os-x/">Gabriel Bucknall</a>.</em></p>
<li><strong>The initialization state of the mouse wheel support is exposed</strong></li>
<p><em>You can read the value of the &#8220;initialized&#8221; property (or bind to it) to see if the mouse wheel support has been initialized.</em></p>
<li><strong>The concept of &#8220;registering and unregistering objects&#8221; for mouse wheel support within AS3 code has been removed</strong></li>
<p><em>This concept is no longer useful, given the new implementation.</em></p>
</ul>
<h3>Determining the InteractiveObject to dispatch the mouse wheel event</h3>
<p>
Like mentioned in the changelog above, I&#8217;ve added an another method for finding the <em>InteractiveObject</em> on stage and under the mouse cursor that should dispatch the mouse wheel event when one is sent from the JavaScript end. This is based on the solution to this same issue Gabriel Bucknall has come up with at <a href="http://blog.pixelbreaker.com/flash/as30-mousewheel-on-mac-os-x/">pixelbreaker.com</a>. My solution basically went through the whole display list hierarcy every time a mouse wheel event had to be dispatched, trying to find mouse-enabled InteractiveObjects that were under the mouse cursor, and then asked the topmost of these to dispatch the <em>MouseEvent</em>. Gabriel&#8217;s solution was to attach a <em>MouseEvent.MOUSE_MOVE</em> event listener to the Stage and keep a reference to the object that was the target for the last such event, and then use that reference to ask this object to dispatch the mouse wheel event whenever required.
</p>
<p>
Now, the main difference between these two solutions, I&#8217;ve found, is that Gabriel&#8217;s is faster but inaccurate in some border cases, while mine is slower but more accurate. The slowness of my solution is very clear if you understand the amount of processing that goes on whenever the user starts rolling the wheel: for each event, the application needs to go through the whole hierarchy of objects on the Stage, find <em>InteractiveObjects</em> that are under the mouse cursor, mouse-enabled and visible, and then find the one of those that is deepest in the display list. Gabriel&#8217;s solution doesn&#8217;t need to do any of this: it already has the <em>InteractiveObject</em> reference it wants to use at this point. The inaccuracy, on the other hand, stems from the fact that if the user doesn&#8217;t move their mouse, the reference won&#8217;t get updated. What this means is that if the <em>InteractiveObjects</em> on Stage have moved (in relation to the mouse cursor,) or been added to or removed from the display list while the cursor has stayed put, the reference will not be up to date, and probably incorrect.
</p>
<p>
As you&#8217;ve probably deduced from the last paragraph, there are upsides and downsides to both of these approaches, and I at least would like to be able to choose which one to use, based on the context of what I happen to be doing at the moment. This is why I&#8217;ve added this exact feature into the code in the form of a property the value of which you can set at will:</p>
<pre class="prettyprint">
private var _mwSupport:ExternalMouseWheelSupport = ExternalMouseWheelSupport.getInstance(stage);

_mwSupport.dispatchingObjectDeterminationMethod = ExternalMouseWheelSupport.COPY_MOUSEMOVE_EVENTS;
// or
_mwSupport.dispatchingObjectDeterminationMethod = ExternalMouseWheelSupport.TRAVERSE_DISPLAY_LIST;
</pre>
</p>
<p>
You can test the differences between these two options with the <a href="/stuff/AS3ExternalMouseWheelSupport/demo/example.html">demo</a>.
</p>
<h3>Deployment and use</h3>
<p>
So like I wrote before, the process of deploying and initializing this solution has changed a bit from the last version. This is how you do it now.</p>
<ol>
<li><strong>Include the JavaScript file onto the page that embeds the Flash object(s)</strong></li>
<div class="codecolorer-container html4strict mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;./extMouseWheel.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></div></div>
<p></p>
<li><strong>Make sure your embedded Flash objects have a parent <em>div</em> element</strong></li>
<div class="codecolorer-container html4strict mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width:600px;height:600px;&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flashContainerDiv&quot;</span>&gt;</span><br />
&nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- add Flash object's &lt;object&gt; and &lt;embed&gt; tags here --&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></div></div>
<p></p>
<li><strong>In your AS3 code, get a reference to the singleton instance of <em>ExternalMouseWheelSupport</em> in at least one place</strong></li>
<p>As you can see, the singleton instance accessor is not a property anymore, but a method, so that you can pass a reference to the Stage to it. This change is because of the removal of dependencies to Flex libraries, which could be used to access the Stage instance in the previous version.</p>
<pre class="prettyprint">
import org.hasseg.externalMouseWheel.ExternalMouseWheelSupport;
private var _mwSupport:ExternalMouseWheelSupport = ExternalMouseWheelSupport.getInstance(stage);
</pre>
<p>I generally do this in the <em>applicationComplete</em> event handler, but you can of course call it wherever you want, as long as you make sure the Stage reference you&#8217;re using is not <em>null</em> (an Error will be thrown if it is.)</p>
</ol>
<p>&#8230;and that&#8217;s it. :)
</p>
<h3>Downloads and demo</h3>
<ul>
<li><a href="/stuff/AS3ExternalMouseWheelSupport/demo/example.html">A Working example</a></li>
<li><a href="/stuff/AS3ExternalMouseWheelSupport/AS3ExternalMouseWheelSupport.zip">The sources (ZIP archive)</a></li>
<li><a href="/stuff/AS3ExternalMouseWheelSupport/asdoc-output/index.html">AsDoc-generated API documentation</a></li>
</ul>
<p>This code is licensed under the <a href="/stuff/license/MIT_License.txt">MIT License</a>.
</p>
<h3>Other info</h3>
<p>
I&#8217;ve tested this solution with the following browsers (sadly, Opera on the Mac isn&#8217;t supported since <em>ExternalInterface</em> doesn&#8217;t seem to work in the latest version:)</p>
<ul>
<li><strong>On OS X 10.5.2:</strong></li>
<ul>
<li>Safari 3.1.1</li>
<li>Firefox 3 beta 5</li>
<li>Camino 1.6</li>
<li>OmniWeb 5.7</li>
</ul>
<li><strong>On Windows XP SP2:</strong></li>
<ul>
<li>Internet Explorer 7.0</li>
<li>Firefox 2.0</li>
<li>Safari 3.1.1</li>
<li>Opera 9.27</li>
</ul>
</ul>
<p>If someone could please test this on the Mac OS version of Firefox 2 and the Windows versions of Firefox 3 beta and IE 6, I&#8217;d very much appreciate it.</p>
]]></content:encoded>
			<wfw:commentRss>http://hasseg.org/blog/post/138/os-x-mouse-wheel-support-for-actionscript-3-flash-applications-v2/feed/</wfw:commentRss>
		<slash:comments>75</slash:comments>
		</item>
		<item>
		<title>A &#8220;Go to Parent of Current Folder&#8221; Toolbar Button for Finder</title>
		<link>http://hasseg.org/blog/post/114/a-go-to-parent-of-current-folder-toolbar-button-for-finder/</link>
		<comments>http://hasseg.org/blog/post/114/a-go-to-parent-of-current-folder-toolbar-button-for-finder/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 17:07:44 +0000</pubDate>
		<dc:creator>Ali Rantakari</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://hasseg.org/blog/?p=114</guid>
		<description><![CDATA[Although the updated version introduced with Leopard significantly improves upon the one in Tiger, I still think Mac OS&#8217;s Finder is lacking in several departments. I Don&#8217;t feel &#8220;at home&#8221; with separate file managers (Path Finder or ForkLift, for example &#8212; even though I do own a license to the latter, I only use it [...]]]></description>
			<content:encoded><![CDATA[<p>
<img align="right" src='http://hasseg.org/blog/wp-content/uploaded/2008/02/findertoolbarparentbutton.png' alt='The “go to parent folder” button in the Finder toolbar' /> Although the updated version introduced with Leopard significantly improves upon the one in Tiger, I still think Mac OS&#8217;s Finder is lacking in several departments. I Don&#8217;t feel &#8220;at home&#8221; with separate file managers (<a href="http://www.cocoatech.com/">Path Finder</a> or <a href="http://www.binarynights.com/">ForkLift</a>, for example &#8212; even though I do own a license to the latter, I only use it as an SFTP client,) so I&#8217;ve taken it upon myself to improve the experience of using Finder. The first thing that annoyed me with it was the fact that even though you could use the key combo <i>Command(or Apple key) + Up arrow</i> to go to the parent of the current folder, there was no button in the toolbar for it (which is exactly how I would prefer to invoke this action.) Well, due to the fact that you can drag any application to Finder&#8217;s toolbar, it&#8217;s quite easy to add your own buttons there.
</p>
<p>
<em><b>Update (feb 13, 08)</b>: Updated the app to have a much nicer icon (made by Matti Schneider &#8212; thanks!)</em>
</p>
<p><span id="more-114"></span></p>
<p>
It&#8217;s ridiculously easy to tell Finder to go to the parent of the currently open folder with Applescript, so that&#8217;s what I did &#8211; I wrote an Applescript for this and saved it as an application. Then I added a nice icon for the app (made by Matti Schneider) that would not look out of place in the Finder toolbar, and dragged it there. Voilà:<br />
<img src='http://hasseg.org/blog/wp-content/uploaded/2008/02/gotoparentfolderbutton-big-v2.png' alt='Go to parent folder button for Finder’s toolbar (with nicer icon)' />
</p>
<p>
<a href="/stuff/goToParentFolderToolbarButton/goToParentFolderToolbarButton.zip">Download it here</a>
</p>
<p>
Oh yeah, and here&#8217;s the Applescript I used:</p>
<div class="codecolorer-container applescript mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #ff0033;">front</span> <span style="color: #0066ff;">window</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">set</span> theFolder <span style="color: #ff0033; font-weight: bold;">to</span> target<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #ff0033;">front</span> <span style="color: #0066ff;">window</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">set</span> target <span style="color: #ff0033; font-weight: bold;">to</span> parent <span style="color: #ff0033; font-weight: bold;">of</span> target<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #ff0033;">front</span> <span style="color: #0066ff;">window</span> <span style="color: #ff0033; font-weight: bold;">to</span> select theFolder<br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></div></div></p>
]]></content:encoded>
			<wfw:commentRss>http://hasseg.org/blog/post/114/a-go-to-parent-of-current-folder-toolbar-button-for-finder/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The Mac Applications I Use and Recommend</title>
		<link>http://hasseg.org/blog/post/19/the-mac-applications-i-use/</link>
		<comments>http://hasseg.org/blog/post/19/the-mac-applications-i-use/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 22:34:56 +0000</pubDate>
		<dc:creator>Ali Rantakari</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://hasseg.org/blog/?p=19</guid>
		<description><![CDATA[I&#8217;ve long though about documenting the slew of applications I&#8217;ve accustomed myself to using on my Macbook, but I&#8217;ve never really gotten around to it until now. The main reason I have for writing this kind of a list is to document these things on a remote server (or preferably several – Google, I&#8217;m looking [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve long though about documenting the slew of applications I&#8217;ve accustomed myself to using on my Macbook, but I&#8217;ve never really gotten around to it until now. The main reason I have for writing this kind of a list is to document these things on a remote server (or preferably several – Google, I&#8217;m looking at you) in case my laptop decides it&#8217;s time to give up the ghost and I&#8217;m forced to start all over again with a new one. Writing this in my blog should accomplish this goal, and in addition it can serve as my official list of recommended applications for other Mac OS X users. So, here it is, in all its long glory.
</p>
<p><span id="more-19"></span></p>
<p>
I have been trying to update this page regularly. The last update was <strong>Apr 1, 2011</strong>.
</p>
<p>
All applications below are either open source or otherwise distributed free of charge, unless the price of the license has been mentioned.
</p>
<h1>Office / Productivity</h1>
<ul>
<li>
<h2>Web Browser</h2>
</li>
<ol>
<li>
<h3><a href="http://www.apple.com/safari/">Safari</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/safariicon.jpg' alt='Safari icon' /> I&#8217;ve been using Safari as my main browser. The reason for this is that it has all the features I need from a browser, it looks nicer than the other alternatives, and it performs quite well. Another important thing is that Safari integrates into the OS, meaning that it supports the <em>Cmd-Ctrl-D</em> dictionary panel feature that is enabled in all Cocoa text controls, and that it uses the OS network location settings (proxies etc.), while Firefox and Opera have their own sets of proxy settings and do not support the dictionary panel feature. There are other browsers that integrate into the OS just like Safari, but they lack some of the other features I require. I don&#8217;t need ad blocking in the browser since I use GlimmerBlocker.<br />
<br /><strong>Safari Plugins I use:</strong></p>
<ul>
<li><a href="http://www.entropy.ch/software/macosx/xmlviewplugin/">XML View Plugin</a> by Marc Liyanage<br /><em>(Enables displaying of XML in the browser with color coding etc. just like Firefox does out of the box)</em></li>
<li><a href="http://rentzsch.github.com/clicktoflash/">ClickToFlash</a> by Jonathan &#8216;Wolf&#8217; Rentzsch et al.<br /><em>(Disables loading of all Flash items until you explicitly click on them or whitelist the current site)</em></li>
</ul>
<li>
<h3><a href="http://www.google.com/chrome">Chrome</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/chrome-icon.png" alt="Chrome icon" width="52" height="52" /> The Mac port of Google&#8217;s Chrome has been coming along very nicely, but even though it&#8217;s really fast and has a lot of the latest and greatest browser tech (well, Safari does, too), it still has many rough edges that prevent me from adopting it as my main browser (namely, <a href="http://code.google.com/p/chromium/issues/detail?id=8947">lack of text-only resizing</a>, page previews in the print dialog, support for the dictionary panel and a proper AppleScript dictionary (at the time of this writing)).</p>
<li>
<h3><a href="http://en.www.mozilla.com/en/firefox/">Firefox</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/firefoxicon.jpg' alt='Firefox icon' /> Firefox is definitely the most customizable browser out there, but it feels a bit more sluggish than Safari, Chrome and Opera.<br />
<br /><strong>Firefox Addons I use:</strong></p>
<ul>
<li><a href="http://systemproxy.mozdev.org/">System Proxy</a> by Ilya Voronin<br /><em>(makes Firefox use the OS proxy settings (normally it has its own settings for those, which you would have to manually keep changing whenever your location changes))</em></li>
<li><a href="http://www.takebacktheweb.org/">GrApple themes</a> by Aronnax<br /><em>(nice Safari-like themes that I prefer to the default one)</em></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/7261">Look Up in Dictionary</a> by Macaw<br /><em>(Even though the dictionary panel feature doesn&#8217;t work in Firefox (due to it not using OS-native text layout APIs,) this extension allows you to open the stand-alone OS X Dictionary application from within the context menu of a selection)</em></li>
</ul>
<li>
<h3><a href="http://www.opera.com/">Opera</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/operaicon.jpg' alt='Opera icon' /> I Only use Opera for online banking, since after every bank login and logout I want to clear the cache and history in the browser. I Can do that with Opera without losing any of my actual browsing history (which I&#8217;d like to retain) since I don&#8217;t use it for any other browsing.
</ol>
<li>
<h2>Web Ad Blocking</h2>
</li>
<ol>
<li>
<h3><a href="http://glimmerblocker.org/">GlimmerBlocker</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/glimmerblocker-icon.png" alt="glimmerblocker-icon" width="52" height="52" /> GlimmerBlocker runs a local proxy server on your computer and handles all of your ad blocking needs through that regardless of which browser you use. You control it via a preference pane it installs into System Preferences.
</ol>
<li>
<h2>Office Suite</h2>
</li>
<ol>
<li>
<h3><a href="http://www.apple.com/iwork/">iWork &#8217;08</a></h3>
<p> <em>$79 for one license or $99 for the family pack</em></li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/iworkicon.jpeg' alt='iWork 08 icon' /> Apple&#8217;s iWork package has earned a position as my number one office app suite because of the clean UI of the apps included (<a href="http://www.apple.com/iwork/pages/">Pages</a> for word processing and page layout, <a href="http://www.apple.com/iwork/numbers/">Numbers</a> for spreadsheets and <a href="http://www.apple.com/iwork/keynote/">Keynote</a> for presentations). Even the MS Office file format support is pretty good.</p>
<li>
<h3><a href="http://porting.openoffice.org/mac/download/aqua.html">OpenOffice.org</a> and <a href="http://www.neooffice.org">NeoOffice</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/neoofficeicon.jpg' alt='NeoOffice icon' /> <img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2008/08/openoffice-logo.jpg" alt="" title="openoffice-logo" width="53" height="53" /> My second choice is the native Mac version of OpenOffice.org. It&#8217;s a lot slower and clunkier than iWork, but it does have more features. NeoOffice is an OpenOffice.org fork that I used before the official Aqua port of OO.org was released, since I didn&#8217;t want to run the X11 version.
</ol>
<li>
<h2>Document Viewing</h2>
</li>
<ul>
<li>
<h3><a href="http://skim-app.sourceforge.net/">Skim</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/skimicon.png' alt='Skim icon' /> I&#8217;ve been using Skim as my main PDF viewer because it has a nicer UI and more features than Preview, and it is quite fast, especially compared to <a href="http://www.adobe.com/support/downloads/product.jsp?platform=macintosh&#038;product=10">Adobe&#8217;s viewer</a>. Skim has been updated <em>ridiculously often</em> during the whole time I&#8217;ve used it (which is good!).</p>
<li>
<h3><a href="http://wakaba.c3.cx/s/apps/xee.html">Xee</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/xeeicon.jpg' alt='Xee icon' /> Xee is my favorite image viewer. It trumps Preview in that it&#8217;s allows you to easily browse through all the images in the same folder.
</ul>
<li>
<h2>Diagram Drawing</h2>
</li>
<ol>
<li>
<h3><a href="http://www.omnigroup.com/applications/omnigraffle/">OmniGraffle Professional</a> (v.4)</h3>
<p> <em>$99.95 for one license (v.5, standard), $199.95 (v.5, professional)</em></li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/omnigraffleicon.jpg' alt='OmniGraffle icon' /> OmniGraffle is the best diagramming / vector graphics application I have ever used, hands down. I Liked MS Visio before, but OmniGraffle is way better. It&#8217;s not the cheapest application in the world but it&#8217;s well worth the price. I&#8217;ve used it to create all kinds of drawings from icons and CD/DVD covers to UML diagrams. I have version 4 but at the time of this writing, version 5 is the latest.
</ol>
<li>
<h2>General Productivity</h2>
</li>
<ul>
<li>
<h3><a href="http://www.obdev.at/products/launchbar/index.html">LaunchBar</a></h3>
<p> <em>$19.95 for a single home user license and $29.95 for a family license</em></li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2008/02/launchbaricon.jpg' alt='LaunchBar icon' /> LaunchBar is an application not dissimilar to Quicksilver. It can provide quick access to <em>&#8220;applications, documents, contacts and bookmarks, to your iTunes library, to search engines and more&#8221;</em>. I Currently use it to launch applications, since I got it with the MacHeist 2008 bundle and it&#8217;s a bit faster for that than Spotlight.</p>
<li>
<h3><a href="http://www.shadowlab.org/Software/spark.php">Spark</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/spark-icon.jpg' alt='Spark icon' /> Spark allows you to configure custom system-wide keyboard shortcuts for doing any number of different things (e.g. running scripts or applications, opening files or folders, controlling iTunes or performing system actions like logging out or starting the screen saver).</p>
<li>
<h3><a href="http://quicksilver.blacktree.com/">Quicksilver</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/quicksilvericon.jpg' alt='Quicksilver icon' /> Quicksilver is the venerable productivity helper application that allows you to open files, launch applications, and god knows what else – people have found amazingly creative uses for this app. You use it by first pressing a keyboard shortcut to invoke it, then starting to type the name of something that you want to operate on (a file, a folder, an application&#8230;), and after that you can press enter to run the default action or tab to select some other action you want to perform on the found item.
</ul>
<li>
<h2>Calendar</h2>
</li>
<ul>
<li>
<h3><a href="http://www.busymac.com/busycal/">BusyCal</a></h3>
<p> <em>$40 per computer (or $10 when upgrading from BusySync)</em></li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/busycal-icon.png" alt="busycal-icon" width="54" height="54" /> iCal was one of the reasons I wanted to start using OS X and buy a Mac. I liked the clutter-free interface, which is very important to me in a calendar app. In Aug &#8217;09, though, I started using BusyCal instead. It&#8217;s very similar but includes a bunch of extra features (most notably more reliable synchronization with Google Calendar). I also trust the developers of BusyCal to be more focused on its development than Apple is in the development of iCal.
</ul>
<li>
<h2>Address Book</h2>
</li>
<ul>
<li>
<h3><a href="http://danauclair.com/addressbooksync/">AddressBookSync</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/addressbooksync-icon.png" alt="addressbooksync-icon" width="52" height="52" /> This free application makes it very easy to download profile pictures and other information for all of your contacts from Facebook and into your local Address Book database. It has worked quite well for me and has saved me lots of manual work.
</ul>
</ul>
<h1>Communication</h1>
<ul>
<li>
<h2>E-Mail</h2>
</li>
<ol>
<li>
<h3><a href="http://mailplaneapp.com/">Mailplane</a></h3>
<p> <em>$24.95 for a single license</em></li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/mailplaneicon.png' alt='Mailplane icon' /> I prefer to use the GMail user interface over the more traditional e-mail software interfaces, but I would also like to keep my emails in a separate window or application from my web browsing. Mailplane is an application that wraps up the GMail interface in a nice Cocoa app that adds all kinds of nice OS integration into the process of using GMail. It can also pop up the Google Talk UI in its own window, which I think is very nice. Very much recommended.</p>
<li>
<h3><a href="http://en.www.mozilla.com/en/thunderbird/">Thunderbird</a></h3>
</li>
<p><img style="padding-right:7px;" align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/thunderbirdicon.jpeg' alt='Thunderbird icon' /> Thunderbird is my second choice if I cannot use Mailplane. It&#8217;s thus my preferred one from all the more traditional e-mail applications.
</ol>
<li>
<h2>Instant Messaging</h2>
</li>
<ol>
<li>
<h3><a href="http://www.adiumx.com/">Adium</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/adiumicon.jpg' alt='Adium icon' /> Adium is an excellent multi-protocol IM client that I use as my main IM application. In the past it had some trouble connecting to the MSN network (which, unfortunately, is the network many of the people I&#8217;d like to chat with happen to use) through proxies, but lately it seems to have been working just fine for me.
</ol>
<li>
<h2>Video/Audio (Conference) Calls</h2>
</li>
<ol>
<li>
<h3><a href="http://www.skype.com/">Skype</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/skypeicon.jpg' alt='Skype icon' /> Skype is the well known VOIP application that I trust the esteemed reader is familiar with.
</ol>
<li>
<h2>IRC</h2>
</li>
<ol>
<li>
<h3><a href="http://colloquy.info/">Colloquy</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/colloquyicon.jpg' alt='Colloquy icon' /> I haven&#8217;t been able to hang around in IRC a lot after starting to use OS X, but I&#8217;ve tested all the IRC clients available and this one seems like the best one for me – I feel that the most important thing in an IRC client is to be able to display the discussions in a very readable (read: color-coded) way, and Colloquy can do this. What it lacks in features it makes up for in UI elegance.
</ol>
</ul>
<h1>Media &amp; Entertainment</h1>
<ul>
<li>
<h2>Music Player</h2>
</li>
<ul>
<li>
<h3><a href="http://cogx.org/">Cog</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/cogicon.jpeg' alt='Cog icon' /> I Usually prefer to organize my music &#8220;library&#8221; as simply a file/folder structure instead of a centralized database (like iTunes does it). Therefore I need a simple music player that has a nice and clear UI, good sound quality, and that doesn&#8217;t keep any sort of database about the files it&#8217;s used to play. Cog fits the bill perfectly.</p>
<li>
<h3><a href="http://www.rogueamoeba.com/airfoil/">AirFoil</a></h3>
<p> <em>$25 for single license</em></li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/airfoil-icon.png" alt="" width="52" height="52" /> This is an app for streaming audio over the network from one computer to another (or to an Airport Express). I tried using iTunes&#8217; home sharing feature for streaming music from my (Mac) laptop into our living room (Windows) HTPC but for some inexplicable reason some particular files refused to be streamed. I then replaced this setup with AirFoil and have been happy as Larry ever since (however happy he is).
</ul>
<li>
<h2>Video Player</h2>
</li>
<ol>
<li>
<h3><a href="http://www.apple.com/quicktime/">Quicktime</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/quicktimeicon.jpg' alt='Quicktime icon' /> When Apple removed the ridiculous constraint of not being able to view videos in fullscreen with the basic version of Quicktime, I started to actually use it, although I usually do pick VLC, MPlayer or Movist over it:</p>
<li>
<h3><a href="http://mplayerosx.sttz.ch/">MPlayer OS X Extended</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/mplayer-icon.jpg' alt='MPlayer OS X Extended icon' /> <a href="http://www.mplayerhq.hu/">MPlayer</a> is an excellent video player that comes with built-in support for almost every codec imaginable. The standard OS X GUI is not nearly as good as this custom one, which I prefer to use instead.</p>
<li>
<h3><a href="http://www.videolan.org/vlc/">VLC Player</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/vlcicon.jpg' alt='VLC player icon' /> VLC is <em>another</em> excellent video player that comes with built-in support for almost every codec imaginable.</p>
<li>
<h3><a href="http://code.google.com/p/movist/">Movist</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/movist-icon.png" alt="Movist icon" width="52" height="52" /> Movist&#8217;s biggest differentiating feature is the fact that it can use both Quicktime and <a href="http://ffmpeg.org/">FFmpeg</a> for decoding the video, and you can switch between these two options with the click of a button. It also has good support for subtitles and a pretty clean preferences panel and UI.
</ol>
<li>
<h2>Codecs</h2>
</li>
<ul>
<li>
<h3><a href="http://perian.org/">Perian</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/perianicon.jpg' alt='Perian icon' /> Perian, the self-proclaimed &#8220;swiss-army knife for Quicktime&#8221; adds support for a <em>very</em> large number of video and audio formats to Quicktime. Essential.</p>
<li>
<h3><a href="http://www.microsoft.com/windows/windowsmedia/player/wmcomponents.mspx">Flip4Mac</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/flip4macicon.jpg' alt='Flip4Mac icon' /> Flip4Mac, now distributed under the more generic name &#8220;Windows Media components for Quicktime&#8221;, adds support for – you guessed it – Windows Media formats to Quicktime. Essential.</p>
<li>
<h3><a href="http://xiph.org/quicktime/">Xiph Quicktime Components</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/xiphqt-icon.png" alt="XiphQT icon" width="52" height="52" /> This package adds support for the Xiph media formats (Ogg Theora, Vorbis, FLAC) to Quicktime. Especially interesting due to Firefox&#8217;s initial implementation of the HTML5 video tag <a href="https://developer.mozilla.org/en/Using_audio_and_video_in_Firefox">supporting only Ogg video</a> &mdash; after this is installed, Safari will support it as well.
</ul>
<li>
<h2>Video Conversion</h2>
</li>
<ul>
<li>
<h3><a href="http://www.techspansion.com/visualhub">VisualHub</a></h3>
<p> <em><del>$23.32 for household license</del> (Edit: VisualHub has been <a href="http://www.techspansion.com">discontinued</a>. I still use it but you might want to take a look at <a href="http://videomonkey.org/">VideoMonkey</a> instead.)</em></li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/visualhubicon.jpg' alt='VisualHub icon' /> This is basically a very easy-to-use GUI for ffmpeg, which is a well known and mature open source command-line application for converting video from one format to another. VisualHub works very well and its greatest asset seems to be that it has support for encoding from/to a huge number of formats, due to ffmpeg.</p>
<li>
<h3><a href="http://handbrake.m0k.org">Handbrake</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/handbrakeicon.jpg' alt='Handbrake icon' /> Handbrake is a converter application that is able to convert DVDs to MPEG-4 formats. It can&#8217;t handle other DVD copy protection mechanisms than CSS, though.
</ul>
<li>
<h2>Audio Editing</h2>
</li>
<ol>
<li>
<h3><a href="http://audacity.sourceforge.net/">Audacity</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/audacityicon.jpg' alt='Audacity icon' /> Audacity is a nice and very capable open source application that is able to record and edit audio.
</ol>
<li>
<h2>Image Editing</h2>
</li>
<ol>
<li>
<h3><a href="http://pixelmator.com/">Pixelmator</a></h3>
<p> <em>$59 for one license</em></li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/pixelmatoricon.jpg' alt='Pixelmator icon' /> Pixelmator is a native Mac image editor with a flashy UI and tight OS integration. The application is very nice all around and has been updated quite often &#8212; almost all of the things I thought it was missing in the first versions have been fixed by now (version 1.2.2). Most of the features are implemented in a very Photoshop-like manner, which makes it easy to get started with it if you&#8217;ve used Photoshop before. Very much recommended. Some people prefer <a href="http://flyingmeat.com/acorn/">Acorn</a>, which is another excellent image editor for the Mac.
</ol>
<li>
<h2>Games</h2>
</li>
<ol>
<li>
<h3><a href="http://www.scummvm.org/">ScummVM</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/scummvmicon.jpeg' alt='ScummVM icon' /> I don&#8217;t really play any games anymore (I&#8217;d like to, though, but I don&#8217;t have that much time for it), but I do have ScummVM, a multi-platform interpreter for the SCUMM adventure game system, installed so that I&#8217;ll be able to play some of those classic adventure games on my Mac.
</ol>
<li>
<h2>Newsreader</h2>
</li>
<ol>
<li>
<h3><a href="http://www.newsgator.com/INDIVIDUALS/NETNEWSWIRE/">NetNewsWire</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/netnewswire-icon.png" alt="netnewswire-icon" width="52" height="52" /> I&#8217;ve been using Google Reader as my main newsfeed reader due to the OK user interface and the fact that it&#8217;s a web app and thus lets me access my feed subscriptions from anywhere. Now that the venerable NetNewsWire has finally added support for synchronization with Google Reader (currently only in the latest beta versions), I&#8217;ve begun using it on the desktop, since the UI is obviously a lot nicer in this native desktop app.
</ol>
</ul>
<h1>Nerdery</h1>
<ul>
<li>
<h2>Code Editor</h2>
</li>
<ol>
<li>
<h3><a href="http://www.jedit.org/">jEdit</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/jediticon.jpeg' alt='jEdit icon' /> jEdit was one of the few options I had for choosing a capable editor for writing ActionScript, and because of its extendability, configurability and excellent plugins on a nice plugin architecture I&#8217;ve been using it as my main editor for all coding tasks. It&#8217;s a bit slow and clunky at times (well, it&#8217;s made in Java, after all) but I&#8217;ve simply fallen in love with the Beanshell macro system it has so it&#8217;ll be difficult for me to migrate to anything else.</p>
<li>
<h3><a href="http://www.fraiseapp.com/">Fraise</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/smultronicon.jpg' alt='Smultron icon' /> Fraise is a &#8216;continuation&#8217; fork of <a href="http://smultron.sourceforge.net/">Smultron</a> by Peter Borg, on which development was halted a while ago. It is a nice and simple text/code editing app that I mainly use as a general-purpose text editor. It launches quickly so it&#8217;s also perfect for quick fixes to scripts, config files and such if I don&#8217;t have my main editor open.
</ol>
<li>
<h2>Source Code Control</h2>
</li>
<ul>
<li>
<h3><a href="http://git-scm.com">Git</a> and <a href="http://gitx.laullon.com/">GitX (L)</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/git-logo.png" alt="Git logo" title="git-logo" width="53" height="19" /> <img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/gitx-icon.jpg" alt="GitX icon" title="gitx-icon" width="53" height="53" /> There are many good GUIs for Git on OS X but GitX is my favorite. It&#8217;s quite fast, straightforward and simple, and particularly its commit view matches my mental model of committing stuff in Git really well. <a href="http://gitx.frim.nl/">The original GitX project</a> has apparently stalled a bit but fortunately others have picked up the code. The fork linked above is GitX(L) (which I use), but <a href="https://github.com/brotherbard/gitx/wiki">Brotherbard&#8217;s fork</a> is another option.</p>
<li>
<h3><a href="http://mercurial.selenic.com/">Mercurial</a> and <a href="http://bitbucket.org/snej/murky/">Murky</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/hg-icon.png" alt="hg icon" width="53" height="53" /> <img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/murky-icon.png" alt="murky icon" width="53" height="53" /> I&#8217;ve recently decided to start using Mercurial for some small personal projects instead of Git. I like both but I noticed how I didn&#8217;t really use Git&#8217;s branching at all for my personal projects, and even though Git&#8217;s documentation and &#8216;user friendliness&#8217; in general has been improved a lot over time, it seems to still be easier to figure out (and remember) how to do some less-common things in Mercurial. I&#8217;ve grown accustomed to using GitX in my workflow a lot, though, so I was happy to see that Mercurial&#8217;s best OS X GUI, Murky, has improved a lot since I first heard about it.</p>
<li>
<h3><a href="http://www.lachoseinteractive.net/en/community/subversion/svnx/">SvnX</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/svnxicon.jpeg' alt='SvnX icon' /> The source code versioning system I&#8217;ve used at work is SVN. The SVN command-line client has been included in OS X since Leopard, so there&#8217;s no need to separately install it, but a GUI front-end for it does come in handy. I&#8217;ve been using SvnX, which seems to be the best free option. Even though I know nicer alternatives exist, SvnX has been good enough for me.
</ul>
<li>
<h2>File Transfer ((S)FTP)</h2>
</li>
<ol>
<li>
<h3><a href="http://www.binarynights.com/">ForkLift</a></h3>
<p> <em>$29.95 for one license</em></li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/forklifticon1.jpg' alt='ForkLift icon' /> A File manager application primarily meant for replacing the Finder. I simply use this as an SFTP client application, since it seems more robust than the free alternatives and sports an excellent &#8216;live editing&#8217; feature that uploads any changes to an edited file in the background every time you save. It also works as an excellent application remover and a batch renamer.</p>
<li>
<h3><a href="http://rsug.itd.umich.edu/software/fugu/">Fugu</a> and <a href="http://cyberduck.ch/">Cyberduck</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/fugu.png' alt='Fugu icon' /><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/cyberduckicon.jpeg' alt='Cyberduck icon' /> The best free alternatives for FTP (which I rarely use anymore) and SFTP. Both have been a bit buggy when I&#8217;ve used them.
</ol>
<li>
<h2>File Transfer (BitTorrent)</h2>
</li>
<ol>
<li>
<h3><a href="http://transmission.m0k.org/">Transmission</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/transmissionicon.jpg' alt='Transmission icon' /> My BitTorrent application of choice. Transmission has a very nice and clean UI and it has always worked very well. It was also recently updated to allow for selective downloading (i.e. downloading only some specific files from a torrent), which a lot of people seemed to be asking for.
</ol>
<li>
<h2>File Synchronization</h2>
</li>
<ol>
<li>
<h3><a href="http://www.getdropbox.com/">DropBox</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2008/08/dropbox-icon.jpg" alt="DropBox icon" title="dropbox-icon" width="53" height="53" /> DropBox is a very nice cross-platform file synchronization application that automatically and transparently syncs all files and folders under a specific path in your local filesystem onto their servers and any other computers you have that are running DropBox clients. You can also share folders with other DropBox users and use URLs to specific files in your &#8220;public&#8221; folder to share individual files with anyone. As of this writing it&#8217;s still in closed beta.
</ol>
<li>
<h2>Task Automation</h2>
</li>
<ul>
<li>
<h3><a href="http://www.symonds.id.au/marcopolo/">MarcoPolo</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/marcopoloicon.png' alt='MarcoPolo icon' /> An excellent open source app that changes my network location and a bunch of other settings automatically based on set criteria from different sources (e.g. WLAN SSID, IP range etc&#8230;). Unfortunately development on this appears to have been halted for a long time (jan 2011) but the app front page has links to a bunch of alternatives that do pretty much the same thing.</p>
<li>
<h3><a href="http://lingon.sourceforge.net/">Lingon</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/lingonicon.jpg' alt='Lingon icon' /> Lingon is a GUI frontend to the launchd system daemon configuration and its controller launchctl. It&#8217;s basically a very nice, easy, fast and clean way to schedule applications or scripts to run at defined times (e.g. at specific intervals or whenever a specific file changes). The newer versions of Lingon have a completely overhauled interface, which is much simpler, but I quite liked the old one. The biggest problem for me is the fact that you have to log out or restart for some changes to get applied. The developer says this is because of the changes Apple made to launchd in Leopard, but as far as I understand, it&#8217;s still quite possible to load and unload jobs with launchctl without logging out. <em><strong>Note:</strong> Lingon is not developed anymore but as far as I know, the latest version can still be useful so I&#8217;ll keep it listed here.</em></p>
<li>
<h3><a href="http://swannman.wordpress.com/2007/02/11/scriptsaver-28/">ScriptSaver</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/scriptsaverpicture.png' alt='ScriptSaver screenshot' /> ScriptSaver is a screensaver that allows you to set it to run applescripts whenever it starts and stops. You specify the script to run at screensaver startup, the actual screensaver to use, and the script to run when the screensaver stops.</p>
<li>
<h3><a href="http://www.bernhard-baehr.de/">SleepWatcher</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/terminalicon.jpg' alt='Terminal icon' /> SleepWatcher is a system daemon that executes shell scripts whenever your Mac goes to sleep and whenever it wakes up.
</ul>
<li>
<h2>Backups</h2>
</li>
<ul>
<li>
<h3><a href="http://www.shirt-pocket.com/SuperDuper/">SuperDuper!</a></h3>
<p> <em>$27.95 for one license</em></li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/superduper-icon.jpg" alt="SuperDuper! icon" title="superduper-icon" width="53" height="53" /> The two most recommended backup applications (besides Time Machine, of course) are SuperDuper! and Carbon Copy Cloner. I&#8217;d been using Carbon Copy Cloner for a while, but since I ran into some problem that prevented it from finishing a full backup of my laptop&#8217;s HDD a couple of times, I decided to try SuperDuper! instead in hopes that it&#8217;d be more reliable (so far, it has been.) Using either one of these, it&#8217;s super easy to create bit-by-bit clones of your HDD onto another one and have it ready to step in as a replacement drive in case your main one fails.</p>
<li>
<h3><a href="http://www.bombich.com/software/ccc.html">Carbon Copy Cloner</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2008/08/carboncopycloner-icon.jpg" alt="Carbon Copy Cloner icon" title="carboncopycloner-icon" width="53" height="53" /> Carbon Copy Cloner is the free alternative to SuperDuper!. Feature- and usability-wise, both are very similar, but I&#8217;ve found SuperDuper! to be a bit more reliable. Your mileage may vary.
</ul>
<li>
<h2>Configuration / Personalization</h2>
</li>
<ul>
<li>
<h3><a href="http://www.islayer.com/index.php?op=item&#038;id=28">iStat menus</a></h3>
<p> <em>$16 for single user, $26 for family pack</em></li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/istatmenusicon.jpeg' alt='iStat menus icon' /> iStat menus is a system monitoring application that sits in the system menu bar. It is very similar to <a href="http://www.ragingmenace.com/software/menumeters/">MenuMeters</a>, but better (it has more features and it looks nicer).</p>
<li>
<h3><a href="http://doublecommand.sourceforge.net/">DoubleCommand</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/doublecommandicon.jpg' alt='DoubleCommand icon' /> DoubleCommand is a kernel extension with a preference pane that allows for changing some of the key mappings on your keyboard. I&#8217;m using it to remap my enter key (the one in the Macbook between the right apple key and the left arrow key (note: I have a Finnish keyboard)) to act as an option (alt) key. <em>On newer Macs with Finnish keyboards this would not be needed, as there is a right-side Alt key present</em>.</p>
<li>
<h3><a href="http://www.finderpop.com/">FinderPop</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2008/12/finderpop-icon.png" alt="" title="FinderPop icon" /> FinderPop allows you to extend context menus for Finder (and other apps as well) with its own custom items as well as arbitrary user-defined items, defined by the contents of a folder (that is, just add something to this folder and it will be included as an item into Finder context menus.) Very cool.</p>
<li>
<h3><a href="http://projects.tynsoe.org/en/geektool/">GeekTool</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/geektoolicon.jpg' alt='GeekTool icon' /> GeekTool allows you to display any command line output in text boxes over the desktop background. The output is most commonly from a shell script or CLI app.
</ul>
<li>
<h2>Terminal Application</h2>
</li>
<ul>
<li>
<h3>Terminal</h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/terminal-icon.png" alt="" width="50" height="50" /> I started using the system default Terminal app instead of iTerm around the time Snow Leopard came out due to iTerm having some issues with non-ASCII characters (I might switch back at some point though). I had to install SIMBL and <a href="http://niw.at/articles/2007/11/02/TerminalColoreopard/en">an inputmanager hack</a> to be able to change the ANSI colors, though (iTerm has this built in).</p>
<li>
<h3><a href="http://decimus.net/dterm.php">DTerm</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2008/08/dterm-icon.jpg" alt="DTerm icon" title="dterm-icon" width="53" height="53" /> The slogan on DTerm&#8217;s website says &#8220;A command line anywhere and everywhere&#8221;, which pretty much describes what the application does &#8212; it lets you open up a quick terminal whenever and wherever with a global keyboard shortcut, setting the working directory in this terminal instance to the path of the file that is currently open in whichever application you have in focus (if the front window of this application is a Cocoa document window). This is a <em>really nice</em> way to run some quick commands without first opening a full Terminal app and cd&#8217;ing to the correct directory.</p>
<li>
<h3><a href="http://iterm.sourceforge.net/">iTerm</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/itermicon.jpg' alt='iTerm icon' /> iTerm has improves upon the Terminal app that ships with the OS with some simple details like the fact that it only maximizes the vertical size of the window when using &#8216;Zoom&#8217; (invoked, for example, from the plus button on the window corner) and that it allows you to change the ANSI colors without an external inputmanager hack. Essential.
</ul>
<li>
<h2>System Tools / Helper Apps</h2>
</li>
<ul>
<li>
<h3><a href="http://growl.info/">Growl</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/growlicon.jpg' alt='Growl icon' /> Growl is a global notification system that a lot of applications use to notify the user of something that they&#8217;re doing. It&#8217;s an excellent idea and what is more excellent is the number of applications that have actually added support for it. It&#8217;s a shame most of the display styles look like ass, though (I use &#8220;smoke&#8221;, which looks nice and clean). The <em>growlnotify</em> command-line app that can be used to send messages to Growl is broken in Leopard as of this writing (version 1.1.4), but <a href="?p=111">there&#8217;s a workaround</a>.</p>
<li>
<h3><a href="http://wafflesoftware.net/hexpicker/">Hex Color Picker</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2008/08/hexcolorpicker-icon.jpg" alt="Hex Color Picker" width="53" height="53" /> Hex Color Picker plugs into the standard system color panel and adds features for working with hexadecimal colors. Very useful for anyone who has to work with websites.</p>
<li>
<h3><a href="http://www.panic.com/~wade/picker/">Developer Color Picker</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/DeveloperColorPicker-icon.png" alt="DeveloperColorPicker-icon" width="54" height="54" /> Just like the Hex Color Picker above, Developer Color Picker is able to copy HTML and CSS representations of colors into the clipboard, in addition to Cocoa/Cocoa Touch/Core Graphics -related representations (or declarations) (NSColor, UIColor, CGColorRef).</p>
<li>
<h3><a href="http://lightheadsw.com/caffeine/">Caffeine</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2008/08/caffeine-icon.jpg" alt="Caffeine new icon" title="caffeine-icon" width="53" height="53" /> Caffeine is a nice little menubar application that lets you temporarily make sure your computer won&#8217;t go to sleep. Very handy especially when doing presentations or watching web videos on battery power.</p>
<li>
<h3><a href="http://rogueamoeba.com/freebies/">SoundSource</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/soundsource-icon.png" alt="soundsource-icon" width="54" height="54" /> SoundSource sits in your menu bar and allows you to quickly switch audio input and output sources as well as adjust their volumes. Very handy especially if you often switch between USB speakers and headphones on the same computer.
</ul>
<li>
<h2>Unarchiving</h2>
</li>
<ol>
<li>
<h3><a href="http://wakaba.c3.cx/s/apps/unarchiver.html">The Unarchiver</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/theunarchivericon.jpg' alt='The Unarchiver icon' /> The Unarchiver is .. well, an unarchiver application, and one that supports more formats than the unarchiver that comes with OS X.</p>
<li>
<h3><a href="http://www.unrarx.com/">UnRarX</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/unrarxicon.jpeg' alt='UnRarX icon' /> If you ever come across some multi-part RAR archives that other unarchiving tools won&#8217;t open, the next step would be to try this one.
</ol>
<li>
<h2>Disc Burning</h2>
</li>
<ol>
<li>
<h3><a href="http://burn-osx.sourceforge.net/">Burn</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2008/08/burn-icon1.jpg" alt="Burn new icon" title="burn-icon1" width="53" height="53" /> Burn is a simple and clean application for burning CDs and DVDs in various formats.
</ol>
<li>
<h2>VNC Client</h2>
</li>
<ol>
<li>
<h3><a href="http://www.jinx.de/JollysFastVNC.html">JollysFastVNC</a></h3>
<p> <em>29.90€ +VAT for one license</em></li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2008/08/jollysfastvnc-icon.jpg" alt="Jolly\&#039;s fast VNC new icon" title="jollysfastvnc-icon" width="53" height="53" /> I&#8217;ve been using this as my number one VNC client instead of Chicken of the VNC because this seems to be a bit faster. Leopard has a VNC client installed by default (called Screen Sharing), but I&#8217;ve noticed that it&#8217;s also <u>really</u> slow compared to this one.</p>
<li>
<h3><a href="http://sourceforge.net/projects/cotvnc/">Chicken of the VNC</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/chickenofthevncicon.jpg' alt='Chicken of the VNC icon' /> My number two VNC client. This is an older application than JollysFastVNC, and may thus be more solid and stable, but as it seems a bit slower to update the screen and I haven&#8217;t had any problems with JollysFastVNC, I&#8217;ll keep using it instead of this.
</ol>
<li>
<h2>Virtualization</h2>
</li>
<ol>
<li>
<h3><a href="http://www.vmware.com/products/fusion/">VMWare Fusion</a></h3>
<p> <em>$79.99 for one license</em></li>
<p><img align="left" alt='VMWare Fusion icon' src='http://hasseg.org/blog/wp-content/uploaded/2007/12/vmwarefusion-icon.png' /> This, I think, is the best virtualization software currently available for the Mac and my preferred choice. I Suspect this situation will not change for a while, given the fact that VMWare has always had the best virtualization software on the market and they seem to be interested in continuing to upgrade their Mac product (probably due to continuous competition from <a href="http://www.parallels.com/en/products/desktop/">Parallels</a>, though.) I Use this to run virtualized instances of Windows XP and Ubuntu Linux on my mac.</p>
<li>
<h3><a href="http://www.virtualbox.org">Virtualbox</a></h3>
</li>
<p><img align="left" alt='Virtualbox icon' src='http://hasseg.org/blog/wp-content/uploaded/2007/12/virtualbox-icon.png' /> The best <em>free</em> virtualization solution for the Mac is this one. Not quite as polished as Fusion, but, you know, free.</p>
<p>
</ol>
<li>
<h2>Miscellaneous</h2>
</li>
<ol>
<li>
<h3><a href="http://www.codeweavers.com/products/cxmac/">Crossover Mac</a></h3>
<p> <em>37€ (Standard) or 64€ (Pro)</em></li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/crossover-icon.png" alt="crossover-icon" width="54" height="54" /> I use this commercial <a href="http://www.winehq.org/">Wine</a> distribution by Codeweavers to run <a href="http://www.regexbuddy.com/">RegexBuddy</a> (which is Windows-only) on OS X without firing up a full virtual machine.</p>
<li>
<h3><a href="http://fluidapp.com/">Fluid</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2008/08/fluid-icon.jpg" alt="Fluid icon" title="fluid-icon" width="53" height="53" /> Fluid is an application that generates site-specific browsers &#8212; that is, applications that embed a WebKit view within them, displaying by default a specific web site. This is a nice way of running web applications in their own windows and processes instead of in a tab or a window within one of your web browsers. I&#8217;ve used Fluid to make Google Reader into a site-specific browser for myself. Very handy.</p>
<li>
<h3><a href="http://www.sveinbjorn.org/platypus">Platypus</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/platypusicon.jpeg' alt='Platypus icon' /> Platypus is a nifty little application that allows you to take any script (e.g. shell script, applescript&#8230;) you&#8217;ve created and make it into an application bundle. It also has a command-line client, which allows for making simple build scripts for automation.</p>
<li>
<h3><a href="http://grandperspectiv.sourceforge.net/">GrandPerspective</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/grandperspective-icon.png" alt="" title="" width="47" height="47" /> This application displays a useful graphical representation of disk space taken by files contained by a specified hard drive or folder. It allows you to easily find where all your disk space went.
</ol>
<li>
<h2>Quick Look Generators (Plugins)</h2>
</li>
<ol>
<p><em>Update: I&#8217;ve removed the two items I previously had here, since the pages behind the following two links provide much better (and probably more frequently updated) lists of Quick Look plugins:</em></p>
<ul>
<li><a href="http://www.qlplugins.com/">http://www.qlplugins.com/</a></li>
<li><a href="http://www.quicklookplugins.com/">http://www.quicklookplugins.com/</a></li>
</ul>
</ol>
<li>
<h2>Command-Line Interface Programs</h2>
</li>
<ul>
<li>
<h3><a href="http://www.macports.org/">MacPorts</a></h3>
</li>
<p><img align="left" src="http://hasseg.org/blog/wp-content/uploaded/2007/09/macports-logo.png" alt="MacPorts logo" title="macports-logo" width="53" height="53" /> MacPorts is the closest thing on Mac OS to what the Linux distributions call &#8220;package managers&#8221;. It automatically downloads, compiles and installs software for you (mainly ports of software originally written for other Unix-like operating systems, hence the name,) along with all of the required dependencies. Some people prefer <a href="http://www.finkproject.org/">Fink</a>, which is pretty much the same thing.</p>
<li>
<h3><a href="http://www.cs.usyd.edu.au/~massad/project-proxy-config.html">proxy-config</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/cli.jpg' alt='CLI program icon' /> Returns you the FTP, HTTP and HTTPS system proxy settings. My ~/.bashrc runs this in order to set the <em>ftp_proxy</em>, <em>http_proxy</em>, <em>https_proxy</em> and <em>RSYNC_PROXY</em> environment variables to the same values I&#8217;ve set in System Preferences for whichever location I happen to be in.</p>
<li>
<h3><a href="http://will.harris.ch/bluelist.gz">bluelist</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/blueutilicon.png' alt='Bluetooth icon' /> Returns you a list of the connected bluetooth device names. </p>
<p></p>
<li>
<h3><a href="http://www.frederikseiffert.de/blueutil/">blueutil</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/blueutilicon.png' alt='Bluetooth icon' /> Allows you to check the current state of bluetooth (i.e. is it on or off), and set it to go on or off.</p>
<li>
<h3><a href="http://www.fernlightning.com/doku.php?id=software:misc:tms">tms</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/cli.jpg' alt='CLI program icon' /> Allows for making several different kinds of read-only queries to the Time Machine system, like <em>status</em>, <em>log</em>, <em>diff</em>, <em>delta</em> etc. I much prefer to use this for browsing my backups instead of the standard animated 3D space-time continuum thingamajiggie. <em><strong>Note:</strong> tms doesn&#8217;t seem to be developed anymore, and the latest version doesn&#8217;t work in Snow Leopard. I&#8217;m still hoping development on this will continue so I&#8217;ll refrain from removing it from this list.</em></p>
<li>
<h3><a href="http://osxutils.sourceforge.net/">osxutils</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/cli.jpg' alt='CLI program icon' /> A Bunch of different useful command-line utilities. 
<p>&nbsp;</p>
<li>
<h3><a href="http://www.intergalactic.de/pages/iSight.html">isightcapture</a></h3>
</li>
<p><img align="left" src='http://hasseg.org/blog/wp-content/uploaded/2007/09/cli.jpg' alt='CLI program icon' /> Captures images using the iSight webcam and writes them to files.
</p>
</ul>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hasseg.org/blog/post/19/the-mac-applications-i-use/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Changing Application Settings in OS X Based on (Network) Location</title>
		<link>http://hasseg.org/blog/post/4/changing-application-settings-in-os-x-based-on-network-location/</link>
		<comments>http://hasseg.org/blog/post/4/changing-application-settings-in-os-x-based-on-network-location/#comments</comments>
		<pubDate>Wed, 04 Jul 2007 23:57:14 +0000</pubDate>
		<dc:creator>Ali Rantakari</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://hasseg.org/blog/?p=4</guid>
		<description><![CDATA[I Generally use my laptop in three different locations: At home At work, in my employer&#8217;s main building At work, in the building of a partner organization Changing application settings manually every time I arrive at a new location gets tiring really, really fast. The location settings you can create in OS X can specify [...]]]></description>
			<content:encoded><![CDATA[<p><img style="margin-left:10px;" src="http://hasseg.org/blog/wp-content/uploaded/2007/07/picture-2.jpg" alt="MarcoPolo switching the location" align="right" /> I Generally use my laptop in three different locations:</p>
<ul>
<li>At home</li>
<li>At work, in my employer&#8217;s main building</li>
<li>At work, in the building of a partner organization</li>
</ul>
<p>
Changing application settings manually every time I arrive at a new location gets tiring really, really fast. The <em>location</em> settings you can create in OS X can specify network-related settings (proxies etc.) on a system level for all the different locations you enter, but then you of course have to manually switch the current location setting every time. I First used Quicksilver for that, but then found out about <a href="http://www.symonds.id.au/marcopolo/">MarcoPolo</a>, which is an excellent open source application that can change your network location (and initiate any other specified actions) automatically based on a bunch of rules using <em>evidence sources</em> (like Wi-Fi access point SSID or the first octets of a DHCP-assigned IP address) that you can set up. Setting up MarcoPolo and defining the rules was really straightforward, and its operation has been quite stable from the day I&#8217;ve started using it.
</p>
<p>
The problem I had next was that I used two applications that are cross-platform and thus not designed to take advantage of any OS-wide settings: <a href="http://en.www.mozilla.com/en/firefox/">Firefox</a> and <a href="http://subversion.tigris.org/">Subversion</a>. So, these applications have their own settings management and I needed a way to make some of their settings (namely the proxy servers) change automatically along with everything else.
</p>
<p>
<em><b>Update (jan 14, 2008):</b> I Rewrote this script in Python a while back. It&#8217;s now much nicer. <a href="/stuff/switchSettingsScript/switchConfigsScript-python.zip">Get the updated version here</a>.</em>
</p>
<p>
<em><b>Update (aug 17, 2008):</b> Refined the text in the post a bit according to my larger amount of experience with this. Changed link to point to <a href="/stuff/switchSettingsScript/switchConfigsScript-python-v2.zip">the latest version of the script</a>.</em>
</p>
<p><span id="more-4"></span></p>
<p>
The way I did this was to create a Python script that swaps configuration files set up beforehand for every location for these two applications. Then I added <em>actions</em> in MarcoPolo to run this shell script every time I arrive at a new location. When the script runs, it checks the current location and then goes through all the applications specified in its settings and changes their configuration files to ones I have set up for the location in question. It also notifies the user of what it is doing with <a href="http://growl.info/">Growl</a> notifications.
</p>
<p>
You can download the shell script below. I tried to write it so that it&#8217;ll be pretty straightforward for others to take advantage of as well. The directions to use it are in the script itself.
</p>
<p>
<a href="/stuff/switchSettingsScript/switchConfigsScript-python-v2.zip">The script and supporting files in a zip archive</a>
</p>
<p>This is what the script itself looks like:</p>
<p><div class="codecolorer-container python mac-classic codecolorer-customstyle" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span><br />
<span style="color: #808080; font-style: italic;"># ----------------------------------------------------------</span><br />
<span style="color: #808080; font-style: italic;"># DESCRIPTION:</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># A Script that switches application configuration files</span><br />
<span style="color: #808080; font-style: italic;"># based on the current system network location (I myself</span><br />
<span style="color: #808080; font-style: italic;"># use this for changing proxy server configurations)</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># Copyright (c) 2007-2008 Ali Rantakari</span><br />
<span style="color: #808080; font-style: italic;"># http://hasseg.org</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># ----------------------------------------------------------</span><br />
<span style="color: #808080; font-style: italic;"># REQUIRES:</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># - OS X Leopard (10.5)</span><br />
<span style="color: #808080; font-style: italic;"># - Growl (and the growlnotify script (distributed with</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;growl))</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># ----------------------------------------------------------</span><br />
<span style="color: #808080; font-style: italic;"># USAGE:</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># - Go through the 'settings' area below and change the</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; values to your liking</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># - Create configuration files for each location and each</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; application you would like to change configs for, using</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; the following naming pattern:</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; &nbsp; &nbsp;&lt;appname&gt;.&lt;config_file_name&gt;.&lt;location_name&gt;</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; &nbsp; &nbsp;( for example: firefox.user.js.Work )</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; These files must be located in the same folder as this</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; script. If you wish to add a common, location-agnostic</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; prefix for an app's configuration file, create a file</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; with the following naming pattern, and it will be</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; prepended to the configuration file before it is set:</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; &nbsp; &nbsp;&lt;appname&gt;.&lt;config_file_name&gt;</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; </span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; You can also create a file called &quot;defaultconfig-prefix&quot;,</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; which will be prepended to all configuration files as</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; they are set, regardless of application and location.</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># - Call the script to switch the configuration files.</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; I Suggest using some automated system for this - I</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; myself use MarcoPolo. Since this is a Python script and</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; MarcoPolo doesn't want to run it (using the &quot;ShellScript&quot;</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; action,) make it call the included switchProxiesCaller</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; bash script (which will then call this one) each time</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; the network location changes.</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># ----------------------------------------------------------</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<br />
<br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">string</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">sys</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">os</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">shutil</span><br />
<br />
<br />
<br />
<span style="color: #ff7700;font-weight:bold;">def</span> getMyBaseName<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">basename</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">def</span> getMyDirName<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">dirname</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
<br />
<br />
<br />
<br />
<br />
<span style="color: #808080; font-style: italic;"># ----------------------------------------------------------------</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># SETTINGS:</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<br />
<span style="color: #808080; font-style: italic;"># The applications you want to switch configuration files for.</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># A dictionary where each key is the app name and corresponding</span><br />
<span style="color: #808080; font-style: italic;"># values are dictionaries with the following two keys:</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; file : the app's config file name</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; dir &nbsp;: the directory where the config file is located</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(without trailing slash)</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># examples:</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; apps['firefox'] = {'file':'user.js', 'dir':'/Users/me/Library/Application Support/Firefox/Profiles/wn7lxarp.default'}</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; apps['subversion'] = {'file':'servers', 'dir':'/Users/me/.subversion'}</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; apps['bash'] = {'file':'.bash_profile', 'dir':'/Users/me'}</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
apps <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<span style="color: #808080; font-style: italic;"># locations of CLI apps used</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># - system: (these should be here)</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
osascript <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;/usr/bin/osascript&quot;</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<span style="color: #808080; font-style: italic;"># - custom: (these you need to get yourself)</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
growlnotify <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;/usr/local/bin/growlnotify&quot;</span><br />
<br />
<br />
<br />
<br />
<br />
<span style="color: #808080; font-style: italic;"># GROWL SETTINGS:</span><br />
<br />
<span style="color: #808080; font-style: italic;"># whether or not to use growl for notifications</span><br />
<span style="color: #808080; font-style: italic;"># (if this is False, notifications will be</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp;printed to stdout)</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
growl_use <span style="color: #66cc66;">=</span> <span style="color: #008000;">True</span><br />
<br />
<span style="color: #808080; font-style: italic;"># the name of this application </span><br />
<span style="color: #808080; font-style: italic;"># (to send to growlnotify)</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
growl_appname <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;Config switch script&quot;</span><br />
<br />
<span style="color: #808080; font-style: italic;"># the file to use as an icon in growl</span><br />
<span style="color: #808080; font-style: italic;"># notifications</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
growl_icon <span style="color: #66cc66;">=</span> getMyDirName<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">&quot;/icon.png&quot;</span><br />
<br />
<br />
<br />
<span style="color: #808080; font-style: italic;"># - - - - - - - - - - - - - - - - - - - - - -</span><br />
<span style="color: #808080; font-style: italic;"># settings end here.</span><br />
<span style="color: #808080; font-style: italic;"># ----------------------------------------------------------------</span><br />
<span style="color: #808080; font-style: italic;"># </span><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<span style="color: #808080; font-style: italic;"># BEGIN: functions -----------------------------------------</span><br />
<br />
<br />
<span style="color: #808080; font-style: italic;"># displays a notification/message to the user</span><br />
<span style="color: #ff7700;font-weight:bold;">def</span> showMessage<span style="color: black;">&#40;</span>title<span style="color: #66cc66;">,</span> msg<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; title <span style="color: #66cc66;">=</span> title.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'&quot;'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\'</span>'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; msg <span style="color: #66cc66;">=</span> msg.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'&quot;'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\'</span>'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>growl_use<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>growlnotify<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span>growlnotify+<span style="color: #483d8b;">' -a &quot;'</span>+growl_appname+<span style="color: #483d8b;">'&quot; -t &quot;'</span>+title+<span style="color: #483d8b;">'&quot; -m &quot;'</span>+msg+<span style="color: #483d8b;">'&quot; --image &quot;'</span>+growl_icon+<span style="color: #483d8b;">'&quot;'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot; &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;** Error:&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot; &nbsp; growlnotify not found in path: <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>+growlnotify+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot; &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;** &quot;</span>+title+<span style="color: #483d8b;">&quot;:&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot; &nbsp; &quot;</span>+msg<br />
<br />
<br />
<br />
<span style="color: #808080; font-style: italic;"># returns the name of the current OS X network location</span><br />
<span style="color: #ff7700;font-weight:bold;">def</span> getCurrLocation<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #dc143c;">cmd</span> <span style="color: #66cc66;">=</span> osascript+<span style="color: #483d8b;">&quot;&quot;&quot;&lt;&lt;END<br />
&nbsp; &nbsp; tell application &quot;System Events&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; tell network preferences<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return the name of current location<br />
&nbsp; &nbsp; &nbsp; &nbsp; end tell<br />
&nbsp; &nbsp; end tell<br />
&nbsp; &nbsp; END&quot;&quot;&quot;</span><br />
&nbsp; &nbsp; fin<span style="color: #66cc66;">,</span>fout <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">os</span>.<span style="color: #dc143c;">popen2</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">cmd</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> fout.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">rstrip</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span><br />
<br />
<br />
<br />
<span style="color: #808080; font-style: italic;"># concatenates two files (first &amp; second) into a</span><br />
<span style="color: #808080; font-style: italic;"># third file (output)</span><br />
<span style="color: #ff7700;font-weight:bold;">def</span> concatenateFiles<span style="color: black;">&#40;</span>first<span style="color: #66cc66;">,</span> second<span style="color: #66cc66;">,</span> output<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #008000;">file</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>first<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; data <span style="color: #66cc66;">=</span> <span style="color: #008000;">file</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">file</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #008000;">file</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>second<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; data +<span style="color: #66cc66;">=</span> <span style="color: #008000;">file</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">file</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; outputfile <span style="color: #66cc66;">=</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>output<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; outputfile.<span style="color: black;">write</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; outputfile.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<br />
<br />
<span style="color: #ff7700;font-weight:bold;">def</span> getFileContents<span style="color: black;">&#40;</span>filepath<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #008000;">file</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>filepath<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; data <span style="color: #66cc66;">=</span> <span style="color: #008000;">file</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">file</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> data<br />
&nbsp; &nbsp; <br />
<br />
<br />
<span style="color: #808080; font-style: italic;"># --end--: functions - - - - - - - - - - - - - - - - - - - -</span><br />
<br />
<br />
<br />
<br />
<br />
<br />
currloc <span style="color: #66cc66;">=</span> getCurrLocation<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>currloc <span style="color: #66cc66;">!=</span> <span style="color: #008000;">None</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: black;">&#40;</span>currloc <span style="color: #66cc66;">!=</span> <span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> appkey <span style="color: #ff7700;font-weight:bold;">in</span> apps:<br />
&nbsp; &nbsp; &nbsp; &nbsp; app <span style="color: #66cc66;">=</span> apps<span style="color: black;">&#91;</span>appkey<span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; origcfg <span style="color: #66cc66;">=</span> app<span style="color: black;">&#91;</span><span style="color: #483d8b;">'dir'</span><span style="color: black;">&#93;</span>+<span style="color: #483d8b;">&quot;/&quot;</span>+app<span style="color: black;">&#91;</span><span style="color: #483d8b;">'file'</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; thiscfg <span style="color: #66cc66;">=</span> getMyDirName<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">&quot;/&quot;</span>+appkey+<span style="color: #483d8b;">&quot;.&quot;</span>+app<span style="color: black;">&#91;</span><span style="color: #483d8b;">'file'</span><span style="color: black;">&#93;</span>+<span style="color: #483d8b;">&quot;.&quot;</span>+currloc<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>thiscfg<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newcontents <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>getMyDirName<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">&quot;/defaultconfig-prefix&quot;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newcontents <span style="color: #66cc66;">=</span> newcontents + getFileContents<span style="color: black;">&#40;</span>getMyDirName<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">&quot;/defaultconfig-prefix&quot;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>getMyDirName<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">&quot;/&quot;</span>+appkey+<span style="color: #483d8b;">&quot;.&quot;</span>+app<span style="color: black;">&#91;</span><span style="color: #483d8b;">'file'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newcontents <span style="color: #66cc66;">=</span> newcontents + getFileContents<span style="color: black;">&#40;</span>getMyDirName<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">&quot;/&quot;</span>+appkey+<span style="color: #483d8b;">&quot;.&quot;</span>+app<span style="color: black;">&#91;</span><span style="color: #483d8b;">'file'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newcontents <span style="color: #66cc66;">=</span> newcontents + getFileContents<span style="color: black;">&#40;</span>thiscfg<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">try</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span>origcfg<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outputfile <span style="color: #66cc66;">=</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>origcfg<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outputfile.<span style="color: black;">write</span><span style="color: black;">&#40;</span>newcontents<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outputfile.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showMessage<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Settings for &quot;</span>+appkey+<span style="color: #483d8b;">&quot; OK&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'When you run '</span>+appkey+<span style="color: #483d8b;">' the next time, settings for &quot;'</span>+currloc+<span style="color: #483d8b;">'&quot; will be used.'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: black;">&#40;</span><span style="color: #008000;">IOError</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">error</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> why:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showMessage<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Error&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'Can not write new '</span>+appkey+<span style="color: #483d8b;">' config file: &quot;'</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>why<span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'&quot;'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showMessage<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Error&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'Can not find '</span>+appkey+<span style="color: #483d8b;">' configuration for location &quot;'</span>+currloc+<span style="color: #483d8b;">'&quot;'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <br />
<span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; showMessage<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Error&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">&quot;Can not determine current network location&quot;</span><span style="color: black;">&#41;</span></div></div></p>
]]></content:encoded>
			<wfw:commentRss>http://hasseg.org/blog/post/4/changing-application-settings-in-os-x-based-on-network-location/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

