<?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>woolie t. &#187; Programming</title>
	<atom:link href="http://www.wooliet.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wooliet.com</link>
	<description>Floating my Boat</description>
	<lastBuildDate>Sun, 04 Jul 2010 05:58:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Patterns Schmatterns: But Don&#8217;t Forget the Fun</title>
		<link>http://www.wooliet.com/2010/07/03/patterns-schmatterns-but-dont-forget-the-fun/</link>
		<comments>http://www.wooliet.com/2010/07/03/patterns-schmatterns-but-dont-forget-the-fun/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 05:58:36 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[overengineering]]></category>
		<category><![CDATA[seanmonstar]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=515</guid>
		<description><![CDATA[Courtesy of SeanMonstar, I now know to guard myself against Criminal Overengineering.
The most insidious cause of overengineering is over-generalizing. We will over-generalize anything given half a chance. Writing code to work with a list of students? Well, we might want to work with teachers and the general public someday, better add a base People class [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2010/07/03/patterns-schmatterns-but-dont-forget-the-fun/">Patterns Schmatterns: But Don&#8217;t Forget the Fun</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Courtesy of <a href="http://seanmonstar.com/post/731937222/criminal-overengineering">SeanMonstar</a>, I now know to guard myself against <a href="http://coderoom.wordpress.com/2010/06/23/criminal-overengineering/"><strong>Criminal Overengineering</strong></a>.</p>
<blockquote><p>The most insidious cause of overengineering is over-generalizing. We will over-generalize anything given half a chance. Writing code to work with a list of students? Well, we might want to work with teachers and the general public someday, better add a base People class and subclass Student from that. Or Person and then EducationPerson and then Student. Yes, that’s better, right?<br />
&#8230;<br />
We have to stop championing each ridiculous feat of overengineering and call it what it is. It’s not ‘future-proof’, because we can’t see the future. It’s not robust, it’s hard to read. Applying a generic solution to a single case isn’t good programming, it’s criminal overengineering because like it or not somebody, somewhere will pay for it.
</p></blockquote>
<p>He mentions fear as a motivator; the worry that your code won&#8217;t stand up against the unforeseen use-case.  He also describes the sense of productivity it engenders. In other words, &#8220;look at all this code I just cranked out&#8221;.  </p>
<p>And while I agree with everything he says, I do have a small point of contention: He doesn&#8217;t account for the fun factor.  This must be the exception to the rule.  The one time it is okay to shoot way high.  </p>
<p>I mean, isn&#8217;t it <em>fun</em> to create these beasts? To take a simple problem and abstract it out to this giant chain of inheritance and interfaces and abstractions?  I&#8217;m serious here.  I&#8217;m sure there exist the coders who enjoy nothing more than filling in a function stub with one <code>return</code> statement, mumbling &#8220;done&#8221; to themselves, and then moving on to the next task at hand.  But aren&#8217;t most of us the kind who <em>enjoy</em> the creating and building of these&#8230;things?</p>
<p>So yeah, while absorbing the fluorescent rays of a cubicle sun, make sure not to &#8220;makes things harder than they are&#8221; (to quote my dad) too often.  But try to find an excuse every now and again to exercise those creative muscles and think larger than the simple problem at hand.  That&#8217;s what I say.</p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2010/07/03/patterns-schmatterns-but-dont-forget-the-fun/">Patterns Schmatterns: But Don&#8217;t Forget the Fun</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2010/07/03/patterns-schmatterns-but-dont-forget-the-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The ReadyAgain jQuery Plugin: Re-executing Ready</title>
		<link>http://www.wooliet.com/2010/06/09/the-readyagain-jquery-plugin-re-executing-ready/</link>
		<comments>http://www.wooliet.com/2010/06/09/the-readyagain-jquery-plugin-re-executing-ready/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 22:21:50 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[bitbucket]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[readmorerighthere]]></category>
		<category><![CDATA[readyagain]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=475</guid>
		<description><![CDATA[I&#8217;ve been wanting to become better acquainted with the Mecurial revision control system (see Hg Init for more info).    There&#8217;s also been a jQuery related issue I&#8217;ve been wanting to investigate.  So I made the jump and
1. Created a plugin
2. Created a repository for that plugin at BitBucket
ReadyAgain at BitBucket
The ReadyAgain [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2010/06/09/the-readyagain-jquery-plugin-re-executing-ready/">The ReadyAgain jQuery Plugin: Re-executing Ready</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been wanting to become better acquainted with the <a href="http://mercurial.selenic.com/">Mecurial</a> revision control system (see <a href="http://hginit.com/index.html">Hg Init</a> for more info).    There&#8217;s also been a <a href="http://jquery.com/">jQuery</a> related issue I&#8217;ve been wanting to investigate.  So I made the jump and</p>
<p>1. Created a plugin<br />
2. Created <a href="http://www.bitbucket.org/wooliet/readyagain">a repository</a> for that plugin at <a href="http://www.bitbucket.org/">BitBucket</a></p>
<p style="text-align:center;font-size:1.75em;padding:5px;border:1px solid #333;"><a href="http://www.bitbucket.org/wooliet/readyagain">ReadyAgain at BitBucket</a></p>
<h3 style>The ReadyAgain jQuery Plugin</h3>
<p>Prior to version 1.4, the array of functions saved by jQuery for execution when the DOM is ready (i.e. those functions added by <code>$(document).ready(function...)</code>) was an accessible property of jQuery. This meant that you could reference the array directly using something like <code>$.readyList</code>.  Now, however, that array has been hidden within an anonymous, self-executing function (the deepest, darkest well of data hiding in javascript, <a href="http://briancrescimanno.com/2009/09/24/how-self-executing-anonymous-functions-work/">here&#8217;s a bit of a primer</a>).  So re-executing all of the <code>ready</code> functions by grabbing a copy of that array becomes impossible.</p>
<p>The <a href="http://www.bitbucket.org/wooliet/readyagain">ReadyAgain</a> plugin is my attempt to solve that issue.  The specifics can be seen by looking at the code, but the basic concept is to override <code>jQuery.ready</code> to intercept each function as its added, and to save it within our own internal array.</p>
<h3>Public Code</h3>
<p>So the initial commit of the code is there and I&#8217;ve typed up a page on the Wiki with some examples.  I hope that people use it and maybe even contribute to it.  It would certainly be something fun for me to be a part of and from which to learn.</p>
<p><span id="more-475"></span></p>
<h3>The Path to Here</h3>
<p>An issue that has come up a couple of times regarding my <a href="http://wordpress.org/extend/plugins/read-more-right-here/">&#8216;Read More Right Here&#8217; Wordpress plugin</a> is that, when the post content is loaded, effects like a thickbox or lightbox or whatever-box are not applied to images in the new content.  More generally speaking, <em>any</em> javascript fanciness used on <em>any</em> of the new content elements is missing.  </p>
<p>The reason is that most every javascript based modification is applied to the document within a &#8216;DOM Ready&#8217; function (and rightly so) . With jQuery, this is the <code><a href="http://api.jquery.com/ready/">jQuery.ready</a></code> function.  So a plugin might add some nifty image effects to all images on the page like so:  <code>$('img').NiftyStuff()</code>.  But the images within the content pulled down by my plugin <em>aren&#8217;t yet there</em>.  They don&#8217;t arrive to the page until <em>after</em> the &#8216;Read More&#8217; link is clicked.  </p>
<p>So how do you re-execute <code>NiftyStuff</code> and the potentially countless other plugin functions on that new content?</p>
<p><strong>Live &amp; Delegate</strong></p>
<p>One quick solution would be to make use of jQuery&#8217;s <a href="http://api.jquery.com/live/">live</a> or <a href="http://api.jquery.com/delegate/">delegate</a> functions.  When used, they will monitor the DOM for new elements and execute code as needed.  But I guess this is still a relatively new process since it&#8217;s not something I&#8217;ve noticed in any of the plugins I&#8217;ve come across.</p>
<p><strong>Rerun Ready (i.e. my plugin)</strong></p>
<p>Re-execution of each of the saved <code>ready</code> functions is another possibility.  What&#8217;s more, the <a href="http://www.bitbucket.org/wooliet/readyagain">ReadyAgain</a> plugin will allow you to execute all of the ready functions within a more specific context (instead of the default &#8216;document&#8217; context, <a href="http://www.bitbucket.org/wooliet/readyagain/wiki/Home">see the wiki for more</a>).  So potentially only the <em>new</em> content will have the saved <code>ready</code> functions applied.</p>
<h3>Risky Business: Not the final solution</h3>
<p>At this point you might be thinking to yourself &#8220;Great, so you&#8217;ve packaged this with &#8216;Read More Right Here&#8217; and everything works perfectly&#8221;.  Sorry, but no.  At least not yet.</p>
<p>I experimented with it a bit, and it&#8217;s honestly just too hazardous.  I mean, it&#8217;s a serious case of &#8220;Use at your own risk&#8221;.  It is generally assumed (and again, rightly so) that the code executed within jQuery&#8217;s <code>ready</code> function will only be executed <em>once</em>.  So you might see a new element with a static ID value added to the page over and over. Or you might see some element that&#8217;s <a href="http://api.jquery.com/animate/">animating</a> with relative values (e.g. <code>top:'+=25px'</code>), which could happen over and over.  Or any other number of possible side-effects.  </p>
<p>This plugin is really something that (at least in its current form) should only be added on an individual basis.  You <em>have</em> to examine what happens within the <code>ready</code> function of other jQuery based Wordpress plugins.   There&#8217;s just no way that I can see to have this become default behavior within the RMRH Wordpress plugin.</p>
<p>But time will tell.  Maybe creating this public repository will put some eyes on it and who knows what solutions will develop from that.</p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2010/06/09/the-readyagain-jquery-plugin-re-executing-ready/">The ReadyAgain jQuery Plugin: Re-executing Ready</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2010/06/09/the-readyagain-jquery-plugin-re-executing-ready/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Miter Box Slider</title>
		<link>http://www.wooliet.com/2010/05/24/miter-box-slider/</link>
		<comments>http://www.wooliet.com/2010/05/24/miter-box-slider/#comments</comments>
		<pubDate>Mon, 24 May 2010 15:19:20 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Recommendations]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[codecanyon]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[miterbox]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=458</guid>
		<description><![CDATA[I submitted a jQuery plugin to CodeCanyon before this past weekend started, and this morning I received an &#8220;it&#8217;s been accepted&#8221; email.  If you&#8217;re not already familiar with it, CodeCanyon is a marketplace for code.  It allows anyone to submit a piece of code to sell. If accepted, they set the price and [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2010/05/24/miter-box-slider/">Miter Box Slider</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I submitted a jQuery plugin to <a href="http://codecanyon.net?ref=WoolieT">CodeCanyon</a> before this past weekend started, and this morning I received an &#8220;it&#8217;s been accepted&#8221; email.  If you&#8217;re not already familiar with it, <a href="http://codecanyon.net?ref=WoolieT">CodeCanyon</a> is a marketplace for code.  It allows anyone to submit a piece of code to sell. If accepted, they set the price and take a cut of any profits.  It&#8217;s part of the larger <a href="http://envato.com/">Envato</a> marketplace, which includes areas for selling things like <a href="http://themeforest.net?ref=WoolieT">site designs</a> and <a href="http://audiojungle.net?ref=WoolieT">audio clips</a>.  </p>
<p><a href="http://codecanyon.net/item/miter-box-slider/104871?ref=WoolieT">Miter Box Slider</a> is my submission. It&#8217;s a jQuery &#8217;slider&#8217; plugin (i.e. when there&#8217;s a slideshow display of images at websites). What&#8217;s awesome about it is that it provides the ability to create truly <em>unique</em> animation transitions. With other sliders you&#8217;ll see a set of predefined transition effects, but with <a href="http://codecanyon.net/item/miter-box-slider/104871?ref=WoolieT">Miter Box</a>, <em>you</em> create the transitions.  It&#8217;s actually very powerful.  One of the largest issues I had developing it was that I would often end up just playing with it. It&#8217;s a fun tool for experimenting. </p>
<p>Regardless of whether other people decide to use it, I really am pretty proud of it.  Remember that those who run the site review the code and set the price? Right now, mine is the <a href="http://codecanyon.net/category/javascript?x=23&#038;y=11&#038;order=desc&#038;sort_by=cost&#038;type=files&#038;categories=javascript&#038;page=1&#038;ref=WoolieT">highest priced</a> (one of only two at that price) item in the javascript section of code. I don&#8217;t know everything that goes into that price point, but I will say that I think it&#8217;s an indication of the power my plugin offers. </p>
<p>If you&#8217;ve got a site, or create sites, and are looking for some way to spice up the way you display your images, check out <a href="http://codecanyon.net/item/miter-box-slider/full_screen_preview/104871?ref=WoolieT">the Miter Box demo</a>.</p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2010/05/24/miter-box-slider/">Miter Box Slider</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2010/05/24/miter-box-slider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Absolute Positioning and the Canvas Element</title>
		<link>http://www.wooliet.com/2009/06/01/absolute-positioning-and-the-canvas-element/</link>
		<comments>http://www.wooliet.com/2009/06/01/absolute-positioning-and-the-canvas-element/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 04:27:46 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[johnresig]]></category>
		<category><![CDATA[processingjs]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=337</guid>
		<description><![CDATA[I&#8217;ve been working on a personal &#8220;hobby time&#8221; project lately using John Resig&#8217;s port of Processing (a Java thing) to Processing.js (a javascript thing).
I was at one of those lulls where, instead of worrying about the code, I started playing with the layout.  My &#60;canvas&#62; element is sitting inside a &#60;div&#62;, whose &#8220;positioning&#8221; property [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2009/06/01/absolute-positioning-and-the-canvas-element/">Absolute Positioning and the Canvas Element</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a personal &#8220;hobby time&#8221; project lately using <a href="http://ejohn.org/">John Resig&#8217;s</a> port of <a href="http://processing.org/">Processing</a> (a Java thing) to <a href="http://processingjs.org/">Processing.js</a> (a javascript thing).</p>
<p>I was at one of those lulls where, instead of worrying about the code, I started playing with the layout.  My <code>&lt;canvas&gt;</code> element is sitting inside a <code>&lt;div&gt;</code>, whose &#8220;positioning&#8221; property I changed to <code>absolute</code>.  After this edit, the top-left corner of my <code>&lt;canvas&gt;</code> was no longer <code>(0,0)</code>.  It had changed to the <code>(x,y)</code> coordinate of the <code>&lt;canvas&gt;</code> element on the page. </p>
<p>Of course, the above conclusion was only reached <em>after</em> a bunch of &#8220;W.T.F is going on? Why T.F. is everything broken?&#8221;. After some other debugging routes, it dawned on me what <em>might</em> have happened.  So I set the <a href="http://processingjs.org/reference/frameRate">frame rate</a> to 1, and used <a href="http://getfirebug.com/">Firebug</a> to <a href="http://getfirebug.com/logging.html">log</a> the <a href="http://processingjs.org/reference/mouseX"><code>mouseX</code></a> and <a href="http://processingjs.org/reference/mouseY"><code>mouseY</code></a> as I moved the mouse around.  Sure enough, my positioning of &#8220;<code>top: 200; left:200;</code>&#8221; was reflected in Firebug&#8217;s console output showing coordinates near those values while hovering around the top left corner.  Commenting out the style sheet&#8217;s absolute positioning returned the console output to the <code>(0,0)</code> area code.</p>
<p>So this is a defect, right?  I can&#8217;t imagine that&#8217;s how it&#8217;s supposed to work.  Anyway, consider this a <a href="http://www.wooliet.com/2008/08/23/heads-up-regarding-the-codeigniter-video-tutorial/">heads-up</a> if you decide to embark on a little processing.js play.</p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2009/06/01/absolute-positioning-and-the-canvas-element/">Absolute Positioning and the Canvas Element</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2009/06/01/absolute-positioning-and-the-canvas-element/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Wordpress, jQuery and &#8216;noConflict&#8217;</title>
		<link>http://www.wooliet.com/2008/09/05/wordpress-jquery-and-noconflict/</link>
		<comments>http://www.wooliet.com/2008/09/05/wordpress-jquery-and-noconflict/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 03:31:19 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=108</guid>
		<description><![CDATA[I&#8217;ve been working on a plugin for Wordpress and have, until now, been using Mootools.  I decided that I should try and simplify things by using jQuery, since it is already included with Wordpress.  
So let me take you through my links and hopefully summarize what I&#8217;ve learned.  First though, let me [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/09/05/wordpress-jquery-and-noconflict/">Wordpress, jQuery and &#8216;noConflict&#8217;</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a plugin for <a href="http://wordpress.org">Wordpress</a> and have, until now, been using <a href="http://mootools.net/">Mootools</a>.  I decided that I should try and simplify things by using <a href="http://jquery.com/">jQuery</a>, since it is already included with Wordpress.  </p>
<p>So let me take you through my links and hopefully summarize what I&#8217;ve learned.  First though, let me say, I&#8217;m assuming that you already know what it means to hook into the Wordpress application flow by <a href="http://codex.wordpress.org/Function_Reference/add_action">adding &#8220;actions&#8221;</a>. If not, read up.<br />
<span id="more-108"></span></p>
<h3>Inject Your Javascript</h3>
<p>The Wordpress Codex for <code><a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">wp_enqueue_script</a></code> has a list of other javascript libraries included as well as a link to <a href="http://nickohrn.com/loading-javascript-libraries-in-wordpress-plugins-with-wp_enqueue_script/">this brief tutorial</a> at <a href="http://nickohrn.com/">Nick Ohrn</a>.</p>
<p>Basically Wordpress provides the <code>wp_register_script</code> method to register a javascript file and its dependencies using a unique string to serve as a &#8220;handle&#8221;.  After you&#8217;ve registered them, you can then use that handle when calling <code>wp_enqueue_script</code>.  This will spit out the appropriate <code>&lt;script&gt;</code> elements to your document, in their correct order, and (hopefully) avoid any duplicate entries or conflicts with other scripts.</p>
<p>I&#8217;ve added both the  <code>wp_register_script</code> and the <code>wp_enqueue_script</code> calls to the method I&#8217;ve added as part of Wordpress <code>'init'</code> (i.e. <code>add_action('init', myLoadJsMethod)</code>).  I think you can also just use <code>wp_enqueue_script</code> directly, without first registering, but it seems like a good idea to do both.  For example, if things change, you can keep the registration in <code>'init'</code> but then move the call to enqueue somewhere else, like the <code>'template_redirect'</code>.</p>
<p>What&#8217;s important to know, though, is that you cannot call <code>wp_enqueue_script</code> as part of the <code>'wp_head'</code> action.  At that point, it&#8217;s too late.  This was confusing to me because I was originally just echoing out the path to my script within the function I set for <code>'wp_head'</code>, and it worked fine.  But to work within the Wordpress world, it has to happen <em>before</em> the header action, which means <code>'init'</code> or <code>'template_redirect'</code> (or possibly others, not sure).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_init_method<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// include the js if not a single post page</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> 
    <span style="color: #009900;">&#123;</span>
       wp_register_script<span style="color: #009900;">&#40;</span>
       		<span style="color: #0000ff;">'my_handle'</span><span style="color: #339933;">,</span> 
                my_get_base_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;js/my_javascript.js&quot;</span><span style="color: #339933;">,</span>
                <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// my_javascript.js depends on jQuery</span>
&nbsp;
       wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'my_handle'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>            
    <span style="color: #009900;">&#125;</span>    
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> my_get_base_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> PLUGINDIR <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> plugin_basename<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;read-more-right-here/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> my_init_method<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Notice that at line #11 I only needed to use the string &#8216;jquery&#8217; to register my script as being dependent on it.  This is because &#8216;jquery&#8217; is included with Wordpress and has already been registered with that handle.</p>
<h3>Making jQuery Work</h3>
<p>Let&#8217;s test this out with a simple call to <code>alert</code> in our javascript.  Following good practice, we&#8217;ll make sure to do this after our page&#8217;s DOM is locked and loaded.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'document'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>	
	<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ready&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Ahh Crap.  <a href="http://getfirebug.com/">Firebug</a> is telling me that <font color="red"><strong>$ is not a function</strong></font>.  A little google later and I&#8217;m at <a href="http://comox.textdrive.com/pipermail/wp-hackers/2008-March/018979.html">this thread</a>, with the answer I&#8217;m seeking nine messages in, <a href="http://comox.textdrive.com/pipermail/wp-hackers/2008-March/019024.html">right here</a>.</p>
<blockquote><p>jQuery in WordPress uses the noConflict option to prevent issues with<br />
Prototype&#8230;&#8230;.Check online for jQuery.noConflict()</p></blockquote>
<p>It&#8217;s always something.  Alright, <a href="http://docs.jquery.com/Using_jQuery_with_Other_Libraries">so what do the jQuery docs say</a>?</p>
<blockquote><p>By default, jQuery uses &#8220;$&#8221; as a shortcut for &#8220;jQuery&#8221;.  However, you can override that default by calling <a href="http://docs.jquery.com/Core/jQuery.noConflict">jQuery.noConflict()</a> at any point after jQuery and the other library have both loaded.</p></blockquote>
<p>It goes on to say that you can also just set something else as the new &#8220;$&#8221; by setting a new variable to the result of <code>jQuery.noConflict()</code>.</p>
<p>So the above javascript is changed to this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> $j <span style="color: #339933;">=</span> jQuery.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
$j<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'document'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>	
	<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ready&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>And it works!</p>
<h3>Summation (Because I Type Too Much)</h3>
<ul>
<li>Use <code>wp_register_script</code> and <code>wp_enqueue_script</code> to load your javascript</li>
<li>Do <em>not</em> use <code>wp_register_script</code> and <code>wp_enqueue_script</code> as part of the <code>wp_head</code> hook, it must happen earlier (e.g. <code>init</code>, <code>template_redirect</code>)</li>
<li>jQuery in Wordpress uses &#8220;no conflict&#8221; mode, see <a href="http://docs.jquery.com/Using_jQuery_with_Other_Libraries">here</a> for workarounds</li>
</ul>
<p>If I&#8217;ve misstated or completly misunderstood anything above, please feel free to correct me in the comments.</p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/09/05/wordpress-jquery-and-noconflict/">Wordpress, jQuery and &#8216;noConflict&#8217;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2008/09/05/wordpress-jquery-and-noconflict/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>LOLCode Has Me LOL&#8217;ing OMG DOOD</title>
		<link>http://www.wooliet.com/2008/09/01/lolcode-has-me-loling-omg-dood/</link>
		<comments>http://www.wooliet.com/2008/09/01/lolcode-has-me-loling-omg-dood/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 05:04:07 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[geshi]]></category>
		<category><![CDATA[lolcat]]></category>
		<category><![CDATA[todo]]></category>
		<category><![CDATA[wpsyntax]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=103</guid>
		<description><![CDATA[Not only is LOLCode funny, but it&#8217;s effin real.  Here are the specs and here are some implementations.
But who cares.  It&#8217;s just plain funny.  I mean, I&#8217;ve read the two front page examples (very bottom of the home page) at least twenty times and it still manages to entertain.  
COUNT!!1
HAI
CAN HAS [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/09/01/lolcode-has-me-loling-omg-dood/">LOLCode Has Me LOL&#8217;ing OMG DOOD</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Not only is <a href="http://lolcode.com/">LOLCode</a> funny, but it&#8217;s effin <em>real</em>.  <a href="http://lolcode.com/specs/1.2">Here are the specs</a> and here are some <a href="http://lolcode.com/implementations/implementations">implementations</a>.</p>
<p>But who cares.  It&#8217;s just plain funny.  I mean, I&#8217;ve read the two front page examples (very bottom of the home page) at least twenty times and it still manages to entertain.  </p>
<p><a href="http://lolcode.com/examples/count-1">COUNT!!1</a></p>
<blockquote><pre>HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
	UP VAR!!1
	VISIBLE VAR
	IZ VAR BIGGER THAN 10? KTHXBYE
IM OUTTA YR LOOP
KTHXBYE</pre>
</blockquote>
<p><a href="http://qbnz.com/highlighter/">GeSHi</a> (used by <a href="http://wordpress.org/extend/plugins/wp-syntax/">WP-Syntax</a>) needs to get up in that piece so my blog can have syntactically correct formatting of LOLCode.</p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/09/01/lolcode-has-me-loling-omg-dood/">LOLCode Has Me LOL&#8217;ing OMG DOOD</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2008/09/01/lolcode-has-me-loling-omg-dood/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Heads-Up Regarding the CodeIgniter Video Tutorial</title>
		<link>http://www.wooliet.com/2008/08/23/heads-up-regarding-the-codeigniter-video-tutorial/</link>
		<comments>http://www.wooliet.com/2008/08/23/heads-up-regarding-the-codeigniter-video-tutorial/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 22:13:49 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=95</guid>
		<description><![CDATA[I&#8217;ve finally gotten around to working through the second video tutorial for CodeIgniter.  It&#8217;s centered around creating a blog in about 20 minutes (it continues from the shorter, &#8220;Hello World&#8221; intro tutorial&#8230;so if you haven&#8217;t already, I&#8217;d start from there).
There&#8217;s a small error I didn&#8217;t notice (but should have).  It had me stumped [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/08/23/heads-up-regarding-the-codeigniter-video-tutorial/">Heads-Up Regarding the CodeIgniter Video Tutorial</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally gotten around to working through <a href="http://codeigniter.com/tutorials/watch/blog/">the second video tutorial</a> for <a href="http://codeigniter.com">CodeIgniter</a>.  It&#8217;s centered around creating a blog in about 20 minutes (it continues from the shorter, <a href="http://codeigniter.com/tutorials/watch/intro/">&#8220;Hello World&#8221; intro tutorial</a>&#8230;so if you haven&#8217;t already, I&#8217;d start from there).</p>
<p>There&#8217;s a small error I didn&#8217;t notice (but should have).  It had me stumped for a bit but, as is most always the case, the solution was painfully obvious.<br />
<span id="more-95"></span><br />
I&#8217;ve got the video running and am coding along as the guy speaks.  Pretty early on, when setting CodeIgniter to automatically connect to a particular database, you&#8217;re instructed to open <em>system/application/config/autoload.php</em> file to modify the <code>$autoload['core']</code> array to include the database &#8220;core library&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
| -------------------------------------------------------------------
|  Auto-load Core Libraries
| -------------------------------------------------------------------
|
| DEPRECATED:  Use $autoload['libraries'] above instead.
|
*/</span>
<span style="color: #000088;">$autoload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'core'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'database'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>A little later, after creating a couple of database entries and setting the page to display their values, I was greeted with the following error:</p>
<blockquote><p><strong>A PHP Error was encountered</strong></p>
<p>Severity: Notice</p>
<p>Message: Undefined property: Blog::$db</p>
<p>Filename: controllers/blog.php</p>
<p>Line Number: 16</p></blockquote>
<p>The call to <code>$this->db->get</code> failed because the <code>$db</code> member of <code>Blog</code> (which extends CodeIngiter&#8217;s <code>Controller</code> class) didn&#8217;t exist.</p>
<p>You know why?  Did you actually read the comments in the php code above?  I didn&#8217;t.  I was quickly moving around and typing while the tutorial played.  If you didn&#8217;t notice it the first time, reread them now.</p>
<p>See it?  Nice and big and all-caps: <code><strong>DEPRECATED</strong></code>.  &#8220;Use <code>$autoload['libraries']</code> above instead.&#8221;  Which I did and then it worked.</p>
<p>Lesson learned, right?  Always read the comments.</p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/08/23/heads-up-regarding-the-codeigniter-video-tutorial/">Heads-Up Regarding the CodeIgniter Video Tutorial</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2008/08/23/heads-up-regarding-the-codeigniter-video-tutorial/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Reading Lines Using Java</title>
		<link>http://www.wooliet.com/2008/08/21/reading-lines-using-java/</link>
		<comments>http://www.wooliet.com/2008/08/21/reading-lines-using-java/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 02:41:29 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[readlines]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=90</guid>
		<description><![CDATA[Every year or so, for whatever reason, I end-up trying to read text files line by line using Java.  I always start out thinking regular expressions, and it always starts to look unnecessarily convoluted. 
Three or four years ago I came across BufferedReader and, whatdya know, its got the function readLine.  Of course, [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/08/21/reading-lines-using-java/">Reading Lines Using Java</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Every year or so, for whatever reason, I end-up trying to read text files line by line using Java.  I always start out thinking regular expressions, and it always starts to look unnecessarily convoluted. </p>
<p>Three or four years ago I came across <code><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/io/BufferedReader.html">BufferedReader</a></code> and, whatdya know, its got the function <code><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/io/BufferedReader.html#readLine()">readLine</a></code>.  Of course, each time I start anew, I forget the lessons I&#8217;ve previously learned.  Then, when the code&#8217;s starting to look rough, I remember &#8220;Oh yeah, there&#8217;s a really easy way to do this.&#8221;  So I find the old code and voilà.</p>
<p>I realize this is simple stuff.  It&#8217;s just one of those things that&#8217;s worth putting out there for the occasional search result that might help someone out .</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* Note that I've left out exception handling. */</span>
&nbsp;
ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> lines = <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399; font-weight: bold;">File</span> file = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">File</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;C:<span style="color: #000099; font-weight: bold;">\p</span>ath<span style="color: #000099; font-weight: bold;">\t</span>o<span style="color: #000099; font-weight: bold;">\f</span>ile.txt&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003399; font-weight: bold;">BufferedReader</span> reader = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">BufferedReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">FileReader</span><span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003399; font-weight: bold;">String</span> line<span style="color: #339933;">;</span>
<span style="color: #000000;  font-weight: bold;">while</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>line = bufferedReader.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!</span>= <span style="color: #006600; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
     lines.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>			
&nbsp;
bufferedReader.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/08/21/reading-lines-using-java/">Reading Lines Using Java</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2008/08/21/reading-lines-using-java/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Firebug&#8217;s Future</title>
		<link>http://www.wooliet.com/2008/08/12/firebugs-future/</link>
		<comments>http://www.wooliet.com/2008/08/12/firebugs-future/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 23:17:09 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[joehewitt]]></category>
		<category><![CDATA[johnresig]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=75</guid>
		<description><![CDATA[Firebug is a fantastic tool.  It works as an add-on to Firefox and can be used for all sorts of fun stuff.  It is a javascript debugger (breakpoints, variables and watch expressions).  It can also be used to &#8220;inspect&#8221; whatever web page you happen to be visiting (hover over areas of the [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/08/12/firebugs-future/">Firebug&#8217;s Future</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://getfirebug.com/">Firebug</a> is a fantastic tool.  It works as an add-on to <a href="https://addons.mozilla.org/en-US/firefox/addon/1843">Firefox</a> and can be used for all sorts of fun stuff.  It is a javascript debugger (breakpoints, variables and watch expressions).  It can also be used to &#8220;inspect&#8221; whatever web page you happen to be visiting (hover over areas of the page to see its corresponding HTML and CSS).  It&#8217;ll even profile the javascript.</p>
<p>The original author, Joe Hewitt, <a href="http://joehewitt.com/post/firebug-news/">open sourced Firebug sometime last year</a> and back in mid-July, <a href="http://ejohn.org/about/">John Resig</a> (a well-known javascript guru and Mozilla employee) <a href="http://ejohn.org/blog/firebuggin/">announced that he was taking over its development</a>. Today <a href="http://ejohn.org/blog/tracking-firebug-stability/">he laid out his initial plans</a>:</p>
<ul>
<li>Improve the knowledge of Firebug that we have</li>
<li>Build a runnable set of test cases to prevent regressions</li>
<li>Track the state of Firebug performance</li>
<li>Audit and Improve</li>
</ul>
<p>I can&#8217;t wait to see how Firebug evolves now that Resig has reign.</p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/08/12/firebugs-future/">Firebug&#8217;s Future</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2008/08/12/firebugs-future/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Available Online: When Print Has No Space for Content</title>
		<link>http://www.wooliet.com/2008/08/09/available-online-when-print-has-no-space-for-content/</link>
		<comments>http://www.wooliet.com/2008/08/09/available-online-when-print-has-no-space-for-content/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 04:17:59 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Internets]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[absurd]]></category>
		<category><![CDATA[drdobbs]]></category>
		<category><![CDATA[missinglistings]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=73</guid>
		<description><![CDATA[Dr. Dobb&#8217;s Journal is a pretty well-known magazine geared towards software engineers, and they&#8217;ve been at it for more than thirty years.  The articles are generally pretty hit or miss for my taste. I was just reading the August 2008 print edition, specifically Disentangling Concepts in Object-Oriented Systems.  It&#8217;s pretty meh in my [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/08/09/available-online-when-print-has-no-space-for-content/">Available Online: When Print Has No Space for Content</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ddj.com/about.html">Dr. Dobb&#8217;s Journal</a> is a pretty well-known magazine geared towards software engineers, and they&#8217;ve been at it for more than thirty years.  The articles are generally pretty hit or miss for my taste. I was just reading the August 2008 print edition, specifically <a href="http://www.ddj.com/cpp/209900542">Disentangling Concepts in Object-Oriented Systems</a>.  It&#8217;s pretty <em>meh</em> in my opinion, but that&#8217;s neither here nor there.  The problem I found is something I&#8217;ve come across before in this magazine, but this time it was just plain absurd.<br />
<span id="more-73"></span></p>
<h3>The Setup</h3>
<p>The overall gist of the article is the promotion of good <a href="http://en.wikipedia.org/wiki/Object-oriented_design">OO</a> design.  The focus is interface design, and the author begins with an example of acceptable code that could use a little redesign.</p>
<blockquote><p>I start with a simple implementation of a PolarArray class that meets the requirements previously specified. I fixed the size of the globe to 8×8 (via const variables); see Listing One.</p></blockquote>
<p>Okay, &#8220;Listing One&#8221;.  I flip the page and there it is, &#8220;Listing One&#8221;, which is a complete implementation for his example class (plus six lines of example calls).  This listing takes up <em>more than half</em> of the page.  I am fully aware that this is the stepping stone towards greater understanding.  I can see that the author has laid out some perfectly plausible code, in its entirety, as the starting point of a lesson. </p>
<p>Then, predictably, refinements are described. (By the way, all bold text in all of the following quotes are mine).</p>
<blockquote><p>Consider how you might use the various features of object-oriented design to better differentiate the two concepts in play. What if you refactor the index-translation portion of the class so that it is publicly available? You could force users to understand coordinate system and coordinates as distinct concepts from value lookup.</p>
<p><strong>Listing Two (available online; see &#8220;Resource Center,&#8221; page 5</strong>) certainly differentiates the value lookup from the coordinate system.</p></blockquote>
<p>Okay, &#8220;Listing Two&#8221; isn&#8217;t included with the article.  It appears that the author thought it would be included, because he doesn&#8217;t even really describe what he&#8217;s done.  But whatever.  I know that there&#8217;s only so much code they&#8217;re going to put in a print magazine.  The author probably has a few more iterations of improvement to make anyway.  And I am curious what the final result will be.</p>
<blockquote><p>Let&#8217;s back up a step and try a different approach&#8230;.If you add a few <em>enums</em> to the code, the implementation might look like <strong>Listing Three (available online)</strong>.  Now we&#8217;re getting somewhere!</p></blockquote>
<p>What?!  Alright, there&#8217;s no &#8220;Listing Three&#8221; code either.  And seriously, is it just me, or does it seem like the author assumed it would be included with the article?  Did the editors at Dobbs do any&#8230;editing work on this?</p>
<blockquote><p>Let&#8217;s take this a step further&#8230;.Similarly, you will create a <em>Pole</em> base class, from which we will derive <em>NorthPole</em> and <em>SouthPole</em>; <strong>see Listing Four (available online)</strong>.</p>
<p>Now we&#8217;re really making progress! <strong>Looking at the example client code</strong>, you see that the distinction between the three concepts—value lookup, coordinate system, and coordinate—is clearly differentiated.</p></blockquote>
<p>Sweet.  What I like to do while reading Dr. Dobbs on the can is to also bring the laptop in with me just in case there&#8217;s some code I want to view.</p>
<blockquote><p>Pay particular attention to the example client code at the bottom of the listing; notice how it is both readable and clearly differentiates the three concepts into separate tokens; <strong>see Listing Five (available online)</strong>.</p></blockquote>
<p>That&#8217;s it.  The rest of the show is mostly a recap.  Which is what I&#8217;d like to do as well.</p>
<h3>The Punchline</h3>
<p>There were five listings of code, each one serving as a point of improvement against its previous.  The only code listing included with this article is the first one, the &#8220;wrong&#8221; one.  It occupies more than half (literally) of the page.  It didn&#8217;t have to be that way.  It&#8217;s an interface that&#8217;s being described, right?  So why not just print the function signatures?  We don&#8217;t need no stinkin&#8217; function bodies.  And example client code?  I need to see examples of function calls that have no parameters?  With all the space used for that first listing, there&#8217;s more that could have been done.</p>
<h3>The Kicker</h3>
<p>Did you follow my link to the story at their website?  You might have already noticed what I find to be the best part of all of this.  I expected to see instances of &#8220;(available online)&#8221; replaced with the actual listings.  They&#8217;re not.  &#8220;Listing Two&#8221; is followed by &#8220;(available online at www.ddj.com/code/)&#8221;.  The rest just say &#8220;(available online)&#8221;.  That&#8217;s it.  Not even a friggin&#8217; link.  </p>
<p>The magazine&#8217;s &#8220;Resource Center on page 5&#8243; is a box that mentions &#8220;www.ddj.com&#8221;.  The homepage.  I guess they figure you can track down the specific article and from there find the code.</p>
<p>When you have found the article at their website, you are rewarded with &#8220;<a href="www.ddj.com/code/">ddr.com/code</a>&#8220;?  What&#8217;s there?  A list of three links, each a publications you might have read and for which you might be searching for code.</p>
<p>It&#8217;s all so wrong in so many ways.  But I feel cleansed having now ranted.  </p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/08/09/available-online-when-print-has-no-space-for-content/">Available Online: When Print Has No Space for Content</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2008/08/09/available-online-when-print-has-no-space-for-content/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Do More to Do Better</title>
		<link>http://www.wooliet.com/2008/08/04/do-more-to-do-better/</link>
		<comments>http://www.wooliet.com/2008/08/04/do-more-to-do-better/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 00:29:35 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Recommendations]]></category>
		<category><![CDATA[advice]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/?p=65</guid>
		<description><![CDATA[Coding Horror, a blog that I&#8217;ve started reading regularly, has some fantastic advice on how to improve your skills (regardless of the domain): Quantity Always Trumps Quality.  
When it comes to software, the same rule applies. If you aren&#8217;t building, you aren&#8217;t learning. Rather than agonizing over whether you&#8217;re building the right thing, just [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/08/04/do-more-to-do-better/">Do More to Do Better</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.codinghorror.com/blog/">Coding Horror</a>, a blog that I&#8217;ve started reading regularly, has some fantastic advice on how to improve your skills (regardless of the domain): <a href="http://www.codinghorror.com/blog/archives/001160.html">Quantity Always Trumps Quality</a>.  </p>
<blockquote><p>When it comes to software, the same rule applies. If you aren&#8217;t building, you aren&#8217;t learning. Rather than agonizing over whether you&#8217;re building the right thing, <em>just build it</em>. And if that one doesn&#8217;t work, <a href="http://www.codinghorror.com/blog/archives/000190.html">keep building</a> until you get one that does.</p></blockquote>
<p>This is advice that I sincerely need to start following.  I tend to have the debilitating problem of starting to work on an idea but never completing it because of constant tweaks and muddles and experiments and refinements <em>ad nauseam</em>.  With an approach like that, your results are always incomplete.  And when you feel like you can never complete something, you tend to move on to something else (i.e. quit).
<p/>
When I used to create and record music, it was the same thing.  The difference, however, was that there was always something to show for the effort, even if I wasn&#8217;t totally satisfied.  No matter my perceived flaws, there was still a piece of recorded music I could share with others.  But when the code isn&#8217;t finished, or the design still &#8220;in-flux&#8221;, it&#8217;s pretty difficult to call it a day and let the beast loose on the world.  </p>
<p/>
I hereby resolve to&#8230;oh who am I kidding.</p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/08/04/do-more-to-do-better/">Do More to Do Better</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2008/08/04/do-more-to-do-better/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Friendly Reminder &#8211; mod_rewrite needs AllowOverride All</title>
		<link>http://www.wooliet.com/2008/02/17/friendly-reminder-mod_rewrite-needs-allowoverride-all/</link>
		<comments>http://www.wooliet.com/2008/02/17/friendly-reminder-mod_rewrite-needs-allowoverride-all/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 08:15:56 +0000</pubDate>
		<dc:creator>Woolie</dc:creator>
				<category><![CDATA[Internets]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[modrewrite]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.wooliet.com/2008/02/17/friendly-reminder-mod_rewrite-needs-allowoverride-all/</guid>
		<description><![CDATA[Running Wordpress locally and not sure why the permalink or category pages are resulting in 404 errors?
It&#8217;s more than likely due to mod_rewrite not being allowed to do its job. If you don&#8217;t know anything about mod_rewrite, here is a nice howto.  Also, of course, is Apache&#8217;s own documentation.
In a nutshell, the redirects created [...]<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/02/17/friendly-reminder-mod_rewrite-needs-allowoverride-all/">Friendly Reminder &#8211; mod_rewrite needs AllowOverride All</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Running Wordpress locally and not sure why the permalink or category pages are resulting in 404 errors?</p>
<p>It&#8217;s more than likely due to mod_rewrite not being allowed to do its job. If you don&#8217;t know anything about mod_rewrite, <a href="http://www.rankinglabs.com/Mod_Rewrite">here is a nice</a> howto.  Also, of course, is <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html">Apache&#8217;s own documentation</a>.</p>
<p>In a nutshell, the redirects created by Wordpress in your .htaccess need the authority to send a page request <em>elsewheres</em>.   Open httpd.conf and make sure that you have <strong>AllowOverride</strong> set to <strong>All</strong>.<br />
<span id="more-32"></span><br />
e.g.</p>
<blockquote><p><code><br />
Options Indexes FollowSymlinks MultiViews<br />
AllowOverride All<br />
Order allow,deny<br />
Allow from all</code></p></blockquote>
<p>I don&#8217;t mean in the default &#8220;&lt;Directory />&#8221; section of httpd.conf, I mean in the actual domain.  For example, you&#8217;re testing Wordpress and you&#8217;ve got something like: </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<code>Alias /wp "F:/webSites/wordpress"</code></p>
<p>Make sure you also have:</p>
<blockquote><p><code><br />
&lt;Directory "F:/webSites/wordpress"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Options Indexes FollowSymlinks MultiViews<br />
&nbsp;&nbsp;&nbsp;&nbsp;AllowOverride All<br />
&nbsp;&nbsp;&nbsp;&nbsp;Order allow,deny<br />
&nbsp;&nbsp;&nbsp;&nbsp;Allow from all<br />
&lt;/Directory&gt;</code></p></blockquote>
<p>Of course, mine was set to &#8220;None&#8221; instead of &#8220;All&#8221;.</p>
<p>Note also that you will obviously need to tell Apache to load that module by making sure the following line is uncommented (with &#8216;#&#8217; characters denoting line comments):</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<code>LoadModule rewrite_module modules/mod_rewrite.so</code></p>
<p>I spent way too much time trying to figure out what was wrong.  It&#8217;s almost always the case that the longer you spend trying to debug a specific problem, the more likely it is that the solution is dead simple.</p>
<p>
                             ~~~~~~~~~~~~~~~~

This has been a <a href="http://www.wooliet.com">woolie</a> posting.<br/><br/><a href="http://www.wooliet.com/2008/02/17/friendly-reminder-mod_rewrite-needs-allowoverride-all/">Friendly Reminder &#8211; mod_rewrite needs AllowOverride All</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wooliet.com/2008/02/17/friendly-reminder-mod_rewrite-needs-allowoverride-all/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
