<?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"
	>

<channel>
	<title>Rusty Razor Blade</title>
	<atom:link href="http://www.rustyrazorblade.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rustyrazorblade.com</link>
	<description>Tech Thoughts, Mostly on LAMP - by Jon Haddad</description>
	<pubDate>Thu, 08 May 2008 18:37:57 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>VMWare, Losing Time, and Sessions</title>
		<link>http://www.rustyrazorblade.com/2008/05/08/vmware-losing-time-and-sessions/</link>
		<comments>http://www.rustyrazorblade.com/2008/05/08/vmware-losing-time-and-sessions/#comments</comments>
		<pubDate>Thu, 08 May 2008 18:37:43 +0000</pubDate>
		<dc:creator>jon</dc:creator>
		
		<category><![CDATA[php]]></category>

		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=124</guid>
		<description><![CDATA[I&#8217;ll keep it short.  In the last few days, login on our dev server broke.  We hadn&#8217;t changed anything related to it, and everything looked good code wise.  What we finally figured out was that our session cookie was set to expire 2 days into the future, and our VMWare image had [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll keep it short.  In the last few days, login on our dev server broke.  We hadn&#8217;t changed anything related to it, and everything looked good code wise.  What we finally figured out was that our session cookie was set to expire 2 days into the future, and our VMWare image had lost 2 days of time.  </p>
<p>Fix by doing the following:</p>
<blockquote><p>ntpdate ntp.nasa.gov > /dev/null</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/05/08/vmware-losing-time-and-sessions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MySQL: Time Delayed Replication</title>
		<link>http://www.rustyrazorblade.com/2008/05/07/mysql-time-delayed-replication/</link>
		<comments>http://www.rustyrazorblade.com/2008/05/07/mysql-time-delayed-replication/#comments</comments>
		<pubDate>Wed, 07 May 2008 19:12:39 +0000</pubDate>
		<dc:creator>jon</dc:creator>
		
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=123</guid>
		<description><![CDATA[I was cruising the MySQL Forge Worklog when I came across the idea of Time Delayed Replication.  I had never considered the benefits of deliberately keeping a slave server behind a master. 
Kristian Koehntopp gives a good example:
Kristian Koehntopp writes:
TDS: Time delayed SQL_THREAD (Have a replication slave that is always
lagging 30 minutes behind).
Currently, replication [...]]]></description>
			<content:encoded><![CDATA[<p>I was cruising the MySQL Forge Worklog when I came across the idea of <a href="http://forge.mysql.com/worklog/task.php?id=344">Time Delayed Replication</a>.  I had never considered the benefits of deliberately keeping a slave server behind a master. </p>
<p>Kristian Koehntopp gives a good example:</p>
<blockquote><p>Kristian Koehntopp writes:</p>
<p>TDS: Time delayed SQL_THREAD (Have a replication slave that is always<br />
lagging 30 minutes behind).</p>
<p>Currently, replication is a rolling recovery: To set up replication you<br />
restore from a full dump with a binlog position. You then continously<br />
download binlog and roll forward. In case of a master crash a slave is a<br />
readily recovered instance (as opposed to a backup, which still has to be<br />
restored).</p>
<p>This protects against crashes, but not against oopses.</p>
<p>A time delayed slave (TDS) is a nice protection against oopses.</p>
<p>Sugar on top addendum: With the binlog being a table, any table type,<br />
it will be very easy to delete an oopsing statement out of the<br />
unapplied binlog queue. Currently, a simple time delayed slave will<br />
protect you against oopses, but it will be very hard to extract the<br />
relevant binlog portion out of the TDS replication log skipping the<br />
oopsing statement.</p>
<p>With a MyISAM binlog table, it is just a matter of DELETE FROM<br />
REPLICATION.BINLOG WHERE STATEMENT_ID = 1717;
</p></blockquote>
<p>Definately a cool idea.  Instead of having to restore from a backup, you just take down your master, pull out the busted query, let the server catch up, and bring the slave up as the new master.  Doing a restore from our current database backups takes about 3-4 hours, and we&#8217;re not even huge.  It seems like your downtime here would be limited to however long it takes your slave to catch up.  Additionally, once you take down your master and remove your bogus query (truncate table perhaps?) you can allow the slave to replicate everything and catch up (no longer limited to 30 min behind, ideally).  Depending on your traffic, this could limit your downtime in the case of a catastrophic loss to 20 minutes or so instead of hours, and your data loss would be far less.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/05/07/mysql-time-delayed-replication/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How many lines of code?</title>
		<link>http://www.rustyrazorblade.com/2008/05/05/how-many-lines-of-code/</link>
		<comments>http://www.rustyrazorblade.com/2008/05/05/how-many-lines-of-code/#comments</comments>
		<pubDate>Mon, 05 May 2008 21:48:55 +0000</pubDate>
		<dc:creator>jon</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=122</guid>
		<description><![CDATA[I was curious how many lines of code were in PHPBB 3. I only wanted to know about the .php files.  
find . -name &#8216;*.php&#8217; -exec wc -l {} \; &#124; awk &#8216;{ SUM += $1 } END {print SUM}&#8217; 
The downside to this is that it includes whitespace and braces as lines, as [...]]]></description>
			<content:encoded><![CDATA[<p>I was curious how many lines of code were in PHPBB 3. I only wanted to know about the .php files.  </p>
<blockquote><p>find . -name &#8216;*.php&#8217; -exec wc -l {} \; | awk &#8216;{ SUM += $1 } END {print SUM}&#8217; </p></blockquote>
<p>The downside to this is that it includes whitespace and braces as lines, as well as comments.  Oh well.  It&#8217;s a good approximation.</p>
<p><em>Edit: There are 172,189 lines of code in phpbb3.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/05/05/how-many-lines-of-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BBEdit + CTags = Awesome</title>
		<link>http://www.rustyrazorblade.com/2008/05/01/bbedit-ctags-awesome/</link>
		<comments>http://www.rustyrazorblade.com/2008/05/01/bbedit-ctags-awesome/#comments</comments>
		<pubDate>Thu, 01 May 2008 23:07:19 +0000</pubDate>
		<dc:creator>jon</dc:creator>
		
		<category><![CDATA[bbedit]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=121</guid>
		<description><![CDATA[I posted a complaint a while ago about BBEdit complaining about a few things.  I moved onto TextMate for a few weeks, but it lacked some of the powerful BBEdit features I&#8217;ve gotten used to.
Then I discovered ctags.  I set up a cron on my PHP dev site to rescan my dev folder [...]]]></description>
			<content:encoded><![CDATA[<p>I posted a <a href="http://www.rustyrazorblade.com/2008/03/15/bbedit-i-love-you-but-please-can-we-have-a-few-more-things/">complaint</a> a while ago about BBEdit complaining about a few things.  I moved onto TextMate for a few weeks, but it lacked some of the powerful BBEdit features I&#8217;ve gotten used to.</p>
<p>Then I discovered ctags.  I set up a cron on my PHP dev site to rescan my dev folder once an hour.  BBEdit automatically discovered my ctags file and gave me the definitions right a right click.</p>
<p>Ctags is available through yum (yum install ctags).</p>
<blockquote><p>ctags &#8211;languages=php  &#8211;recurse=yes</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/05/01/bbedit-ctags-awesome/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Load Balancer</title>
		<link>http://www.rustyrazorblade.com/2008/04/23/mysql-load-balancer/</link>
		<comments>http://www.rustyrazorblade.com/2008/04/23/mysql-load-balancer/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 00:43:47 +0000</pubDate>
		<dc:creator>jon</dc:creator>
		
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=120</guid>
		<description><![CDATA[I&#8217;m not sure how I didn&#8217;t see this earlier, but it looks like MySQL 5.1 is coming with a load balancer for replicated servers.  I&#8217;m absolutely pumped about this - we&#8217;ve got a few sites running with multiple db slaves and it&#8217;s so annoying having to check if they&#8217;re behind the master.
It looks like [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure how I didn&#8217;t see this earlier, but it looks like MySQL 5.1 is coming with a <a href="http://dev.mysql.com/doc/refman/5.1/en/load-balancer.html">load balancer</a> for replicated servers.  I&#8217;m absolutely pumped about this - we&#8217;ve got a few sites running with multiple db slaves and it&#8217;s so annoying having to check if they&#8217;re behind the master.</p>
<p>It looks like the load balancer will automatically pull slaves out if they fall behind, and route connections to the ones that are the most up to date.   It is based on <a href="http://forge.mysql.com/wiki/MySQL_Proxy">MySQL Proxy</a>, which is currently in Alpha.</p>
<p><a href="http://dev.mysql.com/doc/refman/5.1/en/load-balancer.html">MySQL Load Balancer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/04/23/mysql-load-balancer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP Warning: Memcache::set(): Failed to extract &#8216;connection&#8217; variable</title>
		<link>http://www.rustyrazorblade.com/2008/04/16/php-warning-memcacheset-failed-to-extract-connection-variable/</link>
		<comments>http://www.rustyrazorblade.com/2008/04/16/php-warning-memcacheset-failed-to-extract-connection-variable/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 01:46:15 +0000</pubDate>
		<dc:creator>jon</dc:creator>
		
		<category><![CDATA[memcached]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=119</guid>
		<description><![CDATA[I got this today.  Solved by restarting the Memcached server.  Move along.
Edit: this is actually a reoccurring bug we&#8217;re seeing with the memcache 2.2.3 stable build on 2 different boxes
2nd Edit: Actually it was a bug in my code.  I wasn&#8217;t setting the server and ip correctly, there was a typo in [...]]]></description>
			<content:encoded><![CDATA[<p>I got this today.  Solved by restarting the Memcached server.  Move along.</p>
<p><em>Edit: this is actually a reoccurring bug we&#8217;re seeing with the memcache 2.2.3 stable build on 2 different boxes</em><br />
<em>2nd Edit: Actually it was a bug in my code.  I wasn&#8217;t setting the server and ip correctly, there was a typo in my configuration</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/04/16/php-warning-memcacheset-failed-to-extract-connection-variable/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How curl_exec and urlencode killed my single sign on</title>
		<link>http://www.rustyrazorblade.com/2008/04/16/how-curl_exec-and-urlencode-killed-my-single-sign-on/</link>
		<comments>http://www.rustyrazorblade.com/2008/04/16/how-curl_exec-and-urlencode-killed-my-single-sign-on/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 18:02:04 +0000</pubDate>
		<dc:creator>jon</dc:creator>
		
		<category><![CDATA[curl]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=117</guid>
		<description><![CDATA[If you do any work with single sign on, you&#8217;ll be familiar with the concept of exchanging tokens and validating against the authentication server using that token.  One of the issues I&#8217;ve just run into which resulted in a huge headache is with urlencoding the result of a curl_exec that had a line ending. [...]]]></description>
			<content:encoded><![CDATA[<p>If you do any work with single sign on, you&#8217;ll be familiar with the concept of exchanging tokens and validating against the authentication server using that token.  One of the issues I&#8217;ve just run into which resulted in a huge headache is with urlencoding the result of a curl_exec that had a line ending. It&#8217; easy to miss when it&#8217;s a longer string and you aren&#8217;t paying very close attention.  This is a very simple example, and it still takes a second to realize there&#8217;s an extra character at the end.</p>
<blockquote><p>php> echo urlencode(&#8221;test@str!ngw!th0u7\n&#8221;);<br />
test%40str%21ngw%21th0u7%0A<br />
php> echo urlencode(&#8221;test@str!ngw!th0u7&#8243;);<br />
test%40str%21ngw%21th0u7</p></blockquote>
<p>Basically, I&#8217;d recommend calling a trim() on any results you get back, unless you love newlines at the end for some reason.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/04/16/how-curl_exec-and-urlencode-killed-my-single-sign-on/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Awesome Awk Tutorial</title>
		<link>http://www.rustyrazorblade.com/2008/04/15/awesome-awk-tutorial/</link>
		<comments>http://www.rustyrazorblade.com/2008/04/15/awesome-awk-tutorial/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 07:29:48 +0000</pubDate>
		<dc:creator>jon</dc:creator>
		
		<category><![CDATA[awk]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=116</guid>
		<description><![CDATA[This is exactly what I look for when I&#8217;m trying to find a tutorial.  Thank you, Andrew M. Ross.
My favorite awk tutorial ever.
]]></description>
			<content:encoded><![CDATA[<p>This is exactly what I look for when I&#8217;m trying to find a tutorial.  Thank you, Andrew M. Ross.</p>
<p><a href="http://doc.ddart.net/shell/awk/">My favorite awk tutorial ever.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/04/15/awesome-awk-tutorial/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Decimal vs Float in MySQL</title>
		<link>http://www.rustyrazorblade.com/2008/04/01/decimal-vs-float-in-mysql/</link>
		<comments>http://www.rustyrazorblade.com/2008/04/01/decimal-vs-float-in-mysql/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 00:26:03 +0000</pubDate>
		<dc:creator>jon</dc:creator>
		
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=114</guid>
		<description><![CDATA[While I&#8217;ve known how floating points are stored, I didn&#8217;t know if decimal was stored any differently, or if it was more or less accurate.  According to a post on the MySQL list:
Bruno Rodrigues Silva wrote:
> Dear all.
>
> The MySQL Manual inform that Decimal Data Type is used
> for represent exact-number, but like Float [...]]]></description>
			<content:encoded><![CDATA[<p>While I&#8217;ve known how floating points are stored, I didn&#8217;t know if decimal was stored any differently, or if it was more or less accurate.  According to a <a href="http://lists.mysql.com/mysql/201704">post on the MySQL list</a>:</p>
<blockquote><p>Bruno Rodrigues Silva wrote:<br />
> Dear all.<br />
><br />
> The MySQL Manual inform that Decimal Data Type is used<br />
> for represent exact-number, but like Float Point Data<br />
> Type, Decimal use rounding case the fractional part is<br />
> not sufficient. Therefore, what the difference? </p>
<p>Hi Bruno,</p>
<p>FLOAT rounds as floating point and DECIMAL rounds as you would expect it<br />
to. Floating point arithmetic is not exact and that&#8217;s why they&#8217;ve called<br />
DECIMAL an &#8220;exact packed decimal number&#8221; because apparently you can rely<br />
on it&#8217;s roundings.</p>
<p>The primary use for DECIMAL is money, where floating point would fail<br />
miserably and produce lots of errors (money leak) at the end of the month.</p>
<p>As floating point arithmetic has it&#8217;s own separated section on your<br />
processor (unless you have a 386 or older computer) it would be *much*<br />
faster than DECIMAL, so use it only if you are absolutely sure you need it.</p>
<p>cheers,<br />
&#8211;renato
</p></blockquote>
<p>Not exactly breaking news, but I had never looked at decimal very closely.  Good to know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/04/01/decimal-vs-float-in-mysql/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Problems Installing Subversion From Source On CentOS</title>
		<link>http://www.rustyrazorblade.com/2008/03/26/problems-installing-subversion-from-source-on-centos/</link>
		<comments>http://www.rustyrazorblade.com/2008/03/26/problems-installing-subversion-from-source-on-centos/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 07:23:06 +0000</pubDate>
		<dc:creator>jon</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/2008/03/26/problems-installing-subversion-from-source-on-centos/</guid>
		<description><![CDATA[I was setting up a new server for someone, and encountered this error while I was trying to build svn
/usr/bin/ld: cannot find -lexpat
Now, while I can do some things on that a sys admin can, I am by no means a sys admin.  I have only installed svn a handful of times, and I [...]]]></description>
			<content:encoded><![CDATA[<p>I was setting up a new server for someone, and encountered this error while I was trying to build svn</p>
<blockquote><p>/usr/bin/ld: cannot find -lexpat</p></blockquote>
<p>Now, while I can do some things on that a sys admin can, I am by no means a sys admin.  I have only installed svn a handful of times, and I didn&#8217;t know what this was.  </p>
<p>First I installed expat from source.  It didn&#8217;t help.</p>
<p>I then installed apr and apr-util.  Didn&#8217;t help.  I probably needed to follow these instructions.. but I didn&#8217;t.</p>
<blockquote><p>Libraries have been installed in:<br />
   /usr/local/apr/lib</p>
<p>If you ever happen to want to link against installed libraries<br />
in a given directory, LIBDIR, you must either use libtool, and<br />
specify the full pathname of the library, or use the `-LLIBDIR&#8217;<br />
flag during linking and do at least one of the following:<br />
   - add LIBDIR to the `LD_LIBRARY_PATH&#8217; environment variable<br />
     during execution<br />
   - add LIBDIR to the `LD_RUN_PATH&#8217; environment variable<br />
     during linking<br />
   - use the `-Wl,&#8211;rpath -Wl,LIBDIR&#8217; linker flag<br />
   - have your system administrator add LIBDIR to `/etc/ld.so.conf&#8217;
</p></blockquote>
<p>Decided I don&#8217;t care anymore about trying to figure out why it wasn&#8217;t working and just got the subversion dependencies from their site, untarred them into the svn folder as recommended.  Everything compiled without issue.</p>
<p>On the make install, I got this:</p>
<blockquote><p>/usr/local/src/subversion-1.4.6/subversion/svnversion/.libs/lt-svnversion: error while loading shared libraries: /usr/local/src/subversion-1.4.6/subversion/libsvn_delta/.libs/libsvn_delta-1.so.0: cannot restore segment prot after reloc: Permission denied<br />
make: *** [revision-install] Error 127</p></blockquote>
<p>Googling that error got me to <a href="http://www.ittvis.com/services/techtip.asp?ttid=3092">this site</a>, where it suggested SELinux might be breaking it.  I disabled it and rebooted the machine.  The install proceeded without issue at this point.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/03/26/problems-installing-subversion-from-source-on-centos/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
