<?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>Rusty Razor Blade &#187; tips</title>
	<atom:link href="http://www.rustyrazorblade.com/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rustyrazorblade.com</link>
	<description>Tech Thoughts, Mostly on LAMP - by Jon Haddad</description>
	<lastBuildDate>Wed, 21 Jul 2010 20:42:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Running Erlang Code from the Command Line</title>
		<link>http://www.rustyrazorblade.com/2010/07/running-erlang-code-from-the-command-line/</link>
		<comments>http://www.rustyrazorblade.com/2010/07/running-erlang-code-from-the-command-line/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 18:31:31 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[erlang]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=1105</guid>
		<description><![CDATA[This was really useful for me in scripting TextEdit to run my unit tests, as Erlide has been crashing every time I use it.

erl -run mymodule myfunc -run init stop -noshell

http://www.trapexit.org/Running_Erlang_Code_From_The_Command_Line
]]></description>
			<content:encoded><![CDATA[<p>This was really useful for me in scripting TextEdit to run my unit tests, as Erlide has been crashing every time I use it.</p>
<pre>
erl -run mymodule myfunc -run init stop -noshell
</pre>
<p><a href='Running Erlang Code From the Command Line'>http://www.trapexit.org/Running_Erlang_Code_From_The_Command_Line</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2010/07/running-erlang-code-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Textmate &#8211; Stop ._ Backup Files</title>
		<link>http://www.rustyrazorblade.com/2010/02/textmate-stop-_-backup-files/</link>
		<comments>http://www.rustyrazorblade.com/2010/02/textmate-stop-_-backup-files/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 04:08:46 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[textmate]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=1001</guid>
		<description><![CDATA[Pretty sure this stops TextMate from creating the ridiculous backup files in my network shares.
defaults write com.macromates.textmate OakDocumentDisableFSMetaData 1
]]></description>
			<content:encoded><![CDATA[<p>Pretty sure this stops TextMate from creating the ridiculous backup files in my network shares.</p>
<blockquote><p>defaults write com.macromates.textmate OakDocumentDisableFSMetaData 1</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2010/02/textmate-stop-_-backup-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux/OSX: find out what network ports are in use</title>
		<link>http://www.rustyrazorblade.com/2010/01/linuxosx-find-out-what-network-ports-are-in-use/</link>
		<comments>http://www.rustyrazorblade.com/2010/01/linuxosx-find-out-what-network-ports-are-in-use/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 19:21:07 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=951</guid>
		<description><![CDATA[To get a quick idea of what ports you have open on your local box, you can use nmap.

~ jhaddad$ nmap localhost
Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-05 11:06 PST
Interesting ports on localhost (127.0.0.1):
Not shown: 499 closed ports, 492 filtered ports
PORT      STATE SERVICE
80/tcp    open  http
88/tcp [...]]]></description>
			<content:encoded><![CDATA[<p>To get a quick idea of what ports you have open on your local box, you can use nmap.</p>
<blockquote><p>
~ jhaddad$ nmap localhost<br />
Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-05 11:06 PST<br />
Interesting ports on localhost (127.0.0.1):<br />
Not shown: 499 closed ports, 492 filtered ports<br />
PORT      STATE SERVICE<br />
80/tcp    open  http<br />
88/tcp    open  kerberos-sec<br />
548/tcp   open  afp<br />
631/tcp   open  ipp<br />
3306/tcp  open  mysql<br />
3325/tcp  open  unknown<br />
5900/tcp  open  vnc<br />
9000/tcp  open  cslistener<br />
10000/tcp open  snet-sensor-mgmt
</p></blockquote>
<p>For more detailed information, try netstat:</p>
<blockquote><p>netstat -an</p></blockquote>
<p>You&#8217;ll get a breakdown of every socket open on your machine &#8211; useful for figuring out who&#8217;s connected and from where.</p>
<p>The OSX version of netstat lacks a few options &#8211; such as the useful &#8216;-p&#8217; option to display the process id (PID) &#8211; which can be useful combined with kill to get rid of unwanted connections &#8211; for instance,an SSH tunnel accidentally left open.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2010/01/linuxosx-find-out-what-network-ports-are-in-use/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MacBook Air Battery Drain While Sleeping</title>
		<link>http://www.rustyrazorblade.com/2009/12/macbook-air-battery-drain-while-sleeping/</link>
		<comments>http://www.rustyrazorblade.com/2009/12/macbook-air-battery-drain-while-sleeping/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 19:54:53 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=948</guid>
		<description><![CDATA[I bought a MacBook Air in June this year, refurbished.  I didn&#8217;t really use it a lot for day to day work, and when I didn&#8217;t use it I was charging it.  It was very convenient &#8211; it weighs practically nothing and has almost no impact on me while traveling.  When I [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.rustyrazorblade.com/wp-content/uploads/2009/12/CCF3038A-5A01-412B-B13C-7F24B836F6DC.jpg" alt="CCF3038A-5A01-412B-B13C-7F24B836F6DC.jpg" border="0" width="127" height="95" align="right" />I bought a MacBook Air in June this year, refurbished.  I didn&#8217;t really use it a lot for day to day work, and when I didn&#8217;t use it I was charging it.  It was very convenient &#8211; it weighs practically nothing and has almost no impact on me while traveling.  When I cut back on using it, I noticed a few things.</p>
<ol>
<li>When I&#8217;d leave it unplugged for a few days, the battery would be dead.  After a bit of testing I noticed I was losing roughly 25% of my battery life overnight if it wasn&#8217;t unplugged.
</li>
<li>It started creaking when I&#8217;d open it.  I was genuinely concerned it would just fall apart when I was trying to open it.</li>
</ol>
<p>Obviously both of these things suck, so after a bit I brought it to the Apple store.  They pretty much replaced everything in it &#8211; battery, logic board, screen bezel, hinges, and gave it back to me.  So problem #2 was solved, but for some reason I kept seeing the battery issue.</p>
<p>I brought it back Monday of this week.  The guy there (Ryan) explained to me that since I wasn&#8217;t up to date w/ my software, the tech guys would basically just give it back and refuse to work on it.  He suggested resetting the PRAM and calibrating the battery.  He also didn&#8217;t seem to think that losing 25% battery overnight was weird, even though I&#8217;ve owned 2 MacBook Pros and 2 iBooks that never had this issue &#8211; I could leave my MacBook Pro unplugged for days and it would only lose a few %.  </p>
<p>I did these things, but it didn&#8217;t make a difference.  It was only after a ton of looking around that someone suggested turning off bluetooth.</p>
<p>After turning off bluetooth, I let the laptop sit overnight in sleep.  I checked it the next morning, and it was only down 4% from the night before.  Huge improvement.  I think I could have accomplished the same thing if I turned off the &#8220;Allow Bluetooth devices to wake this computer&#8221; setting, but since I&#8217;m not using it, I&#8217;d rather just disable it.</p>
<p>Anyway, if anyone knows anything else about this issue, I&#8217;m interested to find out more.  I like the Air as a &#8220;sit on the couch and browse the web&#8221; laptop, hate it for doing any sort of IDE development.  Also not great for playing Scrabble on Facebook &#8211; it can&#8217;t hold the entire board on the screen.  Lame.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2009/12/macbook-air-battery-drain-while-sleeping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interesting Programmer Links</title>
		<link>http://www.rustyrazorblade.com/2009/04/interesting-programmer-links/</link>
		<comments>http://www.rustyrazorblade.com/2009/04/interesting-programmer-links/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 19:47:08 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=606</guid>
		<description><![CDATA[
Peeping into memcached.
Really interesting read about how to examine what&#8217;s stored in memcached.  
Peep uses ptrace to freeze a running memcached server, dump the internal key metadata, and return the server to a running state. If you have a good host ejection mechanism in your client, such as in the Twitter libmemcached builds, you [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://blog.evanweaver.com/articles/2009/04/20/peeping-into-memcached/">Peeping into memcached</a>.</li>
<p>Really interesting read about how to examine what&#8217;s stored in memcached.  </p>
<blockquote><p>Peep uses ptrace to freeze a running memcached server, dump the internal key metadata, and return the server to a running state. If you have a good host ejection mechanism in your client, such as in the Twitter libmemcached builds, you won&#8217;t even have to change the production server pool. The instance is not restarted, and no data is lost.</p></blockquote>
<li><a href="http://dev.mysql.com/tech-resources/articles/mysql-54.html">Quick look at MySQL 5.4</a>
</li>
<p>Highlights include scalability improvements, subquery optimizations and join improvements, improved stored procedure management, out parameters in prepared statements, and new information schema additions.</p>
<li><a href="http://www.easyvmx.com/new-easyvmx.shtml">EasyVMX</a></li>
<p>EasyVMX lets you create empty VMWare images.  Very useful when coupled with the <a href="http://www.vmware.com/products/player/">VMWare player</a>.</p>
<li><a href="http://www.atlassian.com/starter/?s_kwcid=HM_Starter">For the next 5 days you can get Jira 5 user license for $5.</a></li>
<p>I used Jira about 3 years ago at Infosearch Media, which I don&#8217;t think exists any more.  Anyway, it trounced bugzilla then and still does.  </p>
<li><a href="http://geektips.patg.net/?p=24">A cool rundown on what you can do with the information schema in MySQL.  </a></li>
<p>I like this post, it makes a few really cool points.  It explains how to get a list of all tables and their engine and how to get a list of foreign keys in your schema.  Very cool.</p>
<li><a href="http://q4m.31tools.com/">Q4M</a>, a Queue storage engine</li>
<p>Q4M looks like a pretty cool storage engine that aims to address twitter-like features.  I&#8217;ll be trying this out for myself in the near future.</p>
<blockquote><p>Q4M (Queue for MySQL) is a message queue licensed under GPL that works as a pluggable storage engine of MySQL 5.1, designed to be robust, fast, flexible. It is already in production quality, and is used by several web services (see Users of Q4M).</p></blockquote>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2009/04/interesting-programmer-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling libjpeg on 64 bit Centos</title>
		<link>http://www.rustyrazorblade.com/2008/07/compiling-libjpeg-on-64-bit-centos/</link>
		<comments>http://www.rustyrazorblade.com/2008/07/compiling-libjpeg-on-64-bit-centos/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 22:14:55 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=136</guid>
		<description><![CDATA[I ran into an issue just now compiling libjpeg on 64 bit CentOS.  I found this very helpful post that gives a workaround using a config.guess file from libtool.  For some reason, I didn&#8217;t have the folder he suggested, but I did have the alternative (automake).
cp /usr/share/automake-1.9/config.guess .
cp /usr/share/automake-1.9/config.sub .

I copied the above [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into an issue just now compiling libjpeg on 64 bit CentOS.  I found <a href="http://www.noah.org/wiki/Jpegsrc_64">this very helpful post</a> that gives a workaround using a config.guess file from libtool.  For some reason, I didn&#8217;t have the folder he suggested, but I did have the alternative (automake).</p>
<blockquote><p>cp /usr/share/automake-1.9/config.guess .<br />
cp /usr/share/automake-1.9/config.sub .
</p></blockquote>
<p>I copied the above files into my jpeg-6b directory, and</p>
<blockquote><p>./configure &#8211;enable-shared &#8211;enable-static</p></blockquote>
<p>worked correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/07/compiling-libjpeg-on-64-bit-centos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Report space remaining on disk on unix login</title>
		<link>http://www.rustyrazorblade.com/2008/03/report-space-remaining-on-disk-on-unix-login/</link>
		<comments>http://www.rustyrazorblade.com/2008/03/report-space-remaining-on-disk-on-unix-login/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 20:04:02 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[awk]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/2008/03/23/report-space-remaining-on-disk-on-unix-login/</guid>
		<description><![CDATA[I get a kick out of stuff like this.  Add this to your .bash_profile to be greeted with the remaining space on your disk.
df -h &#124; awk &#8216;NR==2 {print &#8220;Space available &#8221; $4}&#8217;
This will actually change depending on which version of df you&#8217;re using (i think).  I get different output on my Mac [...]]]></description>
			<content:encoded><![CDATA[<p>I get a kick out of stuff like this.  Add this to your .bash_profile to be greeted with the remaining space on your disk.</p>
<blockquote><p>df -h | awk &#8216;NR==2 {print &#8220;Space available &#8221; $4}&#8217;</p></blockquote>
<p>This will actually change depending on which version of df you&#8217;re using (i think).  I get different output on my Mac than I do on a CentOS machine &#8211; df seems to auto wrap lines on long drive names, so when I check the space on the CentOS server I need to change the line number (NR goes to 3) and the column to print (down to 3).  </p>
<p>On my mac, this is what I get:</p>
<blockquote><pre>haddad:~ jhaddad$ df -h
Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   149Gi  144Gi  4.9Gi    97%    /
devfs          106Ki  106Ki    0Bi   100%    /dev
fdesc          1.0Ki  1.0Ki    0Bi   100%    /dev
map -hosts       0Bi    0Bi    0Bi   100%    /net
map auto_home    0Bi    0Bi    0Bi   100%    /home

haddad:~ jhaddad$ df -h | awk 'NR==2 {print "Space available " $4}'
Space available 4.9Gi
</pre>
</blockquote>
<p>I should probably clear some stuff off my drive.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/03/report-space-remaining-on-disk-on-unix-login/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Western Digital Drive with Leopard &#8211; &#8220;File system formatter failed.&#8221;</title>
		<link>http://www.rustyrazorblade.com/2008/02/file-system-formatter-failed/</link>
		<comments>http://www.rustyrazorblade.com/2008/02/file-system-formatter-failed/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 07:59:47 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/2008/02/26/file-system-formatter-failed/</guid>
		<description><![CDATA[I just bought a 1TB Western Digital drive.  I am stoked.
However, I tried to format the drive on my Mac (Leopard) and got the error &#8220;File system formatter failed&#8221; when I tried to format the disk as MacOS Extended (Journaled).  Not cool.
I found this forum thread which suggested using multiple partitions to solve [...]]]></description>
			<content:encoded><![CDATA[<p>I just bought a 1TB Western Digital drive.  I am stoked.</p>
<p>However, I tried to format the drive on my Mac (Leopard) and got the error &#8220;File system formatter failed&#8221; when I tried to format the disk as MacOS Extended (Journaled).  Not cool.</p>
<p>I found <a href="http://forums.dealnews.com/read.php?4,2742587">this forum thread</a> which suggested using multiple partitions to solve the problem.  When I was trying this, I went into options and changed the partition scheme from Master Boot Record to GUID partition table.  It formatted fine.</p>
<p>To test things further, I changed the scheme back to 1 partition, and left the format as GUID partition table.  This time it worked flawlessly.</p>
<p>The GUID type says it will not work as a start up disk MacOS older than 10.4.  So if you&#8217;re still on Panther you can&#8217;t boot up off my backup drive.  Try not to cry too much.</p>
<p><em>Update: here&#8217;s a few reasons why <a href="http://rantsandstuff.com/2009/07/15/guid-vs-mbr/">GUID owns MBR</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/02/file-system-formatter-failed/feed/</wfw:commentRss>
		<slash:comments>106</slash:comments>
		</item>
		<item>
		<title>Compiling Imagemagick on MacOS X &#8211; Not finding libjpeg</title>
		<link>http://www.rustyrazorblade.com/2007/11/compiling-imagemagick-on-macos-x-not-finding-libjpeg/</link>
		<comments>http://www.rustyrazorblade.com/2007/11/compiling-imagemagick-on-macos-x-not-finding-libjpeg/#comments</comments>
		<pubDate>Thu, 01 Nov 2007 18:48:13 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/index.php/2007/11/01/compiling-imagemagick-on-macos-x-not-finding-libjpeg/</guid>
		<description><![CDATA[I ran into an issue trying to get Imagemagick (convert) working on OSX last night.  I had compiled libjpeg and installed it, but when I would compile convert, it would not have jpeg support.
I found this post on dzone, which I followed and was able to use libjpeg just fine.
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config.sub [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into an issue trying to get Imagemagick (convert) working on OSX last night.  I had compiled libjpeg and installed it, but when I would compile convert, it would not have jpeg support.</p>
<p>I found <a href="http://snippets.dzone.com/posts/show/38">this post on dzone</a>, which I followed and was able to use libjpeg just fine.</p>
<p><code>tar zxvf jpegsrc.v6b.tar.gz<br />
cd jpeg-6b<br />
cp /usr/share/libtool/config.sub .<br />
cp /usr/share/libtool/config.guess .<br />
./configure --enable-shared --enable-static<br />
make<br />
sudo make install<br />
sudo ranlib /usr/local/lib/libjpeg.a</code></p>
<p>I&#8217;m pretty sure I didn&#8217;t do the last step (sudo ranlib), and it worked fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2007/11/compiling-imagemagick-on-macos-x-not-finding-libjpeg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP compile error on CentOS Install</title>
		<link>http://www.rustyrazorblade.com/2007/07/php-compile-error-on-centos-install/</link>
		<comments>http://www.rustyrazorblade.com/2007/07/php-compile-error-on-centos-install/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 01:13:40 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/index.php/2007/07/15/php-compile-error-on-centos-install/</guid>
		<description><![CDATA[I installed CentOS 5 on my VMWare a few days ago.  I installed gcc via yum, compiled and installed libxml2.  I then tried to install PHP 5.2.3 and received this error:
configure: error: installation or configuration problem: C++ compiler cannot create executables.
It took me forever to figure this out, but I had to install [...]]]></description>
			<content:encoded><![CDATA[<p>I installed CentOS 5 on my VMWare a few days ago.  I installed gcc via yum, compiled and installed libxml2.  I then tried to install PHP 5.2.3 and received this error:</p>
<p><code>configure: error: installation or configuration problem: C++ compiler cannot create executables.</code></p>
<p>It took me forever to figure this out, but I had to install the g++ library, then it compiled fine.</p>
<p><code>yum install gcc-c++</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2007/07/php-compile-error-on-centos-install/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
