<?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>The House of Ding &#187; Mac</title>
	<atom:link href="http://www.houseofding.com/category/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.houseofding.com</link>
	<description>Technology, programming, design, and everything in-between.</description>
	<lastBuildDate>Fri, 30 Oct 2009 03:09:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>My iTunes veto list</title>
		<link>http://www.houseofding.com/2009/08/my-itunes-veto-list/</link>
		<comments>http://www.houseofding.com/2009/08/my-itunes-veto-list/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 14:15:19 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.houseofding.com/?p=237</guid>
		<description><![CDATA[I&#8217;ve actually been using this iTunes veto script for a few months now and it&#8217;s been so satisfying to hear silence every time these songs are played on the&#160;radio: Green Day - Know Your&#160;Enemy Green Day - Horseshoes and&#160;Handgrenades U2 - I&#8217;ll Go Crazy If I Don&#8217;t Go Crazy&#160;Tonight Bob Dylan - It&#8217;s All&#160;Good Bob [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve actually been using <a href="http://www.houseofding.com/2009/06/itunes-veto-avoid-those-overplayed-new-songs/" >this iTunes veto script</a> for a few months now and it&#8217;s been so satisfying to hear silence every time these songs are played on the&nbsp;radio:</p>
<ul>
<li>Green Day - Know Your&nbsp;Enemy</li>
<li>Green Day - Horseshoes and&nbsp;Handgrenades</li>
<li>U2 - I&#8217;ll Go Crazy If I Don&#8217;t Go Crazy&nbsp;Tonight</li>
<li>Bob Dylan - It&#8217;s All&nbsp;Good</li>
<li>Bob Dylan - Beyond Here Lies&nbsp;Nothin&#8217;</li>
<li>Iron and Wine - Love&nbsp;Vigilantes</li>
<li>Discovery - Orange&nbsp;Shirt</li>
</ul>
<p>Ahh&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.houseofding.com/2009/08/my-itunes-veto-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iTunes Veto: avoid those overplayed new songs</title>
		<link>http://www.houseofding.com/2009/06/itunes-veto-avoid-those-overplayed-new-songs/</link>
		<comments>http://www.houseofding.com/2009/06/itunes-veto-avoid-those-overplayed-new-songs/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 19:10:18 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.houseofding.com/?p=217</guid>
		<description><![CDATA[I listen to a stream of The Current almost all day, every day. I love this station, but I cringe every time they play that new Green Day song or when I hear Bono sing, well, anything. No longer! I&#8217;ve written a set of Ruby scripts that&#8217;ll let me veto away the ugliness so that [...]]]></description>
			<content:encoded><![CDATA[<p>I listen to a stream of <a href="http://minnesota.publicradio.org/tools/play/streams/the_current.pls" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://minnesota.publicradio.org/tools/play/streams/the_current.pls');">The Current</a> almost all day, every day. I love this station, but I cringe every time they play that new Green Day song or when I hear Bono sing, well, anything. No longer! I&#8217;ve written a set of Ruby scripts that&#8217;ll let me veto away the ugliness so that I&#8217;ll never get nasty songs stuck in my head&nbsp;again.</p>
<p>I should point out that these scripts assume you&#8217;re running Mac <span class="caps">OS</span> X 10.5 with Developer Tools installed. Both scripts use the <code>osx/cocoa</code> library to interact with&nbsp;iTunes.</p>
<h3>veto</h3>
<p>the <code>veto</code> script pulls the track title that iTunes is currently streaming and appends it to&nbsp;<code>~/.itunes_vetoes_songs</code>.</p>
<pre>
#!/usr/bin/env ruby -w

require 'osx/cocoa'
include OSX
OSX.require_framework 'ScriptingBridge'

itunes = SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes")
`echo "#{itunes.currentStreamTitle}" >> ~/.itunes_vetoed_songs`
</pre>
<h3>veto_watcher</h3>
<p><code>veto_watcher</code> runs in the background and looks for vetoes songs to appear the iTunes stream. When they do, it turns down the volume and spares your ears. When the vetoed track is done, the volume goes back up. Note: this <em>should</em> return the volume to it&#8217;s previous setting, but the instance variable kept breaking, so it just goes back up to&nbsp;100%&thinsp;&mdash;&thinsp;careful!</p>
<pre>
#!/usr/bin/env ruby -w

# start a new thread
pid = fork do

  require 'osx/cocoa'
  include OSX
  OSX.require_framework 'ScriptingBridge'

  @itunes = SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes")

  def itunes_is_running?
    return !`ps -A -o comm | grep iTunes.app`.empty?
  end

  def mute
    @itunes.soundVolume = 0 if @itunes.soundVolume > 0
  end

  def unmute
    @itunes.soundVolume = 100 if @itunes.soundVolume == 0
  end

  def check_for_veto
    vetoes = `cat ~/.itunes_vetoed_songs`.split("\n")

    if vetoes.index(@itunes.currentStreamTitle)
      mute
    elsif @itunes.soundVolume == 0
      unmute
    end
  end

  # main loop: check for a veto every 5 seconds
  loop do
    check_for_veto if itunes_is_running?
    sleep(5)
  end

end

Process.detach(pid)
</pre>
<p>I have the <code>veto_watcher</code> script start up when I log in and I&#8217;ve set up a Quicksilver trigger to run the <code>veto</code> script. What&#8217;s up now,&nbsp;Bono?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.houseofding.com/2009/06/itunes-veto-avoid-those-overplayed-new-songs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://minnesota.publicradio.org/tools/play/streams/the_current.pls" length="0" type="audio/x-scpls" />
		</item>
		<item>
		<title>Screen lock keyboard shortcut for your Mac</title>
		<link>http://www.houseofding.com/2009/01/screen-lock-keyboard-shortcut-for-you-mac/</link>
		<comments>http://www.houseofding.com/2009/01/screen-lock-keyboard-shortcut-for-you-mac/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 08:52:01 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.houseofding.com/?p=41</guid>
		<description><![CDATA[I&#8217;ve always been slightly annoyed by the lack of a keyboard shortcut to lock the screen on my Mac. There are several popular solutions out there (screensaver activated by hot corners, a lock icon in menu bar, etc), but I really missed my Windows-style Windows key+L keyboard shortcut. I&#8217;ve finally found a suitable solution with [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been slightly annoyed by the lack of a keyboard shortcut to lock the screen on my Mac.  There are several popular solutions out there (screensaver activated by hot corners, a lock icon in menu bar, etc), but I really missed my Windows-style Windows key+L keyboard shortcut. I&#8217;ve finally found a suitable solution with a combination of a Terminal command and <a href="http://www.blacktree.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.blacktree.com/');">Quicksilver</a>&#8217;s trigger&nbsp;functionality.</p>
<h3>Command-line&nbsp;script</h3>
<p>It turns out there&#8217;s a simple terminal command to do exactly what we want.  The following command will hide your desktop contents and display a login window (along with a fancy screen-rotating&nbsp;animation).</p>
<p>Open your favorite text editor and save a file called <code>lockscreen</code> with the contents below.  I saved mine in a directory called <code>~/bin/</code>, but you can put yours anywhere. (Note: ignore the text wrap below—there is no line break in the&nbsp;command)</p>
<p class="code"><code>#!/bin/sh<br />
/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession&nbsp;-suspend</code></p>
<p>Now, we have to make the <code>lockscreen</code> file executable. In Terminal,&nbsp;type:</p>
<p class="code"><code>chmod 754&nbsp;~/bin/lockscreen</code></p>
<h3>Set up a Quicksilver&nbsp;trigger</h3>
<p>The built-in keyboard shortcut system in <span class="caps">OS</span> X can&#8217;t easily trigger a command-line script like our <code>lockscreen</code> script. We&#8217;ll set up a trigger in Quicksilver to accomplish the same&nbsp;effect.</p>
<p>In Quicksilver, go to the Catalog and add a your lockscreen&nbsp;script.</p>
<p>Next, go the Triggers section in Quicksilver. Add a new HotKey under the Custom Triggers section.  Type <code>lockscreen</code> under &#8216;Select an item&#8217; and click Save (it should automatically find this from the catalog). Then click on the Trigger column to set the keyboard shortcut.  I went with Ctrl+Option+Command+L, but choose whichever combination you&nbsp;like.</p>
<p>That&#8217;s it—close the Quicksilver window and try out your new keyboard&nbsp;shortcut!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.houseofding.com/2009/01/screen-lock-keyboard-shortcut-for-you-mac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Managing local development websites on your Mac</title>
		<link>http://www.houseofding.com/2008/11/managing-local-development-websites-on-your-mac/</link>
		<comments>http://www.houseofding.com/2008/11/managing-local-development-websites-on-your-mac/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 04:48:38 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.houseofding.com/?p=15</guid>
		<description><![CDATA[I recently had my hard drive fail in my MacBook Pro I use for work, which, while a little painful, gave me the opportunity get a fresh, clean install of everything—especially my Apache config files.  Like a lot of developers, my Apache config files had been hacked to pieces.  This was a great time to [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had my hard drive fail in my MacBook Pro I use for work, which, while a little painful, gave me the opportunity get a fresh, clean install of everything—especially my Apache config files.  Like a lot of developers, my Apache config files had been hacked to pieces.  This was a great time to re-think how I was doing&nbsp;things.</p>
<h3>Apache according to&nbsp;Apple</h3>
<p>My previous strategy of ignoring every line Apple included in httpd.conf and trying to write my own super genius configuration was a nightmare.  My new strategy would be to follow the guidelines and files that Apple includes with the 10.5&nbsp;Apache.</p>
<h3>Configuration&nbsp;files</h3>
<p>As of 10.5, Apple arranges Apache configuration files in the following&nbsp;manner:</p>
<ul>
<li>/etc/apache2/httpd.conf - the über config&nbsp;file</li>
<li>/etc/apache2/extras/httpd-vhosts.conf - virtual&nbsp;hosts</li>
<li>/etc/apache2/users/<em>your_user_name</em>.conf - options and access control (<span class="caps">IP</span>&nbsp;exceptions)</li>
</ul>
<p>We&#8217;ll use only these files to set up an individual site for each development&nbsp;app/website.</p>
<h3>First things&nbsp;first</h3>
<p>Before you start editing files, turn on your local web server by going to <em>System Preferences</em> &gt; <em>Sharing</em> and checking the <em>Web Sharing</em>&nbsp;checkbox.</p>
<h3>Clean up&nbsp;httpd.conf</h3>
<p>Assuming you&#8217;ll want to do local Ruby on Rails (via Passenger), <span class="caps">SSL</span> (with a <a href="http://www.houseofding.com/2008/11/generate-a-self-signed-ssl-certificate-for-local-development-on-a-mac/" >self-signed certificate</a>), and <span class="caps">PHP</span> development, make the following changes to you&nbsp;/etc/apache2/httpd.conf:</p>
<p class="code">
<code>Listen 443<br />
LoadModule php5_module libexec/apache2/libphp5.so<br />
Include /private/etc/apache2/extra/httpd-vhosts.conf<br />
# Rails via Phusion Passenger (mod_rails)<br />
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so<br />
RailsSpawnServer /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/bin/passenger-spawn-server<br />
RailsRuby&nbsp;/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby</code></p>
<p>Add these lines to the end or your httpd.conf or just download this version with the changes already in&nbsp;place.</p>
<h3>Add some virtual&nbsp;hosts</h3>
<p>We&#8217;ll set up virtual hosts that respond to re-routed local <span class="caps">DNS</span> requests like acoolwebsite.local or companysite.local.  To do this, we&#8217;ll have to first add some lines to the /etc/hosts file to pick up these&nbsp;requests.</p>
<h3>/etc/hosts</h3>
<p>Add any local development websites to your /etc/hosts file and point them to the loopback <span class="caps">IP</span> address,&nbsp;127.0.0.1:</p>
<p class="code">
<code>127.0.0.1 sslwebsite.local<br />
127.0.0.1&nbsp;companywebsite.local</code>
</p>
<h3>/etc/apache2/extra/httpd-vhosts.conf</h3>
<p>Now we&#8217;ll add corresponding virtual host entries in&nbsp;/etc/apache2/extra/httpd-vhosts.conf:</p>
<p class="code">
<code>NameVirtualHost *:443<br />
&lt;VirtualHost *:443&gt;<br />
&nbsp;&nbsp;DocumentRoot /Users/your_user_name/Sites/sslwebsite<br />
&nbsp;&nbsp;ServerName sslwebsite.local<br />
&lt;/VirtualHost&gt;<br />
&lt;VirtualHost *:80&gt;<br />
&nbsp;&nbsp;DocumentRoot /Users/your_user_name/Sites/companywebsite<br />
&nbsp;&nbsp;ServerName companywebsite.local<br />&nbsp;&lt;/VirtualHost&gt;</code>
</p>
<h3>Access&nbsp;control</h3>
<p>Since you&#8217;re the only one developing on your machine, you can safely open up all Apache options and enable overrides in /etc/apache2/users/<em>your_user_name</em>.conf:</p>
<p class="code">
<code>&lt;Directory "/Users/your_user_name/Sites/"&gt;<br />
&nbsp;&nbsp;Options All<br />
&nbsp;&nbsp;AllowOverride All<br />
&nbsp;&nbsp;Order deny,allow<br />
&nbsp;&nbsp;Deny from all<br />
&nbsp;&nbsp;Allow from 127.0.0.1<br />
&nbsp;&nbsp;Allow from 72.14.207.99 # Joe's computer<br />
&nbsp;&nbsp;# Order allow,deny<br />
&nbsp;&nbsp;# Allow from all<br />&nbsp;&lt;/Directory&gt;</code>
</p>
<p>This only allows requests to be made from your own machine. You can add <span class="caps">IP</span> exceptions to allow access from coworkers&#8217; machines or for demoing purposes. I leave the last two lines commented in case I need to temporarily open a site up to the world or if I don&#8217;t know the <span class="caps">IP</span> of a demo&nbsp;machine.</p>
<h3>Restart&nbsp;Apache</h3>
<p>That&#8217;s it—restart Apache with <code>sudo apachectl restart</code> and you should be in&nbsp;business.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.houseofding.com/2008/11/managing-local-development-websites-on-your-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate a self-signed SSL certificate for local development on a Mac</title>
		<link>http://www.houseofding.com/2008/11/generate-a-self-signed-ssl-certificate-for-local-development-on-a-mac/</link>
		<comments>http://www.houseofding.com/2008/11/generate-a-self-signed-ssl-certificate-for-local-development-on-a-mac/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 06:02:12 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.houseofding.com/?p=16</guid>
		<description><![CDATA[Generate a host&#160;key First, make a home for the new SSL files—I use /etc/apache2/ssl.  Open up a terminal window, cd to the new directory and issue the following command to create a host key&#160;file. sudo ssh-keygen -f&#160;host.key Generate a certificate request&#160;file This command will create a certificate request file. A certificate request file contains information [...]]]></description>
			<content:encoded><![CDATA[<h3>Generate a host&nbsp;key</h3>
<p>First, make a home for the new <span class="caps">SSL</span> files—I use /etc/apache2/ssl.  Open up a terminal window, cd to the new directory and issue the following command to create a host key&nbsp;file.</p>
<p><code>sudo ssh-keygen -f&nbsp;host.key</code></p>
<h3>Generate a certificate request&nbsp;file</h3>
<p>This command will create a certificate request file. A certificate request file contains information about your organization that will be used in the <span class="caps">SSL</span> certificate. The command will ask you a bunch of questions; because this is for local development, nonsense will&nbsp;suffice.</p>
<p><code>sudo openssl req -new -key host.key -out&nbsp;reqeust.csr</code></p>
<h3>Create the <span class="caps">SSL</span>&nbsp;certificate</h3>
<p>Create a self-signed <span class="caps">SSL</span> certificate using the request&nbsp;file.</p>
<p><code>sudo openssl x509 -req -days 365 -in request.csr -signkey host.key -out&nbsp;server.crt</code></p>
<h3>Apache</h3>
<p>Add the following to your Apache configuration to use the new&nbsp;certificate:</p>
<p><code>SSLEngine on<br />
SSLCertificateFile /etc/apache2/ssl/server.crt<br />
SSLCertificateKeyFile&nbsp;/etc/apache2/ssl/server.key</code></p>
<p>Restart Apache with <code>sudo apachectl restart</code> and try our your new&nbsp;certificate.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.houseofding.com/2008/11/generate-a-self-signed-ssl-certificate-for-local-development-on-a-mac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fix for Mac 10.5.5 ssh, scp, sftp</title>
		<link>http://www.houseofding.com/2008/10/fix-for-mac-1055-ssh-scp-sftp/</link>
		<comments>http://www.houseofding.com/2008/10/fix-for-mac-1055-ssh-scp-sftp/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 16:56:00 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.houseofding.com/?p=13</guid>
		<description><![CDATA[The 10.5.5 update for Mac has apparently broken ssh. Until Apple fixes this, the best option seems to be to compile a patched version of OpenSSH. I&#8217;ve written this script to automate the downloading, compilation, and aliasing. This process leaves the existing ssh intact, but aliases the ssh, scp, and sftp commands to the newer [...]]]></description>
			<content:encoded><![CDATA[<p>The 10.5.5 update for Mac has apparently broken ssh.  Until Apple fixes this, the best option seems to be to compile a patched version of OpenSSH. I&#8217;ve written <a href="/fix_openssh">this script</a> to automate the downloading, compilation, and aliasing. This process leaves the existing ssh intact, but aliases the ssh, scp, and sftp commands to the newer working versions.  When Apple does release a fix, just remove the alias lines in your ~/.bash_login file to use the original&nbsp;version.</p>
<h3>Important!</h3>
<p>Please note that this script generate a <span class="caps">LOT</span> of files during the compilation. Create a temporary directory and execute this script from there. That way you easily delete the whole mess when you&#8217;re&nbsp;done.</p>
<h3>fix_openssh&nbsp;source</h3>
<pre>#!/usr/bin/env ruby -w

`curl -O ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-5.1p1.tar.gz`
`tar -zxvf openssh-5.1p1.tar.gz`
`openssh-5.1p1/configure`
`cd openssh-5.1p1 <span class="amp">&amp;</span> make`
`cd openssh-5.1p1 <span class="amp">&amp;</span> sudo make install`
`echo "#fix ssh bug in 10.5.5... temporarily change this to /opt/local/bin/ssh" &gt;&gt; ~/.bash_login`
`echo "alias ssh='/opt/local/bin/ssh'" &gt;&gt; ~/.bash_login`
`echo "alias ssh='/opt/local/bin/scp'" &gt;&gt; ~/.bash_login`
`echo "alias ssh='/opt/local/bin/sftp'" &gt;&gt; ~/.bash_login`</pre>
<p>I know—there&#8217;s really nothing Ruby about this.  I guess it could just be a shell&nbsp;script.</p>
<h3>Update&nbsp;10/10/08</h3>
<p>My machine installs files to /opt/local/bin/, but it appears that on most Macs, it&#8217;ll install your new binaries to /opt/local/bin/.  If this is that case on yours, just change the alias path in your&nbsp;~/.bash_login.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.houseofding.com/2008/10/fix-for-mac-1055-ssh-scp-sftp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
