<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Solid State Raam</title>
	
	<link>http://solidstateraam.com</link>
	<description>Explorations (and exploitations) of the digital world by one of its many netizens.</description>
	<lastBuildDate>Sun, 07 Mar 2010 13:33:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TheSolidState" /><feedburner:info uri="thesolidstate" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>TheSolidState</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Moving WordPress to a New URL and New Permalink Structure</title>
		<link>http://feedproxy.google.com/~r/TheSolidState/~3/HbFBqhA1hkY/</link>
		<comments>http://solidstateraam.com/moving-wordpress-to-a-new-url-and-new-permalink-structure/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 03:01:25 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=545</guid>
		<description><![CDATA[When I decided to change the permalink structure and move my WordPress blog from blog.raamdev.com to raamdev.com, I knew it was going to be a delicate process. I have over a thousand posts, more than three hundred of which have been indexed by Google. A huge portion of my traffic comes from Google, so my [...]]]></description>
			<content:encoded><![CDATA[<p>When I decided to change the permalink structure and move my WordPress blog from blog.raamdev.com to raamdev.com, I knew it was going to be a delicate process. I have over a thousand posts, more than three hundred of which have been indexed by Google. A huge portion of my traffic comes from Google, so my biggest concern was that the old URLs redirect to the new location.</p>
<h3>Step 1: Disable plugins</h3>
<p>It&#8217;s a good idea to disable your plugins before making these changes. At the very least, if you have a caching plugin installed (such as WP Super Cache), delete the cache and then disable that plugin.</p>
<h3>Step 2: Change the blog URL</h3>
<p>First, I had to change the WordPress blog URL from blog.raamdev.com to raamdev.com/blog/. This is simply a matter of updating the &#8220;WordPress address&#8221; and &#8220;Blog address&#8221; options from within the WordPress Administration panel (Settings -> General).</p>
<p>Second, I wanted the final URL to be raamdev.com/, instead of raamdev.com/blog/. To do this, I first changed the &#8220;Blog address&#8221; to raamdev.com/. Now to get WordPress working on the webroot (raamdev.com/), I had to move /blog/index.php to the webroot (/index.php) and then edit index.php and change this line,</p>
<pre class="brush: plain;">
require('./wp-blog-header.php');
</pre>
<p>to this,</p>
<pre class="brush: plain;">
require('./blog/wp-blog-header.php');
</pre>
<p>Now, when index.php is loaded, it knows to look for all the WordPress files in /blog/ and since WordPress has been configured to use raamdev.com/ as the &#8220;Blog address&#8221;, it will automatically handle everything else.</p>
<h3>Step 3: Redirect old URLs to the new URL</h3>
<p>The <code>blog.</code> sub-domain maps to a directory in the webroot called <code>/blog/</code>. If someone visits a link to a page that includes the sub-domain, the web server needs to tell the browser the new location. To do this, I needed to recreate the /blog/ directory and add the following to an <code>.htaccess</code> file:</p>
<pre class="brush: plain;">
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^blog\.raamdev\.com$ [NC]
RewriteRule ^(.*)$ http://raamdev.com/blog/$1 [R=301,L]
</pre>
<p>Now, if someone tries to visit http://blog.raamdev.com/2010/01/28/some-blog-post, the web server will do a 301 redirect to http://raamdev.com/blog/2010/01/28/some-blog-post.</p>
<blockquote><p><strong>What&#8217;s a 301 redirect?</strong> Well, when you move a web page from one location to another, you can specify the type of redirection. A <a href="http://en.wikipedia.org/wiki/URL_redirection#HTTP_status_codes_3xx">301 redirect</a> means the web page has been moved permanently. This is useful for keeping indexes updated. For example, if someone searches Google and finds an old link, Google will detect the 301 redirect and update its index with the new URL, thereby keeping your URL&#8217;s pagerank.</p></blockquote>
<h3>Step 4: Change Permalink structure</h3>
<p>To change the permalink structure, I used the awesome <a href="http://www.deanlee.cn/wordpress/permalinks-migration-plugin/" target="_new">Permalink Migration plugin by Dean Lee</a>. With this plugin, I just specify the old permalink structure (in my case, this was <code>/%year%/%monthnum%/%postname%/</code>) and then change the permalink structure in WordPress (Settings -> Permalinks) to the new format (I&#8217;m using <code>/%postname%/</code>). </p>
<p>Now whenever someone visits a URL using the old permalink structure, Dean&#8217;s plugin sends a 301 redirect to the new URL.</p>
<h3>Summary</h3>
<p>With the <code>.htaccess</code> rewrite rule and Dean&#8217;s Permalink Migration plugin, we now have a double 301 redirect to make sure the old URLs redirect to the new ones:</p>
<ol>
<li>Someone searches Google and finds this link to my site: http://blog.raamdev.com/2010/01/28/some-blog-post</li>
<li>The <code>.htaccess</code> rule rewrites the URL and redirects: http://raamdev.com/blog/2010/01/28/some-blog-post
</li>
<li>Dean&#8217;s Permalink Migration plugin redirects to the new permalink structure: http://raamdev.com/blog/some-blog-post</li>
</ol>
<img src="http://feeds.feedburner.com/~r/TheSolidState/~4/HbFBqhA1hkY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/moving-wordpress-to-a-new-url-and-new-permalink-structure/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://solidstateraam.com/moving-wordpress-to-a-new-url-and-new-permalink-structure/</feedburner:origLink></item>
		<item>
		<title>Mac OS X: Replicating md5sum Output Format</title>
		<link>http://feedproxy.google.com/~r/TheSolidState/~3/LB6vzQgUPCU/</link>
		<comments>http://solidstateraam.com/mac-os-x-replicating-md5sum-output-format/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 05:00:16 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=492</guid>
		<description><![CDATA[The md5sum program is used to calculate and verify 128-bit MD5 hashes. This program is installed by default in most Unix, Linux, and Unix-like operating systems including BSD. Mac OS X is a BSD variant and it also includes the md5sum program. However, the program is called md5 instead of md5sum and outputs an md5 checksum in a different format than the standard md5sum program.]]></description>
			<content:encoded><![CDATA[<p>The md5sum program is used to calculate and verify 128-bit MD5 hashes. This program is installed by default in most Unix, Linux, and Unix-like operating systems including BSD. Mac OS X is a BSD variant and it also includes the md5sum program. However, the program is called md5 instead of md5sum and outputs an MD5 checksum in a different format than the standard md5sum program.</p>
<p>Here&#8217;s what the standard md5sum output looks like:</p>
<pre class="brush: bash;">
$ md5sum test.txt
d0ea20794ab78114230ba1ab167a22c2 test.txt
</pre>
<p>Now here&#8217;s what the output of md5 on Mac OS X looks like:</p>
<pre class="brush: bash;">
$ md5 test.txt
MD5 (test.txt) = d0ea20794ab78114230ba1ab167a22c2
</pre>
<p>While this normally wouldn&#8217;t be a big deal, it can cause major issues if you&#8217;re trying to run scripts that were written for a Unix-like environment which expect the default md5sum format.</p>
<p>Thankfully, md5 has a switch that reverses the output:</p>
<pre class="brush: bash;">
$ md5 -r test.txt
d0ea20794ab78114230ba1ab167a22c2 test.txt
</pre>
<p>If you&#8217;d like to permanently change md5&#8217;s behavior to mimic that of md5sum, you have two options: </p>
<p>The first is to simply add the following alias to <code>~/.profile</code>:</p>
<pre class="brush: bash;">
alias md5sum='md5 -r'
</pre>
<p>Now when you type &#8216;<code>md5sum test.txt</code>&#8216;, the command will be replaced with &#8216;<code>md5 -r test.txt</code>&#8216;. However, this may not work with your scripts.</p>
<p>The second solution, and my preferred method, is to create a small script called <code>md5sum</code> that contains the following:</p>
<pre class="brush: bash;">
#!/bin/bash
/sbin/md5 -r &quot;$@&quot;
</pre>
<p>I then make this script executable (<code>chmod +x md5sum</code>) and put it in <code>/sbin/</code>. Now, whenever a script calls md5sum, the small bash script above is used and it produces output identical to that of md5sum on other Unix systems.</p>
<img src="http://feeds.feedburner.com/~r/TheSolidState/~4/LB6vzQgUPCU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/mac-os-x-replicating-md5sum-output-format/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://solidstateraam.com/mac-os-x-replicating-md5sum-output-format/</feedburner:origLink></item>
		<item>
		<title>PHP Session Permission Denied Errors with Sub-Domains and IE7 or IE8</title>
		<link>http://feedproxy.google.com/~r/TheSolidState/~3/Xr5eM_ISveY/</link>
		<comments>http://solidstateraam.com/php-session-permission-denied-errors-with-sub-domains-and-ie7-or-ie8/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 13:23:42 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Weird]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=493</guid>
		<description><![CDATA[I encountered a strange problem with IE7 and IE8 where if I visited example.com first and then visited sub-domain.example.com, Apache would return Permission Denied errors errors when trying to access the PHP session files for sub-domain.example.com. After some investigation, it appears this is a problem with the way IE7 and IE8 request session data from Apache, or possibly because IE7 and IE8 have a non-standard way of announcing the domain they're requesting session data for.]]></description>
			<content:encoded><![CDATA[<p>I encountered a strange problem with IE7 and IE8 where if I visited example.com first and then visited sub-domain.example.com, Apache would return Permission Denied errors errors when trying to access the PHP session files for sub-domain.example.com.</p>
<p>After some investigation, it appears this is a problem with the way IE7 and IE8 request session data from Apache, or possibly because IE7 and IE8 have a non-standard way of announcing the domain they&#8217;re requesting session data for.</p>
<p>Here&#8217;s my scenario:</p>
<p>I&#8217;m running Apache 1.3 with two domains, each has their own account with their own users:</p>
<pre class="brush: plain;">
    Domain: mycompany.com
    Session path: /tmp/
    Webserver user: mycompanycom

    Domain: support.mycompany.com
    Session path: /tmp/
    Webserver user: nobody
</pre>
<p>Here is what happens during a normal visit with Firefox/Safari/Chrome:</p>
<ol>
<li>I visit mycompany.com and session file is created in <code>/tmp/</code> owned by the user <code>mycompanycom</code></li>
<li>I then visit support.mycompany.com, and second session file is created in <code>/tmp/</code> owned by user <code>nobody</code></li>
<li>Apache doesn&#8217;t get confused and the correct session files are returned</li>
</ol>
<p>However, here&#8217;s what happens during a visit with IE7 and IE8:</p>
<ol>
<li>I visit mycompany.com and a session file is created in <code>/tmp/</code> owned by the user <code>mycompanycom</code></li>
<li>I then visit support.mycompany.com and, instead of creating second session file in <code>/tmp/</code> owned by the user <code>nobody</code> as you would expect (and as happens when using Firefox/Safari/Chrome), Apache tries to return the session file for mycompany.com. </li>
<li>The session file for mycompany.com is owned by the user <code>mycompanycom</code>, so the web server, running as user <code>nobody</code> cannot access it. Permission is denied.</li>
</ol>
<p>I searched Google for a solution and came across <a href="http://stackoverflow.com/questions/912098/permissions-to-php-session-files/">this question on StackOverflow</a>. Several users suggested creating a separate directory in <code>/tmp/</code> to separate the stored session data for support.mycompany.com from the session data for mycompany.com and then telling PHP to store all session data for support.mycompany.com in the new directory. This worked perfectly!</p>
<p>Here&#8217;s what I did. First, create the new session directory (Note: Make sure the new directory resides inside <code>/tmp/</code>!):</p>
<pre class="brush: bash;">
    mkdir /tmp/support.mycompany.com
    chown nobody:nobody /tmp/support.mycompany.com
</pre>
<p>I then added the following to an <code>.htaccess</code> file in the root web directory for support.mycompany.com:</p>
<pre class="brush: bash;">
    php_value session.save_path '/tmp/support.mycompany.com'
</pre>
<p>And finally, I removed all existing session data in <code>/tmp/</code> to ensure the new session path would get used immediately:</p>
<pre class="brush: bash;">
    rm -f /tmp/sess_*
</pre>
<p>And that&#8217;s it! Now IE7 and IE8 work properly because when visiting support.mycompany.com, IE7 and IE8 do not accidentally find session data for mycompany.com and try to use it.</p>
<p>I&#8217;m fairly certain this problem has to do with how IE7 and IE8 request session data from Apache. They probably first request session data for mycompany.com and THEN request session data for support.mycompany.com, even though the latter was the only doman entered in the address bar.</p>
<img src="http://feeds.feedburner.com/~r/TheSolidState/~4/Xr5eM_ISveY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/php-session-permission-denied-errors-with-sub-domains-and-ie7-or-ie8/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://solidstateraam.com/php-session-permission-denied-errors-with-sub-domains-and-ie7-or-ie8/</feedburner:origLink></item>
		<item>
		<title>Removing the GMail “On Behalf Of” Sender Header</title>
		<link>http://feedproxy.google.com/~r/TheSolidState/~3/0pjEmxL8WlM/</link>
		<comments>http://solidstateraam.com/removing-the-gmail-on-behalf-of-sender-header/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 05:00:40 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[GMail]]></category>
		<category><![CDATA[HOWTO]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=458</guid>
		<description><![CDATA[Like many of you, I have several email accounts. While using GMail as my primary email client would be nice, one of the things that has kept me from doing so is the annoying "On Behalf Of" that the GMail SMTP servers add to outgoing email. Some of the accounts are work related and the "On Behalf Of" comes across as unprofessional (at least to me). GMail now offers the ability to specify an alternate SMTP server, however, which enables you to use GMail as your primary client without announcing it to the world.]]></description>
			<content:encoded><![CDATA[<p>Like many of you, I have several email accounts and while using GMail as my primary email client would be nice, one of the things that has kept me from doing so is the annoying &#8220;On Behalf Of&#8221; that the GMail SMTP servers add to outgoing email. Some of the accounts are work related and the &#8220;On Behalf Of&#8221; comes across to me as unprofessional.</p>
<p><img src="http://solidstateraam.com/wp-content/uploads/2009/12/gmail-on-behalf-of.png" alt="GMail On Behalf Of" /></p>
<p>That &#8220;On Behalf Of&#8221; part is caused by the <code>Sender:</code> header that GMail&#8217;s SMTP servers add:</p>
<pre class="brush: bash;">
Sender: my.personal@gmail.com
Date: Sun, 13 Dec 2009 10:33:18 -0500
Subject: Re: Project Details
From: raam.dev@mydomain.com
To: important-client@domain.com
</pre>
<p>Having your personal GMail address show up looks totally unprofessional and prevents you from being able to keep your personal email, uh, well, personal. Unfortunately, Google has already said it&#8217;s part of their SMTP server specs, so they won&#8217;t change it.</p>
<p>For a long time, your only option was to use a desktop email client like Outlook or Thunderbird to send email using your own domain&#8217;s SMTP server. However, this meant accessing your GMail account using IMAP/POP and basically defeated the purpose of the web client (unless you didn&#8217;t mind switching between the web and desktop client).</p>
<p>When Google offered GMail for Domains (now called <a href="http://www.google.com/apps/intl/en/group/index.html">Google Apps for Domains</a>), I eagerly set up a free account using one of my domains and tested to see if email sent still included the Sender header. Sadly it did and I abandoned the idea of using GMail as my primary email client.</p>
<p>A few days ago I accidentally discovered that now both the standard GMail and Google Apps for Domains have the ability to specify your own SMTP server when you add an external email address to your GMail account. (<a href="http://gmailblog.blogspot.com/2009/07/send-mail-from-another-address-without.html">Here&#8217;s the announcement from a few months ago on Google&#8217;s Blog.</a>) This means you can receive email from you@yourdomain.com and also reply to emails from within GMail as you@yourdomain.com and the receiver won&#8217;t know that you&#8217;re using GMail!</p>
<p>Here&#8217;s how to get this set up:</p>
<p>Login to GMail and click <strong>Settings</strong> at the top right. Then click the <strong>Accounts and Import</strong> tab:</p>
<p><img src="http://solidstateraam.com/wp-content/uploads/2009/12/gmail-settings-accounts-and-import.png" alt="GMail Settings - Accounts and Import" /></p>
<p>Now make sure the &#8220;<strong>Reply from the same address the message was sent to</strong>&#8221; is selected and click &#8220;<strong>Send mail from another address</strong>&#8221; to add your external email account.</p>
<p><img src="http://solidstateraam.com/wp-content/uploads/2009/12/gmail-send-mail-from-another-address.png" alt="GMail - Send mail from another address" /></p>
<p>Fill in the name you want to show up when you send email from this account. This will probably be your name, but it might also be something like &#8220;Company Support&#8221; or &#8220;Sales&#8221;. Now enter your full external email address in the second box and then click <strong>Next Step</strong>.</p>
<p><img src="http://solidstateraam.com/wp-content/uploads/2009/12/gmail-add-another-address-step1.png" alt="GMail - Add another address - Step 1" /></p>
<p>On the next screen, select the second option box, &#8220;<strong>Send through <your domain>  SMTP servers</strong>&#8221; and fill in the SMTP Server, Username, and Password fields. When you click <strong>Add Account</strong>, Google will try connecting to the SMTP server using the credentials you supplied. If it successfully connects, you&#8217;ll be brought back to the <strong>Accounts and Import</strong> tab with your new account added. Otherwise, Google will display the error it had when trying to verify the SMTP connection details.</p>
<p><img src="http://solidstateraam.com/wp-content/uploads/2009/12/gmail-add-another-address-step2.png" alt="GMail - Add another address - Step 2" /></p>
<p>Now you should see the new account listed on the <strong>Accounts and Import</strong> tab, along with a note at the bottom showing that email will be sent using the SMTP server you specified:</p>
<p><img src="http://solidstateraam.com/wp-content/uploads/2009/12/gmail-raam.dev-at-mydomain-dot-com.png" alt="GMail - New account listed on Accounts and Import tab" /></p>
<p>Now, you can send and receive email using this external account and the receiver won&#8217;t see that annoying &#8220;On Behalf Of&#8221; message! Your GMail address won&#8217;t even be visible in the email headers if they choose to view the email source (they&#8217;ll see that the email was routed through a Google server, but Google is well known enough that they probably won&#8217;t care).</p>
<img src="http://feeds.feedburner.com/~r/TheSolidState/~4/0pjEmxL8WlM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/removing-the-gmail-on-behalf-of-sender-header/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://solidstateraam.com/removing-the-gmail-on-behalf-of-sender-header/</feedburner:origLink></item>
		<item>
		<title>Mac OS X: Fixing ‘Always Open With’</title>
		<link>http://feedproxy.google.com/~r/TheSolidState/~3/VQW2jBiQmpo/</link>
		<comments>http://solidstateraam.com/mac-os-x-fixing-always-open-with/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 14:21:11 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=432</guid>
		<description><![CDATA[After installing the <a href="http://macromates.com/" target="_new">TextMate</a> editor I wanted all shell scripts (files ending with the <code>.sh</code> extension) to open in TextMate. Unfortunately, selecting <strong>Open With -> Other...</strong> from the context menu, choosing an application, and then clicking the <strong>Always Open With</strong> checkbox doesn't change the default application for <em>all</em> files with that extension, but rather only changes that specific file.]]></description>
			<content:encoded><![CDATA[<p>After installing the <a href="http://macromates.com/" target="_new">TextMate</a> editor I wanted all shell scripts (files ending with the <code>.sh</code> extension) to open in TextMate. Unfortunately, selecting <strong>Open With -> Other&#8230;</strong> from the context menu, choosing an application, and then clicking the <strong>Always Open With</strong> checkbox doesn&#8217;t change the default application for <em>all</em> files with that extension, but rather only changes that specific file.</p>
<p>If you want to change the default application used to open all files with a specific extension, the steps are slightly different:</p>
<p>Select the file and choose <strong>File -> Get Info</strong> (or <strong>Cmd+i</strong>) and expand the Open With section:</p>
<p><img src="http://solidstateraam.com/wp-content/uploads/2009/12/2009-12-12-always-open-with.png" alt="Get Info" /></p>
<p>From here, select the application you want to use for opening those file types and then click <strong>Change All</strong>. This will update the OS X Launch Services Database, which is consulted when opening files. Now all files with that extension will be opened with the application you selected.</p>
<img src="http://feeds.feedburner.com/~r/TheSolidState/~4/VQW2jBiQmpo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/mac-os-x-fixing-always-open-with/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://solidstateraam.com/mac-os-x-fixing-always-open-with/</feedburner:origLink></item>
		<item>
		<title>Preparing a Mac for Resale with OS X Leopard</title>
		<link>http://feedproxy.google.com/~r/TheSolidState/~3/BvUFqXkr7is/</link>
		<comments>http://solidstateraam.com/preparing-a-mac-for-resale-with-os-x-leopard/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 19:55:52 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[OS X Leopard]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=404</guid>
		<description><![CDATA[When reselling a Mac, it's nice to give the new owner an experience similar to buying a new Mac. This means reinstalling a clean copy of OS X and, if you're super nice, installing the latest software updates and additional software. Finally, the Setup Assistant needs to be reset so that it runs when the new owner turns on the computer.]]></description>
			<content:encoded><![CDATA[<p>When reselling a Mac, it&#8217;s nice to give the new owner an experience similar to buying a new Mac. This means reinstalling a clean copy of OS X and, if you&#8217;re super nice, installing the latest software updates and additional software. Finally, the Setup Assistant needs to be reset so that it runs when the new owner turns on the computer.</p>
<p><em>Note: The steps below were used to prepare a MacBook Pro running OS X Leopard for resale. Although the steps are similar for other versions of OS X, I have only tested them with Leopard.</em></p>
<h3>Backup Your Data</h3>
<p>If the Mac you&#8217;re reselling is your own, you should do a full system backup before proceeding. </p>
<p>My favorite method for doing this is to use an external USB hard drive and <a href="http://www.bombich.com/">Carbon Copy Cloner</a> (free). Carbon Copy Cloner can be used to take a snapshot of your entire drive and make it bootable. This means you can actually boot from your backup drive, given you&#8217;re booting from identical hardware. At the very least, you&#8217;ll have an identical copy of everything on the computer. </p>
<p>You can also use Time Machine to backup your data. I don&#8217;t use Time Machine, so I cannot recommend it. </p>
<p>The bottom line is, you want to backup anything important on the Mac you&#8217;re reselling because the next steps will erase everything.</p>
<h3>Reinstall Mac OS X Leopard</h3>
<ol>
<li>Insert Mac OS X Leopard Install Disc</li>
<li>Restart the computer</li>
<li>Hold down the Option key while the computer is restarting. The system will then prompt you to select a startup disk. Choose the Mac OS X Leopard Install Disc.</li>
<li>On the &#8220;Select a Destination&#8221; screen, click &#8220;Options&#8221; and choose &#8220;Erase and Install&#8221;. This will ensure a clean installation of Mac OS X Leopard.</li>
<li>Follow the remaining steps to install Mac OS X; they are all self explanatory.</li>
<li>When the installation finishes, the Mac will reboot and you&#8217;ll be presented with the Setup Assistant.</li>
</ol>
<p>If you&#8217;re not interested in installing the software updates or any additional software, press Command+Q to quit the Setup Assistant and choose Shutdown. The next time you turn on the machine, the Setup Assistant will launch again.</p>
<h3>Install Software Updates &#038; Additional Software</h3>
<p>If you want to be super nice to the new owner of your Mac, you&#8217;ll need to complete the Setup Assistant and create a temporary user. We will use that user to download and install the software updates as well as install any additional applications (Firefox, MS Office, etc.). Once we&#8217;re done updating the system and installing software, we&#8217;ll delete the temporary user and reset the Setup Assistant.</p>
<ol>
<li>Complete the Setup Assistant and create the first user account (we&#8217;ll delete this user and reset the Setup Assistant later, so it doesn&#8217;t matter what you use). Make note of the shortname for the user you create as we&#8217;ll need that in the next section (e.g., user &#8220;Raam Dev&#8221; will probably have a shortname of &#8220;raamdev&#8221;).
</li>
<li>At this point, you should be logged into the newly reinstalled system using the temporary account you created.</li>
<li>Connect to the Internet (using a wired or wireless connection)</li>
<li>Run Software Update (Apple Icon -> Software Update) and install any available updates. This may take awhile!</li>
<li>After the system reboots, run Software Update again. There will most likely be more updates to install. Repeat this process until there are no more updates to install.</li>
<li>Install any additional applications, being sure to install for &#8220;All Users&#8221; if prompted. Also, make sure the new applications are installed in <code>/Applications/</code> and not <code>~/Applications/</code></li>
</ol>
<h3>Clean Up and Reset the Setup Assistant</h3>
<p>Now that we&#8217;ve installed the latest updates and installed any additional software, we need to clean things up. First, we&#8217;ll delete the temporary user we created and then we&#8217;ll reset the Setup Assistant to ensure it launches the next time we boot up.</p>
<p>First, you&#8217;ll need to start the Mac in Single User mode by restarting and holding down Command+S. This mode does not have a graphical user interface (GUI) and is entirely command-based.</p>
<p>Once you&#8217;re in Single User mode, run the following commands and press Enter at the end of each line. (Note: The <code>$</code> represents the command prompt; you don&#8217;t actually type the <code>$</code>.)</p>
<p>By default, the hard drive is mounted as read-only in Single User mode. Before we continue, we need to make the disk writable:</p>
<pre class="brush: bash;">
$ mount -uw /
</pre>
<p>Next, we clean up that temporary user we created. Replace <code>USERNAME</code> with the shortname of the user you created in the previous section.</p>
<pre class="brush: bash;">
$ rm -R /Library/Preferences/
$ rm -R /Users/USERNAME/
$ /bin/launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist &amp;
$ dscl . -delete /Users/USERNAME
</pre>
<p>And lastly, we need to reset the Setup Assistant so it runs the next time we start the Mac:</p>
<pre class="brush: bash;">
$ rm /var/db/.AppleSetupDone
</pre>
<p>Now that everything is cleaned up and the Setup Assistant has been reset, we can shutdown the system and ship or deliver the Mac to its new owner!</p>
<pre class="brush: bash;">
$ shutdown -h now
</pre>
<p>If you want to boot the Mac to make sure it looks the way it should when the user gets it (i.e., the intro video and Setup Assistant start), just make sure you press Command+Q  and choose Shutdown. </p>
<img src="http://feeds.feedburner.com/~r/TheSolidState/~4/BvUFqXkr7is" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/preparing-a-mac-for-resale-with-os-x-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://solidstateraam.com/preparing-a-mac-for-resale-with-os-x-leopard/</feedburner:origLink></item>
		<item>
		<title>Unix/Linux: Finding and Killing Processes by User</title>
		<link>http://feedproxy.google.com/~r/TheSolidState/~3/YWOR_udRigE/</link>
		<comments>http://solidstateraam.com/unixlinux-finding-and-killing-processes-by-user/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 05:00:34 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=385</guid>
		<description><![CDATA[If you've ever run <code>ps aux &#124; grep user</code> to list processes and hunt for process IDs, you'll be happy to know there is a simpler alternative. Both finding and killing processes owned by a particular user is made simple using the handy <code>pgrep</code> and <code>pkill</code> utilities. ]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever run <code>ps aux | grep user</code> to list processes and hunt for process IDs, you&#8217;ll be happy to know there is a simpler alternative. Both finding and killing processes owned by a particular user is made simple using the handy <code>pgrep</code> and <code>pkill</code> utilities. </p>
<p><strong>Listing Processes with pgrep</strong></p>
<p>Listing all the processes owned by the user <code>raam</code> can be done like this (the <code>-l</code> switch causes the output to include the process name):</p>
<pre class="brush: bash;">
$ pgrep -l -u raam
9614 screen
9628 bash
9644 irssi
16165 bash
16297 rtorrent
19462 ssh
19515 bash
19526 ssh
20964 sshd
</pre>
<p>You can also filter the list of results by appending a full (or partial) process name to the command:</p>
<pre class="brush: bash;">
$ pgrep -l -u raam bash
9628 bash
16165 bash
19515 bash
</pre>
<p><strong>Killing Processes with pkill</strong></p>
<p>The <code>pkill</code> command does basically the same thing as <code>pgrep</code>, except it kills the processes instead of listing them. This is useful if you have a user with several dead processes, or if you were deleting a user and you wanted to kill any running processes first.</p>
<p>Killing all the processes owned by the user <code>raam</code> looks like this:</p>
<pre class="brush: bash;">
$ pkill -u raam
</pre>
<p>And once again, if you only wanted to kill all the bash processes owned by <code>raam</code>, you would append the process name to the command:</p>
<pre class="brush: bash;">
$ pkill -u raam bash
</pre>
<p>As always, check the man pages for <code>pgrep</code> and <code>pkill</code> for more information and switch options.</p>
<img src="http://feeds.feedburner.com/~r/TheSolidState/~4/YWOR_udRigE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/unixlinux-finding-and-killing-processes-by-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://solidstateraam.com/unixlinux-finding-and-killing-processes-by-user/</feedburner:origLink></item>
		<item>
		<title>Mac OS X: Resizing Oversized Windows to Fit the Screen</title>
		<link>http://feedproxy.google.com/~r/TheSolidState/~3/gopJpTmFwP0/</link>
		<comments>http://solidstateraam.com/mac-os-x-resizing-oversized-windows-to-fit-the-screen/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 16:41:14 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=359</guid>
		<description><![CDATA[I recently switched from a 15″ MacBook Pro (2007 model) to the latest 13″ MacBook Pro (2009, unibody model). After transferring my iTunes library to the new laptop, I found that the size of the iTunes window exceeded the size of the screen (the 15” MBP had a 1440×900, while the 13” MBP has a slightly smaller 1280×800). This meant I was unable to grab the bottom right corner of the window to resize it.]]></description>
			<content:encoded><![CDATA[<p>I recently switched from a 15&#8243; MacBook Pro (2007 model) to the latest 13&#8243; MacBook Pro (2009, unibody model). After transferring my iTunes library to the new laptop, I found that the size of the iTunes window exceeded the size of the screen (the 15” MBP had a 1440&#215;900, while the 13” MBP has a slightly smaller 1280&#215;800). This meant I was unable to grab the bottom right corner of the window to resize it:</p>
<p><a href="http://solidstateraam.com/wp-content/uploads/2009/11/itunes_too_maximized.png"><img src="http://solidstateraam.com/wp-content/uploads/2009/11/itunes_too_maximized.png" alt="iTunes too large to resize!" width="550"/></a></p>
<p>Unfortunately, the maximize button in iTunes only cycles through Previous Size and the Mini Player mode; at no point does it actually maximize the window to fit the screen!</p>
<p><strong>Note: As Ondrej commented below, you might be able to fix this by simply holding down the Alt/Option key and pressing the zoom/maximize button (the green button).</strong></p>
<p>I tried installing an application called <a href=”http://www.macupdate.com/info.php/id/30591”>RightZoom</a> which changes the behavior of the maximize button in OS X by maximizing the window to fill the screen (as opposed to simply maximizing for “best fit”). However, that did nothing to change the behavior of iTunes.</p>
<p>After searching the web for solutions and finding nothing, I remembered a trick I had used in the past on Windows computers: <strong>Change the display resolution to something smaller, thereby forcing the operating system to resize windows to fit the new resolution.</strong> Then, after the OS resizes the windows, change the resolution back to the original. Of course this only works if the original resolution is not already set for the lowest one (it most likely isn&#8217;t).</p>
<p>To my relief, this trick worked perfectly! When I switched to a smaller resolution, the iTunes window was resized to fit the smaller screen.</p>
<p>For your reference, here are the steps:</p>
<ol>
<li>Launch System Preferences -> Displays</li>
<li>Select a smaller resolution</li>
<li>iTunes (or any other application) will be resized to fit the smaller resolution</li>
<li>Change the resolution back to the default</li>
<li>Oversized window problems solved!</li>
</ol>
<img src="http://feeds.feedburner.com/~r/TheSolidState/~4/gopJpTmFwP0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/mac-os-x-resizing-oversized-windows-to-fit-the-screen/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://solidstateraam.com/mac-os-x-resizing-oversized-windows-to-fit-the-screen/</feedburner:origLink></item>
		<item>
		<title>MAC Address Validation Regex with egrep</title>
		<link>http://feedproxy.google.com/~r/TheSolidState/~3/PMKIe_VsV7s/</link>
		<comments>http://solidstateraam.com/mac-address-validation-regex-with-egrep/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 00:45:08 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Regex]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Validation]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=334</guid>
		<description><![CDATA[I needed an easy way to validate a MAC address in a bash script that generated a unique hostname based on the MAC address of the system. Read about how I solved the problem using a regular expression and egrep.]]></description>
			<content:encoded><![CDATA[<p>I needed an easy way to validate a MAC address in a bash script that generated a unique hostname based on the MAC address of the system. This gem did the trick:</p>
<pre class="brush: bash;">
echo &quot;00:11:24:3e:a5:78&quot; | egrep &quot;^([0-9a-fA-F]{2}\:){5}[0-9a-fA-F]{2}$&quot;
</pre>
<p>In the event that there was a problem getting the MAC address (e.g., faulty NIC or unstable device driver), I generate a random hostname instead of basing the hostname generation on the MAC. Here&#8217;s how I validated the MAC in the script:</p>
<pre class="brush: bash;">
if [ `echo $ACTIVE_INTERFACE_MAC | egrep &quot;^([0-9a-fA-F]{2}\:){5}[0-9a-fA-F]{2}$&quot;` ]; then
	# generate unique hostname based on MAC
else
	# generate random-character hostname
fi
</pre>
<img src="http://feeds.feedburner.com/~r/TheSolidState/~4/PMKIe_VsV7s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/mac-address-validation-regex-with-egrep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://solidstateraam.com/mac-address-validation-regex-with-egrep/</feedburner:origLink></item>
		<item>
		<title>A Script to Install &amp; Configure ifplugd on Debian</title>
		<link>http://feedproxy.google.com/~r/TheSolidState/~3/FsnR-d4udvo/</link>
		<comments>http://solidstateraam.com/a-script-to-install-configure-ifplugd-on-debian/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 05:00:56 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=148</guid>
		<description><![CDATA[The default configuration on some older Linux systems is to only send a DHCP request while booting up. This means if the network cable gets unplugged, or if the router is powered off, the system may lose its IP configuration. To restore the network connection, the system may need to be manually rebooted or have [...]]]></description>
			<content:encoded><![CDATA[<p>The default configuration on some older Linux systems is to only send a DHCP request while booting up. This means if the network cable gets unplugged, or if the router is powered off, the system may lose its IP configuration. To restore the network connection, the system may need to be manually rebooted or have someone at the local console run the <code>dhclient</code> command to request a DHCP lease. </p>
<p>For systems that are only accessed remotely via SSH, such a scenario can be painful. What is needed is a daemon that watches the link status of the Ethernet jack and reconfigures the network (or sends out another DHCP request) when it detects a cable is plugged in (or the power to the router is restored).</p>
<p><a href="http://0pointer.de/lennart/projects/ifplugd/#overview">ifplugd</a> does exactly that:</p>
<blockquote><p>ifplugd is a Linux daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled.</p></blockquote>
<p>On a Debian system, installing and configuring ifplugd is relatively simple using <code>apt-get install ifplugd</code>. Once its been installed, it needs to be configured by editing <code>/etc/default/ifplugd</code>. The most basic configuration is to simply set <code>INTERFACES="auto"</code> and <code>HOTPLUG_INTERFACES="all"</code>. This configuration tells ifplugd to watch all network interfaces for a new link status and automatically reconfigure them using the Debian network configuration defined in <code>/etc/network/interfaces</code>.</p>
<p>I recently needed to automate the install and configuration of ifplugd on many remote Linux systems, so I wrote this simple script.  </p>
<p>Download: <a href="http://solidstateraam.com/wp-content/uploads/2009/06/install-ifplugd.tar.gz">install-ifplugd.tar.gz</a></p>
<pre class="brush: bash;">
#!/bin/sh

#########################################
# Author: Raam Dev
#
# This script installs ifplugd and configures
# it to automatically attempt to restore any
# lost connections.
#
# Must be run as root!
#########################################

# Check if we're running this as root
if [ $EUID -ne 0 ]; then
   echo &quot;This script must be run as root&quot; 1&gt;&amp;2
   exit 1
fi

# Files used when configuring ifplugd
OUTFILE=/tmp/outfile.$$
CONFIG_FILE=/etc/default/ifplugd

# Update package list and install ifplugd, assuming yes to any questions asked
# (to insure the script runs without requiring manual intervention)
apt-get update --assume-yes ; apt-get install --assume-yes ifplugd

# Configure ifplugd to watch all interfaces and automatically attempt configuration
sed 's/INTERFACES=\&quot;\&quot;/INTERFACES=\&quot;auto\&quot;/g' &lt; $CONFIG_FILE &gt; $OUTFILE
mv $OUTFILE $CONFIG_FILE

sed 's/HOTPLUG_INTERFACES=\&quot;auto\&quot;/HOTPLUG_INTERFACES=\&quot;all\&quot;/g' &lt; $CONFIG_FILE &gt; $OUTFILE
mv $OUTFILE $CONFIG_FILE
</pre>
<p>If you&#8217;re interested in doing more with ifplugd, check out <a href="http://www.linux.com/archive/articles/114008">this article</a>.</p>
<img src="http://feeds.feedburner.com/~r/TheSolidState/~4/FsnR-d4udvo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/a-script-to-install-configure-ifplugd-on-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://solidstateraam.com/a-script-to-install-configure-ifplugd-on-debian/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.649 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-03-07 08:33:34 -->
