<?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>Dereleased &#187; Programs And Tools</title>
	<atom:link href="http://www.dereleased.com/category/programs-and-tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dereleased.com</link>
	<description>Information Saturation</description>
	<lastBuildDate>Sat, 10 Sep 2011 20:41:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Programming Nuances, PHP and JavaScript</title>
		<link>http://www.dereleased.com/2009/09/23/programming-nuances-php-and-javascript/</link>
		<comments>http://www.dereleased.com/2009/09/23/programming-nuances-php-and-javascript/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 20:29:45 +0000</pubDate>
		<dc:creator>Clark</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Programs And Tools]]></category>
		<category><![CDATA[The Internet]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[for-loop]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[loops]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[while-loop]]></category>

		<guid isPermaLink="false">http://www.dereleased.com/?p=97</guid>
		<description><![CDATA[Two little snippets, some simple things that seem to be forgotten when writing code.  First, a general example using PHP; have you ever found yourself writing a loop that looks something like this? $i = 0; while ($row = mysql_fetch_assoc($result) { // ... // maybe something about $i % 2 to determine even-from-odd rows ++$i; [...]]]></description>
			<content:encoded><![CDATA[<p>Two little snippets, some simple things that seem to be forgotten when writing code.  First, a general example using PHP; have you ever found yourself writing a loop that looks something like this?</p>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">(</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">(</span><span style="color: #000088;">$result</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
	<span style="color: #666666; font-style: italic;">// ...</span>
	<span style="color: #666666; font-style: italic;">// maybe something about $i % 2 to determine even-from-odd rows</span>
	<span style="color: #339933;">++</span><span style="color: #000088;">$i</span><span style="color: #339933;">;</span>
<span style="color: #009900;">}</span></pre>
</div>
</div>
<p>If so, remember this: you are (effectively) building a complicated, difficult to read and easy-to-break for-loop.  There is no magic law that says that all three arguments of a for-loop must be related to the same variable (heck, you may have even used a few of them with no arguments in one or more positions).  Consider the following:</p>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">for</span> <span style="color: #009900;">(</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">(</span><span style="color: #000088;">$result</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span><span style="color: #000088;">$i</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
	<span style="color: #666666; font-style: italic;">// ...</span>
	<span style="color: #666666; font-style: italic;">// the same code can go here</span>
<span style="color: #009900;">}</span></pre>
</div>
</div>
<p>While the differences may seem semantic-bordering-on-syntactic-sugar at first (there is no real execution difference between for-loops and while-loops, of course), consider what differences they offer to you as a developer:</p>
<ol>
<li>When looking at the for loop, you know immediately what is involved, instead of hunting for the declaration and incrementation of <span style="font-family:'Courier New',Courier,Monospace;color:#CCC;">$i</span>, or whatever your preferred increment-variable flavor is.</li>
<li>It saves code real-estate</li>
<li>You can easily edit the contents of the loop, as well as what contains the loop, and not worry about destroying an important variable declaration, iteration, etc.</li>
</ol>
<p>Of course, this isn&#8217;t a serious gripe, just a nudge towards thinking outside of &#8220;traditional&#8221; declarations and using something that will be easily maintainable.</p>
<p>Second, remember that everything in JavaScript can be treated like an object-reference.  Of course, you&#8217;ve probably been told this before, but I want to bring up one instance in particular: functions.  If something returns a function reference, you can execute it directly, without cluttering the parser/code with unnecessary calls to things like <span style="font-family:'Courier New',Courier,Monospace;color:#CCC;">setTimeout()</span>.  Consider the following code I have been running into a lot recently (using Prototype 1.6):</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">setTimeout<span style="color: #009900;">(</span>someFunction.<span style="color: #660066;">bind</span><span style="color: #009900;">(</span>window<span style="color: #009900;">)</span><span style="color: #339933;">,</span><span style="color: #CC0000;">10</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>While this will certainly do what you want, the call to <span style="font-family:'Courier New',Courier,Monospace;color:#CCC;">setTimeout()</span> is superfluous, and serves only to confound the matter.  Since it is an object reference, you may use function notation to execute it like any other function object, such as:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">someFunction.<span style="color: #660066;">bind</span><span style="color: #009900;">(</span>window<span style="color: #009900;">)</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>Not only is it more concise, but when you look at it you know exactly what you&#8217;re doing with it.</p>
<p>Remember, while avoiding cleverness for cleverness&#8217; sake, it is important to use your brain while programming.  Strive for elegance and keep on truckin&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dereleased.com/2009/09/23/programming-nuances-php-and-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Isn&#8217;t Google Chrome In Widespread Use Yet?</title>
		<link>http://www.dereleased.com/2009/07/25/why-isnt-google-chrome-in-widespread-use-yet/</link>
		<comments>http://www.dereleased.com/2009/07/25/why-isnt-google-chrome-in-widespread-use-yet/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 18:18:23 +0000</pubDate>
		<dc:creator>Clark</dc:creator>
				<category><![CDATA[Programs And Tools]]></category>
		<category><![CDATA[The Internet]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[market share]]></category>
		<category><![CDATA[netscape]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://www.dereleased.com/?p=73</guid>
		<description><![CDATA[In last Thursday&#8217;s article I ended up discussing browser market share and trends. As I wrote that article, I was using Firefox 3; As I write this article, however, I am using Google Chrome. This fact, actually, shocks even me, so I&#8217;ll share how it happened. A quick search of google reveals that many of [...]]]></description>
			<content:encoded><![CDATA[<p>In <a title="CSS Versus Tables: The War Continues" href="http://www.dereleased.com/2009/07/23/css-versus-tables-the-war-continues/" target="_self">last Thursday&#8217;s article</a> I ended up discussing browser market share and trends.  As I wrote that article, I was using Firefox 3;  As I write this article, however, I am using Google Chrome.  This fact, actually, shocks even me, so I&#8217;ll share how it happened.</p>
<p>A <a title="Let Me Google That For You" href="http://lmgtfy.com/?q=firefox+crashing+in+vista+64" target="_blank">quick search of google</a> reveals that many of us on Vista 64 have been plagued with instability and inexplicable crashes from Firefox for a little while now.  And, while the browser was generally stable, it could happen at frustrating times &#8212; for example, in the middle of writing my <a title="Online Ratings Sites: When, Why, and How to Trust Them" href="http://www.dereleased.com/2009/07/24/online-ratings-sites-and-when-to-trust-them/" target="_self">last article</a>.  Thankfully, WP had a fairly up-to-date draft saved, so I didn&#8217;t lose much, but what if I&#8217;d been typing an email at the time?  Or using some sort of ticket system that didn&#8217;t have an autosave feature?</p>
<p>I forget how it happened, but I ended up reading the <a title="Google Chrome Comic" href="http://www.google.com/googlebooks/chrome/" target="_blank">Google Chrome Comic</a>, which is an interesting read to be suggested to anyone considering chrome, but let me summarize what I got out of it: Chrome runs each and every tab in its own process.  You heard right, the tab bar is being run by Chrome&#8217;s central &#8220;process manager&#8221; and it seperates each and every tab out into a unique PID, handle, etc.  The first advantage is huge: If you crash, <strong>only one tab crashes</strong>; all the others are <strong>fine and dandy</strong>.  And, overall, it means that even if every tab crashes, the parent process manager <strong>doesn&#8217;t lose all your settings</strong>.  But let&#8217;s step back a bit and talk about how we got here.</p>
<p>In the beginning, as far as most people who got a PC between 1996 and now are concerned, was the Internet Explorer.  And it was good&#8230; ish.  Well, when you were first getting a computer, there wasn&#8217;t a whole lot to notice about it being bad.  If it seemed slow, well, that&#8217;s just the speed computers run, no real need to worry.  In fact, and I don&#8217;t think anyone is disputing me on this one, most of the reason Internet Explorer is still being used in such volume is actually very pragmatic on the part of its home user base: <a title="Problem Solving Flow Chart" href="http://ggot.org/moimages/words/problemsolvingflowchart.jpg" target="_blank">If It&#8217;s Not Broken, Don&#8217;t Fix It</a>.  As far as your average user goes, there&#8217;s nothing wrong with IE.  Well, there is, but not that they can see.</p>
<p>If I had to pick a number one problem with IE, it&#8217;d be security.  Since IE has been a part of the &#8220;Core OS&#8221; since Windows 95, it has access to a lot of components that other browsers, by virtue of not hooking functions that are allowed to run in Kernel Space, do not.  And with great power, comes great responsibility &#8212; except for the part where it was apparently decided that Microsoft should be able to silently install its own ActiveX controls.  Now, I&#8217;m not going to bash them for trying to take control of the user&#8217;s machine and make decisions for them, and I am not going to say that, for the average user, this doesn&#8217;t make a lot of sense, as it allows Microsoft Signed ActiveX controls, which have a tendency to make browsing into a less painful experience for the users, become available with little-to-no interaction on their part; really, it does make sense from that perspective.</p>
<p>If you&#8217;ve ever been identified as <q>&#8220;The Computer Guy&#8221;</q> by your family or friends, you&#8217;ve inevitably had to suffer through some questions which just seem downright silly, and make you wonder how they could possibly not know this and still manage to not get their fork stuck in a nostril while eating.  One of the common complaints, that usually makes any and all support personnel scoff, is that <q>&#8220;I didn&#8217;t do anything, I just got a virus.&#8221;</q> The odds of that happening are, well, slightly more likely than the presence of snow in the earth&#8217;s molten core &#8212; you always <strong>did</strong> something.  Except, of course, when they genuinely didn&#8217;t.  A while back, a vulnerability was identified with the <a title="Microsoft's Article (brief) and a link to the hotfix" href="http://www.microsoft.com/technet/security/bulletin/ms08-041.mspx" target="_blank">Access Shanpshot Viewer ActiveX Control</a> that allowed someone to execute arbitrary code with the same access level of the currently logged on user.  And, what&#8217;s more, not only did it automatically, and silently, install on the target&#8217;s machine, it would even install if a user had an updated version of the same control.  And this is only one issue of its kind.</p>
<p>From a web developer&#8217;s perspective, <a title="Debugging for IE is one of the most time consuming tasks in web development" href="http://graphjam.com/2008/08/22/song-chart-memes-web-development/" target="_blank">75% of the hassle of developing a new application is debugging it for IE</a>.  When I first started slamming my face into the keyboard and calling what came out on the screen &#8220;HTML&#8221; I was only viewing it in IE.  And, because of this, I developed a lot of bad habits.  Quickly, too.  That was over 10 years ago now, and I am still embarrased over this hideous markup, thankfully now striken from the web with the demise of sites like Angelfire and Fortunecity.  Again, though, from the user&#8217;s perspective, this makes the web &#8220;more accessible&#8221; because little Johnny&#8217;s website looks good in IE, but looks like a steaming pile of dung and other unmentionables in FireFox.</p>
<p>Of course, from the <abbr title="Well, at least THIS web developer...">Web Developer</abbr>&#8216;s perspective, Firefox is pretty much the best choice.  Standards Compliance to a fault, a <strong>plethora</strong> of development and debugging tools (Web Developer Toolbar, Console², Firebug and Execute JS are daily saviors of my sanity), and open source?  Sign me right up!  And, for my day-to-day work, I will continue to use Firefox, for all of these other reasons.  Build it to work with all the standards, and then go back and hack it up for the other browsers, not the other way around.  At least, that&#8217;s one man&#8217;s opinion.</p>
<p>Most other browser alternatives are regarded by those outside of their userbase with a silent disdain.  I don&#8217;t mind if you want to use Safari or Netscape, but in all honesty, if my site doesn&#8217;t work in your browser, I probably don&#8217;t care.  It&#8217;s not that you aren&#8217;t important, it&#8217;s just that your browser doesn&#8217;t agree with the other 85+ percent of the browser market; I&#8217;ve got to draw the line somewhere, and I draw it right over <em>your</em> browser&#8217;s stupid face.</p>
<p>So why support chrome?  Well, A lot of us were taken in early by the google name.  <q>&#8220;Google is making a browser?  God yes, get me in on that!&#8221;</q> Of course, Chrome hasn&#8217;t taken off as much as we really expected it to, clocking in at between <a title="Wikipedia: Usage Share of Web Browsers" href="http://en.wikipedia.org/wiki/File:Web_browser_usage_share.svg" target="_blank">1.80%</a> and <a title="w3schools: Browser Statistics" href="http://www.w3schools.com/browsers/browsers_stats.asp" target="_blank">5.50%</a> for may of 2009, depending on who you ask.  And I&#8217;m proud to add myself to that list, at least from home, because just a moment ago Firefox crashed and lost <strong>all</strong> of my settings.  I might as well have reinstalled, save for my addons.  This was after it crashed about 10 times in a row.  Great.</p>
<p>Now, supposedly, <a title="Google: Firefox 3.6 supports 64-but" href="http://lmgtfy.com/?q=firefox+3.6+supports+64-bit" target="_blank">we will get 64-but support in the release of Firefox 3.6</a>, but I&#8217;m not going to hold my breath.  There&#8217;s still the nature of that multi-threaded-versus-multi-process programming scheme.  And the memory bloat, don&#8217;t get me started about the memory bloat (<q>&#8220;Mommy, why is Firefox taking up over 800 MB of memory?&#8221;</q>).  No no, for now, I&#8217;m pleased, if a little annoyed at having to reconfigure yet another program.  Of course, it seems pretty clearly worth it, and if you haven&#8217;t tried Chrome yet, <a title="Get Google Chrome" href="http://www.google.com/chrome/" target="_blank">let me go ahead and implore you to do so</a>.  In addition to being shiny and wonderful, it is also extremely fast, reliable, and just plain shiny.  Let me end this by saying:</p>
<p><q>&#8220;Thanks, Chrome.  <a title="Look Around You: Water" href="http://www.blants.com" target="_blank">Thome</a>.&#8221;</q></p>
<p>Update!  Another fun thing about chrome is that, in addition to crashing responsibly, it uses its error messages to lighten to mood of what&#8217;s just happened.  Read more about this in one of my favorite blogs, <a title="Coding Horror by Jeff Atwood" href="http://www.codinghorror.com/blog/archives/001238.html" target="_blank">Jeff Atwood&#8217;s Coding Horror</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dereleased.com/2009/07/25/why-isnt-google-chrome-in-widespread-use-yet/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

