<?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>Baron Knoxburry &#187; Uncategorized</title>
	<atom:link href="http://b-knox.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://b-knox.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 28 Jul 2010 23:41:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Detect an Empty Set in jQuery</title>
		<link>http://b-knox.com/181/detect-an-empty-set-in-jquery/</link>
		<comments>http://b-knox.com/181/detect-an-empty-set-in-jquery/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 21:31:11 +0000</pubDate>
		<dc:creator>b-knox</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://b-knox.com/?p=181</guid>
		<description><![CDATA[I spent over a half hour looking for the best solution to this.  Personally, I blame the jQuery documentation.  When reading over the jQuery core description it states, starting in version 1.4, that jQuery returns an empty set but offers no method to detect it.  Ultimately, I found that .length is the way to go [...]]]></description>
			<content:encoded><![CDATA[<p>I spent over a half hour looking for the best solution to this.  Personally, I blame the jQuery documentation.  When reading over the <a href="http://api.jquery.com/jQuery/">jQuery core</a> description it states, starting in version 1.4, that jQuery returns an empty set but offers no method to detect it.  Ultimately, I found that <a href="http://api.jquery.com/length/">.length</a> is the way to go but I wanted to expound on all three methods I discovered.</p>
<h3>count with javascript</h3>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> jQueryCount<span class="br0">&#40;</span>obj<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">var</span> len <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> k <span class="kw1">in</span> obj<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; len<span class="sy0">++;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">return</span> len<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p>This was the first type of solution I found.  Actually, I haven&#8217;t even tried it.  I knew right off the bat there has to be a built in jQuery function so I kept digging&#8230;</p>
<h3>.size()</h3>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="st0">&#8216;ul li:visible&#8217;</span><span class="br0">&#41;</span>.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">==</span><span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co2">/* do stuff here if no visible li elements exist */</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p>Yes!  After scouring the API documentation for 20 minutes I finally stumbled upon what I was looking for — <a href="http://api.jquery.com/size/">.size()</a> It returns a count of elements inside a jQuery object.  If there are no elements in the object it returns zero.  </p>
<p>But what&#8217;s this?!?!  The comments on the entry say it&#8217;s a stupid function that should be deprecated.  The page suggests something better&#8230;</p>
<h3>.length</h3>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="st0">&#8216;ul li:visible&#8217;</span><span class="br0">&#41;</span>.<span class="me1">length</span><span class="sy0">==</span><span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co2">/* do stuff here if no visible li elements exist */</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p><a href="http://api.jquery.com/length/">.length</a> works in a different way to get a similar answer.  It seems to be &#8220;faster, and more consistent to JavaScript in general&#8221;.  I hope this is helpful to someone in a similar situation!  :D</p>
]]></content:encoded>
			<wfw:commentRss>http://b-knox.com/181/detect-an-empty-set-in-jquery/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Spring Forward</title>
		<link>http://b-knox.com/36/spring-forward/</link>
		<comments>http://b-knox.com/36/spring-forward/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 20:30:54 +0000</pubDate>
		<dc:creator>b-knox</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://b-knox.com/?p=36</guid>
		<description><![CDATA[Birds and bees outside!??!  The clock in my minivan displays the correct time now?!?!  I lost an hour of sleep!??!?  HOLY BAJEEEZUS!]]></description>
			<content:encoded><![CDATA[<div id="attachment_37" class="wp-caption aligncenter" style="width: 460px"><a href="http://b-knox.com/wp-content/uploads/2010/03/DSCF6877.jpg"><img class="size-large wp-image-37" title="A bee in the flower!" src="http://b-knox.com/wp-content/uploads/2010/03/DSCF6877-1024x768.jpg" alt="" width="450" height="337" /></a><p class="wp-caption-text">I took this photo but I didn&#39;t remove the snow!  :o</p></div>
<p>Birds and bees outside!??!  The clock in my minivan displays the correct time now?!?!  I lost an hour of sleep!??!?  <strong>HOLY BAJEEEZUS!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://b-knox.com/36/spring-forward/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Our Hero</title>
		<link>http://b-knox.com/26/our-hero/</link>
		<comments>http://b-knox.com/26/our-hero/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 20:49:46 +0000</pubDate>
		<dc:creator>b-knox</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gift]]></category>
		<category><![CDATA[hero]]></category>

		<guid isPermaLink="false">http://b-knox.com/?p=26</guid>
		<description><![CDATA[I got out of bed at 2pm; in the midst of great grogginess I checked Battle of the Bits for any activity and was heroically surprised!  Strobe, a venerable BotBr, effortlessly coagulated a victoriously stunning viral video with a photo of myself from, liek, 6 years ago.  I both laughed and scoffed like a junior [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.tackfilm.se/?id=1267982271045RA95"><img class="alignnone size-full wp-image-27" title="perspective" src="http://b-knox.com/wp-content/uploads/2010/03/perspective.jpg" alt="" width="600" height="336" /></a></p>
<p>I got out of bed at 2pm; in the midst of great grogginess I checked<a href="http://battleofthebits.org"> Battle of the Bits</a> for any activity and was heroically surprised!  <a href="http://battleofthebits.org/barracks/Profile/Strobe/">Strobe</a>, a venerable BotBr, effortlessly coagulated a victoriously stunning viral video with a photo of myself from, liek, 6 years ago.  I both laughed and scoffed like a junior high hermaphrodite at such the glorious wakeup surprise!</p>
<p><a href="http://en.tackfilm.se/?id=1267982271045RA95">Watch it / Make your own here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://b-knox.com/26/our-hero/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World!</title>
		<link>http://b-knox.com/4/hello-world-2/</link>
		<comments>http://b-knox.com/4/hello-world-2/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 18:58:41 +0000</pubDate>
		<dc:creator>b-knox</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dub]]></category>
		<category><![CDATA[mp3]]></category>

		<guid isPermaLink="false">http://b-knox.com/?p=4</guid>
		<description><![CDATA[OH!  What do ya know?  It&#8217;s time for da B-Knox to join the bloggosphere!  It&#8217;s just another WordPress installation against the world.  Still ironing out the kinks of the layout, dress to impress!  :o WordPress is new and so is my account at SoundCloud and so a merry &#8220;Hello World!&#8221; to you all.  :D baron [...]]]></description>
			<content:encoded><![CDATA[<p>OH!  What do ya know?  It&#8217;s time for da B-Knox to join the bloggosphere!  It&#8217;s just another WordPress installation against the world.  Still ironing out the kinks of the layout, dress to impress!  :o</p>
<p>WordPress is new and so is my account at SoundCloud and so a merry &#8220;Hello World!&#8221; to you all.  :D</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="81" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowscriptaccess" value="always" /><param name="src" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fbaron-knoxburry%2Fbaron-knoxburry-energy-box-dub" /><embed type="application/x-shockwave-flash" width="100%" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fbaron-knoxburry%2Fbaron-knoxburry-energy-box-dub" allowscriptaccess="always"></embed></object> <span><a href="http://soundcloud.com/baron-knoxburry/baron-knoxburry-energy-box-dub">baron knoxburry &#8211; energy box dub</a> by  <a href="http://soundcloud.com/baron-knoxburry">Baron Knoxburry</a></span></p>
<p>This track was written last August but I share it now.</p>
]]></content:encoded>
			<wfw:commentRss>http://b-knox.com/4/hello-world-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
