<?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>Pelago</title>
	<atom:link href="http://pelagodesign.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pelagodesign.com/blog</link>
	<description>Santa Barbara Web Design and Web Development Blog on the web world and other randoms</description>
	<pubDate>Thu, 07 Aug 2008 23:41:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Toolbar buttons galore</title>
		<link>http://www.pelagodesign.com/blog/2008/08/07/toolbar-buttons-galore/</link>
		<comments>http://www.pelagodesign.com/blog/2008/08/07/toolbar-buttons-galore/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 23:40:03 +0000</pubDate>
		<dc:creator>Jaime</dc:creator>
		
		<category><![CDATA[Browsers]]></category>

		<category><![CDATA[Creative Engineering]]></category>

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

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

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/?p=392</guid>
		<description><![CDATA[Here&#8217;s a great time-saver extension. Toolbar Buttons is perfect for adding tough-to-find Firefox functions. They&#8217;re there BUT you have dig deep within Tools > Options to get to them. Need to quickly disable javascript, flash and images with just three quick clicks? No problem, just drag and drop the buttons. Here is my current setup:

]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a great time-saver extension. <a href="https://addons.mozilla.org/en-US/firefox/addon/2377">Toolbar Buttons</a> is perfect for adding tough-to-find <a href="http://www.pelagodesign.com/blog/tag/firefox/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Firefox">Firefox</a> functions. They&#8217;re there BUT you have dig deep within Tools > Options to get to them. Need to quickly disable <a href="http://www.pelagodesign.com/blog/tag/javascript/" class="st_tag internal_tag" rel="tag" title="Posts tagged with javascript">javascript</a>, <a href="http://www.pelagodesign.com/blog/tag/flash/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Flash">flash</a> and images with just three quick clicks? No problem, just drag and drop the buttons. Here is my current setup:</p>
<p><img src="http://www.pelagodesign.com/blog/wp-content/uploads/2008/08/toolbar.gif" alt="" title="toolbar" class="alignnone size-full wp-image-393" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2008/08/07/toolbar-buttons-galore/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP to Javascript Project: php.js</title>
		<link>http://www.pelagodesign.com/blog/2008/07/24/php-to-javascript-project-phpjs/</link>
		<comments>http://www.pelagodesign.com/blog/2008/07/24/php-to-javascript-project-phpjs/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 17:53:49 +0000</pubDate>
		<dc:creator>Jaime</dc:creator>
		
		<category><![CDATA[Browsers]]></category>

		<category><![CDATA[Creative Engineering]]></category>

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/?p=391</guid>
		<description><![CDATA[A lot of people are familiar with PHP&#8217;s functions, and though Javascript functions are often quite similar, some functions may be missing or addressed differently. The Javascript implementations should be as compliant with the PHP versions as possible, a good indication is that the PHP function manual could also apply to the Javascript version.
http://kevin.vanzonneveld.net/techblog/
]]></description>
			<content:encoded><![CDATA[<blockquote><p>A lot of people are familiar with <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a>&#8217;s functions, and though <a href="http://www.pelagodesign.com/blog/tag/javascript/" class="st_tag internal_tag" rel="tag" title="Posts tagged with javascript">Javascript</a> functions are often quite similar, some functions may be missing or addressed differently. The <a href="http://www.pelagodesign.com/blog/tag/javascript/" class="st_tag internal_tag" rel="tag" title="Posts tagged with javascript">Javascript</a> implementations should be as compliant with the <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> versions as possible, a good indication is that the <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> function manual could also apply to the <a href="http://www.pelagodesign.com/blog/tag/javascript/" class="st_tag internal_tag" rel="tag" title="Posts tagged with javascript">Javascript</a> version.</p></blockquote>
<p><a href="http://kevin.vanzonneveld.net/techblog/">http://kevin.vanzonneveld.net/techblog/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2008/07/24/php-to-javascript-project-phpjs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing Libmcrypt on a Godaddy Virtual Dedicated Server</title>
		<link>http://www.pelagodesign.com/blog/2008/07/11/installing-libmcrypt-on-a-godaddy-virtual-dedicated-server/</link>
		<comments>http://www.pelagodesign.com/blog/2008/07/11/installing-libmcrypt-on-a-godaddy-virtual-dedicated-server/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 23:17:54 +0000</pubDate>
		<dc:creator>John</dc:creator>
		
		<category><![CDATA[Creative Engineering]]></category>

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

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

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

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/?p=390</guid>
		<description><![CDATA[We recently deployed a web site using GoDaddy&#8217;s virtual dedicated server. Everything about the default PHP installation was fine, except that libmcrypt was not available. When I asked the godaddy support staff &#8220;How do we enable libmcrypt for PHP?&#8221; their response was far from helpful:

Thank you for contacting Server Support. Unfortunately 3rd party installations and [...]]]></description>
			<content:encoded><![CDATA[<p>We recently deployed a web site using <a href="http://www.pelagodesign.com/blog/tag/godaddy/" class="st_tag internal_tag" rel="tag" title="Posts tagged with godaddy">GoDaddy</a>&#8217;s virtual dedicated server. Everything about the default <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> installation was fine, except that <a href="http://www.pelagodesign.com/blog/tag/libmcrypt/" class="st_tag internal_tag" rel="tag" title="Posts tagged with libmcrypt">libmcrypt</a> was not available. When I asked the <a href="http://www.pelagodesign.com/blog/tag/godaddy/" class="st_tag internal_tag" rel="tag" title="Posts tagged with godaddy">godaddy</a> support staff &#8220;How do we enable <a href="http://www.pelagodesign.com/blog/tag/libmcrypt/" class="st_tag internal_tag" rel="tag" title="Posts tagged with libmcrypt">libmcrypt</a> for <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a>?&#8221; their response was far from helpful:</p>
<blockquote><p>
Thank you for contacting Server Support. Unfortunately 3rd party installations and configurations are not supported.
</p></blockquote>
<p>Rather than argue with the support team about what constitutes a 3rd party installation, I decided to google around and see if I could do it myself. Hours later, I succeeded. Here are the steps for installing <a href="http://www.pelagodesign.com/blog/tag/libmcrypt/" class="st_tag internal_tag" rel="tag" title="Posts tagged with libmcrypt">libmcrypt</a>:</p>
<ol>
<li>su root</li>
<li>yum install gcc-c++</li>
<li>yum install lex</li>
<li>yum install libxml2</li>
<li>yum install libxml2-devel</li>
<li>yum install flex</li>
<li>wget http://downloads.sourceforge.net/mcrypt/<a href="http://www.pelagodesign.com/blog/tag/libmcrypt/" class="st_tag internal_tag" rel="tag" title="Posts tagged with libmcrypt">libmcrypt</a>-2.5.8.tar.gz?modtime=1171868460&#038;big_mirror=0</li>
<li>tar -xzvf <a href="http://www.pelagodesign.com/blog/tag/libmcrypt/" class="st_tag internal_tag" rel="tag" title="Posts tagged with libmcrypt">libmcrypt</a>-2.5.8.tar.gz</li>
<li>cd <a href="http://www.pelagodesign.com/blog/tag/libmcrypt/" class="st_tag internal_tag" rel="tag" title="Posts tagged with libmcrypt">libmcrypt</a>-2.5.8</li>
<li>./configure</li>
<li>make</li>
<li>make install</li>
<li>wget http://museum.<a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">php</a>.net/php5/<a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">php</a>-5.1.6.tar.gz</li>
<li>tar -xzvf <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">php</a>-5.1.6.tar.gz</li>
<li>cd <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">php</a>-5.1.6</li>
<li>./configure &#8211;with-mcrypt=shared,/usr/local/lib</li>
<li>make (after running &#8216;make&#8217;, DO NOT RUN &#8216;make install&#8217;)</li>
<li>cp modules/mcrypt.so /usr/lib/<a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">php</a>/modules/</li>
<li>Add a file /etc/<a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">php</a>.d/mcrypt.ini<br />
; Enable mcrypt extension module<br />
extension=mcrypt.so</li>
<li>/usr/sbin/apachectl restart</li>
</ol>
<p>That&#8217;s it! To confirm a successful install, just run phpinfo() and look for the mcrypt section</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2008/07/11/installing-libmcrypt-on-a-godaddy-virtual-dedicated-server/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wordpress 2.5 moderate comments bug</title>
		<link>http://www.pelagodesign.com/blog/2008/06/19/wordpress-25-moderate-comments-bug/</link>
		<comments>http://www.pelagodesign.com/blog/2008/06/19/wordpress-25-moderate-comments-bug/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 18:53:43 +0000</pubDate>
		<dc:creator>Jaime</dc:creator>
		
		<category><![CDATA[Creative Engineering]]></category>

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

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/?p=389</guid>
		<description><![CDATA[There&#8217;s a bug with 2.5 that doesn&#8217;t allow you to moderate comments. The problem is with the _wp_get_comment_list function and how it retrieves counts from the database specifically a missing column index. Running this line on your database should fix the problem:
ALTER TABLE wp_comments ADD INDEX ( comment_date_gmt );
]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a bug with 2.5 that doesn&#8217;t allow you to moderate comments. The problem is with the _wp_get_comment_list function and how it retrieves counts from the database specifically a missing column index. Running this line on your database should fix the problem:</p>
<p><code>ALTER TABLE wp_comments ADD INDEX ( comment_date_gmt );</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2008/06/19/wordpress-25-moderate-comments-bug/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Test drive higher quality YouTube videos (MP4)</title>
		<link>http://www.pelagodesign.com/blog/2008/04/23/test-drive-higher-quality-youtube-videos/</link>
		<comments>http://www.pelagodesign.com/blog/2008/04/23/test-drive-higher-quality-youtube-videos/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 03:43:32 +0000</pubDate>
		<dc:creator>Jaime</dc:creator>
		
		<category><![CDATA[Macromedia Flash]]></category>

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

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2008/04/23/test-drive-higher-quality-youtube-videos/</guid>
		<description><![CDATA[Want to watch higher quality YouTube videos? 
Add &#038;fmt=18 to the last part of the URL. You won&#8217;t see DVD quality video but you&#8217;ll see a great difference from whats currently available. 
Edit: Want to make it even easier? This GM script does it for you.
]]></description>
			<content:encoded><![CDATA[<p>Want to watch higher quality YouTube videos? </p>
<p>Add <strong>&#038;fmt=18</strong> to the last part of the URL. You won&#8217;t see DVD quality video but you&#8217;ll see a great difference from whats currently available. </p>
<p>Edit: Want to make it even easier? <a href="http://userscripts.org/scripts/show/23898">This GM script does it for you.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2008/04/23/test-drive-higher-quality-youtube-videos/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Setting locale to tr_TR (Turkish) lowercases class names</title>
		<link>http://www.pelagodesign.com/blog/2008/04/03/setting-locale-to-tr_tr-turkish-lowercases-class-names/</link>
		<comments>http://www.pelagodesign.com/blog/2008/04/03/setting-locale-to-tr_tr-turkish-lowercases-class-names/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 19:57:00 +0000</pubDate>
		<dc:creator>Jaime</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

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

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

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

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2008/04/03/setting-locale-to-tr_tr-turkish-lowercases-class-names/</guid>
		<description><![CDATA[So I was working away at localizing some pages and for some reason they all worked except tr_TR. What was the problem? The server had an outdated PHP installation with a bug that lowercases class names which ends a fatal error.
Why it it so? After some investigations I came across this bug and came to [...]]]></description>
			<content:encoded><![CDATA[<p>So I was working away at localizing some pages and for some reason they all worked except tr_TR. What was the problem? The server had an outdated <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> installation with a bug that lowercases class names which ends a fatal error.</p>
<p>Why it it so? After some investigations I came across <a href="http://bugs.php.net/bug.php?id=18556">this bug</a> and came to the conclusion that in the Turkish language, the latin i is not equal to capital latin i. </p>
<p>AWESOME!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2008/04/03/setting-locale-to-tr_tr-turkish-lowercases-class-names/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JavaScript debugging on Safari for Windows</title>
		<link>http://www.pelagodesign.com/blog/2008/03/17/javascript-debugging-on-safari-for-windows/</link>
		<comments>http://www.pelagodesign.com/blog/2008/03/17/javascript-debugging-on-safari-for-windows/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 22:23:16 +0000</pubDate>
		<dc:creator>Jaime</dc:creator>
		
		<category><![CDATA[Creative Engineering]]></category>

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

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

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

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2008/03/17/javascript-debugging-on-safari-for-windows/</guid>
		<description><![CDATA[Just had to do this and thought I&#8217;d post it for anyone who might find it helpful. Here is how you enable the Debug menu if you&#8217;re running windows:
1. Navigate to the folder below (replace USERNAME with your user account).
    C:\Documents and Settings\USERNAME\Application Data\Apple Computer\Safari
2. open up Preferences.plist and add the following [...]]]></description>
			<content:encoded><![CDATA[<p>Just had to do this and thought I&#8217;d post it for anyone who might find it helpful. Here is how you enable the Debug menu if you&#8217;re running windows:</p>
<p>1. Navigate to the folder below (replace USERNAME with your user account).<br />
    C:\Documents and Settings\USERNAME\Application Data\Apple Computer\<a href="http://www.pelagodesign.com/blog/tag/safari/" class="st_tag internal_tag" rel="tag" title="Posts tagged with safari">Safari</a></p>
<p>2. open up Preferences.plist and add the following two lines anywhere before the line &#8220;&lt;/dict&gt;&#8221;</p>
<p>&lt;key&gt;IncludeDebugMenu&lt;/key&gt;<br />
&lt;true /&gt; </p>
<p>3. Restart <a href="http://www.pelagodesign.com/blog/tag/safari/" class="st_tag internal_tag" rel="tag" title="Posts tagged with safari">Safari</a> and you should now have a Debug menu.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2008/03/17/javascript-debugging-on-safari-for-windows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WTF!? preg_replace() returns null?</title>
		<link>http://www.pelagodesign.com/blog/2008/01/25/wtf-preg_replace-returns-null/</link>
		<comments>http://www.pelagodesign.com/blog/2008/01/25/wtf-preg_replace-returns-null/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 00:09:17 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
		
		<category><![CDATA[Creative Engineering]]></category>

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

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

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

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

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

		<category><![CDATA[regular expressions]]></category>

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2008/01/25/wtf-preg_replace-returns-null/</guid>
		<description><![CDATA[On one of our sites were were running into a problem when we tried to pass HTML content from a database through an email obfuscation function to prevent spiders from scraping our clients&#8217; emails. We quickly discovered that some of the longer pages were showing up completely blank. The preg_replace() function we were using to [...]]]></description>
			<content:encoded><![CDATA[<p>On one of our sites were were running into a problem when we tried to pass HTML content from a database through an email obfuscation function to prevent spiders from scraping our clients&#8217; emails. We quickly discovered that some of the longer pages were showing up completely blank. The <a href="http://www.pelagodesign.com/blog/tag/preg_replace/" class="st_tag internal_tag" rel="tag" title="Posts tagged with preg_replace">preg_replace</a>() function we were using to run the obfuscation code on email addresses was returning null. After some hunting I found the answer.</p>
<p><span id="more-384"></span></p>
<p>In <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> 5.2, Pearl Compatible <a href="http://www.pelagodesign.com/blog/tag/regular-expressions/" class="st_tag internal_tag" rel="tag" title="Posts tagged with regular expressions">Regular Expressions</a> (<a href="http://www.pelagodesign.com/blog/tag/pcre/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PCRE">PCRE</a>) introduced with little fanfare a <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> setting called backtrack_limit, which, for the first time, set a limit on the number of backtracks a regular expression could perform before it stops operating and reports an error. Unfortunately, when <a href="http://www.pelagodesign.com/blog/tag/pcre/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PCRE">PCRE</a> encounters an error of this type, it doesn&#8217;t report a notice or warning or error. All it does is return NULL, something that the preg family of functions typically never does. There were a lot of entries on the <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> site reporting this behavior as a bug, and sites that are <a href="http://www.pelagodesign.com/blog/tag/regex/" class="st_tag internal_tag" rel="tag" title="Posts tagged with regex">regex</a> heavy (like Wiki sites) scrambled to figure out WTF was going on.</p>
<p>The only way to actually determine that this type of <a href="http://www.pelagodesign.com/blog/tag/pcre/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PCRE">PCRE</a> error took place in your code is to call preg_last_error() after you&#8217;ve tried to run your <a href="http://www.pelagodesign.com/blog/tag/regex/" class="st_tag internal_tag" rel="tag" title="Posts tagged with regex">regex</a>. Of course, before <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> 5.2, backtrack errors were handled much more gracefully (if they were even created), by returning the original string that was passed to the <a href="http://www.pelagodesign.com/blog/tag/regex/" class="st_tag internal_tag" rel="tag" title="Posts tagged with regex">regex</a> function.</p>
<p>To get around this backtrack limit, if you&#8217;re running <a href="http://www.pelagodesign.com/blog/tag/regex/" class="st_tag internal_tag" rel="tag" title="Posts tagged with regex">regex</a> on large pages (or really long strings) is to increase the backtrack limit in your <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a>.ini settings. I increased ours from 100,000 to 1,000,000. Of course, you still run the risk of producing an error on really, <em>really</em> long strings, and that&#8217;s why a second step you should take is to add better error handling any place where you might run a <a href="http://www.pelagodesign.com/blog/tag/pcre/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PCRE">PCRE</a> function on a really long string. Should an error be produced, it&#8217;s up to you how to handle it, whether that be returning the original string, or breaking your string up into smaller pieces and running them separately.</p>
<p>Ultimately the best thing one can do (and should always to) is optimize your <a href="http://www.pelagodesign.com/blog/tag/regex/" class="st_tag internal_tag" rel="tag" title="Posts tagged with regex">regex</a> as much as possible, and for some people that just means knowing when to use <a href="http://www.pelagodesign.com/blog/tag/regex/" class="st_tag internal_tag" rel="tag" title="Posts tagged with regex">regex</a> and when a simple str_replace() will suffice.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2008/01/25/wtf-preg_replace-returns-null/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ISO Week and Year in PHP and PostgreSQL</title>
		<link>http://www.pelagodesign.com/blog/2008/01/10/iso-week-and-year-in-php-and-postgresql/</link>
		<comments>http://www.pelagodesign.com/blog/2008/01/10/iso-week-and-year-in-php-and-postgresql/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 16:48:49 +0000</pubDate>
		<dc:creator>John</dc:creator>
		
		<category><![CDATA[Creative Engineering]]></category>

		<category><![CDATA[iso-8601]]></category>

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

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

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

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2008/01/10/iso-week-and-year-in-php-and-postgresql/</guid>
		<description><![CDATA[The new year always brings with it a few small things that go bump in the morning. 2008 was no different. Intervals started behaving oddly on New Year&#8217;s Eve morning — the default timesheet was a year behind schedule. What happened?
In our PHP code, we are using the ISO-8601 week number of year, as specified [...]]]></description>
			<content:encoded><![CDATA[<p>The new year always brings with it a few small things that go bump in the morning. 2008 was no different. <a href="http://www.myintervals.com/">Intervals</a> started behaving oddly on New Year&#8217;s Eve morning — the default timesheet was a year behind schedule. What happened?</p>
<p>In our <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> code, we are using the <a href="http://www.pelagodesign.com/blog/tag/iso-8601/" class="st_tag internal_tag" rel="tag" title="Posts tagged with iso-8601">ISO-8601</a> week number of year, as specified on the <a href="http://php.net/date">PHP date function page</a>, but we weren&#8217;t using <a href="http://www.pelagodesign.com/blog/tag/iso-8601/" class="st_tag internal_tag" rel="tag" title="Posts tagged with iso-8601">ISO-8601</a> for the year. The <a href="http://www.pelagodesign.com/blog/tag/iso-8601/" class="st_tag internal_tag" rel="tag" title="Posts tagged with iso-8601">ISO-8601</a> week number specifies the last monday of a year as the first week of the new year, if that new year begins before thursday. Intervals thought it was the first year of 2007!</p>
<p>In <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a>, the fix was as easy as converting all instances of date(&#8217;Y') to date(&#8217;o'), according to <a href="http://php.net">php.net</a>:</p>
<blockquote><p><a href="http://www.pelagodesign.com/blog/tag/iso-8601/" class="st_tag internal_tag" rel="tag" title="Posts tagged with iso-8601">ISO-8601</a> year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> 5.1.0)</p></blockquote>
<p>That fixed everything on the <a href="http://www.pelagodesign.com/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a> side of things. But next we had to dig into the <a href="http://www.pelagodesign.com/blog/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sql">SQL</a> queries and get them to use the ISO Year.</p>
<p>Snag.</p>
<p><a href="http://www.postgresql.org/">PostgreSQL 8.2.5</a> doesn&#8217;t support ISO Year in the Extract function. EXTRACT(ISOYEAR, timestamp) is being included in <a href="http://www.pelagodesign.com/blog/tag/postgresql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with postgresql">PostgreSQL</a> 8.3, <a href="http://developer.postgresql.org/pgdocs/postgres/functions-datetime.html">as specified here in the RC1 documentation</a>. But <a href="http://www.pelagodesign.com/blog/tag/postgresql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with postgresql">PostgreSQL</a> 8.3 hasn&#8217;t been released yet, and we needed to fix things immediately.</p>
<p>Our final <a href="http://www.pelagodesign.com/blog/tag/postgresql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with postgresql">PostgreSQL</a> fix was to instead use the <a href="http://www.postgresql.org/docs/8.2/interactive/functions-formatting.html">TO_CHAR(timestamp, &#8216;IYYY&#8217;) function</a>. It&#8217;s not ideal to be using a string formatting function for data comparisons, because it slows down some of the queries. But we had to trade some performance to get things working properly again in the new year. <a href="http://www.postgresql.org/community/weeklynews/">As soon as the PostgreSQL developers release a stable version of 8.3</a>, we&#8217;ll change our queries back to using EXTRACT(ISOYEAR, timestamp). </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2008/01/10/iso-week-and-year-in-php-and-postgresql/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Messenger bags</title>
		<link>http://www.pelagodesign.com/blog/2008/01/04/messenger-bags/</link>
		<comments>http://www.pelagodesign.com/blog/2008/01/04/messenger-bags/#comments</comments>
		<pubDate>Fri, 04 Jan 2008 18:00:23 +0000</pubDate>
		<dc:creator>John</dc:creator>
		
		<category><![CDATA[Creative Engineering]]></category>

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

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

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2008/01/04/messenger-bags/</guid>
		<description><![CDATA[Check out these great messenger bags made from recycled materials, from Alchemy Goods:
http://alchemygoods.com/messenger.html
]]></description>
			<content:encoded><![CDATA[<p>Check out these great messenger bags made from recycled materials, from <a href="http://alchemygoods.com/">Alchemy Goods</a>:<br />
<a href="http://alchemygoods.com/messenger.html">http://alchemygoods.com/messenger.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2008/01/04/messenger-bags/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
