<?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>firsttube.com &#187; Development</title>
	<atom:link href="http://www.firsttube.com/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.firsttube.com</link>
	<description>crunchy nuggets, served semi-daily</description>
	<lastBuildDate>Tue, 03 Jan 2012 00:14:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Why Degrade Gracefully?</title>
		<link>http://www.firsttube.com/read/why-degrade-gracefully/</link>
		<comments>http://www.firsttube.com/read/why-degrade-gracefully/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 23:11:25 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://firsttube.com/?p=1472</guid>
		<description><![CDATA[I got thinking today, as I near roll out of an internal helpdesk app heavily using jQuery, why we bother to degrade our scripts so they work without javascript. I get it: some people have javascript disabled in their browser&#8230; &#8230; <a href="http://www.firsttube.com/read/why-degrade-gracefully/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I got thinking today, as I near roll out of an internal helpdesk app heavily using jQuery, why we bother to degrade our scripts so they work without javascript.  I get it: some people have javascript disabled in their browser&#8230; but my question is this: so what?</p>
<p>Javascript is a core part of web experience today.  In fact, I&#8217;d say that, on the desktop in the full browser front, if your browser doesn&#8217;t support at least HTML 4, javascript, and CSS 2, you&#8217;re not playing with the right tools.  After all, we expect that people can parse HTML, why not expect that javascript is a pre-requisite for web usage?</p>
<p><a href="http://firsttube.com/uploads/2009/07/javascript_1.jpg"><img class="aligncenter size-full wp-image-1473" title="javascript" src="http://firsttube.com/uploads/2009/07/javascript_1.jpg" alt="javascript" width="400" height="300" /></a></p>
<p>Some of us go to great pains to make sure our sites work should a user have javascript disabled.  But I&#8217;m actually considering the opposite: hiding certain critical elements if you don&#8217;t have javascript enabled to ensure that each visitor is on an even playing field.  Wrapping submit buttons in jQuery&#8217;s <em>append()</em> method, submitting data on <em>click()</em>, and plentifully exchanging JSON data via AJAX throughout ought to properly cripple participation of those who opt out of script execution on my site.</p>
<p>It all comes down to this: if you want your site to reach the widest audience possible, you need to anticipate that the client may not allow you scripting capability.  Conversely, on our intranet, and maybe one day on my websites, I&#8217;m doing the opposite: if you want to use the site, you&#8217;ve got to enable javascript: if you don&#8217;t, well&#8230; your loss.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/why-degrade-gracefully/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>IE: Sucking Hard Since Version 5</title>
		<link>http://www.firsttube.com/read/ie-sucking-hard-since-version-5/</link>
		<comments>http://www.firsttube.com/read/ie-sucking-hard-since-version-5/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 13:27:00 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Rant]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Web Browser]]></category>
		<category><![CDATA[Web Browsers]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://firsttube.com/?p=1336</guid>
		<description><![CDATA[This code (extracted from a javascript file) works in every major browser except IE (including IE8): $&#40;'a[rel*=fancybox]'&#41;.fancybox&#40;&#123; 'frameWidth' : 500, 'frameHeight' : 465, 'hideOnContentClick' : false, 'centerOnScroll' : true, &#125;&#41;; This is the fix: $&#40;'a[rel*=fancybox]'&#41;.fancybox&#40;&#123; 'frameWidth' : 500, 'frameHeight' : &#8230; <a href="http://www.firsttube.com/read/ie-sucking-hard-since-version-5/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This code (extracted from a javascript file) works in every major browser except IE (including IE8):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">     $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a[rel*=fancybox]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fancybox</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
          <span style="color: #3366CC;">'frameWidth'</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">500</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">'frameHeight'</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">465</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">'hideOnContentClick'</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">'centerOnScroll'</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
     <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is the fix:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">     $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a[rel*=fancybox]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fancybox</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
          <span style="color: #3366CC;">'frameWidth'</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">500</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">'frameHeight'</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">465</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">'hideOnContentClick'</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">'centerOnScroll'</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span>
     <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>See the difference? Yeah, neither did I.  The difference is the last comma in the argument list.</p>
<p>That&#8217;s 3 consecutive major versions of IE that have been absolutely crap.  Why anyone continues to use IE is beyond me.  IE: sucking hard since version 5.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/ie-sucking-hard-since-version-5/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Firefox is Still King When It Comes to Development</title>
		<link>http://www.firsttube.com/read/firefox-is-still-king/</link>
		<comments>http://www.firsttube.com/read/firefox-is-still-king/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 15:01:35 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Web Browsers]]></category>

		<guid isPermaLink="false">http://firsttubecom/?p=916</guid>
		<description><![CDATA[At home, I prefer Camino.  At work, I use Google Chrome.  I find both to be very pleasurable experiences.  But no browser out there comes even close to challenging Firefox when it comes to development.   First of all, extensions &#8230; <a href="http://www.firsttube.com/read/firefox-is-still-king/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At home, I prefer <a href="http://caminobrowser.org">Camino</a>.  At work, I use <a href="http://google.com/chrome">Google Chrome</a>.  I find both to be very pleasurable experiences.  But no browser out there comes even close to challenging Firefox when it comes to development.  </p>
<p>First of all, extensions such as <a href="https://addons.mozilla.org/firefox/addon/2108">Stylish</a> and <a href="http://getfirebug.com">Firebug</a> are invaluable.  In fact, scratch Firebug, the default Firefox error console alone is aces to me.</p>
<p>Is there anyone who can tell me why no browser besides Firefox has a &#8220;View Background Image&#8221; link even as an option? How come no other browser has developer friendly stuff? I know that the Web Inspector in Webkit browsers is really cool &#8211; I love Webkit &#8211; but ultimately, it&#8217;s Firefox I often resort to when I&#8217;m doing real work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/firefox-is-still-king/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OSNews vs. WordPress</title>
		<link>http://www.firsttube.com/read/osnews-vs-wordpress/</link>
		<comments>http://www.firsttube.com/read/osnews-vs-wordpress/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 00:35:20 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Nerd]]></category>
		<category><![CDATA[OSNews]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://firsttubecom/?p=656</guid>
		<description><![CDATA[I&#8217;ve spent quite a bit of time, over the last 5 or 6 days, diving into WordPress and learning what makes it tick.  Parts of WordPress are really impressive &#8211; just flat out cool. The way some of it works &#8230; <a href="http://www.firsttube.com/read/osnews-vs-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent quite a bit of time, over the last 5 or 6 days, diving into WordPress and learning what makes it tick.  Parts of WordPress are <em>really</em> impressive &#8211; just flat out <em><strong>cool</strong></em>. The way some of it works is fairly complex and deciphering it sometimes means reading page after page after page to understand an entire routine.  But sometimes, when you finally see, end to end, how something in WordPress works &#8211;  I mean really see individual bits of the engine &#8211; you have to admit it teaches you a little about PHP.  WordPress, underneath it all, is a pretty big beast and its strength and ubiquitous presence comes largely, I think, from the fact that it can do virtually anything.  The really sweet plugin system, the ways hooks work, &#8220;The Loop,&#8221; the dynamic options panel &#8211; it&#8217;s all very educational.  </p>
<p>The interesting thing here is that I&#8217;ve browsed the source of <a href="http://slashcode.com">Slash</a>, <a href="http://scoop.kuro5hin.org">Scoop</a>, <a href="http://phpnuke.org">phpNuke</a>, and now <a href="http://wordpress.org">WordPress</a>, and all of them are <strong>definitively</strong> more complex and much heavier than the entire <a href='http://osnews.com'>OSNews</a> codebase. Now, before you jump all over me &#8211; firstly, Slash and Scoop are Perl, and I don&#8217;t really read Perl, so I can&#8217;t speak as an expert there.  Secondly, WordPress and Nuke both are very portable and dynamic, whereas <a href='http://osnews.com'>OSNews</a> has a narrow focus and, location-wise, is very static.  But that aside, <a href='http://osnews.com'>OSNews</a> has withstood simultaneous link bombs from <a href="http://slashdot.org">Slashdot</a> and <a href="http://digg.com">Digg</a>.  As amazing as WordPress is, it&#8217;s mostly amazing that it functions at all and loads in less than 2 minutes per page with as much going on as I can see behind the scenes.   That&#8217;s not a cut on WordPress, by the way.</p>
<p>In fact, if anything , what is really impressed upon me is how smooth and simple <a href='http://osnews.com'>OSNews</a> code is, if I may be so bold.  OSNews runs superfast due, in part, to lots of creative caching, some on-demand, some via cron.  But it also does so because of highly efficient queries that are measured for speed on their JOINs, meaning in some cases, it&#8217;s faster to do 20 simple queries than one complex one, or build a long and scary chain of &#8220;OR x=a OR x=b OR x=c OR x=d&#8230;&#8221;  Watching WordPress code in action is really fun for me, but watching <a href='http://osnews.com'>OSNews</a> work knowing what I now know about how much work PHP can cram into its threads is even more fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/osnews-vs-wordpress/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The Third Great Platform</title>
		<link>http://www.firsttube.com/read/The-Third-Great-Platform/</link>
		<comments>http://www.firsttube.com/read/The-Third-Great-Platform/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 14:31:40 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[SDK]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/The-Third-Great-Platform</guid>
		<description><![CDATA[First, there was the PC. Then, there was the web. Now, there is the iPhone. At long last, the iPhone will become what it was destined to be. In June, when the iPhone 2.0 update is released, the iPhone&#8217;s true &#8230; <a href="http://www.firsttube.com/read/The-Third-Great-Platform/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>First, there was the PC. <br />
Then, there was the web. <br />
Now, there is the iPhone.  </p>
<p>At long last, the iPhone will become what it was destined to be.  In June, when the <a href="http://www.engadget.com/2008/03/06/iphone-2-0-software-update-hits-in-june/">iPhone 2.0 update</a> is released, the iPhone&#8217;s true potential will be unlocked.  VoIP? Sure, why not!? Games? You betcha.  Exchange, ActiveSync, Remote Wipe, 802.1X? Check.  How about access to the entire SDK via XCode, a compact framework (Cocoa Touch), a native emulator, and access to the SQLite databases present in the iPhone file system? Yup.  Lastly, how about the most innovative platform in the last 20 years that has single handedly made the mobile web viable? Present and accounted for.  </p>
<p>In fact, the iPhone is a new generation, and it&#8217;s been grunting along the sidelines as a gloried browser.  But come iPhone 2.0, it will validate itself as one of the most amazing devices out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/The-Third-Great-Platform/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How To REALLY Survive Digg on a Shared Host</title>
		<link>http://www.firsttube.com/read/how-to-really-survive-digg-on-a-shared-host/</link>
		<comments>http://www.firsttube.com/read/how-to-really-survive-digg-on-a-shared-host/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 22:48:29 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Digg]]></category>
		<category><![CDATA[High Performance]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/How-To-REALLY-Survive-Digg-on-a-Shared-Host</guid>
		<description><![CDATA[After reading a ridiculous post on &#8220;surviving the Digg effect on a shared host,&#8221; (and then laughing ridiculously at it), I decided to write a real tutorial on real-live ways not only to survive the Digg effect, but also a &#8230; <a href="http://www.firsttube.com/read/how-to-really-survive-digg-on-a-shared-host/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After reading a ridiculous post on &#8220;<a href="http://digg.com/programming/How_to_Survive_Digg_on_a_Shared_Host">surviving the Digg effect on a shared host</a>,&#8221; (and then laughing ridiculously at it), I decided to write a <i>real</i> tutorial on real-live ways not only to survive the Digg effect, but also a simple but powerful way to improve your site&#8217;s performance.  Read more within.</p>
<p><span id="more-92"></span><br />
The fact is, it&#8217;s rarely PHP that crashes a website.  It&#8217;s usually overloading MySQL and/or bandwidth limitations.  Obviously, we can&#8217;t do much about bandwidth.  If you&#8217;re on a really cool host, they may be psyched for your Digging or Slashdotting, but most are not particularly keen on you using too much processor, too much bandwidth, or too many MySQL connections.  Although MySQL is capable of amazing scaling, rarely do web hosts leverage it properly, and even if they did, rarely do most programmers know how to read into slow queries, find inefficient code like loops within loops, and debug a site performance before it&#8217;s too late.  </p>
<p>The site linked from Digg shares a very lame trick, let&#8217;s examine:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//put this code at the very beginning of your page, before anything else</span>
<span style="color: #000088;">$randomdigg</span> <span style="color: #339933;">=</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$randomdigg</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Thanks for visiting, but the site is under a great deal of 
stress due to being on the front page of Digg. 
Please try back in a few moments. Thanks!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Ok, so essentially, approximately 25% of the time, the page will work, the other 75% of the time, the user will get the message and be asked to refresh later.  That&#8217;s really lame.  First off, unless you want your website to be functional only 25% of the time, you have to be there babysitting it when it hits front page.  Also, you need to remove this code.  But what if you wanted everything to happen automagically? What if your site could withstand a digging, a slashdotting, a redditing, an OSNews&#8217;ing, a Farking, whatever&#8230;. all at once, without being forewarned?   </p>
<p>Although there are lots of [[http://www.danga.com/memcached/|tools that can do magic for you]], you can leverage plain old PHP to do this  dirty work for you, and it&#8217;s easy to integrate into your site.  </p>
<p>Here&#8217;s the premise, we examine the referrer of the page, and if the page is from one or many domains that you specify, you build a cache ON REQUEST.  Then, you serve the cached version.  When the cache stales, say after minute or two, you refresh it, as needed, again, on request. And the best part is, it&#8217;s easy to do. </p>
<p>So, let&#8217;s review the code.  First, at the top of the page, let&#8217;s do this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$rfr</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_REFERER'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//get the referring site</span>
<span style="color: #000088;">$op</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strstr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rfr</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'digg.com'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$op</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;do-cache&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> 
<span style="color: #000088;">$cache</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/path/to/mysite/cache/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$postid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.html&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Let&#8217;s take it line by line.  First, we get the referring site.  If it is digg.com, we&#8217;re going to turn the cache on by setting $op to &#8220;do-cache.&#8221; Note that we preset the $op variable to null to prevent abuse.  Next, we define the file we&#8217;re going to use as the cache.  Since we might want to do this for any entry/page, we&#8217;ll give it a unique address.  Remember that you do not have to use .html as an extension, since it&#8217;s static code anyway. I&#8217;ve seen &#8220;id.cache&#8221;, &#8220;id.txt&#8221;, and even just &#8220;id&#8221;.  It doesn&#8217;t matter, it will be included in a PHP page and spit out as X/HTML anyway.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$fmt</span> <span style="color: #339933;">=</span> <span style="color: #990000;">filemtime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fmt</span> <span style="color: #339933;">&gt;</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">180</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
		<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: http://mysite.com/cache/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.html&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fmt</span> <span style="color: #339933;">&gt;</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1800</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
         <span style="color: #666666; font-style: italic;">//cache will reload if it's been reloaded </span>
         <span style="color: #666666; font-style: italic;">//in the last half hour</span>
	   <span style="color: #000088;">$op</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;do-cache&quot;</span><span style="color: #339933;">;</span> 
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	   <span style="color: #000088;">$op</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This might seem overwhelming, but it&#8217;s really not.  Check it out.  If the cache exists, regardless of referrer, we&#8217;re going to check it.  The filemtime() function will tell us when the cache was last refreshed.  If it reports a time in the last 180 seconds (you can change that number), it will redirect you to the cache.  PHP will barely have to do any work, Apache will barely have to do any work, and MySQL will not be touched at all.  Almost any host can hang in there to serve static traffic like this.  </p>
<p>But what about if the cache is old?  Once your site is no longer getting hits every three minutes, for the next 27 minutes, it will blindly reload the cache.  It will keep the cache going as long as the page has been hit in the last 30 minutes.  After no one hits the cache for 30 minutes, it will go back to fully dynamic.  When someone hits the page from digg again, it will start the caching process again.  In this case, we&#8217;re going to let the cache rebuild.  Enter the next part of the code.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$op</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;do-cache&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">ob_clean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>If the $op variable is set to &#8220;do-cache&#8221;, our mission is&#8230; uh&#8230; to build or rebuild the cache. So, we begin with two simple PHP standard functions, <i>ob_clean()</i> and <i>ob_start()</i>.  The &#8220;ob&#8221; in these functions stands for &#8220;output buffering.&#8221;  When you buffer your output, nothing is echoed by the script, but rather written to a buffer.  In short, it&#8217;s all stored up in memory for eventual dumping later.  Now we stop the caching scripts and just write our normal HTML via PHP and MySQL.    </p>
<p>At the end of the page &#8211; the very end, after your html element is closed, you&#8217;ll need this last bit.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$op</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;do-cache&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #000088;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ob_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
		<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span><span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #009900;">&#125;</span>
	<span style="color: #339933;">@</span><span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #990000;">ob_get_flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  	
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>What&#8217;s up with this? Again, if we&#8217;re building the cache, we&#8217;re getting the contents of the buffer, which contains all of our page.  Then we&#8217;re opening the cache file we specified above, and lastly, dumping the contents of the buffer into the cache file.  Our final action is to clear the buffer, which is unnecessary to us now anyway.  </p>
<p>That&#8217;s it.  Your cache is reloaded, and will be served for the next three minutes, after which it will reload the cache every 3 minutes until no one hits the site for 30 minutes.  Then it will go back to dynamic.  If another digg visitor comes, it will recache and serve the cache.  Having written several types of caching mechanisms for large sites myself, I can tell you this &#8220;cache on demand&#8221; method works.  On <a href="http://www4.osnews.com">OSNews v4</a>, we use this for things like user-specific RSS files, which aren&#8217;t plausibly built via cron jobs and, frankly, we don&#8217;t want to allow access to MySQL without limit.  They reload every 60 minutes, regardless of referer.  </p>
<p>If you maintain a site and have any concern about being Dugg, I encourage you to research some sort of caching mechanism.  Your web host will thank you, and you will be thankful for the maintained uptime and high hit count.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/how-to-really-survive-digg-on-a-shared-host/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Integers on the Intertubes</title>
		<link>http://www.firsttube.com/read/integers-on-the-intertubes/</link>
		<comments>http://www.firsttube.com/read/integers-on-the-intertubes/#comments</comments>
		<pubDate>Wed, 12 Dec 2007 16:22:44 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/Integers-on-the-Intertubes</guid>
		<description><![CDATA[Some time ago, I wrote an application for my company. Like most weblets I&#8217;ve written, this used PHP and either MySQL or MSSQL for the backend. This particular application logged all phone calls. As part of the record, it would &#8230; <a href="http://www.firsttube.com/read/integers-on-the-intertubes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some time ago, I wrote an application for my company.  Like most weblets I&#8217;ve written, this used PHP and either MySQL or MSSQL for the backend.  This particular application logged all phone calls. As part of the record, it would record the caller&#8217;s account number, which is a 5 or 6 digit integer.</p>
<p>So, I got a phone call from the director of our customer contact department this week.  He was concerned about the reports.  He made a decision last week that when a call came in that was a lead &#8211; in other words, a non-customer, that his people would fill the phone number from the caller ID into the account number field.  But when he ran his export reports, he found that hisn techs had entered this phone number for ALL of the calls: 429-496-7295.  That&#8217;s weird, he said.  So he called me and asked why that was.  I checked all the calls and most were from one woman, so my first instinct was &#8220;Check if her browser has autocomplete turned on&#8221;.  But he swore that he tried it too and gotten the same result.</p>
<p>I checked the database and sure enough, it was right there: 429-496-7295, in all of the fields.  So I went back to the code.  In short, I took the input from the form, and declared it like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$accountnum</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'accountnum'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Pretty straightforward: explicitly declare the type.  So, I started my debugging by attempting to manually enter the data into the database.  Sure enough: the account key field showed this: 4294967295.</p>
<p>So, I went back to the PHP and started by dumping out the raw SQL query:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">INSERT INTO calls <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'x'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'x'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'x'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'4294967295'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'x'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'x'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>What? So the database automatically converts it to this weird phone number and PHP does too?  Suddenly it occured to me. One of the benefits of 64-bit computing is the ability to address more memory.  There are limits to what can be done in 32-bit computing, and one is that <a href="http://en.wikipedia.org/wiki/Integer_(computer_science)">integers have a limit</a>!  In this case, a database field called &#8220;integer&#8221; is limited to numbers between -2,147,483,648 and +2,147,483,647.  It just so happens that the number is the same length as a US phone number &#8211; 10 digits.  Changing the db field to &#8220;BIGINT&#8221; allowed me to manually run the SQL query and it worked.  But the app still didn&#8217;t.</p>
<p>PHP&#8217;s int() and (int) $var syntaxes both conform to the integer limit.  So I devised a work around:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ac</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'accountnum'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ac</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$ac</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$ac</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<p>It&#8217;s not gorgeous, but it will more than suffice for an internal app.  We web programmers don&#8217;t usually have to deal with big integers, so it&#8217;s totally possible that web developers would never have had occasion to handle a situation like this.  Here&#8217;s looking forward to native 64-bit for our next server, though.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/integers-on-the-intertubes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I Switched to Safari 3</title>
		<link>http://www.firsttube.com/read/I-Switched-to-Safari-3/</link>
		<comments>http://www.firsttube.com/read/I-Switched-to-Safari-3/#comments</comments>
		<pubDate>Sun, 26 Aug 2007 10:42:15 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Web Browsers]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/I-Switched-to-Safari-3</guid>
		<description><![CDATA[I really did not expect to ever post something like this, but it&#8217;s true: I switched to Safari 3. I love Camino, really I do. But recently, its limitations have been bothering me. I prefer my tabs in a very &#8230; <a href="http://www.firsttube.com/read/I-Switched-to-Safari-3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I really did not expect to ever post something like this, but it&#8217;s true: I switched to Safari 3.</p>
<p>I love <b>Camino</b>, really I do.  But recently, its limitations have been bothering me.  I prefer my tabs in a very specific order and often I have several tabs open.  If ever I close a tab by mistake, I cannot get that same order without doing tons of work or re-launching.  Safari 3 draggable tabs.  </p>
<p>One of the things that used to bother me about Safari was that there was no &#8220;New Tab&#8221; button available for the toolbar.  There is now. It&#8217;s also got great keychain integration, private browing, the original embedded RSS,  true Aqua widgets, resizable text boxes, easy PDF integration, and it&#8217;s super-fast.   </p>
<p>Camino doesn&#8217;t support Ad-Block, but rather, stylesheet-based filtering.  Safari does that too, by default, and it&#8217;s even easier to use than it is in Camino.  Safari doesn&#8217;t have any Flash problems and once you add &#8220;Safari Stand&#8221; and enable the debug menu, you have a perfect drop in replacement.  </p>
<p>My biggest complaint about Camino was the lack of development tools.  It doesn&#8217;t have a Javascript debugger (<a href="http://escapedthoughts.com/camino/hacks">ChimericalConsole</a> never worked me for), doesn&#8217;t have a decent source viewer, doesn&#8217;t have many third party hacks to add functionality &#8211; it&#8217;s a browser for users, not developers.  Without XUL, it&#8217;s tough to add features easily.  And that made it tough to use for me.  When I did any serious work, I&#8217;d always switch to Opera or, more recently, Safari 3.  Safari 3&#8242;s Inspector is just awesome.  </p>
<p>So&#8230; for now, I am Opera on Windows and Safari on Mac.  My browser requirements are more demanding than most. I have felt for some time that Opera and Firefox on Mac just &#8220;feel&#8221; wrong, they don&#8217;t fit.  So we&#8217;ll see how the Safari experiment goes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/I-Switched-to-Safari-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Export Blogsome, Export Slashdot Journal</title>
		<link>http://www.firsttube.com/read/Export-Blogsome-Export-Slashdot-Journal/</link>
		<comments>http://www.firsttube.com/read/Export-Blogsome-Export-Slashdot-Journal/#comments</comments>
		<pubDate>Wed, 22 Aug 2007 16:55:07 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Blogsome]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Small Axe]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/Export-Blogsome-Export-Slashdot-Journal</guid>
		<description><![CDATA[I was recently issued a challenge: backup a blogsome blog and the content of a Slashdot journal and merge them into a single database. I foolishly accepted this challenge, knowing that Blogsome is based on WordPress. Come to find out &#8230; <a href="http://www.firsttube.com/read/Export-Blogsome-Export-Slashdot-Journal/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was recently issued a challenge: backup a blogsome blog <i>and</i> the content of a Slashdot journal and merge them into a single database.  I foolishly accepted this challenge, knowing that Blogsome is based on WordPress.  Come to find out that Blogsome doesn&#8217;t allow you to backup or export their WordPress content.  Also, Slashdot doesn&#8217;t provide you a way to export or backup your journal.  The prize was sweet: a brand new, fairly expensive, unlocked mobile phone.  </p>
<p>If you want to make a mirror of your blogsome blog, you can use a single very powerful command to generate a snapshot of it from any Linux machine or Windows with Cygwin installed: </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-k</span> <span style="color: #660033;">-m</span> <span style="color: #660033;">-r</span> http:<span style="color: #000000; font-weight: bold;">//</span>url</pre></div></div>

<p>
But this will only create a static HTML mirror of your website.  It won&#8217;t allow you manipulate content or put it into another database.  That leaves only one way to do it &#8211; request the entire site page by page, and parse each page individually.  RSS is not reliable here, as most people have it set to only 15 or so items and parsing an enormous page make make PHP or your server run out of memory or alloted script execution time. </p>
<p>It&#8217;s a multi-step process, to be certain.  It was actually <i>painful</i> to go through the process.  Requesting over and over, debugging the script line by line.  It takes several steps to get things right.  But, eventually, I did it. I was able to export a Blogsome blog in its entirety &#8211; every entry, all the categories, all the comments with emails and websites &#8230;everything.  </p>
<p>Slashdot was the same.  It took some tinkering, but eventually, I was able to backup a very lengthy Slashdot journal.  Again, in its entirety.  I got every post, the date, etc.  It was not simple, but it worked well.  And I not only got them backed up, I merged them into a single database serving up&#8230; Small Axe 0.6 (which was a whole adventure of its own, taking current <a href='http://firsttube.com'>firsttube.com</a> code and &#8220;neutralizing&#8221; it).  Suffice it to say, when I saw all entries working and served in Small Axe, I had a huge smile.   Turns out that the person I was doing this for decided against Small Axe (only because it doesn&#8217;t yet offer all the bells and whistles WordPress does, even if it is a beast).  But it was irrelevant &#8211; the hard part was getting the data properly, and that&#8217;s done.  Migrating to *any* blog database is possible if you have the time, inclination, and skill to write a SQL export/import script. </p>
<p>Here&#8217;s how it works: </p>
<p>* Cycle through each page of the blogsome blog.  On each page, we get the entries, the URL, the postid, and other relevant info.  We set a flag on each item to 0. <br />
* As we retreive the items, we correct the path to images, spacing, smilies, etc. <br />
* Then we cycle through each page individually.  We have all the URLs already, so we go through each one and parse comments.  It&#8217;s important to know that comment owner comments are marked up differently.  As we get the comments, we upodate the flag and let the script run on its own.  Our 900+ items took about an hour by meta-refreshing the fully rendered page every 3 seconds. <br />
* As we go through the comments, we strip tags we don&#8217;t want, we fix emoticons, we fix internal links, spacing, etc.  We must expose emails temporarily if we want them to transfer over. <br />
* Finally, we import them all into a central database with an agreed schema.  </p>
<p>If you have a Blogsome blog and/or a Slashdot journal you need backed up, I can help you do it.  It&#8217;s not a simple process, but it is very accurate and preserves whatever data is exposed via HTML.  So for the right barter, I would be very motivated to help.  If I can simplify the process, I may create an open script to do this.  But for now, I&#8217;ve got the code.  </p>
<p>On a related note, I&#8217;ll probably release an updated version of Small Axe sometime in the not too distant future, because the amount of changing I&#8217;ve done and all the features I&#8217;ve just implemented are killer.  Small Axe is FAR from WordPress caliber tested, but it&#8217;s SUPER simple and can do all the basics of a normal blog, including templating, smart per-domain caching, blocking by ip, username, email, or keyword, gravatar support, tons of configuration options, RSS and Atom support, threaded commenting, post locking, post expiring, browser identification, slug-based permalinking, and much more.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/Export-Blogsome-Export-Slashdot-Journal/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Featured Link Integration</title>
		<link>http://www.firsttube.com/read/Featured-Link-Integration/</link>
		<comments>http://www.firsttube.com/read/Featured-Link-Integration/#comments</comments>
		<pubDate>Fri, 17 Aug 2007 16:40:49 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/Featured-Link-Integration</guid>
		<description><![CDATA[I integration the &#8220;Link Blog&#8221; into the RSS feed a few weeks ago, and now I&#8217;ve integrated it into the front page. Hope you enjoy.]]></description>
			<content:encoded><![CDATA[<p>I integration the &#8220;Link Blog&#8221; into the RSS feed a few weeks ago, and now I&#8217;ve integrated it into the front page.  Hope you enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/Featured-Link-Integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>firsttube.com revision 8</title>
		<link>http://www.firsttube.com/read/firsttubecom-revision-8/</link>
		<comments>http://www.firsttube.com/read/firsttubecom-revision-8/#comments</comments>
		<pubDate>Sun, 22 Apr 2007 16:05:29 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/firsttubecom-revision-8</guid>
		<description><![CDATA[If you are one of the few people NOT reading this from either a feed reader or the OSNews Staff Blog, you&#8217;ll notice I&#8217;ve completely redesigned the site (with a little help from Site Studio). The new site is much &#8230; <a href="http://www.firsttube.com/read/firsttubecom-revision-8/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are one of the few people NOT reading this from either a feed reader or the <a href="http://osnews.com/staff">OSNews Staff Blog</a>, you&#8217;ll notice I&#8217;ve completely redesigned the site (with a little help from Site Studio).  </p>
<p>The new site is much simpler, easier to use, and less overwhelming.  I will be adding some of the previous material &#8211; links and such &#8211; back in over the next few weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/firsttubecom-revision-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OSNews 4 Outline</title>
		<link>http://www.firsttube.com/read/osnews-4-outline/</link>
		<comments>http://www.firsttube.com/read/osnews-4-outline/#comments</comments>
		<pubDate>Wed, 17 Jan 2007 19:11:12 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[OSNews]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/OSNews-4-Outline</guid>
		<description><![CDATA[At the request of some of my readers, I am going to continue to discuss some OSNews development. If you are not interested in the technical bits, this piece is not for you, however, if you are, read on for &#8230; <a href="http://www.firsttube.com/read/osnews-4-outline/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At the request of some of my readers, I am going to continue to discuss some <a href='http://osnews.com'>OSNews</a> development.  If you are not interested in the technical bits, this piece is not for you, however, if you are, read on for an account of how <a href='http://osnews.com'>OSNews</a> 4 will work.<br />
<span id="more-229"></span><br />
Although I never really made this public, the <a href="http://jobs.osnews.com">Jobs.OSNews</a> site was really a prototype for how I see <a href='http://osnews.com'>OSNews</a> looking and feeling.  In the sense that the screen is not too crowded but has plenty of control, the basic colors are still a smooth green, there is plenty of white space and liberal use of Javascript where necessary.  </p>
<p>I&#8217;ve also discarded the concept of &#8220;collapsed threading&#8221; vs. &#8220;expanded threading.&#8221;  All threads will be expanded, because it&#8217;s less code and it&#8217;s easier to maintain.  Building on that, comments below your &#8220;threshold&#8221; will not require a reload, but rather just an &#8220;expand&#8221; to be viewed.  Lots of things, like viewing below-threshold comments, moderation, etc will not require a page load.  Only some of this requires actual AJAX, the rest is just Javascript. </p>
<p>I&#8217;ve also cleaned up the URIs quite a bit.  First off, pages no longer have a file extension.  If we one day rewrite the site in Python, or Ruby on Rails, or whatever, we&#8217;ll be future compatible.  I will be redircting all working pages to the proper page in the new site, so links will still work.  It will be nice to reference my comments at www.osnews.com/user/ascheinberg/comments, my bookmarks at www.osnews.com/user/ascheinberg/bookmarks, my &#8220;starred stories&#8221; (more on that below) at www.osnews.com/user/ascheinberg/starred, my friends and fans at www.osnews.com/user/ascheinberg/relationships, and my public profile at just www.osnews.com/user/ascheinberg.  </p>
<p>That said, several of the pages that exist now will go bye-bye in favor of better organized pages.  Besides just the user info pages, you&#8217;ll find that thread.php, subthread.php, permalink.php, read_thread.php all pretty much capture the same information.  Also, reply.php will be blended with the regular comment posting section.  So a code cleanup is in order.   </p>
<p>I&#8217;m rewriting in XHTML, although I&#8217;m not worrying about validation just yet.  That said, it&#8217;s almost entirely styled with CSS, and thus far, there are no tables. That&#8217;s not to say there will not be several tables, but for now, layout is solely CSS.  </p>
<p>I came up with the concept of &#8220;starred stories&#8221; because I want to make &#8220;recommendations&#8221; more of a suggestion for other readers.  I will be expanding on this point in future posts, but trust me, it will make sense or it will be left out. </p>
<p>I also am currently supporting something I&#8217;ve not decided on: avatars.  It&#8217;s not necessary, but since I wrote an image resizing script for the admin backend for automatic thumbnailing of screenshots, I can easily support an automatic resize for avatars, and honestly, they look nice.   </p>
<p>The threading implementation, believe it or not, is actually faster than the current implementation because it&#8217;s much sleeker code.  I&#8217;s very cool to quickly switch between thresholds and view modes without setting cookies or updating profiles.  </p>
<p>One of the very cool features I&#8217;ve already got working is pretty much a tagging system, except instead of liberal use of tags, it will be used to &#8220;group&#8221; stories.  Let&#8217;s say it&#8217;s time for WinHEC &#8211; we can group all stories from there as &#8220;WinHEC 2007&#8243; or something.  Or &#8220;CES.&#8221;  Or &#8220;Macworld,&#8221; &#8220;LinuxExpo,&#8221; or even &#8220;Fedora Core 7.&#8221;  It remains to be seen HOW we will use this system, but it&#8217;s already in the actual live database.  Note that it will NOT show up in the current version of <a href='http://osnews.com'>OSNews</a> (v3).</p>
<p>Lastly, for today&#8217;s OSN4 details, I have one more fun feature I&#8217;ve toyed with for some time: user defined conversations.  Essentially, it allows users to create their own <a href='http://osnews.com'>OSNews</a> article, or even just a blurb for discussion.  I don&#8217;t know the specifics, this isn&#8217;t coded yet, but I think this could be really neat &#8211; let&#8217;s say you start a conversation: &#8220;Predict the specs for the next macbooks&#8221; or &#8220;Your experiences with Windows Vista.&#8221;  Could be fun, right?   We&#8217;ll see whether or not this turns out to make the cut.  </p>
<p>Lastly, I want to share one more thing: RSS everywhere.  Every relevant page will have an RSS feed.  I&#8217;m excited about this.  </p>
<p>So far, I have a working site that displays the main pages (the index, the story page, and the comment pages, with a working working threading implementation).  More as it comes. </p>
<p>As always, all of this OSN4 stuff is subject to change.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/osnews-4-outline/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New OSNews Project</title>
		<link>http://www.firsttube.com/read/New-OSNews-Project/</link>
		<comments>http://www.firsttube.com/read/New-OSNews-Project/#comments</comments>
		<pubDate>Sun, 19 Nov 2006 08:24:53 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[OSNews]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/New-OSNews-Project</guid>
		<description><![CDATA[I&#8217;ve been off the radar with firsttube.com this last week, mostly because my free time was spent working on a new project for OSNews. I hope we&#8217;re going to roll it out after Thanksgiving, but it&#8217;s definitely the nicest code &#8230; <a href="http://www.firsttube.com/read/New-OSNews-Project/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been off the radar with <a href='http://firsttube.com'>firsttube.com</a> this last week, mostly because my free time was spent working on a new project for OSNews.  I hope we&#8217;re going to roll it out after Thanksgiving, but it&#8217;s definitely the nicest code I&#8217;ve written thus far and probably the nicest site.  A lot of what I wrote here is going to influence the way we move with OSN4.  </p>
<p>In the meantime, this new project is hopefully going to be launched in the next week or two and I&#8217;m hoping it makes a splash.  In the meantime, I need a few beta testers to provide some feedback.  If you&#8217;d like to help test a new site we&#8217;ve been working on, please post a comment below and I can explain what to do.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/New-OSNews-Project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>firsttube.com gets threads</title>
		<link>http://www.firsttube.com/read/firsttubecom-gets-threads/</link>
		<comments>http://www.firsttube.com/read/firsttubecom-gets-threads/#comments</comments>
		<pubDate>Tue, 07 Nov 2006 20:46:38 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[OSNews]]></category>
		<category><![CDATA[Threading]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/firsttubecom-gets-threads</guid>
		<description><![CDATA[I understand that some people believe that threading comments are unintuitive, they confuse the user, and that they are ugly. I like &#8216;em. So this site now supports threading in the comments. Now &#8211; as of right now, you can &#8230; <a href="http://www.firsttube.com/read/firsttubecom-gets-threads/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I understand that some people believe that threading comments are unintuitive, they confuse the user, and that they are ugly.  I like &#8216;em.  So this site now supports threading in the comments. </p>
<p>Now &#8211; as of right now, you can only reply once, like digg, but it supports two deep.  This is only because I haven&#8217;t found a more elegant way to allow deeper threading in the code.  As soon as I do, I will be allowing deeper threading,  probably 3 or 4 comments deep for aesthetic reasons.</p>
<p>The entire thing is done in CSS, unlike <a href='http://osnews.com'>OSNews</a> which is hard coded to the pixel with very complex code that  really makes me uncomfortable when I see it. This is much nicer.  It&#8217;s all done via templates, and there are only two &#8211; one for comments and one for threads, and this will probably change to one soon too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/firsttubecom-gets-threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small Axe Getting Close To Actual Releases</title>
		<link>http://www.firsttube.com/read/Small-Axe-Getting-Close-To-Actual-Releases/</link>
		<comments>http://www.firsttube.com/read/Small-Axe-Getting-Close-To-Actual-Releases/#comments</comments>
		<pubDate>Fri, 27 Oct 2006 15:49:38 +0000</pubDate>
		<dc:creator>Adam S</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Small Axe]]></category>

		<guid isPermaLink="false">http://firsttubecom/read/Small-Axe-Getting-Close-To-Actual-Releases</guid>
		<description><![CDATA[I am very close to releasing a flood of code on smallaxesolutions.com. Included in the first batch are: - Small Axe Encryption (which is VERY breakable (being as though the decrypt code is actually available, but a new version, which &#8230; <a href="http://www.firsttube.com/read/Small-Axe-Getting-Close-To-Actual-Releases/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am very close to releasing a flood of code on <a href="http://smallaxesolutions.com">smallaxesolutions.com</a>.  Included in the first batch are: </p>
<p>- Small Axe Encryption (which is VERY breakable (being as though the decrypt code is actually available, but a new version, which uses a password to decode, will eventually be out).  </p>
<p>- Small Axe PHP XML-RPC API.  YIKES.  What a mouthful.  It&#8217;s by far the easiest API out there.  I have searched high and low for an API.  Version 0.1 is so simple it&#8217;s crazy.  </p>
<p>- Dango 2.1.  A simple discussion board.  Version 3 will be a complete rewrite, so this is a nice mini-step.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firsttube.com/read/Small-Axe-Getting-Close-To-Actual-Releases/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

