<?xml version="1.0"?>
<!-- name="generator" content="blosxom/2.0" -->
<rss version="2.0">
<channel>
<title>In A Row - Get Your Ducks There   </title>
<link>http://www.inarow.net</link>
<description>Get Your Ducks in a Row - Development, Linux and Random Ramblings</description>
<language>en</language>
<pubDate>Fri, 11 Jul 2008 04:43:01 GMT</pubDate>
<lastBuildDate>Fri, 11 Jul 2008 04:43:01 GMT</lastBuildDate>

<item>
    <title>Introduction to PEAR</title>
    <link>http://www.inarow.net/2008/07/11#devshed1</link>
    <description>
		&lt;blockquote&gt;&lt;p&gt;If you're a &lt;span class=&quot;caps&quot;&gt;PHP &lt;/span&gt;programmer, chances are you've either run across &lt;span class=&quot;caps&quot;&gt;PEAR &lt;/span&gt;or could get some excellent use out of it. &lt;span class=&quot;caps&quot;&gt;PEAR &lt;/span&gt;is an acronym for &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; Extension and Application Repository. The creators and maintainers of &lt;span class=&quot;caps&quot;&gt;PEAR &lt;/span&gt;encourage you to pronounce it just like the fruit with the same spelling. But you'll get more than fiber from &lt;span class=&quot;caps&quot;&gt;PEAR, &lt;/span&gt;as you'll learn when you read the rest of this article...&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;A snippet from my article at codewalkers: &lt;a href=&quot;http://www.codewalkers.com/c/a/PEAR-Articles/The-PEAR-Package-Tour-PEAR-Basics/&quot;&gt;The &lt;span class=&quot;caps&quot;&gt;PEAR&lt;/span&gt; Package Tour:  &lt;span class=&quot;caps&quot;&gt;PEAR&lt;/span&gt; Basics&lt;/a&gt;.&lt;/p&gt;
		&lt;script src="http://feeds.feedburner.com/~s/InARow?i=http://www.inarow.net/entries/links/devshed1.html" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
	</description>
	<pubDate>Fri, 11 Jul 2008 04:43:01 GMT</pubDate>
    <guid>http://www.inarow.net/entries/links/devshed1.html</guid>
</item>
<item>
    <title>Link Attack III</title>
    <link>http://www.inarow.net/2008/06/27#link_attack_iii</link>
    <description>
		&lt;p&gt;&lt;a href=&quot;http://zenhabits.net/2008/06/how-to-get-a-lot-done-%E2%80%93-7-tips-to-achieve-more/&quot;&gt;&lt;strong&gt;How to Get a Lot Done - 7 Tips to Achieve More&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;
This veers a bit from my normal posts, but was a great read.  If you have goals, big or small, and feel like you aren't reaching them, give this a read.  The author certainly knows what he's talking about, being a world-travelling, company-starting, web-designing entrepreneur extraordinaire.&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://remysharp.com/2008/06/24/query-string-to-object-via-regex/&quot;&gt;&lt;strong&gt;Query String to Object via regex&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;
This is from remy sharp's blog.  This is a great example of the wonderful tidbits he doles out in helpful posts on this blog.  Lots of great jQuery, regex and Javascript &quot;magic&quot;.&lt;/p&gt;

&lt;div style=&quot;float:right&quot;&gt;
&lt;img src=&quot;http://inarow.net/static/images/entries/link_attack_iii.jpg&quot; alt=&quot;Sun T2000&quot; /&gt;&lt;br /&gt;
&lt;span style=&quot;font-size:80%&quot;&gt;Sun &lt;span class=&quot;caps&quot;&gt;T2000&lt;/span&gt;&lt;/caption&gt;&lt;br /&gt;
&lt;/div&gt;


&lt;p&gt;&lt;a href=&quot;http://ejohn.org/blog/deep-profiling-jquery-apps/&quot;&gt;&lt;strong&gt;Deep Profiling jQuery Apps&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;
John Resig does it again, releasing another awesome project.  This adds profiling into the callstack of a page utilizing jQuery.  It goes much deeper that the profiling capabilities of firebug, and will be a great help if you have a heavy client-side app using jQuery.&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://www.tbray.org/ongoing/When/200x/2008/05/01/Wide-Finder-2&quot;&gt;&lt;strong&gt;Wide Finder 2&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;
Tim Bray is running a second edition of his Wide Finder project.  The basic premise is that taking advantage of the multiple processors available in modern day powerhouse boxes should be easier.  He provided a fairly trivial application in ruby (72 lines to process gigs of log files for counts and top visited pages).  He then ran it (in 23 hours) for a benchmark on an 8-core, 32-thread Sun &lt;span class=&quot;caps&quot;&gt;T2000. &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;He's since given out accounts to a handful of others who had code to test on the box and provided some &lt;a href=&quot;http://wikis.sun.com/display/WideFinder/Results&quot;&gt;preliminary results&lt;/a&gt;.  As you'll see... OCaml apparently rocks, with results coming in at under 10 minutes and less than twice the code footprint of the original.  It's certainly an interesting project to follow.&lt;/p&gt;
		&lt;script src="http://feeds.feedburner.com/~s/InARow?i=http://www.inarow.net/entries/links/link_attack_iii.html" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
	</description>
	<pubDate>Fri, 27 Jun 2008 05:08:24 GMT</pubDate>
    <guid>http://www.inarow.net/entries/links/link_attack_iii.html</guid>
</item>
<item>
    <title>A Programmer's Introduction to jQuery</title>
    <link>http://www.inarow.net/2008/06/16#intro_to_jquery</link>
    <description>
		&lt;p&gt;&lt;small&gt;I wrote this up a while ago, I don't even remember why, but thought some people might enjoy it.&lt;/small&gt;&lt;/p&gt;

&lt;h4&gt;&quot;JavaScript, Ugh.&quot;&lt;/h4&gt;

&lt;p&gt;For many web developers, JavaScript is one of those subjects they'd rather avoid.  Five years ago, the landscape of client-side scripting was pretty bleak.  Browser inconsistencies, implementation bugs and numerous target platforms made developing client-side JavaScript a messy endeavor.&lt;/p&gt;

&lt;p&gt;And then, much to the chagrin of those developers, &quot;Web 2.0&quot; happened.  Overnight, every site on the internet began using &lt;span class=&quot;caps&quot;&gt;AJAX, &lt;/span&gt;every feature request for a site involved something dynamic and client-side, and JavaScript development quickly became as important a skill as any server-side technology.&lt;/p&gt;

&lt;h4&gt;Enter the Libraries&lt;/h4&gt;

&lt;p&gt;As this trend continued, smart developers began longing for the level of abstraction found in most server-side environments.  Just as a &lt;span class=&quot;caps&quot;&gt;PHP &lt;/span&gt;developer could call &lt;code&gt;mail()&lt;/code&gt; on nearly any platform and expect to have an email message sent, JavaScript developers craved this level of abstraction in their day to day work.&lt;/p&gt;

&lt;p&gt;In response to this need, several sharp developers have responded with JavaScript libraries to fill this gap.  These libraries seek to provide a uniform interface, across browser and operating system platforms, for the most common tasks that client-side scripting is called on to perform:&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; Manipulation (moving page elements around, hiding and showing objects)&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;AJAX &lt;/span&gt;and other flavors of client-server interaction that avoid a page refresh&lt;/li&gt;
&lt;li&gt;Animation&lt;/li&gt;
&lt;li&gt;Rich Interfaces (drag and drop, windowing, tabs, events)&lt;/li&gt;
&lt;li&gt;Form manipulation&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;Each of the popular libraries attempt to provide some or all of these capabilities, packaged in their own &lt;span class=&quot;caps&quot;&gt;API.&lt;/span&gt;&lt;/p&gt;

&lt;h4&gt;On to jQuery&lt;/h4&gt;

&lt;p&gt;This article focuses on one of theses libraries, &lt;a href=&quot;http://jquery.com&quot;&gt;jQuery&lt;/a&gt;.  jQuery design is focused on maintaining a small footprint, cross-browser compliance, and reducing the amount of code which must be written for applications.  It provides abstractions for &lt;span class=&quot;caps&quot;&gt;AJAX, DOM &lt;/span&gt;manipulation, event handling and animated effects.&lt;/p&gt;

&lt;p&gt;Developing with jQuery depends on two basic concepts, &lt;span class=&quot;caps&quot;&gt;CSS &lt;/span&gt;selectors and method chaining.&lt;/p&gt;

&lt;p&gt;In most vanilla JavaScript code (which does not make use of a library), you will find code like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function toggle_element( element_id ) {
        var element = document.getElementById( element_id );
        if ( !element ) {
                return false;
        }
  
        var display = element.style.display;
        if ( !display || display == 'block' ) {
                element.style.display = 'none';
        }
        else {
                element.style.display = 'block';
        }
  
        return true;
}
  
window.onload = function () {
        var toggler = document.getElementById( 'toggle_help' );
        if ( toggler ) {
                toggler.onclick = function () { toggle_element( 'help' ) }
        }
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The basic idea here, is that when the page is done loading, during the &lt;code&gt;window.onload&lt;/code&gt; event, we find the &lt;code&gt;toggle_help&lt;/code&gt; element and attach an &lt;code&gt;onclick&lt;/code&gt; event to it.  When that element is clicked, we find the &lt;span class=&quot;caps&quot;&gt;DOM &lt;/span&gt;element with an id of &quot;help&quot;, examine its current display state (the &lt;span class=&quot;caps&quot;&gt;CSS &lt;/span&gt;attribute which controls how it is presented in the flow of the page), determine if it is currently hidden or not, and toggle its display state.&lt;/p&gt;

&lt;p&gt;The same code, implemented with jQuery looks something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; $(document).ready( function () {
        $('#toggle_help').click( function () { $('#help').toggle(); });
});&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As you can see, the code is significantly shorter.  Admittedly, to try and compare based on the 22 versus three line count is a bit silly, as one could easily add or subtracts line from either implementation.  I think it is clear, though, which version is simpler.  jQuery strives to provide an appopriate level of abstraction, simplifying the developer's task, but not obscuring it behind a heavy &lt;span class=&quot;caps&quot;&gt;API.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;An important example of the abstraction jQuery provides is the &lt;code&gt;$(document).ready()&lt;/code&gt; construct.  This serves as an enhanced version of &lt;code&gt;window.onload&lt;/code&gt;.  The primary enhancement is that it acts in a cross-platform waym firing as soon as the &lt;span class=&quot;caps&quot;&gt;DOM &lt;/span&gt;of the page is ready for manipulation.  This is in contrast to &lt;code&gt;window.onload&lt;/code&gt; which can be delayed indefinitely if objects on the page load slowly or improperly (images, iframes, scripts, etc.)&lt;/p&gt;

&lt;h4&gt;&lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Selectors&lt;/h4&gt;

&lt;p&gt;As shown in the previous example, one core features of jQuery is the use of &lt;span class=&quot;caps&quot;&gt;CSS &lt;/span&gt;selectors to find elements within the page.  By now, I imagine that most web developers have had exposure to at least basic &lt;span class=&quot;caps&quot;&gt;CSS, &lt;/span&gt;which is all you'll generally need in order to develop very useful jQuery code.  The selector engine in jQuery implements &lt;span class=&quot;caps&quot;&gt;CSS2 &lt;/span&gt;and &lt;span class=&quot;caps&quot;&gt;CSS3 &lt;/span&gt;selectors, as well as adding a few useful extras.  The following examples, outline various selectors.&lt;/p&gt;

&lt;p&gt;Very concise selectors and code fragments are provided by the use of the $ symbol.  This is not a reserved character in JavaScript, and is used in jQuery as an alias for the main &lt;code&gt;jQuery&lt;/code&gt; object.  This will be seen throughout the examples.&lt;/p&gt;

&lt;p&gt;To start, here's the page we'll work against for these selector examples:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;
        &amp;lt;head&amp;gt;
                &amp;lt;title&amp;gt;Test Page&amp;lt;/title&amp;gt;
        &amp;lt;/head&amp;gt;
        &amp;lt;body&amp;gt;
                &amp;lt;div id=&amp;quot;header&amp;quot;&amp;gt;
                        &amp;lt;h1&amp;gt;Test Page&amp;lt;/h1&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div class=&amp;quot;instructions&amp;quot;&amp;gt;
                        &amp;lt;ul&amp;gt;
                                &amp;lt;li&amp;gt;Read Page&amp;lt;/li&amp;gt;
                                &amp;lt;li&amp;gt;Follow Examples&amp;lt;/li&amp;gt;
                        &amp;lt;/ul&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div id=&amp;quot;mainform&amp;quot;&amp;gt;
                        &amp;lt;form&amp;gt;
                                &amp;lt;span class=&amp;quot;instructions&amp;quot;&amp;gt;
                                        Fill out this form.
                                &amp;lt;/span&amp;gt;
                                &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;first_name&amp;quot; /&amp;gt;
                                &amp;lt;select name=&amp;quot;gender&amp;quot;&amp;gt;
                                        &amp;lt;option&amp;gt;Male&amp;lt;/option&amp;gt;
                                        &amp;lt;option&amp;gt;Female&amp;lt;/option&amp;gt;
                                &amp;lt;/select&amp;gt;
                        &amp;lt;/form&amp;gt;
                &amp;lt;/div&amp;gt;
        &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A simple example, find the header and slide it out of view.  The # character, in front of a name is used to find an element by its id attribute.  An id should be unique in a pages structure.  &lt;code&gt;slideUp()&lt;/code&gt; is an animation method which decreases the height of an element over time, until it is hidden.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$('#header').slideUp('slow');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Find the title heading of the page, and change its color.  In the selector, nested elements are found by simply following one selector with another.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$('#header h1').css('color', 'red');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Remove the second element of a list.  The &lt;code&gt;:nth-child()&lt;/code&gt; selector is provided by jQuery to facilitate this.  &lt;code&gt;remove()&lt;/code&gt; takes matched elements out of the &lt;span class=&quot;caps&quot;&gt;DOM.&lt;/span&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$('#instructions ul li:nth-child(2)').remove()&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Where the &lt;span class=&quot;caps&quot;&gt;CSS &lt;/span&gt;selector concept becomes very powerful, is when you want to operate on groups of items.  All methods of the jQuery object will operate across all the elements that match a given selector.&lt;/p&gt;

&lt;p&gt;Here, we'll find all the instructions and add a class to them.  &lt;code&gt;addClass()&lt;/code&gt; is a method which adds a &lt;span class=&quot;caps&quot;&gt;CSS &lt;/span&gt;class to the matched elements, useful to quickly change items to match a set style.  An important note, regarding &lt;code&gt;addClass()&lt;/code&gt; is that an &lt;span class=&quot;caps&quot;&gt;HTML &lt;/span&gt;element may have more than once class, even though this is not seen very often.  To match all elements which have a given class, the classname is started with a period.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$('.instructions').addClass('warning');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;These are some rather simple examples, but they touch on the main principles you'll use when creating selectors for use with jQuery.  Details on all the selectors available are provided in the &lt;a href=&quot;http://docs.jquery.com/Selectors&quot;&gt;jQuery Docs&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Method Chaining and 'this'&lt;/h4&gt;

&lt;p&gt;One possible disadvantage to using &lt;span class=&quot;caps&quot;&gt;CSS &lt;/span&gt;selectors, as outlined above, is that very complex selectors can become a performance bottleneck.  They can also result in your code being cluttered with the same selector over and over, as you repeatedly manipulate the same elements.  Two facilities help alleviate these issues.&lt;/p&gt;

&lt;h5&gt;Method Chaining&lt;/h5&gt;

&lt;p&gt;All methods of the jQuery object return themselves.  This will be a familiar concept to many object-oriented programmers, but can look a bit foreign to others.  The basic idea being that you need only perform a given selection operation once, and then you perform all necessary operations on that set of results.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$('.intructions').fadeIn('fast')
        .css('border', '1px solid red')
		.addClass('warning');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this example, we find all the instructions.  We cause them to appear, give them a red border and add the warning class.  (Apparently, we really, really want our instructions followed)  It is important to remember that this is equivalent to the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$('.intructions').fadeIn('fast');
$('.intructions').css('border', '1px solid red');
$('.intructions').addClass('warning');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Chaining methods in this manner allows for more concise code and snappier performance, as the selection operation need only be performed once.&lt;/p&gt;

&lt;h5&gt;'this'&lt;/h5&gt;

&lt;p&gt;Another facility provided is the definition of &lt;code&gt;this&lt;/code&gt; inside each jQuery method context to reflect the current element being operated on.  This becomes important with more advanced concepts, as many of them rely of providing callback functions which are executed in the context of  each element matched by the selector.&lt;/p&gt;

&lt;p&gt;In this example, we find every element with the class &quot;click_to_hide&quot; and then attach an &lt;code&gt;onclick&lt;/code&gt; event to it.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$('.click_to_hide').click( function () {
        $(this).hide();
});&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As you can see, we are creating an anonymous function for each element, and when the element is clicked, the element will be hidden.  In this instance, we wrap &lt;code&gt;this&lt;/code&gt; in the &lt;code&gt;jQuery/$&lt;/code&gt; method so we have access to the &lt;code&gt;hide()&lt;/code&gt; method.  Before wrapping, &lt;code&gt;this&lt;/code&gt; is simply a &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; Element.&lt;/p&gt;

&lt;h4&gt;&lt;span class=&quot;caps&quot;&gt;AJAX &lt;/span&gt;and Event Handling&lt;/h4&gt;

&lt;p&gt;Two final topics I'll touch on are &lt;span class=&quot;caps&quot;&gt;AJAX &lt;/span&gt;and event handling.  jQuery provides nice abstractions for both of these, which are likely to prevent numerous bugs and speed development.&lt;/p&gt;

&lt;h5&gt;&lt;span class=&quot;caps&quot;&gt;AJAX&lt;/span&gt;&lt;/h5&gt;

&lt;p&gt;The must-have feature for modern web sites, &lt;span class=&quot;caps&quot;&gt;AJAX, &lt;/span&gt;is greatly simplified when using the jQuery library.  Without using a library, you would be writing complex code to first instantiate a browser-specific &lt;code&gt;XmlHttpRequest&lt;/code&gt; object, then initiating a request and writing a callback function to be triggered.&lt;/p&gt;

&lt;p&gt;With jQuery, for the most common cases of &lt;span class=&quot;caps&quot;&gt;AJAX &lt;/span&gt;usage, you can accomplish this with one simple line:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// Grab the content of url and inject it into #div_to_load_in
$('#div_to_load_in').load(url);&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For a more complex case, where you want to manipulate or act on the result, you'll need to add a bit more code.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var url = '/update_status.php';
$.get(url, {status: $('#status_field').val(}), function (data) {
        if ( data == 'OK' ) {
                alert('Status Updated');
        }
        else {
                alert('Sorry, Status Update Failed. (' + data + ')');
        }
});&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here we're assuming the existence of a server-side script, &quot;update_status.php&quot;, which takes a &quot;status&quot; GET parameter and returns either &quot;OK&quot; or an error message.  In this example, I also utilized the &lt;code&gt;val()&lt;/code&gt; jQuery method which abstracts the process of obtaining the value from any form element.  This includes finding the value attribute of the selected option in a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; tag, value of a text field, or status of a checkbox.&lt;/p&gt;

&lt;h5&gt;Event Handling&lt;/h5&gt;

&lt;p&gt;Event handling in jQuery involves jQuery object methods which bind functions to events.  All of these binding methods are chainable, as with the previous examples.  Many of the browser-native events are simplified or enhanced, to make the script writer's life easier.&lt;/p&gt;

&lt;p&gt;An example of this is &lt;code&gt;hover()&lt;/code&gt; which allows you to bind a function to the movement of the mouse cursor in and out of an element.  Here we add a faux caret to elements of a list as we hover over them, add a 'selected' class, and then remove these decorations when the user's mouse moves on.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; $('li').hover(
        function () { $(this).prepend('&amp;lt;span&amp;gt;&amp;amp;gt;&amp;lt;/span&amp;gt;').addClass('selected'); },
        function () { $(this).removeClass('selected').find('span:first').remove(); }
);&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this example, we see use of &lt;code&gt;this&lt;/code&gt;, method chaining, and &lt;code&gt;find()&lt;/code&gt; which allows using selectors to dig down inside of an element.  &lt;/p&gt;

&lt;h4&gt;Further Reading&lt;/h4&gt;

&lt;p&gt;Hopefully, you now have a feeling for what jQuery can do for your code.  This was simply the 10,000 foot introductory fly-by... jQuery packs a sizeable array of methods and functionality into its 14kb size, and it takes a while to familiarize yourself with most of them.  To continue you exploration, these sites may be of use:&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://jquery.com&quot;&gt;jQuery Site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://docs.jquery.com/&quot;&gt;jQuery Manual&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://docs.jquery.com/Tutorials:How_jQuery_Works&quot;&gt;How jQuery Works by John Resig, Original jQuery Author&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


		&lt;script src="http://feeds.feedburner.com/~s/InARow?i=http://www.inarow.net/entries/development/js/intro_to_jquery.html" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
	</description>
	<pubDate>Mon, 16 Jun 2008 14:31:00 GMT</pubDate>
    <guid>http://www.inarow.net/entries/development/js/intro_to_jquery.html</guid>
</item>
<item>
    <title>Twitt(url)y - An Idea I Thought I Had</title>
    <link>http://www.inarow.net/2008/06/13#twitter_links</link>
    <description>
		&lt;p&gt;I had this awesome idea, evolved from my primary use for twitter -- finding interesting links that others tweet.  I wrote a script to watch the public timeline and grab &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;s, a script to resolve any tinyurl or is.gd or other links to their final destination, and a script to generate reports.&lt;/p&gt;

&lt;p&gt;Then I did some googling.  And found &lt;a href=&quot;http://twitturly.com/&quot;&gt;twitt(url)y&lt;/a&gt; where they aleady do this, with more features. ;)&lt;/p&gt;

&lt;p&gt;Note to self: &lt;strong&gt;Search first, then build.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Below are some results from a limited running of my aborted project.  I did learn about twitter users that simply spam their &lt;span class=&quot;caps&quot;&gt;URL &lt;/span&gt;all day long, and thus the results are number of users that tweeted the link in the time period, not just number of times the link appeared.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Past 3 Hours
2       http://www.nicovideo.jp/watch/sm3643812
2       http://tinyurl.com/6rbvlk
2       http://www.expansion.com/edicion/exp/mercados/wall_street/es/desarrollo/1134736.html
2       http://www.floort.com/show.php/2759
2       http://www.lanacion.cl//prontus_noticias_v2/site/artic/20080613/pags/20080613083112.html
1       http://weather.livedoor.com/area/13/63.html
1       http://www.digitalspy.co.uk/spywire/
1       http://radiopopbitch.com
----------------
Past 6 Hours
2       http://www.thetimesherald.com/apps/pbcs.dll/article?AID=/20080613/NEWS01/806130302/1002
2       http://best-forex-broker.wetpaint.com/
2       http://blog.excite.co.jp/shokotan/2859817/
2       http://gribao.com/s/2325/
2       http://tinyurl.com/5jcyhu]
2       http://tinyurl.com/6rbvlk
2       http://twittercounter.com/
2       http://www.ecodazoo.com/
2       http://www.expansion.com/edicion/exp/mercados/wall_street/es/desarrollo/1134736.html
2       http://www.floort.com/show.php/2759
----------------
Past 12 Hours
12      http://traileraddict.com/trailer/transporter-3/french-teaser
8       http://pownce.com/jooanfossi/notes/2456076/
6       http://pownce.com/andi808/notes/2456075/
6       http://www.flickr.com/photos/anonymonk/2564362689/
4       http://pownce.com/accounts/login/?next=/sbflorido/notes/2449170/
4       http://www.flickr.com/photos/anonymonk/2564362689/:
2       http://www.dormiu.com.br/publieditorial/ultima-chamada-para-pequim-1555/
2       http://www.ecodazoo.com/
2       http://www.expansion.com/edicion/exp/mercados/wall_street/es/desarrollo/1134736.html
2       http://www.facebook.com/common/browser.php&lt;/code&gt;&lt;/pre&gt;
		&lt;script src="http://feeds.feedburner.com/~s/InARow?i=http://www.inarow.net/entries/projects/twitter_links.html" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
	</description>
	<pubDate>Fri, 13 Jun 2008 14:49:18 GMT</pubDate>
    <guid>http://www.inarow.net/entries/projects/twitter_links.html</guid>
</item>
<item>
    <title>RubyKnight - Chess Engine in Ruby</title>
    <link>http://www.inarow.net/2008/06/10#rubyknight</link>
    <description>
		&lt;p&gt;I wrote this a while ago, while reading &lt;a href=&quot;http://astore.amazon.com/iar-20/detail/0691118183/002-5357856-1821657&quot;&gt;Behind Deep Blue&lt;/a&gt; (which is a great book).  It's a chess engine written in ruby.  The actual engine is implemented as a move generator, positional evaluator and a board class which handles the state as a set of bitboards and undoable move events.&lt;/p&gt;

&lt;p&gt;Included are a command-line client and an xboard interface.  The command-line interface accepts coordinate notation and a few commands:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt; e2e4 - coordinate notation, move a pawn&lt;br /&gt;
!play - tell the engine to play as the current color&lt;br /&gt;
!undo - roll back a move&lt;br /&gt;
!dump filename - store the current board state&lt;br /&gt;
!load filename - load a stored board&lt;br /&gt;
!reset - start a new game&lt;br /&gt;
!quit - end the game&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;You can cut the verbosity of the generator engine by editing line 121 of evaluator.rb:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@@ -118,7 +118,7 @@ module RubyKnight
                def time_it label
                        start = Time.now
                        res = yield
-                       puts &amp;quot;TIMING( '#{label}=&amp;gt;#{res}'): #{Time.now - start} seconds&amp;quot;
+                       #puts &amp;quot;TIMING( '#{label}=&amp;gt;#{res}'): #{Time.now - start} seconds&amp;quot;
                        res
                end
        end&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The evaluator is very primitive, and only thinks one move ahead.  Some sort of breadth-first time thinking mode was next on the to-do list.&lt;/p&gt;

&lt;p&gt;You can grab the code via git:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git clone http://darkwing.inarow.net/git/rubyknight.git&lt;/code&gt;&lt;/pre&gt;
		&lt;script src="http://feeds.feedburner.com/~s/InARow?i=http://www.inarow.net/entries/development/ruby/rubyknight.html" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
	</description>
	<pubDate>Tue, 10 Jun 2008 03:43:50 GMT</pubDate>
    <guid>http://www.inarow.net/entries/development/ruby/rubyknight.html</guid>
</item>
<item>
    <title>Debian OpenSSL Security Snafu</title>
    <link>http://www.inarow.net/2008/06/05#openssl_security_snafu</link>
    <description>
		&lt;p&gt;Darn, I thought I dealt with this.  So, a couple weeks back news broke about the terrible OpenSSL problem that had caused gobs of easily crackable ssl keys to generated on debian and its derivatives, and I read up on it.  Being that this is an ubuntu server, I was vulnerable, so I could have swarn I did an apt-get install openssl and got updated versions and regenerated my keys.&lt;/p&gt;


&lt;p&gt;Fast forward to yesterday evening.  I got an invite to &lt;a href=&quot;http://www.heroku.com/&quot;&gt;Heroku&lt;/a&gt; and was playing with the git interface.  I uploaded by public key, and it told me that I had a blacklisted key and pointed me to the &lt;a href=&quot;http://www.ubuntu.com/usn/usn-612-2&quot;&gt;ubuntu security warning&lt;/a&gt;. &lt;/p&gt;

&lt;div style=&quot;float:right&quot;&gt;

&lt;p&gt;&lt;strong&gt;The removed lines:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MD_Update(&amp;amp;m,buf,j);
[ .. ]
MD_Update(&amp;amp;m,buf,j); /* purify complains */&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you didn't hear about the snafu, then you should look into it.  If you did, maybe you should look into it again.  Took me 10 minutes to fix up 3 bad keys and install the new openssl stuff via apt-get.&lt;/p&gt;

&lt;p&gt;(For those who didn't hear:  Many moons ago, a line in an openssl file caused a warning in a tool the debian maintainers used.  The maintainer removed it, and the complaint went away and everything seemed to work fine.  Unfortunately, that line initialized the random number generator.  Without that line, every key on a debian system was generated with the random number generator initialized to the process id of the generating program... a tiny, easily bruteforceable set of seeds.)&lt;/p&gt;
		&lt;script src="http://feeds.feedburner.com/~s/InARow?i=http://www.inarow.net/entries/linux/openssl_security_snafu.html" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
	</description>
	<pubDate>Thu,  5 Jun 2008 21:24:26 GMT</pubDate>
    <guid>http://www.inarow.net/entries/linux/openssl_security_snafu.html</guid>
</item>
<item>
    <title>Linode.com == Awesome VPS Provider</title>
    <link>http://www.inarow.net/2008/06/02#linode_review</link>
    <description>
		&lt;div style=&quot;float:right&quot;&gt;
&lt;a href=&quot;http://linode.com/&quot;&gt;&lt;img src=&quot;http://inarow.net/static/images/entries/linode.png&quot; alt=&quot;Linode Logo&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;I've been hosting a virtual private server with &lt;a href=&quot;http://www.linode.com/&quot;&gt;Linode&lt;/a&gt; for roughly 7 months and I must say, I've been incredibly happy.  My happiness was magnified recently, when they added a Newark, NJ facility to their list of locations.  Previously, I had been hosted in their Fremont, CA datacenter.  While it was perfectly adequate, the difference in ping times and throughput that came from being on the same coast made for a compelling case, and I migrated this server.&lt;/p&gt;

&lt;p&gt;This is where Linode really shines.  I logged into my admin console, and submitted a support ticket asking to migrate.  Next, I hopped over to their &lt;span class=&quot;caps&quot;&gt;DNS &lt;/span&gt;manager (DNS hosting is provided free with a linode account) and cranked the &lt;span class=&quot;caps&quot;&gt;TTL &lt;/span&gt;of all my &lt;span class=&quot;caps&quot;&gt;DNS &lt;/span&gt;records down to 1 hour.  While I was still doing that (at roughly 12:30AM &lt;span class=&quot;caps&quot;&gt;EST&lt;/span&gt;),  one of the staff had configured my migration and responded with my new &lt;span class=&quot;caps&quot;&gt;IP.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;After waiting a day or two for the ne &lt;span class=&quot;caps&quot;&gt;TTL &lt;/span&gt;to propogate, it was time to move.  I updated a few IP specific config files, made sure everything was in order and shut down.  I followed the &quot;you have a migration pending&quot; link in the linode admin console, and initiated the transfer.  The wonderful &lt;span class=&quot;caps&quot;&gt;AJAX &lt;/span&gt;admin console kept me updated about the transfer of my disk images.  I added a boot job to the end of the queue and went to bed.&lt;/p&gt;

&lt;p&gt;Unfortunately, here's where &lt;strong&gt;I&lt;/strong&gt; screwed up.  Linodes bit went perfectly, the images moved over and the server booted.  Unfortunately, I hadn't cleaned up /etc/udev/rules.d/ and my virtual Xen nic got assigned to eth1 because of the new &lt;span class=&quot;caps&quot;&gt;MAC &lt;/span&gt;address.  This meant that dhclient failed to get me my shiny new &lt;span class=&quot;caps&quot;&gt;IP.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Fast forward to the morning, I discover the server isn't up.  I immediately ssh to the &lt;span class=&quot;caps&quot;&gt;LISH &lt;/span&gt;console... which is an account on the Xen host which allows attaching to the server console, scheduling boot jobs and troubleshooting a server with network issues.  After a bit of fumbling around, I hopped onto #linode and asked for help:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;08:58 -!- cdmoyer [~cdmoyer@cpe-76-180-99-185.buffalo.res.rr.com] has joined #linode
08:59 &amp;lt; cdmoyer&amp;gt; Hmm, eth0 disappeared after migration?  doh.
08:59 &amp;lt; caker&amp;gt; cdmoyer: blame udev
09:00 &amp;lt; caker&amp;gt; cdmoyer: remove /etc/udev/rules.d/70-persistent-net.rules and/or /etc/iftab, restart networking
09:03 &amp;lt; cdmoyer&amp;gt; ah, awesome, thanks caker.
09:04 -!- CDMoyer_ [~cmoyer@207.192.69.20] has joined #linode
09:04 -!- cdmoyer [~cdmoyer@cpe-76-180-99-185.buffalo.res.rr.com] has quit [Quit: cdmoyer]
09:05 -!- CDMoyer_ is now known as CDMoyer
09:05 &amp;lt; caker&amp;gt; CDMoyer: woot
09:05 &amp;lt; CDMoyer&amp;gt; Being on the same coast as my linode is very nice.
09:05 &amp;lt; CDMoyer&amp;gt; 1/3 the ping and 80% faster transfer. ;)
09:06 &amp;lt; tasaro&amp;gt; that's because I put red pinstripes on your IPz
09:06 &amp;lt; scott&amp;gt; racing stripes
09:06 &amp;lt; StevenK&amp;gt; Because red VPSes go faster
09:06 &amp;lt; scott&amp;gt; 1/3 the bling though
09:06 &amp;lt; CDMoyer&amp;gt; awesome.  i'm ordering the next linode with a spoiler, too.&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(caker and tasaro are linode staff, and in that chat log, perfectly demonstrate the knowledge, responsiveness, helpfulness and sense of humor of the company)&lt;/p&gt;

&lt;p&gt;For the record, I've got a Linode 540.  $30/month, 15G storage, 540M ram and 300G transfer.  Their base plan is $20/month and provides 360M ram, 10G storage and 200G transfer.  Also, for the record, they don't have a referral plan. ;)&lt;/p&gt;

&lt;p&gt;In case you missed it, it's &lt;a href=&quot;http://linode.com/&quot;&gt;linode.com&lt;/a&gt;&lt;/p&gt;
		&lt;script src="http://feeds.feedburner.com/~s/InARow?i=http://www.inarow.net/entries/reviews/linode_review.html" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
	</description>
	<pubDate>Mon,  2 Jun 2008 16:47:58 GMT</pubDate>
    <guid>http://www.inarow.net/entries/reviews/linode_review.html</guid>
</item>
<item>
    <title>Google &quot;AJAX Libraries&quot; API</title>
    <link>http://www.inarow.net/2008/05/27#google_jslib_hosting</link>
    <description>
		&lt;p&gt;Google is now providing &lt;a href=&quot;http://code.google.com/apis/ajaxlibs/documentation/#AjaxLibraries&quot;&gt;free hosting for various popular JS toolkits&lt;/a&gt;.  jQuery, MooTools, Prototype and Dojo seem to be included at this point.  The idea is that they provide servers which properly server up cache-headers (and bandwidth, I suppose) and the more people that use these &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;s, the faster interactive &quot;Web 2.0&quot; pages will load. (Because the user will have already loaded and cached the libraries from another site using the Google &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;)&lt;/p&gt;

&lt;p&gt;They providee a loading &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;script	src=&amp;quot;http://www.google.com/jsapi&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;script&gt;
	google.load(&quot;jquery&quot;, &quot;1.2&quot;);
&lt;/script&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And a &lt;span class=&quot;caps&quot;&gt;URL &lt;/span&gt;which provides the requested version and library:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;script	src=&amp;quot;http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Both methods allow you to provide as much specificity as you want for the version.  Ask for version 1, and you'll get the latest in the 1 series... ask for 1.2.6 and you'll get that minor revision.&lt;/p&gt;

&lt;p&gt;I'm not sure, is this a great idea... or another foothold for Google to take over the world.  Or both?&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://code.google.com/apis/ajaxlibs/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;AJAX&lt;/span&gt; Libraries &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; Project Page on Google&lt;/a&gt;&lt;/p&gt;
		&lt;script src="http://feeds.feedburner.com/~s/InARow?i=http://www.inarow.net/entries/development/js/google_jslib_hosting.html" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
	</description>
	<pubDate>Tue, 27 May 2008 21:37:00 GMT</pubDate>
    <guid>http://www.inarow.net/entries/development/js/google_jslib_hosting.html</guid>
</item>
<item>
    <title>TinyDB, Toy Framework and jQuery Plugin</title>
    <link>http://www.inarow.net/2008/05/24#tinydb</link>
    <description>
		&lt;p&gt;&lt;a href=&quot;http://tinydb.org/&quot;&gt;TinyDB&lt;/a&gt; is an interesting take on &quot;cloud storage.&quot;   Basically, you send some data via &lt;span class=&quot;caps&quot;&gt;GET, &lt;/span&gt;they give you a &lt;span class=&quot;caps&quot;&gt;URL, &lt;/span&gt;your data is stored in that &lt;span class=&quot;caps&quot;&gt;URL. &lt;/span&gt; It's not private and it doesn't store a lot of information, but it has some interesting possibilities.&lt;/p&gt;

&lt;p&gt;I think a good use for these sort of things, will be quick-built client-side only content dumpage.  You go to &quot;twitter-overload.com&quot; type in a larger than 140 character message and hit save.  JavaScript bundles up your data, stores it in TinyDB and hands you back a &lt;span class=&quot;caps&quot;&gt;URL &lt;/span&gt;which will reload that data from TinyDB and display it.  You take that url and post it to twitter.  (Yes, I know that services like this exist, but the idea of doing it entirely client-side is interesting.)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://darkwing.inarow.net/tinydb/&quot;&gt;TinyDB Toys&lt;/a&gt; is a simple proof of this concept. Here's a &lt;a href=&quot;http://darkwing.inarow.net/tinydb/14C,13C,14L,14M&quot;&gt;TinyDB Toy &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;&lt;/a&gt; with some embedded data.&lt;/p&gt;

&lt;p&gt;To facilitate this, I wrote a jQuery plugin, &lt;a href=&quot;http://inarow.net/static/downloads/jquery.tinydb.js&quot;&gt;jQuery.tinydb&lt;/a&gt;.  The two methods are documented within the source.&lt;/p&gt;

&lt;p&gt;Drop me a comment if you hack up something cool with this.&lt;/p&gt;
		&lt;script src="http://feeds.feedburner.com/~s/InARow?i=http://www.inarow.net/entries/development/js/tinydb.html" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
	</description>
	<pubDate>Sat, 24 May 2008 02:58:58 GMT</pubDate>
    <guid>http://www.inarow.net/entries/development/js/tinydb.html</guid>
</item>
<item>
    <title>Basic git for a Local Repo</title>
    <link>http://www.inarow.net/2008/05/17#simple_local_git</link>
    <description>
		&lt;p&gt;I'm still not fully sold on git, but sometimes it's nice to set up version control for a single project.  It's nice to be able to track what you've done, roll back experiments and otherwise protect your work (and sanity.)  This is just an annotated account of this process for a small project I was doing with CakePHP, half to later refresh my memory and half for others doing the same.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt; git init # create the in-place repo
 
&amp;gt; git add app # add files
 
&amp;gt; echo &amp;quot;.gitignore&amp;quot; &amp;gt;.gitignore # ignore some files
&amp;gt; echo &amp;quot;cake&amp;quot; &amp;gt;&amp;gt; .gitignore
&amp;gt; echo &amp;quot;.htaccess&amp;quot; &amp;gt;&amp;gt; .gitignore
 
&amp;gt; git branch working   # create scratchpad
 
&amp;gt; git checkout working # start working on it.
Switched to branch &amp;quot;working&amp;quot;
 
# edit some files
 
&amp;gt; git status
# On branch working
# Changed but not updated:
#   (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
#
#       modified:   app/controllers/events_controller.php
#
no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)
 
&amp;gt; git add events_controller.php
# On branch working
# Changes to be committed:
#   (use &amp;quot;git reset HEAD &amp;lt;file&amp;gt;...&amp;quot; to unstage)
#
#       modified:   app/controllers/events_controller.php
#
 
# rinse and repeat until you're done with a chunk of work
 
&amp;gt; git commit -m&amp;quot;Bug fixes&amp;quot;  # commit this set of changes to the working branch
 
&amp;gt; git diff ../maste   # see what you changed
 
&amp;gt; git checkout master  # head back to original
&amp;gt; git merge working    # merge your changes in&lt;/code&gt;&lt;/pre&gt;
		&lt;script src="http://feeds.feedburner.com/~s/InARow?i=http://www.inarow.net/entries/development/scm/simple_local_git.html" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
	</description>
	<pubDate>Sat, 17 May 2008 16:28:54 GMT</pubDate>
    <guid>http://www.inarow.net/entries/development/scm/simple_local_git.html</guid>
</item>
</channel></rss>
