<?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>Povert &#187; Tech &amp; Science</title>
	<atom:link href="http://www.povert.com/category/technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.povert.com</link>
	<description>It&#039;s Pronounced &#34;Pah-vert.&#34;  You povert.</description>
	<lastBuildDate>Tue, 18 Oct 2011 15:33:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Steve Jobs</title>
		<link>http://www.povert.com/2011/08/24/steve-jobs/</link>
		<comments>http://www.povert.com/2011/08/24/steve-jobs/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 04:56:09 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Flapping Crane]]></category>
		<category><![CDATA[Tech & Science]]></category>
		<category><![CDATA[Steve Jobs]]></category>

		<guid isPermaLink="false">http://www.povert.com/?p=1101</guid>
		<description><![CDATA[Everyone knew that the resignation of Steve Jobs was imminent. But it&#8217;s still sad. Last weekend, while rearranging upstairs bedrooms to prepare a nursery for our son (he&#8217;s due in less than 3 months!), I found myself looking at my old G4 iMac. It&#8217;s the one with the goose neck and the dome base. This [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone knew that the resignation of Steve Jobs was imminent. But it&#8217;s still sad.</p>
<p>Last weekend, while rearranging upstairs bedrooms to prepare a nursery for our son (he&#8217;s due in less than 3 months!), I found myself looking at my old G4 iMac. It&#8217;s the one with the goose neck and the dome base. This one has a nice 21&#8243; screen. It&#8217;s got a problem now where it&#8217;s a pain to turn it on, but it&#8217;s otherwise in great condition. It&#8217;s still a stunning computer.</p>
<p>Seven years ago, I moved from Flagstaff, AZ to the midwest. Things weren&#8217;t going so well. I talked my parents into buying that iMac for me. It wasn&#8217;t cheap — along with Final Cut Express it was around $1,600.</p>
<p>My interest then was video editing. But it was more than that. For years I was a UNIX nerd. Linux in particular. I still have a soft spot for it (I use Terminal.app and vi every day). But Mac OS X took it to an entirely new level. They somehow managed to combine UNIX underpinnings with solid UI and UX. It was, and still is, amazing.</p>
<p>But, as I said, my interest was in video editing. Through this, I eventually re-connected with an old friend from middle school and started an internet comedy group. We made very few waves (there were some very small ones), but the personal implications were far-reaching. I got a job at IB (where I worked for 5 years) through a recommendation from several of the guys. Shawn officiated my wedding with Kelly. These are people I never would have known if the state of tech on the Mac had been less awesome. They&#8217;re all good friends (and we still miss you, Eric).</p>
<p>My current employment can be traced back to it as well. Not because I use a Mac at work (I do), but because the Mac re-ignited an interest in computing for me. Keep in mind, I was not a fan of the mac in the pre-OS X days. It might have been a decent OS, but it was severely lacking in many respects. OS X, though, was a breath of fresh air. It was a technically competent OS with a nice, even wonderful front-end. People forget just how shitty GUIs were 15 years ago.</p>
<p>I still own a shirt that says, &#8220;I dig Mac OS X&#8221;.</p>
<p>I carry around 2, sometimes 3 iOS devices every day. Which is ridiculous, of course.</p>
<p>I remember thinking, back in 2008, how strange it was that just a year before I didn&#8217;t have EVERYTHING at my fingertips. The iPhone and iPad have drastically altered my lifestyle. I can&#8217;t even imagine life without them now. I use my iPhone more than I&#8217;ve ever used any computer or phone. Or any device, really.</p>
<p>iPhone, and iPod Touch and iPad have had such a huge effect on the market that it&#8217;s really hard to gauge. People lately have taken to saying that there&#8217;s no tablet market: there&#8217;s an iPad market. And it&#8217;s true. Apple is so far ahead of everyone else that it&#8217;s a bit embarassing. They&#8217;ll all catch up eventually, but right now the competition is completely incompetent.</p>
<p>So. Here&#8217;s one guy who managed to create and shepherd some seriously world-changing technology. I didn&#8217;t even mention iPods or MacBooks. He&#8217;s probably going to die long before his time. But a large part of modern life is shaped by what Steve Jobs has done. He changed the world for the better.</p>
<p>Here&#8217;s wishing him the best.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2011/08/24/steve-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>highlight.js</title>
		<link>http://www.povert.com/2010/12/08/highlight-js/</link>
		<comments>http://www.povert.com/2010/12/08/highlight-js/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 04:48:30 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tech & Science]]></category>
		<category><![CDATA[WWW]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.povert.com/?p=1063</guid>
		<description><![CDATA[I&#8217;ve been working on a little bit of javascript in my spare time. The New York Times has recently employed a bit of code that allows you to highlight sentences or paragraphs using a hash in the story&#8217;s URL. I think that&#8217;s a fantastic idea. I&#8217;ve thrown together some JS to do this. It&#8217;s available [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a little bit of javascript in my spare time.  The New York Times has recently employed a bit of code that allows you to highlight sentences or paragraphs using a hash in the story&#8217;s URL.</p>
<p>I think that&#8217;s a fantastic idea.  I&#8217;ve thrown together some JS to do this.  It&#8217;s available <a href="https://github.com/fwonkas/highlight">here</a>.  As a happy bonus, it allows for a range of sentences and it doesn&#8217;t require a page reload to highlight parts.  The sentence selection, however, is terrible.  So if anyone has any suggestions, please fork and put in a pull request.</p>
<p>My code does allow highlighting some stuff while jumping to another part, which I think is pretty neat.  That is, &#8220;Read starting here, but really pay attention to this.&#8221;</p>
<p>(Also, Ken: No, <strong>you&#8217;re</strong> a nerd)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2010/12/08/highlight-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ultra Update 2010</title>
		<link>http://www.povert.com/2010/10/25/ultra-update-2010/</link>
		<comments>http://www.povert.com/2010/10/25/ultra-update-2010/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 03:41:53 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Flapping Crane]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Poker]]></category>
		<category><![CDATA[Tech & Science]]></category>
		<category><![CDATA[death]]></category>
		<category><![CDATA[poker]]></category>
		<category><![CDATA[squirrel]]></category>

		<guid isPermaLink="false">http://www.povert.com/?p=1055</guid>
		<description><![CDATA[I&#8217;ve been really slacking on Flapping Crane skits. It&#8217;s really all my fault. I&#8217;ll try to turn that around this week. We have a bunch of good ones queued up. And by good, I mean awesome. And by awesome, I mean kinda gross. The last few months have been fairly trying. Two friends of mine [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been really slacking on Flapping Crane skits.  It&#8217;s really all my fault.  I&#8217;ll try to turn that around this week.  We have a bunch of good ones queued up.  And by good, I mean awesome.  And by awesome, I mean kinda gross.</p>
<p>The last few months have been fairly trying.  Two friends of mine have killed themselves since July.  One was a partner in Flapping Crane, and the other was a childhood friend I haven&#8217;t talked to for a very long time.  I went to Eric&#8217;s funeral.  Couldn&#8217;t bring myself to go to Nick&#8217;s.</p>
<p>My dad sometimes tells stories about friends who killed themselves.  It always seemed so alien to me before.  I guess as you get older and meet more people, the chances of someone you know killing themselves goes up.  Those are just the odds.  That doesn&#8217;t make it easier to deal with.  But it does help explain it, sort of.</p>
<p>There&#8217;s been some other crap that&#8217;s made life a bit stressful, but I won&#8217;t talk about it here, because I like being mysterious, like a squirrel with a cape.  Why does he have that cape?  Does he realize how badass it makes him look?  Squirrels are nuts, yo.</p>
<p>I&#8217;m currently mulling wiring my house with Cat 6.  Probably going to do it through air ducts, with a wiring closet in the basement.  Seems like a nice way to avoid some of the more confusing pitfalls of wireless.</p>
<p>This Thursday, the wife and I are going to a live(ish) Riff Trax show, which should be a blast.  Friday night, my dad and I are going to enter a poker tournament.  I fully expect to last at least 15 minutes, though I&#8217;m possibly being overly optimistic.</p>
<p>It&#8217;s raining outside now.  Dig that sound.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2010/10/25/ultra-update-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>localStorage</title>
		<link>http://www.povert.com/2010/08/19/localstorage/</link>
		<comments>http://www.povert.com/2010/08/19/localstorage/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 03:37:11 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[WWW]]></category>
		<category><![CDATA[Flapping Crane]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://www.povert.com/?p=995</guid>
		<description><![CDATA[I&#8217;ve been making plenty of use of localStorage in javascript apps lately.  It&#8217;s a very simple way of storing data in the browser that can persist across sessions.  If you want to learn more about it, check out the Local Storage chapter in the excellent Dive into HTML5 web site / future book. Anyway, I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been making plenty of use of localStorage in javascript apps lately.  It&#8217;s a very simple way of storing data in the browser that can persist across sessions.  If you want to learn more about it, check out the <a href="http://diveintohtml5.org/storage.html">Local Storage</a> chapter in the excellent <a href="http://diveintohtml5.org/">Dive into HTML5</a> web site / future book.</p>
<p>Anyway, I&#8217;m using it on a new version of <a href="http://flappingcrane.com/">flappingcrane.com</a> to get around the downside to a recent security fix in Safari.  I wanted to have the icons for skits that have already been watched by the user to be translucent.  That&#8217;s normally a very easy thing to do using CSS:</p>
<p>
<code><br />
.skitIcon a:visited {<br />
	opacity: 0.5;<br />
	-moz-opacity: 0.5;<br />
}<br />
</code>
</p>
<p>However, there&#8217;s kind of a clever security problem with this.  In a nutshell, I can list a bunch of links on a page and give some CSS property to visited links.  Then if you visit the page, a script can examine those links and see which ones have those properties, thus telling me which of those sites you have visited.</p>
<p>A recent version of Safari disabled styling on the :visited pseudo-element for this very reason.</p>
<p>Anyway, this is less of a concern on something like Flapping Crane.  We can track what skits you watch, how much of them you watch, how often you pause them, etc.  While that might creep some people out (we only track hits or plays, but I&#8217;m sure many, many video sites track a lot more), there&#8217;s no serious security issue with that.  I can tell that you&#8217;ve watched &#8220;<a href="http://flappingcrane.com/bugles.html">Bugles</a>&#8221; 145 times (weirdo), but I can&#8217;t tell what other creepy web sites you visit.</p>
<p>So, while we can keep track of what client IP has watched what, there are a variety of reasons why I really don&#8217;t want to do that in order to style a few links.  One, I like to keep DB interactions to a minimum (hah).  Two, it makes for some clunky, ugly interactions that seem like overkill for a little opacity effect.</p>
<p>I&#8217;m sure you can see where I&#8217;m going with this.</p>
<p>When you watch a skit (again, on the new site I&#8217;m working on), if your browser supports localStorage, it&#8217;ll record that you&#8217;ve watched it.  Since it&#8217;s stored in your browser, there&#8217;s no need for querying the database.  Then, when listing out the skit icons, ones that have been viewed get a &#8220;watched&#8221; class.  Any CSS I want can be applied to that.</p>
<p>This is nothing that couldn&#8217;t be accomplished by a variety of other means, but it is nice to have such a remarkably simple way of doing it.  I haven&#8217;t decided if I&#8217;m going to put in a way to do it with cookies, which have more limitations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2010/08/19/localstorage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Abstraction</title>
		<link>http://www.povert.com/2010/06/20/abstraction/</link>
		<comments>http://www.povert.com/2010/06/20/abstraction/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 17:29:09 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Tech & Science]]></category>
		<category><![CDATA[abstraction]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.povert.com/?p=981</guid>
		<description><![CDATA[This paragraph in an Ars article made me snort: First the C guys can&#8217;t imagine writing in assembly anymore, but C++&#8217;s vtable dispatch is still just too slow to consider. Then the C++ guys look back with chagrin at the bad-old-days of rolling their own half-assed object systems in C, but Java is dismissed as [...]]]></description>
			<content:encoded><![CDATA[<p>This paragraph in an <a href="http://arstechnica.com/apple/news/2010/06/copland-2010-revisited.ars">Ars article</a> made me snort:</p>
<blockquote>
<p>First the C guys can&#8217;t imagine writing in assembly anymore, but C++&#8217;s vtable dispatch is still just too slow to consider. Then the C++ guys look back with chagrin at the bad-old-days of rolling their own half-assed object systems in C, but Java is dismissed as a ridiculous pig. Still later, the Java guys sneer at pointers and manual memory management, but JavaScript is ridiculed as a toy &#8220;scripting&#8221; language for validating web forms. And on and on.</p>
</blockquote>
<p>It&#8217;s true.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2010/06/20/abstraction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Flapping Crane Site</title>
		<link>http://www.povert.com/2010/02/11/new-flapping-crane-site/</link>
		<comments>http://www.povert.com/2010/02/11/new-flapping-crane-site/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 01:54:48 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Flapping Crane]]></category>
		<category><![CDATA[WWW]]></category>
		<category><![CDATA[Modernizr]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.povert.com/?p=961</guid>
		<description><![CDATA[The new version of Flapping Crane is up, along with a strange video to commemorate it. You&#8217;ll notice that Pete mentions a new web site and says &#8220;2008&#8243;. Yup, been working on it for that long. Longer, even. The site had stayed unchanged design-wise since at least December 2005. I was kicking ideas around for [...]]]></description>
			<content:encoded><![CDATA[<p>The new version of <a href="http://flappingcrane.com/">Flapping Crane</a> is up, along with a strange video to commemorate it.</p>
<p>You&#8217;ll notice that Pete mentions a new web site and says &#8220;2008&#8243;.  Yup, been working on it for that long.  Longer, even.</p>
<p>The site had stayed unchanged design-wise since at least December 2005.  I was kicking ideas around for a new version at least since 2006.</p>
<p>In early 2008, I had a conversation with Shawn, who came up with this mock:</p>
<p><img src="http://www.povert.com/wp-content/uploads/2010/02/FC-2008-website-c2.jpg" alt="FC-2008-website-c2.jpg" border="0" width="385" height="500" /></p>
<p>It&#8217;s had a lot of changes since then (Alex had some ideas for simplifying the interface), but that&#8217;s basically the same as what is live now.</p>
<p>Part of what took so long was that early on I tried to do way too much.  I later decided to drop &#8220;buy&#8221; and &#8220;pics&#8221;.  They may come back later; I haven&#8217;t decided.  We also drop a lot of the video categories.  There were just way too many.</p>
<p>I&#8217;ve changed the way that &#8220;Most Popular&#8221; is determined — the top six skits were listed as the most popular for about 3 years.  So now it displays the most popular from the last 2 weeks.  It&#8217;s kind of interesting that way.  It changes up a lot.</p>
<p>Anyway, for anyone interested in the nitty-gritty, the site uses <a href="http://developer.yahoo.com/yui/">YUI</a> 2.6.0.  I considered updating it for 2.8.0 or even 3.0, but I&#8217;d already Duke Nukem&#8217; Forever&#8217;d this thing long enough.  It also makes minor use of <a href="http://www.modernizr.com/">Modernizr</a>, mostly to detect whether the browser supports h264.  Eventually the site will support ogg theora too.  That&#8217;s a lot of skits to convert.  At the moment, Safari and Chrome will display the videos natively, while all other browsers will use flash (<a href="http://www.longtailvideo.com/players/jw-flv-player/">JW Player</a>).</p>
<p>I&#8217;ve only done minimal fixes for Internet Explorer.  It works in IE 6-8, though it doesn&#8217;t look as pretty.  I&#8217;ll mop that up later.  Maybe.  See the FAQ on the new site for my attitude towards IE in general (IE 6 in particular).</p>
<p>Also note that the videos are much larger, screen-wise.  They are 640&#215;360 for wide and 640&#215;480 for standard.  I re-encoded almost every single Flapping Crane video, not counting outtakes, which aren&#8217;t on the new site anyway (at least not yet).</p>
<p>Finally, if you were bored enough to make it this long: Yes, there will be new skits.  I bought a house, got married, got a dog, etc.  Haven&#8217;t had a lot of time to edit videos <em>and</em> get this new site up, so it may be a while before any truly new skits show up.  There are, however, some skits that haven&#8217;t been put up yet that I may sneak in *COUGH*toofies*COUGH*.</p>
<p>And yes, there will be actual new, recently shot skits up soon.  Well, eventually.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2010/02/11/new-flapping-crane-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s Wrong With Ads</title>
		<link>http://www.povert.com/2010/01/08/whats-wrong-with-ads/</link>
		<comments>http://www.povert.com/2010/01/08/whats-wrong-with-ads/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 19:26:38 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[WWW]]></category>
		<category><![CDATA[ads]]></category>
		<category><![CDATA[advertising]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.povert.com/?p=914</guid>
		<description><![CDATA[Ads drive me nuts. Not for the reasons it drive some people nuts — as long as they&#8217;re not intrusive, I don&#8217;t mind. I don&#8217;t regularly use AdBlock, though I do use ClickToFlash in Safari for various reasons. I don&#8217;t even think that Flash ads, per se, are a problem. I see two basic problems: [...]]]></description>
			<content:encoded><![CDATA[<p>Ads drive me nuts.</p>
<p>Not for the reasons it drive some people nuts — as long as they&#8217;re not intrusive, I don&#8217;t mind.  I don&#8217;t regularly use AdBlock, though I do use ClickToFlash in Safari for various reasons.  I don&#8217;t even think that Flash ads, per se, are a problem.</p>
<p>I see two basic problems:</p>
<ol>
<li>document.write()</li>
<li>Invalid markup</li>
</ol>
<h3>document.write()</h3>
<p>I hate document.write().  I&#8217;m pretty sure that I am <strong>That Guy At Work Who Hates document.write() With Unreasonable And Embarrassing Passion™</strong>, but it really does limit your options and it contributes to poor page load and rendering times.</p>
<p>Amazingly, a quick search of my past entries here turned up very little about my disdain for document.write(), so I&#8217;ll briefly summarize the problem.</p>
<p>Web browsers don&#8217;t handle external scripts very well.  Because of things like document.write(), the browser actually has to pause the rendering of the page.  Unfortunately, if the script is long-running or the server it&#8217;s on is slow or non-responsive, this can significantly increase the apparent page load time.  Several mildly misbehaving external scripts on a page can have a dramatic cumulative effect.  I set up an <a href="http://sandwichestime.com/loop/">example</a> of this while back to demonstrate this.</p>
<p>This is how most ads are delivered to a page.  So a single ad placed anywhere before any important content on a page can block the display of that page until the ad is displayed.</p>
<p>There are ways around this.  One way would be to have a external javascript file called early in the page.  Then ad positions on the page wouldn&#8217;t be additional external script tags — they would be calls to a function or functions in that main javascript file (I believe Google Adsense allows for something like this method, at least in some circumstances).  You could even get away with document.write() in this case, though that wouldn&#8217;t be eliminating problem #2.  More on that in a moment.  But there is still a basic problem here — we&#8217;re down to one external script, but if its host server is unresponsive, the display of all or most of the page will be held up until it resolves or times out.</p>
<p>Another way would be to dynamically create script tags and append them to the document&#8217;s head.  These tags would point to the external scripts.  But because they&#8217;re inserted this way, the browser doesn&#8217;t have to hold up the page rendering.  YUI&#8217;s <a href="http://developer.yahoo.com/yui/get/#script">Get.script()</a> does exactly this with some handy features thrown in as well.  The big problem here is that document.write() is not compatible with this method.  Unfortunately, 100% of ads out there are written out with document.write() by ad servers, regardless of whether they were written that way.</p>
<p>I&#8217;ve tried overriding document.write().  Last I checked, it actually works in Firefox:</p>
<p><code><br />
(function(){<br />
  var els = document.getElementsByTagName('*'),<br />
      el = els[els.length - 1];<br />
      adURL = 'http://ad-server.com/blah';<br />
  document.write = function(str) {<br />
    if (typeof str != 'undefined') {<br />
      var newEl = document.createElement('span');<br />
      newEl.innerHTML = str;<br />
      var nodes = newEl.childNodes;<br />
      while (nodes.length) {<br />
        el.parentNode.appendChild(nodes[0]);<br />
      }<br />
    }<br />
  }<br />
  YAHOO.util.Get.script(adURL, {<br />
    onSuccess: function(){document.write = dwrite;}<br />
  });<br />
})();<br />
</code></p>
<p>Guess how that pans out in IE?</p>
<p>(Yes, there are some flaws in the above code, but it was proof-of concept.)</p>
<p>And no, <a href="http://www.quirksmode.org/js/placejs.html">the defer attribute does not work</a> when using document.write() and <a href="http://javascript.crockford.com/script.html">should be avoided</a> anyway.</p>
<h3>Invalid Markup</h3>
<p>This problem is actually a consequence of problem #1.  document.write() allows you to just toss arbitrary text and markup onto the page.  There&#8217;s nothing to stop you from slapping this onto an otherwise nice page:</p>
<p><code><br />
document.write('&lt;div&gt;Tacos&lt;/div&gt;');<br />
</code></p>
<p>This can utterly destroy a page&#8217;s layout.  All it takes is one bad ad to toss in one unmatched tag and a page&#8217;s layout will look like it got punched in the face and set on fire.  The same thing could happen using innerHTML.  However, using DOM methods avoids this problem:</p>
<p><code><br />
var div = document.createElement('div');<br />
adSpan.appendChild(div);<br />
div.appendChild(document.createTextNode('Tacos'));<br />
</code></p>
<p>Yes, that appears to be more work.  If your gripe with this solution is that you have to type more, please allow me to do to your face what a stray closing div can do to a page.</p>
<p>Mistakes can be made when doing it this way, but it eliminates an entire category of error that can sometimes be fairly difficult to track down.  Even if you made 100% sure that your ad doesn&#8217;t output invalid html, all it takes is one person in the chain to do a bad copy &#038; paste job to hose it up.  It happens.  It costs money and wastes time.  It also makes me want to make the streets run red with the blood of my enemies.</p>
<p>Iframes, sadly, are not a solution to this problem.  While it would contain the bad markup, they make certain type of ads hard or impossible to do.  There is also a very long-standing Firefox bug in which iframes magically swap contents with each other.</p>
<h3>What Can Be Done?</h3>
<p>So where can we go from here?  I wish I knew.  I don&#8217;t think it&#8217;s realistic to expect that everyone writing ads out there change the way they write them.  Maybe someone with Google&#8217;s clout could do this, but I can&#8217;t imagine that that would end well even for Google.</p>
<p>To make matters worse, whether the ad author avoids document.write() or not is actually irrelevant at this point because ad servers like DoubleClick actually take your ad code and document.write() it — leading to the silly (but common):</p>
<p><code><br />
document.write('&lt;noscript&gt;Blah blah blah&lt;/noscript&gt;');<br />
</code></p>
<p>Overriding document.write() would be a good intermediate step if it worked in IE, but it doesn&#8217;t.</p>
<p>This really is a serious problem.  I can&#8217;t imagine how much potential revenue is lost to slow rendering pages as a result of ads which were supposed to generate revenue in the first place, not to mention the actual money spent on tracking down bad ads that are hosing up a page&#8217;s layout.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2010/01/08/whats-wrong-with-ads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YUI Get.script Manager</title>
		<link>http://www.povert.com/2009/08/21/yui-get-script-manager/</link>
		<comments>http://www.povert.com/2009/08/21/yui-get-script-manager/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 22:14:01 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[yGetMan]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.povert.com/?p=885</guid>
		<description><![CDATA[I threw this together for some extra-curricular activities at work. Figured someone may find it useful. I put it under a BSD license, so feel free to do what you want with it. yGetMan is a simple queue manager for YUI&#8217;s Get.script. If you request a script that&#8217;s already been loaded, it doesn&#8217;t attempt to [...]]]></description>
			<content:encoded><![CDATA[<p>I threw this together for some extra-curricular activities at work.  Figured someone may find it useful.</p>
<p>I put it under a <a href="http://www.povert.com/fun/ygetman/license.txt">BSD license</a>, so feel free to do what you want with it.</p>
<p>yGetMan is a simple queue manager for YUI&#8217;s Get.script.  If you request a script that&#8217;s already been loaded, it doesn&#8217;t attempt to re-load that script.  Whether this is useful to you depends on your environment and circumstances.</p>
<p>See it in action <a href="http://www.povert.com/fun/ygetman/example.html">here</a>.</p>
<p>Here it is: <a href="http://www.povert.com/fun/ygetman/yGetMan.js">yGetMan</a>.  Also, <a href="http://www.povert.com/fun/ygetman/yGetMan-min.js">minified</a>.  Comments in there explain usage.</p>
<p>Also, if someone creates a mascot — a Get Man, if you will — I will make a big deal out of this and celebrate with a big plate of spaghetti.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2009/08/21/yui-get-script-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS-centric JS</title>
		<link>http://www.povert.com/2008/09/11/css-centric-js/</link>
		<comments>http://www.povert.com/2008/09/11/css-centric-js/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 20:29:26 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[WWW]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.povert.com/?p=793</guid>
		<description><![CDATA[This probably isn&#8217;t news to anyone deep in JS/CSS land, but I thought these notes may be handy for someone who&#8217;s still figuring out the best way to approach some problems. There&#8217;s a temptation, I think, to go overboard with JS when manipulating elements on a page. Many tasks can be more simply handled with [...]]]></description>
			<content:encoded><![CDATA[<p>This probably isn&#8217;t news to anyone deep in JS/CSS land, but I thought these notes may be handy for someone who&#8217;s still figuring out the best way to approach some problems.</p>
<p>There&#8217;s a temptation, I think, to go overboard with JS when manipulating elements on a page.  Many tasks can be more simply handled with a combination of JS and CSS.</p>
<p>For example, let&#8217;s say you have a simple unordered list:<br />
<code><br />
&lt;ul id="happyList"&gt;<br />
&nbsp;&nbsp;&lt;li&gt;&lt;a href="tacos.html"&gt;Tacos&lt;/a&gt;&lt;/li&gt;<br />
&nbsp;&nbsp;&lt;li&gt;&lt;a href="burritos.html"&gt;Burritos&lt;/a&gt;&lt;/li&gt;<br />
&nbsp;&nbsp;&lt;li&gt;&lt;a href="enchiladas.html"&gt;Enchiladas&lt;/a&gt;&lt;/li&gt;<br />
&nbsp;&nbsp;&lt;li&gt;&lt;a href="tamales.html"&gt;Tamales&lt;/a&gt;&lt;/li&gt;<br />
&nbsp;&nbsp;&lt;li&gt;&lt;a href="chalupas.html"&gt;Chalupas&lt;/a&gt;&lt;/li&gt;<br />
&nbsp;&nbsp;&lt;li&gt;&lt;a href="antacids.html"&gt;Antacids&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
</code></p>
<p>Let&#8217;s say that you only want 3 items to show by default, and you want a &#8220;More&#8221; link at the bottom that will expand the list to show the rest.</p>
<p>There&#8217;s a few ways you could approach this.  People may be tempted to put an onclick event onto the &#8220;More&#8221; link, then have that call a function that toggles the visibility of each element after the third.  Something like:</p>
<p><code><br />
var happy = document.getElementById('happyList');<br />
var items = happy.getElementsByTagName('li');<br />
function showLinks() {<br />
&nbsp;&nbsp;for (var i=3; i &lt; items; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;items[i].style.display = 'list-item';<br />
&nbsp;&nbsp;}<br />
}<br />
function hideLinks() {<br />
&nbsp;&nbsp;for (var i=3; i &lt; items; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;items[i].style.display = 'none';<br />
&nbsp;&nbsp;}<br />
}<br />
</code></p>
<p>That would work (though I haven&#8217;t actually tested this particular js), but it&#8217;s definitely the crappy way, for a number of reasons.  First, there&#8217;s no need for two functions, though that&#8217;s beside the point of this post.  Second, we&#8217;re running through a for() loop every time each function is called.</p>
<p>Instead of something like that, the way I&#8217;d do it is to first set up this CSS:</p>
<p><code><br />
#happyList.collapsed li {<br />
&nbsp;&nbsp;display: none;<br />
}<br />
#happyList.collapsed li.alwaysShow {<br />
&nbsp;&nbsp;display: list-item;<br />
}<br />
</code></p>
<p>Then, you put a class of &#8216;alwaysShow&#8217; on the first three list item elements, either in the html itself or with javascript:</p>
<p><code><br />
function assignShow() {<br />
&nbsp;&nbsp;var happy = document.getElementById('happyList');<br />
&nbsp;&nbsp;var items = happy.getElementsByTagName('li');<br />
&nbsp;&nbsp;for (var i=0; i &lt; items.length &#038;&#038; i &lt; 3; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;items[i].className = 'alwaysShow';<br />
&nbsp;&nbsp;}<br />
}<br />
</code></p>
<p>Now, when the ul has a class of &#8216;collapsed&#8217;, only the first three items show:</p>
<p><code><br />
function toggleList() {<br />
&nbsp;&nbsp;var happy = document.getElementById('happyList');<br />
&nbsp;&nbsp;if (happy.className == 'collapsed') {<br />
&nbsp;&nbsp;&nbsp;&nbsp;happy.className = '';<br />
&nbsp;&nbsp;} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;happy.className = 'collapsed';<br />
&nbsp;&nbsp;}<br />
}<br />
</code></p>
<p>Or, more succinctly:<br />
<code><br />
function toggleList() {<br />
&nbsp;&nbsp;var happy = document.getElementById('happyList');<br />
&nbsp;&nbsp;happy.className = happy.className ==<br />
&nbsp;&nbsp;&nbsp;&nbsp;'collapsed' ? '' : 'collapsed';<br />
}<br />
</code></p>
<p>Then, either in HTML or using javascript, you can add an element with the &#8220;More&#8221; text and attach an event to it that calls toggleList().</p>
<p>I&#8217;m being a little vague on details here.  My main point is that it&#8217;s preferable to lean on CSS as much as possible.  It helps to avoid micromanaging elements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2008/09/11/css-centric-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress iPhone App</title>
		<link>http://www.povert.com/2008/07/25/wordpress-iphone-app/</link>
		<comments>http://www.povert.com/2008/07/25/wordpress-iphone-app/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 22:31:12 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tech & Science]]></category>
		<category><![CDATA[wordpress iPhone]]></category>

		<guid isPermaLink="false">http://www.povert.com/2008/07/25/wordpress-iphone-app/</guid>
		<description><![CDATA[Testing the wordpress iPhone app. Twitter has ruined my ability to write more than a handful of words at a time.]]></description>
			<content:encoded><![CDATA[<p>Testing the wordpress iPhone app.</p>
<p>Twitter has ruined my ability to write more than a handful of words at a time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2008/07/25/wordpress-iphone-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.povert.com @ 2012-02-07 04:36:18 -->
