Posts About Programming

return home »

The Lion’s Share of Learning to Program

Programming
From my experience, the lion's share of learning to program is learning to read documentation - learning to find singular answers quickly, outside of narrative books and tutorials. It's something often marginalized on the way to absorbing the basic, shared, methodologies of programming but it requires both the resourcefulness to find good documentation and, once found, the patience to read it. And with practice comes the speed to dip into it without interrupting your workflow. Once a programmer has gained that literacy, the impact of forgetfulness and rustiness will be mitigated to the point of trivial inconvenience.

In Response to Riding Rails’ “Rails Has Great Documentation”

Programming
Though I don't have much to articulate, more of a feeling, really, I felt compelled to respond to Raiding Rails' statement that "Rails Has Great Documentation." I'm by no means an experienced Rails developer - I've written a few small applications, even a simple gem - but as someone who's only recently learned enough of the framework to find his way around, I'd like to state simply that I found the process more frustrating from a documentation standpoint than previous learning experiences. I won't argue with any of the points that Gregg makes in his post. For the most part I find them completely valid, with Ryan Bates' Railscasts.com playing a particularly important role in my own education, but that doesn't change my own experience. Maybe it's stylistic choices within the resources themselves (I've found them to be quite narrative) or perhaps the organization of the community around them, I honestly don't know. With how amorphous these statements are, I'm not advocating, or ready to propose, a change. What I would like to do is share my experience, as vague as it may be, and hope that people with much more Ruby on Rails knowledge and involvement, like Gregg, will take notice and help bridge the gap for novice developers struggling with the documentation, like myself.

Overriding Feed Templates in WordPress

Programming
As with Daring Fireball, the titles of posts on this blog are often links to the content they reference rather than permalinks to the posts themselves (as is the default in WordPress). After struggling to find an easy way to override the default feed templates in order to accommodate this convention, I've finally settled on a method that you'll no doubt find both hackish and useful if you share a problem similar to mine. The steps are as follows:
  1. Create a template file for the feed you'd like to override and place it in the root of your WordPress theme. The default templates are located at /wp-includes with the prefix "feed-" (as of WordPress 3.0.1) and you should considering using them as the basis for your custom template. The file I created is named feed-rss2.php.
  2. In the functions.php file of your WordPress theme, add the following lines of code. Here I'm overriding the rss2 feed but you could replace instances of that string with any of the four feeds (rss, rss2, atom, rdf) :
    function custom_rss2(){
    	load_template( TEMPLATEPATH.'/feed-rss2.php' );
    	die();
    }
    add_action( 'do_feed_rss2', 'custom_rss2', 1 );
So, lets go over the good the bad and the ugly. The good news is that, after saving these files, you should now find you're able to bundle feed templates into your theme alongside all of your other templates. In my opinion, this capability should be natively supported in WordPress (perhaps it should look for feed template files of a certain name and only in their absence fall back to the default templates) but it's possible there's a good reason for the omission of functionality. The bad and the ugly are one in the same; no doubt you've already recoiled in horror at the sight of the die() command that makes this method possible. Without it, not only would your custom template load but the default template would be loaded in right behind it and you'd end up with quite a mess of markup in your feed. With it, and here's the hack, it stops WordPress dead in its tracks and prevents any further output. Unfortunately, it also, potentially, prevents other critical core WordPress code from being executed. I've traced the stack and from what I can tell, that isn't the case - it's working wonderfully for this site at the moment - but then I have "been known to make mistakes... from time to time" so utilize this method at your own risk. If you're looking for something quite a bit safer, I recommend following this helpful tutorial for creating a completely new feed in order to apply a custom template rather than overriding one of the defaults.
Born out of The Barbarian Group. Having not yet dived into either, I'd like to see a breakdown of the differences between Cinder and openFrameworks.

Git links for future reference

Programming
From the title, the concept doesn't sound particularly interesting but, after listening to a few different algorithms, the strengths and weakness of each become apparent in their contrast. As Jason Kottke put it "I feel like Homer Simpson when he first saw the drinking bird."
Unfortunately, Shazam / Landmark Digital Services seems intent on being suppressive regardless of their actual rights in the matter.
Currently using this plugin for a work in progress and I can't help but think of the NP-hard "bin packing problem" every time I see it.
The thought of a JS implementation of PureData is exciting; the other examples are equally worth a look. The W3C has started the Audio Incubator Working Group as a means to begin standardization.