<?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>TechKnack &#187; asides</title>
	<atom:link href="http://techknack.net/category/asides/feed/" rel="self" type="application/rss+xml" />
	<link>http://techknack.net</link>
	<description>The rantings of a techie</description>
	<lastBuildDate>Thu, 24 Dec 2009 19:53:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A Couple Little PHP Array Tricks</title>
		<link>http://techknack.net/a-couple-little-php-array-tricks/</link>
		<comments>http://techknack.net/a-couple-little-php-array-tricks/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 19:52:51 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[asides]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://techknack.net/?p=252</guid>
		<description><![CDATA[Maintaining array indexes after deleting an element; selecting a random element from an associative array.]]></description>
			<content:encoded><![CDATA[<p>To delete an item from an array:</p>
<pre class="brush: php;">
unset($array[$i]);
</pre>
<p>However, this will break a &#8220;for ($i=0; $i&lt;count(); $i++)&#8221; loop.  To maintain sequential indexes:</p>
<pre class="brush: php;">
$array = array_values($array);
</pre>
<p>This will reset the indexes; beware, though, the items may not be in the same order afterwards.</p>
<p>To select a random item from an associative list:</p>
<pre class="brush: php;">
$array = array(
    &quot;one&quot;=&gt;1,
    &quot;two&quot;=&gt;2,
    &quot;three&quot;=&gt;3
);
$keys = array_keys($array);
$index = $keys[rand()%count($keys)];
$random = $array[$index];

// or, more compactly:

$k = array_keys($array);
$random = $array[$k[rand()%count($k)]];
</pre>
<img src="http://techknack.net/?ak_action=api_record_view&id=252&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/a-couple-little-php-array-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change Title in FF Nightly Builds</title>
		<link>http://techknack.net/change-title-in-ff-nightly-builds/</link>
		<comments>http://techknack.net/change-title-in-ff-nightly-builds/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 01:02:10 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[asides]]></category>

		<guid isPermaLink="false">http://techknack.net/?p=237</guid>
		<description><![CDATA[Remove the "(Build ###)" -- and other things -- from your FireFox 3 titlebar.]]></description>
			<content:encoded><![CDATA[<p>Nightly builds of FireFox 3.0.5 (from Kubuntu&#8217;s repos) have &#8220;(Build ###)&#8221;, where ### is, well, the build ID, at the end of the page title.  To remove this, open about:config, search for &#8220;nightly.templates.title&#8221;, and erase &#8221; (Build ${AppBuildID})&#8221; from that key&#8217;s value.  No need for a browser restart, you instantly have more title space.  Want more?  Erase the whole thing to remove the &#8221; &#8211; Mozilla Firefox&#8221;, leaving only the page title.</p>
<img src="http://techknack.net/?ak_action=api_record_view&id=237&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/change-title-in-ff-nightly-builds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>isIE JS One-liner</title>
		<link>http://techknack.net/isie-js-one-liner/</link>
		<comments>http://techknack.net/isie-js-one-liner/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 22:43:45 +0000</pubDate>
		<dc:creator>eternicode</dc:creator>
				<category><![CDATA[asides]]></category>

		<guid isPermaLink="false">http://techknack.net/?p=234</guid>
		<description><![CDATA[One line of JS to detect IE.]]></description>
			<content:encoded><![CDATA[<p>Andrea Giammarchi at Web Reflection has posted an <a href="http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html">IE-detection one-liner</a>: IE=&#8221;\v&#8221;==&#8221;v&#8221;.  Reported to return &#8220;true&#8221; only in IE.</p>
<img src="http://techknack.net/?ak_action=api_record_view&id=234&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://techknack.net/isie-js-one-liner/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

