<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>BogoJoker</title>
	
	<link>http://blog.bogojoker.com</link>
	<description>'My humble abode'.sub(/ab/,'c')</description>
	<lastBuildDate>Wed, 19 May 2010 14:56:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Bogojoker" /><feedburner:info uri="bogojoker" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>The Games of the Future?</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/TGLA6T1Px6A/</link>
		<comments>http://blog.bogojoker.com/2010/04/the-games-of-the-future/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 07:04:35 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[inspirational]]></category>
		<category><![CDATA[misc.]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=954</guid>
		<description><![CDATA[In order to jump start posting more often I&#8217;m going to deviate slightly from my technical articles and ramble a bit to get back into the blogging mood. Please bare with me, the next article I write should be back on track.
A sore yet fond subject of my past is video games. Like so many [...]]]></description>
			<content:encoded><![CDATA[<p>In order to jump start posting more often I&#8217;m going to deviate slightly from my technical articles and ramble a bit to get back into the blogging mood. Please bare with me, the next article I write should be back on track.</p>
<p>A sore yet fond subject of my past is video games. Like so many people my age, my past is filled with countless hours of playing video games. Honestly, I remember the happiness and sense of accomplishment I felt from playing games and I have actually built lasting friendships with people I knew only though online personas. However, I stopped &#8220;playing games&#8221; sometime around 2005, and I&#8217;ve since frowned on the subject.</p>
<p>I look back on my gaming history with some resentment because at some point I concluded that I was wasting time. Time that I could spend learning, earning, growing, and doing something of importance. Whatever triggered this I don&#8217;t really know. While being &#8220;game free&#8221; I&#8217;ve noticed some things that have disturbed me.</p>
<p>There is a LOT of game playing going on. Not all gameplay is bothers me. Everyone needs some entertainment and games happen naturally in social activities. I mean excessive gameplay. I can&#8217;t even completely describe exactly what qualifies as matching this description.</p>
<p>I decided to look at myself to see if my time spent without games has had a positive affect on me. I&#8217;m a little biased but I think that things have turned out well for me. Sparing you the details I feel I have a successful challenging job where I feel I can make some kind of impact on the world. Cheesy I know.</p>
<p>But, looking deeper I noticed that my time &#8220;without games&#8221; was in fact not game-less. Where before I spent time playing games with seemingly no positive impact on my future, I was applying some of the same concepts (experience, points, etc) improving myself. I know you didn&#8217;t come here to listen to me talk about myself, so how can I turn this into something constructive? While I was thinking about this I recently came across two presentations that describing a potential future of video games.</p>
<p>Briefly, the idea that appealed to me was that games could be used to improve lives positively. There is an obviously subjective angle to what is considered life improving, but in general there are plenty of things that can be agreed on. Improvements to your health (exercise), being part of a bigger picture (saving energy and gas), and the ability to motivate yourself and do a goo job. These are not your traditional video games, but it is taking the addictive desirable qualities of video games and applying those to real life aspects, and that is what appeals to me.</p>
<p>An example that stood out to me was some recent hybrid cars. These new cars give the driver live, accurate feedback about how efficiently they are driving their car. This extra information gives the driver an incentive to improve their driving. Be it to improve milage, save gas, prolong the life of their vehicle, or whatever. The ambition to be the best or be very good, crucial to many areas and notable in video games, is being used for good.</p>
<p>I am seeing this more and more and I&#8217;m liking what I see. I really hope that more and more people recognize these concepts and use them for the right reasons. I really hope that the idea of positive activities being games takes off.</p>
<p>The two videos I saw were <a href="http://fury.com/2010/02/jesse-shells-mindblowing-talk-on-the-future-of-games-dice-2010/">Jesse Schell &#8220;When games invade real live&#8221;</a> and <a href="http://www.ted.com/talks/view/id/799">Jane Mcgonigal &#8220;Gaming can make a better world&#8221;</a>. In fact, <a href="http://www.upsidelearning.com/blog/index.php/2010/04/23/5-good-ted-talks-on-games/">this page</a> lists 5 videos including both of these meaning the others are likely pretty good too.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2010/04/the-games-of-the-future/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2010/04/the-games-of-the-future/</feedburner:origLink></item>
		<item>
		<title>Removing Haskell’s Hassle</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/JGgs3iqI8Wk/</link>
		<comments>http://blog.bogojoker.com/2009/11/removing-haskells-hassle/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 15:00:23 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=948</guid>
		<description><![CDATA[This goes along with my recent post about my go! script for go. I wrote a similar script for Haskell to overcome a problem I continually had with Haskell&#8217;s interpreter.
The problem is that in order to create useful functions to test in the interpreter (ghc) you need to load your file into the interpreter. However, [...]]]></description>
			<content:encoded><![CDATA[<p>This goes along with my recent post about my go! script for go. I wrote a similar script for Haskell to overcome a problem I continually had with Haskell&#8217;s interpreter.</p>
<p>The problem is that in order to create useful functions to test in the interpreter (ghc) you need to load your file into the interpreter. However, by the time I&#8217;ve opened up the interpreter I forgot to open up an editor (via the shell). Still, if I had a document open than linking the two takes a bit of work (mostly drag and drop). I&#8217;ve managed to spearhead the issue when I first start the interpreter.</p>
<p>My little script allows me to quick edit a file, or even start a new file, and automatically link up with the interpreter. Its another one of the scripts you can find in my <a href="http://bogojoker.com/shell/">~/bin</a>:</p>
<pre class="textmate-source twilight"><span class="source source_ruby"><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>!/usr/bin/env ruby
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Author: Joseph Pecoraro
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Date: Wednesday, September 30, 2009
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Description: Simple Haskell Quick Starter
</span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Defaults
</span><span class="variable variable_other variable_other_constant variable_other_constant_ruby">EDITOR</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>mate<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span> <span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> ENV['EDITOR'] for most Unix Guys
</span><span class="variable variable_other variable_other_constant variable_other_constant_ruby">HASK_DIR</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>expand_path<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>~/haskell<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Determine the File
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>  - default to temp.hs
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>  - use provided file if exists
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>  - create new temp file with given name
</span>file <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>join<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="variable variable_other variable_other_constant variable_other_constant_ruby">HASK_DIR</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>temp.hs<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span><span class="punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby">;</span>
<span class="keyword keyword_control keyword_control_ruby">if</span> <span class="support support_class support_class_ruby">ARGV</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>size <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">&gt;</span> <span class="constant constant_numeric constant_numeric_ruby">0</span>
  name <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">ARGV</span><span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">[</span><span class="constant constant_numeric constant_numeric_ruby">0</span><span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">]</span>
  <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>file? name
    file <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> name
  <span class="keyword keyword_control keyword_control_ruby">else</span>
    name <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby">+=</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>.hs<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span> <span class="keyword keyword_control keyword_control_ruby">unless</span> name <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">=~</span> <span class="string string_regexp string_regexp_classic string_regexp_classic_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby">/</span><span class="constant constant_character constant_character_escape constant_character_escape_ruby">\.</span>hs$<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby">/</span></span>
    file <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> name
  <span class="keyword keyword_control keyword_control_ruby">end</span>
<span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Work the magic
</span>system <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>touch <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>file<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
system <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span><span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span><span class="variable variable_other variable_other_constant variable_other_constant_ruby">EDITOR</span><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span> <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>file<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
system <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>ghci <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>file<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
</span></pre>
<p>Its a nearly perfect replacement of ghci for me. It allows me to focus more on the task at hand rather then getting bogged down and frustrated when I realize I have to stop what I&#8217;m doing to link the interpreter to an editor.</p>
<p>For your own use you may want to customize the EDITOR and HASK_DIR variables. As I tend to use TextMate and a folder in my home directory for throw away files (which I can easily clean up eventually). Let me know if you&#8217;ve suffered with the same problem, or others when working with Haskell!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/11/removing-haskells-hassle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/11/removing-haskells-hassle/</feedburner:origLink></item>
		<item>
		<title>Get Go’in a Little Quicker</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/CXaS93ZGqlQ/</link>
		<comments>http://blog.bogojoker.com/2009/11/get-goin-a-little-quicker/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 15:00:08 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=941</guid>
		<description><![CDATA[Even with Finals literally around the corner I couldn&#8217;t help but play around a little with &#8220;Google&#8217;s New Programming Language&#8221; go. In case you haven&#8217;t heard about go, you can find out everything you need to know at their simple site http://golang.org/.
I&#8217;m not going to talk about what I like/dislike about the language&#8230; yet. Instead [...]]]></description>
			<content:encoded><![CDATA[<p>Even with Finals literally around the corner I couldn&#8217;t help but play around a little with &#8220;Google&#8217;s New Programming Language&#8221; go. In case you haven&#8217;t heard about go, you can find out everything you need to know at their simple site <a href="http://golang.org/">http://golang.org/</a>.</p>
<p>I&#8217;m not going to talk about what I like/dislike about the language&#8230; yet. Instead I&#8217;m going to do what everyone else has probably already done. I wrote a simple compiler/link/run shell script which takes its place in my <a href="http://bogojoker.com/shell/">~/bin</a>:</p>
<pre class="textmate-source twilight"><span class="source source_shell"><span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span>!/bin/bash
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> Author: Joseph Pecoraro
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> Date: Saturday, November 14, 2009
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> Description: Compile, Link, and Run a go script.
</span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> Requires a file
</span><span class="meta meta_scope meta_scope_if-block meta_scope_if-block_shell"><span class="keyword keyword_control keyword_control_shell">if</span> [ <span class="keyword keyword_operator keyword_operator_pipe keyword_operator_pipe_shell">!</span> <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span><span class="variable variable_other variable_other_positional variable_other_positional_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>1</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> ]<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> <span class="keyword keyword_control keyword_control_shell">then</span>
  <span class="support support_function support_function_builtin support_function_builtin_shell">echo</span> <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>usage: go! &lt;filename&gt;<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span><span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> <span class="support support_function support_function_builtin support_function_builtin_shell">exit</span> 1
<span class="keyword keyword_control keyword_control_shell">fi</span></span>

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> Use the proper tools for the arch
</span><span class="meta meta_scope meta_scope_if-block meta_scope_if-block_shell"><span class="keyword keyword_control keyword_control_shell">if</span> [ <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>GOARCH</span> = <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>amd64<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> ]<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> <span class="keyword keyword_control keyword_control_shell">then</span>
  COMPILER=6g<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> LINKER=6l<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> EXTENSION=.6
<span class="keyword keyword_control keyword_control_shell">elif</span> [ <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>GOARCH</span> = <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>386<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> ]<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> <span class="keyword keyword_control keyword_control_shell">then</span>
  COMPILER=8g<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> LINKER=8l<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> EXTENSION=.8
<span class="keyword keyword_control keyword_control_shell">elif</span> [ <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>GOARCH</span> = <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>arm<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> ]<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> <span class="keyword keyword_control keyword_control_shell">then</span>
  COMPILER=5g<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> LINKER=5l<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> EXTENSION=.5
<span class="keyword keyword_control keyword_control_shell">else</span>
  <span class="support support_function support_function_builtin support_function_builtin_shell">echo</span> <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>unsupported GOARCH: <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>GOARCH</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span><span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> <span class="support support_function support_function_builtin support_function_builtin_shell">exit</span> 2
<span class="keyword keyword_control keyword_control_shell">fi</span></span>

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> Strip .go (if its there)
</span>file=<span class="string string_interpolated string_interpolated_backtick string_interpolated_backtick_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">`</span><span class="support support_function support_function_builtin support_function_builtin_shell">echo</span> <span class="variable variable_other variable_other_positional variable_other_positional_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>1</span> <span class="keyword keyword_operator keyword_operator_pipe keyword_operator_pipe_shell">|</span> sed -e <span class="string string_quoted string_quoted_single string_quoted_single_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">'</span>s/.go$//<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">'</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">`</span></span>

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> Compile, Link, and Run (break on any error)
</span><span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>COMPILER</span> <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span><span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>file</span>.go<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> <span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">&amp;&amp;</span> <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>LINKER</span> -o <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>file</span> <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span><span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>file<span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>EXTENSION</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> <span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">&amp;&amp;</span> ./<span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>file</span>
</span></pre>
<p>Why did I write my own? The others I had seen were inadequate, didn&#8217;t work well with tabbing (filename versus executable name), or didn&#8217;t even produce a nice executable name at all. For many, you probably won&#8217;t need to compile, link, and run a program all at once (especially in a systems language). However, I&#8217;ve found that its a great tool to help me learn the language.  This is due in some part to go&#8217;s quick compilation and linking.</p>
<p>It is really amazing to me that all of the languages that I have gotten comfortable working with have a command line shell. JavaScript, Haskell, and Ruby all have shells where I can make a fool of myself while quickly testing syntax or libraries. Go doesn&#8217;t.  Its something I really miss. This little script is a simple replacement that brings me a little closer to interactivity.</p>
<p>I tried to make it generic so it could work on any architecture that go currently builds on. I named the script &#8220;go!&#8221;. Let me know what scripts you&#8217;ve built to work with go.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/11/get-goin-a-little-quicker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/11/get-goin-a-little-quicker/</feedburner:origLink></item>
		<item>
		<title>Improving the Web Inspector</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/a5UCDHlw-jI/</link>
		<comments>http://blog.bogojoker.com/2009/10/improving-the-web-inspector/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 14:45:48 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=886</guid>
		<description><![CDATA[There is a better article on the WebKit blog, showing even more features! I really recommend that you check it out and provide feedback!

I haven&#8217;t been blogging recently&#8230; Instead, for the past 3 months I&#8217;ve been &#8220;doing&#8221; something! I&#8217;ve been working on WebKit, the Open Source Rendering Engine behind browsers like Safari and Chrome.  [...]]]></description>
			<content:encoded><![CDATA[<p><em>There is a better article on the WebKit blog, showing even more features! I really recommend that you <a href="http://webkit.org/blog/829/web-inspector-updates/">check it out</a> and provide feedback!</em></p>
<hr />
<p>I haven&#8217;t been blogging recently&#8230; Instead, for the past 3 months I&#8217;ve been &#8220;doing&#8221; something! I&#8217;ve been working on <a href="http://webkit.org/">WebKit</a>, the Open Source Rendering Engine behind browsers like Safari and Chrome.  More specifically I&#8217;ve been working on the Web Inspector.  Its been a blast!</p>
<p>In a matter of weeks of working on the Inspector I was able to knock out some simple features that I&#8217;ve always wanted.  Soon after I introduced some features that required some serious learning and development.  I really shouldn&#8217;t say &#8220;I&#8221;, because in actuality the WebKit team has been a tremendous help in teaching me and collaborating with me on the new features.  To name a few that have been especially helpful (via their IRC handle because I didn&#8217;t ask their permission) xenon, Rik`, pfeldman, bweinstein, bdash, and pmuellr.</p>
<p>So what were the features?  Here they are, roughly in the order in which they were added:</p>
<h3>Element Attributes (Create + Tab)</h3>
<p>Making new element attributes was difficult, sometimes impossible, and undiscoverable. My goal was to get rid of all three of these obstacles.  Here goes.  Discoverability first.  With the new changes, when you hover over an element in the Element&#8217;s Tree Outline an ellipsis, or some indicator, appears in the element&#8217;s opening tag in the position that the next attribute would go.  Double clicking that ellipsis starts editing as though it were a normal attribute.  To make things easier, you can tab through attributes and backwards using &#8220;shift-tab&#8221;.  When starting to edit an attribute, when you tab over the end it will start making a new attribute.  This way you can quickly make multiple attributes.</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/10/element_attributes.png" alt="element_attributes" title="element_attributes" width="549" height="456" /></p>
<h3>CSS Properties (Create + Tab)</h3>
<p>The same problem existed for CSS Properties.  I added tabbing through CSS properties inside a selector section.  Tabbing forward from the last property (or double clicking the empty space if there are no properties) will start creating a new property.</p>
<h3>CSS Selectors (Create + Modify)</h3>
<p>Yes, you now have the ability to actually add and modify selectors!  This is a feature that many designers have been interested in.  It is really powerful and quite useful.  This will make it easy for designers to hack around inside the Inspector to get the styles just right.  Also, as a side note, the way this is handled in the background leaves room for some new features such as exporting CSS for the changes you&#8217;ve made.  Its certainly an idea being floated around.</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/10/selectors.png" alt="selectors" title="selectors" width="554" height="488" /></p>
<h3>CSS Color Representations (Hex + More)</h3>
<p>One complaint that showed up time and time again in Twitter was that the Inspector only showed rgb color representations.  Many designers wanted the hex representation and had to resort to using Firebug to get that information.  Well, we went one step further.  You can now represent colors any way you&#8217;d like: hex, shorthex, rgb, hsl, or even by its nickname if it has one!  For alpha colors you get rgba and hsla.  Designers, have at it!</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/10/colors.png" alt="colors" title="colors" width="552" height="528" /></p>
<p>Clicking on the color swatch allows you to cycle through the different representations for just that color.  Allowing you to get the different representations that I got in the picture.  However, you can set a preference in the gear menu to display all the colors in a particular format.</p>
<h3>DOM Storage Updates</h3>
<p>The DOM Storage DataGrids now displays live updates.  You don&#8217;t need to manually refresh every time something changes.  Also you can create, edit, and tab through the keys/values.  Double click any open space to start creating a new value.  Catching on to a theme with my updates?  Overall this makes working with DOM Storage just a little more developer friendly.</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/10/dom_storage.png" alt="dom_storage" title="dom_storage" width="554" height="493" /></p>
<h3>Natural Sorting of Properties</h3>
<p>Who counts &#8220;1&#8243;, &#8220;11&#8243;, &#8220;12&#8243;, &#8220;2&#8243;, &#8220;3&#8243;, etc.  Certainly nobody I know! So, I implemented a variant of the alphanumerical sorting algorithm for properties when they are displayed in the console.  Now you get a much more natural ordering!<br />
<img src="http://blog.bogojoker.com/wp-content/uploads/2009/10/inorder.png" alt="sorting" title="sorting" width="552" height="528" /></p>
<h3>Keyboard Shortcuts</h3>
<p>Probably not so well known but you can now switch between the different panels of the Inspector with keyboard shortcuts!  On the Mac its ⌘[ and ⌘].</p>
<h3>Better NodeList Displays</h3>
<p>As a developer myself I find the issues that annoy me, and are likely going to annoy other developers, and set out to solve them.  One classic problem I had was doing a getElementsByTagName or similar and having the console respond blandly with &#8220;NodeList&#8221;.  Not good enough!  NodeLists now display the actual HTML elements in a list just like an Array. Its one of those small details that developers won&#8217;t really notice unless its gone, because we expect it.</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/10/nodelist.png" alt="nodelist" title="nodelist" width="522" height="480" /></p>
<h3>Resources Interactivity</h3>
<p>There were some old feature requests sitting in WebKit&#8217;s Bugzilla.  They requested opening resources on double click, and adding the ability to drag a resource around like it were a link.  I thought they were great ideas!</p>
<h3>Cookies</h3>
<p>This was the first feature that required me really digging into WebKit&#8217;s source, including touching all platforms.  With the help of WebKit developers I eventually added support for viewing all cookie information (secure, httpOnly, etc) and deleting cookies for the Mac.  All other platforms were able to display basic cookie information available through document.cookie.</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/10/cookies.png" alt="cookies" title="cookies" width="551" height="346" /></p>
<p>Another developer, bweinstein, just recently landed some really great improvements!  He added support for Windows, separated cookies out per domain, and enabled resizable grid columns.  Really great work.</p>
<h3>Event Listeners</h3>
<p>Not having the ability to enumerate the Event Listeners via JavaScript has plagued me, and most likely plenty of other developers, for a very long time.  This made viewing Event Listeners an excellent candidate for an Inspector feature.</p>
<p>The implementation as it stands now has some great functionality. There is a new sidebar pane when you inspect an element in the Elements Tree Hierarchy.  If the current Node has registered event listeners there is a separate section for each type of event registered (click, mouseover, etc).  Within each of these lists is a display of all of the event listeners in the entire event flow for that type.  That means you see all the Capturing Event Listeners followed by the Bubbling Event Listeners in the exact order that they execute and on which nodes they are registered.</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/10/event_listeners.png" alt="event_listeners" title="event_listeners" width="554" height="564" /></p>
<p>A few filters will let you customize the list to focus on the entire event flow or just the selected node.  This is still a very new feature, one that Firebug doesn&#8217;t even have yet.  So we are looking for UI improvements and idea on how to improve the feature, but its certainly a cool feature!</p>
<h3>JSON Syntax Highlighting</h3>
<p>JSON is merely a subset of JavaScript but it wasn&#8217;t getting highlighted!  A few lines later, the inspector now syntax highlights JSON just like JavaScript.</p>
<h3>CSS Syntax Highlighting</h3>
<p>The JavaScript syntax highlighter has helped me hundreds of times.  Now, hopefully the CSS syntax highlighter will do the same!  The colors are very close to Dashcode, they look great, and there is even support for some of the rather complex @import, @media, @font-face, and @variables CSS syntaxes.</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/10/css_syntax_highlight.png" alt="css_syntax_highlight" title="css_syntax_highlight" width="557" height="552" /></p>
<p>Hey, as a birthday gift to myself what could be better then adding some serious styling to those black and white stylesheets?  I know what you&#8217;re thinking&#8230; nothing could be better.  Well you&#8217;re almost right!  With some of the refactoring I did bweinstein was able to apply syntax highlighting to the Elements Tree Hierarchy and got some seriously awesome results.  Now the inline scripts and styles are syntax highlighted! These are some really awesome improvements that make working with the Inspector ever more friendly.</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/10/both_highlight.png" alt="both_highlight" title="both_highlight" width="559" height="520" /></p>
<hr />
<p>&nbsp;</p>
<p>To start using any of these features you will need to download the <a href="http://nightly.webkit.org/">WebKit nightly</a>.  Most people think that the nightly overrides their current Safari app.  This is not true.  The nightly binary is a separate application from Safari, named WebKit.  If you just want to try out some of these features you can download the Nightly, and then move it to your trash when you&#8217;re done playing with it.  No harm, no foul.</p>
<p>These are not nearly all of the new features in the Web Inspector.  These are just the ones that I worked on and contributed to. To name some other features there are Scope Bars for the Console and Resources Panel, the ability to view Request and Response HTTP Parameters for Resources (great for debugging AJAX), Resource Status Code indicators, complete Serialization between the inspected page and the inspector, and more.</p>
<p>If you want to contribute feel free to stop by <a href="irc://irc.freenode.net/#webkit">#webkit</a> on Freenode. My handle is JoePeck and I&#8217;d be glad to help you out!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/10/improving-the-web-inspector/feed/</wfw:commentRss>
		<slash:comments>60</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/10/improving-the-web-inspector/</feedburner:origLink></item>
		<item>
		<title>mod_rewrite Tutorial on Nettuts</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/qG_-psIlVQ4/</link>
		<comments>http://blog.bogojoker.com/2009/09/mod_rewrite-tutorial-on-nettuts/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 18:30:23 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=890</guid>
		<description><![CDATA[Its been quite a while since I&#8217;ve written a blog post. For that I apologize. But, you can be sure that I wasn&#8217;t just sitting around!  Earlier today, Nettuts published my second tutorial covering URL manipulation with mod_rewrite in Apache&#8217;s .htaccess configuration files.
As a reminder to any visitors, if you decide to comment please [...]]]></description>
			<content:encoded><![CDATA[<p>Its been quite a while since I&#8217;ve written a blog post. For that I apologize. But, you can be sure that I wasn&#8217;t just sitting around!  Earlier today, Nettuts published my second tutorial covering URL manipulation with mod_rewrite in Apache&#8217;s .htaccess configuration files.</p>
<p>As a reminder to any visitors, if you decide to comment please contribute to the article in some way.  I&#8217;m <a href="http://blog.bogojoker.com/2009/06/too-many-unproductive-comments/">not interested in fluff comments</a>.  With that said, you can check out the tutorial itself at:</p>
<p><a href="http://net.tutsplus.com/tutorials/other/a-deeper-look-at-mod_rewrite-for-apache/"><img src="http://blog.bogojoker.com/wp-content/uploads/2009/09/Screen-shot-2009-09-14-at-Sep-14-2.22.01-PM.png" alt="Nettuts Tutorial" title="Nettuts Tutorial" width="515" height="291" style="border: 1px solid lightGray; margin: 10px 40px;" /></a></p>
<p>You can view the examples here:</p>
<p><a href="http://bogojoker.com/htaccess/part_2/"><img src="http://blog.bogojoker.com/wp-content/uploads/2009/09/Screen-shot-2009-09-14-at-Sep-14-2.25.12-PM.png" alt="Examples" title="Examples" width="519" height="319" style="border:1px solid lightGray; margin: 10px 40px;" /></a></p>
<p>And finally you can download the examples (for Apache 2.0) <a href="http://bogojoker.com/htaccess/part_2_examples.zip">right here</a>.  I hope the tutorial will clear up some myths and confusion about mod_rewrite. Cheers.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/09/mod_rewrite-tutorial-on-nettuts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/09/mod_rewrite-tutorial-on-nettuts/</feedburner:origLink></item>
		<item>
		<title>Web Analytics Taken to the Next Level</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/QPmRr5ltERk/</link>
		<comments>http://blog.bogojoker.com/2009/06/web-analytics-taken-to-the-next-level/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 14:15:19 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[p2p]]></category>
		<category><![CDATA[tabs]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=872</guid>
		<description><![CDATA[I came up with a neat idea the other night.  Using localStorage and sessionStorage you could theoretically monitor the number of tabs or windows a visitor has opened for your site.  As far as I know, this capability has never before been possible.  Well, now it is.
Check out this crude example.
Once you [...]]]></description>
			<content:encoded><![CDATA[<p>I came up with a neat idea the other night.  Using localStorage and sessionStorage you could theoretically monitor the number of tabs or windows a visitor has opened for your site.  As far as I know, this capability has never before been possible.  Well, now it is.</p>
<p>Check out <a href="http://bogojoker.com/x/tab_monitor/monitor.html">this crude example</a>.</p>
<p>Once you open the monitor, leave that tab/window put.  Use the &#8220;Spawn Tab&#8221; link to create new tabs and windows.  The monitor will be notified and display some simple debug.  There are 10 second updates per tab/window so that when they close the monitor can detect it.  The monitor will detect a close within 15 seconds of the tab/window closing and will display the total time the tab/window plus or minus 10 seconds.  Correct values are maintained as the tab/windows browse across pages as long as they stay on the domain!  Just about everything you&#8217;d want or need.</p>
<p>Again, I mentioned this is rather crude.  The fact that the monitor tab remains open is only due to the fact that I wanted to prototype the idea. The majority of the state is stored in localStorage, and each tab/window maintains a single identifier in its sessionStorage to remind the tab/window what id it was while it navigates to multiple pages.  Because everything is stored in the storage this system has the capability to become completely distributed.  Meaning no &#8220;monitor&#8221; tab is necessary, and the scripts can determine, and monitor, on their own the existence of all other tabs.  Thus, this would be a viable option for the next level of web analytics.</p>
<p>As cool as this is, I don&#8217;t think it will provide too much value to the analytics.  For the first time webmasters will be able to know how many windows or tabs a visitor opens (and to what pages they open).  The webmaster will know more about how its user&#8217;s use the website, but I don&#8217;t think this statistic will be a game changer.  Who knows!</p>
<p>So, how does it work?  Very simple.  Each tab includes the client.js code to handle updating the localStorage and maintaining its own &#8220;tab_id&#8221; in sessionStorage.  Data it maintains can be whatever you want, I went with some simple information such as its start time, current url, and latest keepalive:</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/06/Picture-1.png" alt="localStorage values" title="localStorage values" width="586" height="363" style="border: 1px solid lightGray; margin: 0 15px"/></p>
<p>The upkeep for a Tab Client is to restore their session information when you navigate to any new page:</p>
<pre class="textmate-source twilight"><span class="source source_js"><span class="comment comment_line comment_line_double-slash comment_line_double-slash_js"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_js">//</span> Create or Restore tab_id
</span><span class="storage storage_type storage_type_js">var</span> myTabId <span class="keyword keyword_operator keyword_operator_js">=</span> sessionStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>tab<span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
<span class="keyword keyword_control keyword_control_js">if</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> myTabId <span class="keyword keyword_operator keyword_operator_js">===</span> <span class="constant constant_language constant_language_js">undefined</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
  <span class="storage storage_type storage_type_js">var</span> tabs <span class="keyword keyword_operator keyword_operator_js">=</span> localStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>tabs<span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
  <span class="keyword keyword_control keyword_control_js">if</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> tabs <span class="keyword keyword_operator keyword_operator_js">===</span> <span class="constant constant_language constant_language_js">undefined</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
    myTabId <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="constant constant_numeric constant_numeric_js">0</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
    localStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>tabs <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>0<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
  <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span> <span class="keyword keyword_control keyword_control_js">else</span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
    <span class="storage storage_type storage_type_js">var</span> largest <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="support support_function support_function_js">parseInt</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> tabs<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span><span class="support support_function support_function_js">split</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_regexp string_regexp_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">/</span>,<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">/</span></span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span><span class="support support_function support_function_js">pop</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">()</span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span> <span class="constant constant_numeric constant_numeric_js">10</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
    myTabId <span class="keyword keyword_operator keyword_operator_js">=</span> largest<span class="keyword keyword_operator keyword_operator_js">+</span><span class="constant constant_numeric constant_numeric_js">1</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
    localStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>tabs <span class="keyword keyword_operator keyword_operator_js">+=</span> <span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>,<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span> <span class="keyword keyword_operator keyword_operator_js">+</span> myTabId<span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
  <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span>
  sessionStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>tab <span class="keyword keyword_operator keyword_operator_js">=</span> myTabId<span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
<span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span>
</span></pre>
<p>And to perform its keepalives:</p>
<pre class="textmate-source twilight"><span class="source source_js"><span class="comment comment_line comment_line_double-slash comment_line_double-slash_js"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_js">//</span> Update the Latest Timestamp
</span><span class="meta meta_function meta_function_js"><span class="storage storage_type storage_type_function storage_type_function_js">function</span><span class="entity entity_name entity_name_function entity_name_function_js"> setLatest</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_js">(</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_end punctuation_definition_parameters_end_js">)</span></span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
  <span class="storage storage_type storage_type_js">var</span> key <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="string string_quoted string_quoted_single string_quoted_single_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">'</span>tab<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">'</span></span><span class="keyword keyword_operator keyword_operator_js">+</span>myTabId<span class="keyword keyword_operator keyword_operator_js">+</span><span class="string string_quoted string_quoted_single string_quoted_single_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">'</span>_latest<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">'</span></span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
  localStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>setItem<span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span>key<span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span> <span class="keyword keyword_operator keyword_operator_js">+</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="meta meta_class meta_class_instance meta_class_instance_constructor"><span class="keyword keyword_operator keyword_operator_new keyword_operator_new_js">new</span> <span class="entity entity_name entity_name_type entity_name_type_instance entity_name_type_instance_js">Date</span></span><span class="meta meta_brace meta_brace_round meta_brace_round_js">()))</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
<span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span>

<span class="comment comment_line comment_line_double-slash comment_line_double-slash_js"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_js">//</span> Update Status every 10 seconds
</span><span class="support support_class support_class_js">window</span><span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span><span class="support support_function support_function_js">setInterval</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span>setLatest<span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span><span class="constant constant_numeric constant_numeric_js">10000</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
setLatest<span class="meta meta_brace meta_brace_round meta_brace_round_js">()</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span></span></pre>
<p>I put a few more convenience functions in there to help it update these localStorage keys, and communicate with the monitor which was crudely done through localStorage.  That is explained next.</p>
<p>The Tab Monitor as it stands right now receives messages through localStorage&#8217;s &#8220;storage&#8221; event.  It also checks all the tab&#8217;s &#8220;lastest&#8221; keepalives to make sure they didn&#8217;t pass their 10 second limit.  In the case of a tab being closed, it will remove references to that tab and output an approximation of the time the tab was open:</p>
<pre class="textmate-source twilight"><span class="source source_js"><span class="comment comment_line comment_line_double-slash comment_line_double-slash_js"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_js">//</span> Listener - receive messages from tabs
</span><span class="support support_class support_class_js">window</span><span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>addEventListener<span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_quoted string_quoted_single string_quoted_single_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">'</span>storage<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">'</span></span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span> <span class="meta meta_function meta_function_js"><span class="storage storage_type storage_type_function storage_type_function_js">function</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_js">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_js">e</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_end punctuation_definition_parameters_end_js">)</span></span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
  <span class="keyword keyword_control keyword_control_js">if</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> e<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>storageArea <span class="keyword keyword_operator keyword_operator_js">===</span> localStorage <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
    <span class="keyword keyword_control keyword_control_js">if</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> e<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>key <span class="keyword keyword_operator keyword_operator_js">==</span> <span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>tab_msg<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
      <span class="entity entity_name entity_name_type entity_name_type_object entity_name_type_object_js entity_name_type_object_js_firebug">console</span><span class="support support_function support_function_js support_function_js_firebug">.log</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> e<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>newValue <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
      addMsg<span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> e<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>newValue <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span> <span class="comment comment_line comment_line_double-slash comment_line_double-slash_js"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_js">//</span> Appends to the page
</span>    <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span>
  <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span>
<span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>

<span class="comment comment_line comment_line_double-slash comment_line_double-slash_js"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_js">//</span> Purger - clean out tabs that died for 15 seconds
</span><span class="support support_class support_class_js">window</span><span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span><span class="support support_function support_function_js">setInterval</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="meta meta_function meta_function_js"><span class="storage storage_type storage_type_function storage_type_function_js">function</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_js">(</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_end punctuation_definition_parameters_end_js">)</span></span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
  <span class="entity entity_name entity_name_type entity_name_type_object entity_name_type_object_js entity_name_type_object_js_firebug">console</span><span class="support support_function support_function_js support_function_js_firebug">.log</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>purging<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
  <span class="storage storage_type storage_type_js">var</span> now <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="keyword keyword_operator keyword_operator_js">+</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="meta meta_class meta_class_instance meta_class_instance_constructor"><span class="keyword keyword_operator keyword_operator_new keyword_operator_new_js">new</span> <span class="entity entity_name entity_name_type entity_name_type_instance entity_name_type_instance_js">Date</span></span><span class="meta meta_brace meta_brace_round meta_brace_round_js">())</span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span>
      tabs <span class="keyword keyword_operator keyword_operator_js">=</span> localStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>tabs<span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
  <span class="keyword keyword_control keyword_control_js">if</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> tabs <span class="keyword keyword_operator keyword_operator_js">!==</span> <span class="constant constant_language constant_language_js">undefined</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
    <span class="storage storage_type storage_type_js">var</span> toRemove <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="meta meta_brace meta_brace_square meta_brace_square_js">[]</span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span> toKeep <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="meta meta_brace meta_brace_square meta_brace_square_js">[]</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
    tabs <span class="keyword keyword_operator keyword_operator_js">=</span> tabs<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span><span class="support support_function support_function_js">split</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_regexp string_regexp_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">/</span>,<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">/</span></span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
    <span class="keyword keyword_control keyword_control_js">for</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="storage storage_type storage_type_js">var</span> i<span class="keyword keyword_operator keyword_operator_js">=</span><span class="constant constant_numeric constant_numeric_js">0</span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span> len<span class="keyword keyword_operator keyword_operator_js">=</span>tabs<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span><span class="support support_constant support_constant_js">length</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span> i<span class="keyword keyword_operator keyword_operator_js">&lt;</span>len<span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span> i<span class="keyword keyword_operator keyword_operator_js">++</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
      <span class="storage storage_type storage_type_js">var</span> tabId <span class="keyword keyword_operator keyword_operator_js">=</span> tabs<span class="meta meta_brace meta_brace_square meta_brace_square_js">[</span>i<span class="meta meta_brace meta_brace_square meta_brace_square_js">]</span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span>
          tabLatest <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="support support_function support_function_js">parseInt</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> localStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>getItem<span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>tab<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span><span class="keyword keyword_operator keyword_operator_js">+</span>tabId<span class="keyword keyword_operator keyword_operator_js">+</span><span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>_latest<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
      <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span>now<span class="keyword keyword_operator keyword_operator_js">-</span>tabLatest<span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="keyword keyword_operator keyword_operator_js">&gt;=</span><span class="constant constant_numeric constant_numeric_js">15000</span> ? toRemove : toKeep <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span><span class="support support_function support_function_js">push</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span>tabId<span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
    <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span>
    localStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>tabs <span class="keyword keyword_operator keyword_operator_js">=</span> toKeep<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span><span class="support support_function support_function_js">join</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_quoted string_quoted_single string_quoted_single_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">'</span>,<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">'</span></span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
    <span class="keyword keyword_control keyword_control_js">for</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="storage storage_type storage_type_js">var</span> i<span class="keyword keyword_operator keyword_operator_js">=</span><span class="constant constant_numeric constant_numeric_js">0</span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span> len<span class="keyword keyword_operator keyword_operator_js">=</span>toRemove<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span><span class="support support_constant support_constant_js">length</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span> i<span class="keyword keyword_operator keyword_operator_js">&lt;</span>len<span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span> i<span class="keyword keyword_operator keyword_operator_js">++</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
      <span class="storage storage_type storage_type_js">var</span> tabId <span class="keyword keyword_operator keyword_operator_js">=</span> toRemove<span class="meta meta_brace meta_brace_square meta_brace_square_js">[</span>i<span class="meta meta_brace meta_brace_square meta_brace_square_js">]</span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span>
          tabLatest <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="support support_function support_function_js">parseInt</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> localStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>getItem<span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>tab<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span><span class="keyword keyword_operator keyword_operator_js">+</span>tabId<span class="keyword keyword_operator keyword_operator_js">+</span><span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>_latest<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span>
          tabStart <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="support support_function support_function_js">parseInt</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> localStorage<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>getItem<span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>tab<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span><span class="keyword keyword_operator keyword_operator_js">+</span>tabId<span class="keyword keyword_operator keyword_operator_js">+</span><span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>_start<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span>
          time <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span>tabLatest<span class="keyword keyword_operator keyword_operator_js">-</span>tabStart<span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span>/<span class="constant constant_numeric constant_numeric_js">1000</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
      addMsg<span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span> <span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span>Tab <span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span> <span class="keyword keyword_operator keyword_operator_js">+</span> tabId <span class="keyword keyword_operator keyword_operator_js">+</span> <span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span> Closed after <span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span> <span class="keyword keyword_operator keyword_operator_js">+</span> time <span class="keyword keyword_operator keyword_operator_js">+</span> <span class="string string_quoted string_quoted_double string_quoted_double_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">"</span> seconds!<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">"</span></span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
    <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span>
  <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span>
<span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span> <span class="constant constant_numeric constant_numeric_js">5000</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span></span></pre>
<p>This took a little under an hour to get working.  There are still minor issues that I didn&#8217;t attempt to resolve.  However, if there is interest this could be developed into a completely distributed peer-to-peer communication between tabs/windows on a single domain.  However, a little warning. Web Storage is not set in stone.  Not all browsers have implemented it and the specification is subject to change at any minute.  There has been some rather heated debate on the subject of Web Storage recently, with good reason.  All I know is that when its settled, this functionality will continue to exist!</p>
<p>Let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/06/web-analytics-taken-to-the-next-level/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/06/web-analytics-taken-to-the-next-level/</feedburner:origLink></item>
		<item>
		<title>Handling the tab key in a &lt;textarea&gt;</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/5hUWmW7utlA/</link>
		<comments>http://blog.bogojoker.com/2009/06/handling-the-tab-key-in-a-textarea/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 13:30:43 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[tab key]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=867</guid>
		<description><![CDATA[Traversing through input elements with the tab key is important for accessibility reasons.  However, every once in a while you come across a situation where traversal isn&#8217;t really important.  Instead, you want the tab key to actually do something for you.  Even still, you may want to do something fancy with the [...]]]></description>
			<content:encoded><![CDATA[<p>Traversing through input elements with the tab key is important for accessibility reasons.  However, every once in a while you come across a situation where traversal isn&#8217;t really important.  Instead, you want the tab key to actually do something for you.  Even still, you may want to do something fancy with the tab key. Wether its replacing it with spaces or something else.</p>
<p>I found an interesting website today that had an interesting idea.  You could run some test code on the page to test their library.  Their instructions said, &#8220;push tab to evaluate the code.&#8221;  Sure enough you could tell it was working &#8220;onblur&#8221; for the textarea.  The problem with this was that when you pushed tab you lost focus.</p>
<p>I thought about it, and figured you could do a rather simple trick to run some code and refocus on the textarea.  It goes a little like this:</p>
<pre class="textmate-source twilight"><span class="source source_js"><span class="support support_class support_class_js">window</span><span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>addEventListener<span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_quoted string_quoted_single string_quoted_single_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">'</span>load<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">'</span></span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span> <span class="meta meta_function meta_function_js"><span class="storage storage_type storage_type_function storage_type_function_js">function</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_js">(</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_end punctuation_definition_parameters_end_js">)</span></span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
  <span class="storage storage_type storage_type_js">var</span> textarea <span class="keyword keyword_operator keyword_operator_js">=</span> <span class="support support_class support_class_js">document</span><span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span><span class="support support_function support_function_dom support_function_dom_js">getElementById</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_quoted string_quoted_single string_quoted_single_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">'</span>txt<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">'</span></span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
  textarea<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>addEventListener<span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="string string_quoted string_quoted_single string_quoted_single_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">'</span>keydown<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">'</span></span><span class="meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js">,</span> <span class="meta meta_function meta_function_js"><span class="storage storage_type storage_type_function storage_type_function_js">function</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_js">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_js">e</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_end punctuation_definition_parameters_end_js">)</span></span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
    <span class="keyword keyword_control keyword_control_js">if</span> <span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span>e<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>keyCode <span class="keyword keyword_operator keyword_operator_js">===</span> <span class="constant constant_numeric constant_numeric_js">9</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span> <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
      e<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>preventDefault<span class="meta meta_brace meta_brace_round meta_brace_round_js">()</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
      e<span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>stopPropagation<span class="meta meta_brace meta_brace_round meta_brace_round_js">()</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
      <span class="comment comment_line comment_line_double-slash comment_line_double-slash_js"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_js">//</span> operation goes here
</span>    <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span>
  <span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
<span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span></span></pre>
<p>Note that to get the actual character you have to get the character from the event.  There are many ways to do it, keyCode, charCode, which, even keyIdentifier.  You&#8217;ll have to mix things up to work across all browsers.  Basically 9 is the code for the tab key.  So when you get the tab key, it prevents the default behavior and allows you to execute whatever code you want: run some functions, eval some code, display something, ajax request, whatever you want.  Simple.  I think it would improve a few interfaces.  Neat idea to make use of the tab key to perform a function.</p>
<p>You can check out <a href="http://bogojoker.com/x/tab_trigger.html">this example</a> of what I mean.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/06/handling-the-tab-key-in-a-textarea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/06/handling-the-tab-key-in-a-textarea/</feedburner:origLink></item>
		<item>
		<title>Too Many Unproductive Comments</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/PSTqqHmro1w/</link>
		<comments>http://blog.bogojoker.com/2009/06/too-many-unproductive-comments/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:27:37 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[misc.]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[discussion]]></category>
		<category><![CDATA[praise]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=843</guid>
		<description><![CDATA[It seems as though there is an epidemic across the web.  Bad comments.  Not spam, not flames, not even rude remarks&#8230; just plain drivel.  I spent the last few weeks reading all the comments (or as many as I could stand) on the hundreds of blog articles I read every week.  [...]]]></description>
			<content:encoded><![CDATA[<p>It seems as though there is an epidemic across the web.  Bad comments.  Not spam, not flames, not even rude remarks&#8230; just plain drivel.  I spent the last few weeks reading all the comments (or as many as I could stand) on the hundreds of blog articles I read every week.  They fall into two major categories, which I&#8217;ll discuss below.</p>
<p>I&#8217;ve linked to this in the past but I&#8217;ve really taken it to heart: <a href="http://b.lesseverything.com/2009/3/24/your-shit-does-stink-good-friends-are-hard-to-find">Your Shit Does Stink &#8212; Good Friends Are Hard to Find</a>.</p>
<p>What the gentlemen at Less Everything were saying has just continually amplified in my mind over these last few (dare I say &#8220;trying&#8221;) weeks.  Their article is short, and worth the jump, but to put it in context:</p>
<blockquote><p>It’s easier to just smile and nod and say, “that’s great,” and that’s what most of us do. But a true friend will tell you to polish it up or go make changes or start again.</p></blockquote>
<p>The same applies to comments on a blog post.  The idea is to inspire discussion, clarify points, etc. eventually enriching the value of the article itself.  Instead, in a number of sites I&#8217;m seeing &#8220;fluff&#8221; comments, which just make the entire experience of reading comments a downright drag when I&#8217;m actually interested in the content.  So, I counted&#8230;</p>
<p>I took a well written article with over 100 comments and counted more then 50% of the comments were of this &#8220;fluff&#8221; nature.  Although not directly from the article where I calculated my statistics, I pulled this paragon of an example:</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/06/fluff.png" alt="Useless Comment" title="Useless Comment" width="559" height="147" style="border: 1px solid lightGray; margin: 0 15px;" /></p>
<p>I made little effort to hide the identity of the user and the website (which I have the highest respect for).  The fact of the matter is that this comment is not only worthless, it pollutes the pot of potentially worthy comments and thus detracts from the value of the article itself.  In this particular example the commenter actually admits to not reading the article but then claims he knows it will be awesome?!?!  Give me a break.  Hell, if I was the author of the article I would be upset at such an ignominious comment (yah, I looked that one up).</p>
<p>I&#8217;ve gone years on this blog without making a rant.  This is my first.  So, admittedly, I did not hold back.  However, eventually I calmed down and tried to really think about this &#8220;problem.&#8221;</p>
<p>From the author&#8217;s perspective this simple &#8220;praise&#8221; is uplifting.  For those offering the praise its quite simply that&#8230; many want to portray honest thanks and support to the author.  This is all well and good.  However, there are still many reading the article intending to engage in discussion.  Undoubtably the author should both encourage and look forward to this kind of discussion; even more so then the praise!!  Why?  Because its in our nature.  We write so that others can read.  We enable comments so others can tell us what they think. If we didn&#8217;t care for other&#8217;s opinions or views then comments could just as easily be disabled. </p>
<p>So, essentially there are two categories of comments, Praise and Discussion.  So, I think that this should become a model.  The more recent up/down voting scheme is not the model to use for most blog articles.  It works well on ranking sites like StackOverflow and Reddit where correctness or opinion influences the votes.  However in this case there is:</p>
<ul>
<li>
<p>Praise &#8211; essentially always an &#8220;up-vote.&#8221;</p>
</li>
<li>
<p>Discussion &#8211; a level playing field likely to contain constructive criticism as well as support for the article.</p>
</li>
</ul>
<p>Both avenues should be available so that the author and all the commenters have the freedom to interact with whichever degree they feel is appropriate.  In the end the discussion is separated from the &#8220;fluff&#8221; and everyone wins.</p>
<p>I&#8217;m thinking of the current system of WordPress with comments and trackbacks/pings.  They are handled separately, but that is because fundamentally they are different.  To make a system like I&#8217;ve suggested work would either require user action, moderation, or a (likely) sophisticated action.  Two of those don&#8217;t scale and the last is probably too complex to be reliable.  If I&#8217;ve learned anything from StackOverflow its that they have actively crafted and trained their community of users to &#8220;do good&#8221; and do all of this low level work willingly and it has paid off very well.</p>
<p>For starters &#8220;commenters&#8221; must at least be given the choice: to contribute to a discussion, or to thank the author for a well written article.  I don&#8217;t intend on building this system yet, because I personally don&#8217;t have the influence or the popularity to make an impact.  Yet.</p>
<p>Just keep this in mind the next time you comment.  Actually try to &#8220;add value.&#8221;  To rip off the Army&#8230; The whole world can read what you&#8217;re writing.  Is it worth reading?</p>
<p>Cheers?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/06/too-many-unproductive-comments/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/06/too-many-unproductive-comments/</feedburner:origLink></item>
		<item>
		<title>Visualize the Directory Tree</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/dQ13aBPGgUg/</link>
		<comments>http://blog.bogojoker.com/2009/06/visualize-the-directory-tree/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 15:00:56 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[SotD]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[directory tree]]></category>
		<category><![CDATA[listing]]></category>
		<category><![CDATA[tree]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=828</guid>
		<description><![CDATA[Ever have to work with a new directory and you have no idea what its structure is?  Or maybe you have a few files laying around but you&#8217;re not sure which sub-directory they are in?  Or maybe you&#8217;re showing someone else a project and you want to show them the directory hierarchy.  [...]]]></description>
			<content:encoded><![CDATA[<p>Ever have to work with a new directory and you have no idea what its structure is?  Or maybe you have a few files laying around but you&#8217;re not sure which sub-directory they are in?  Or maybe you&#8217;re showing someone else a project and you want to show them the directory hierarchy.  The bare bones solutions of `ls -R` or `find .` are just too archaic and offer no visualization of the structure. To solve this problem, people have built their own &#8220;tree&#8221; scripts.</p>
<p>There are a few tree scripts available online.  Some as simple as find | sed and others are slightly more advanced like a python script.  I wasn&#8217;t pleased with the existing solutions, so I wrote my own.  To get an idea of what I&#8217;m talking about take a look at this screenshot showing the listing of a Rails project:</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/06/Picture-3.png" alt="tree" title="tree" class="aligncenter" /></p>
<p>Its a simple, clean listing of the directory tree.  I will admit, the style is based off of another tree script that I&#8217;ve seen that I liked.  Also, this isn&#8217;t really production quality code.  I take the lazy way out and first get a directory listing and then work from there.  This means that for large directories there may be an initial pause before it starts outputting.  I wouldn&#8217;t suggest running this on your home directory.  Although I can think of better algorithms its unlikely that I would want to run this on huge directories so I&#8217;m more then happy right now.</p>
<p>The usage is pretty bare bones:</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/06/Picture-5.png" alt="tree usage" title="tree usage" class="aligncenter size-full" /></p>
<p>This is one more script I&#8217;ve added to my <a href="http://bogojoker.com/shell/">~/bin</a> and its completely open source <a href="http://github.com/JosephPecoraro/scripts/blob/master/tree">on GitHub</a>.  Its just straight Ruby, no extra packages, works with 1.8 and 1.9.  Oh and did I mention its customizable?</p>
<p>I hope you like it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/06/visualize-the-directory-tree/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/06/visualize-the-directory-tree/</feedburner:origLink></item>
		<item>
		<title>Shell Brace Expansion</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/uBYlPVbAe4I/</link>
		<comments>http://blog.bogojoker.com/2009/06/shell-brace-expansion/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 04:33:35 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[brace expansion]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=802</guid>
		<description><![CDATA[I would say that most developers that I know are comfortable with a shell/terminal but they are not proficient with the shell.  I, for one, am constantly striving to improve my knowledge of the shell, customizing my environment, and trying to maximize my productivity with it.  Even after years of constant usage I [...]]]></description>
			<content:encoded><![CDATA[<p>I would say that most developers that I know are comfortable with a shell/terminal but they are not <em>proficient</em> with the shell.  I, for one, am constantly striving to improve my knowledge of the shell, customizing my environment, and trying to maximize my productivity with it.  Even after years of constant usage I am always learning new tricks and techniques.  It also doesn&#8217;t help that there are thousands of command line applications out there waiting to be absorbed.</p>
<p>My shell of choice, like most people I know, is bash.  Most developers only use the basic features available in shells such as launching programs, command history, auto-completion, and the like.  However, most shells have functionality people don&#8217;t even know about and could probably benefit from.  Who knows, you might even be able to multitask and partake in <a href="http://www.foxybingo.com/">foxy bingo online</a> or pogo games while programming simultaneously. One such feature is <a href="http://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion">Brace Expansion</a>.</p>
<p>Take a look:</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/06/picture-3.png" alt="Brace Expansion" title="Brace Expansion" width="504" height="350" style="margin: 0 50px;" /></p>
<p>Its a little hard to see from the image so I&#8217;ll run down the examples here:</p>
<pre>shell&gt; echo hello{world,goodbye}
helloworld hellogoodbye</pre>
<p>This example shows exactly what Brace Expansion is doing.  Its taking the input line &#8220;hello{}&#8221; and replacing the &#8220;{}&#8221; section with each of the comma separated values, producing &#8220;helloworld&#8221; and &#8220;hellogoodbye.&#8221;</p>
<p>Its important to note that there is no space between &#8220;hello&#8221; and the opening brace.  This is called the preamble and therefore it gets prepended to the front of both &#8220;world&#8221; and &#8220;goodbye.&#8221;  Also, there is no space around the comma inside the braces.  If there were a space then brace expansion doesn&#8217;t take place at all!  The output itself will separate each expansion with a space, just like any other built-in shell expansion. If you really want spaces in the expansion portions you can escape them as you normally would and it will respect that.</p>
<pre>shell&gt; echo file.{txt,rb}
file.txt file.rb</pre>
<p>This points out a couple things.  First of all, I&#8217;m using echo to debug the brace expansion so you can see what it produced.  What seemingly happens, like in the previous case, is that it ran the brace expansion when it parsed the input line, and turned it into the following:</p>
<pre>shell&gt; echo file.txt file.rb</pre>
<p>Now some simple usages pop to mind.  Need to rename a file?  How about &#8220;mv filename.{txt,rb}.&#8221; Want to quickly backup a file, how about &#8220;cp filename.{txt,save}.&#8221;  Whenever you feel yourself typing the same thing twice in a row that is a perfect candidate for brace expansion!  Save yourself some keystrokes, some time, and potential errors by reusing what you&#8217;ve already typed in already!</p>
<p>The third usage is combining two separate but connected brace expansions &#8220;{}{}.&#8221;  This works differently then two completely disjoint sets &#8220;{} &#8230; {}&#8221; and is still different then nested sets &#8220;{&#8230;{}&#8230;}.&#8221;  Rather then discuss the semantics of those, which you can easily find out yourself by just trying them out, I&#8217;ll give you a glimpse of another trick you can do with brace expansion.</p>
<p>Here is a simple example of Sequences:</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/06/picture-4.png" alt="Brace Expansion Sequences" title="Brace Expansion Sequences" width="553" style="margin: 0 50px" /></p>
<p>The syntax for sequences is &#8220;{#..#}.&#8221;  You can even do simple character sequences like &#8220;{a..z}.&#8221;  The second example from the picture shows a postscript, the opposite of the preamble.  Its text that comes immediately after the braces (no space) and is thus appended to the end of each expansion.</p>
<p>I hope you give it try, you might end up liking it.  I actually do some real neat tricks with it in one of my scripts.  If you want to explore it further you should check out some of the more technical documentation:</p>
<ul>
<li><a href="http://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion">Bash Reference Manual &#8211; One Stop Shop</a></li>
<li><a href="http://bash-hackers.org/wiki/doku.php/syntax/expansion/brace">Brace Expansion in Detail &#8211; Includes Bash 4 Features</a></li>
</ul>
<p>Until next time, wrap your head around this crazy line. And no, there is no typo, its running a brace expansion once, which then outputs a very long command which includes brace expansion, and then runs that command with bash:</p>
<pre>shell&gt; echo echo {A..Z}\{0..{1..4}\} | bash</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/06/shell-brace-expansion/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/06/shell-brace-expansion/</feedburner:origLink></item>
		<item>
		<title>Markdown =&gt; Tutorial in 1 Step</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/vgTk3IuoFdQ/</link>
		<comments>http://blog.bogojoker.com/2009/05/markdown-tutorial-in-1-step/#comments</comments>
		<pubDate>Mon, 18 May 2009 15:00:10 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[markdown]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=787</guid>
		<description><![CDATA[When I wrote my Ruby Readline tutorial I felt I came up with a cool concept.  I started with a Markdown file, translated it to html, and I used the headers to generate a Table of Contents on the fly.

It didn&#8217;t take me long to realize that I could turn this into a framework [...]]]></description>
			<content:encoded><![CDATA[<p>When I wrote my <a href="http://bogojoker.com/readline/">Ruby Readline</a> tutorial I felt I came up with a cool concept.  I started with a Markdown file, translated it to html, and I used the headers to generate a Table of Contents on the fly.</p>
<p><a href="http://github.com/JosephPecoraro/markdownorial/tree/master"><img src="http://blog.bogojoker.com/wp-content/uploads/2009/05/picture-11.png" alt="table of contents" title="table of contents" width="516" height="366" style="border: 1px solid lightGray; margin: 10px 20px;" /></a></p>
<p>It didn&#8217;t take me long to realize that I could turn this into a framework where I could turn <em>any</em> Markdown file into a tutorial exactly like this one.  So with surprisingly little work I modified the scripts to work with any markdown file and the html automatically generated from the standard Markdown.pl script.</p>
<p>I called this <a href="http://github.com/JosephPecoraro/markdownorial/tree/master">markdownorial</a>.  Laugh all you want at the name, but I still think the concept is very cool.  I&#8217;ll probably be using this more and more to automatically generate and format a pretty cool looking tutorial from a single markdown file.  The start to finish time for a project like this has instantly dropped to just the raw content part, no design or coding needed!</p>
<p>Advantages include:</p>
<ul>
<li>
<p>Writing Markdown is very fast and efficient.</p>
</li>
<li>
<p>Time is spent writing the content.  Not messing with design,</p>
</li>
<li>
<p>Table of Contents is automatically built for you.</p>
</li>
<li>
<p>Useful permalinks are automatically generated.  Very useful when passing around links.</p>
</li>
<li>
<p>Clean user interface that focuses entirely on the content but the Table of Contents is always available!</p>
</li>
<li>
<p>Git Repository means if I update the design its just a `git pull` away to get the update.</p>
</ul>
<p>Right now the tutorials shows up elegantly in all standards compliant browsers. Safari/Webkit and Chrome display it perfectly.  Opera has some very minor Unicode issues but displays everything perfectly. Firefox has some separate Unicode issues and if you don&#8217;t have the latest version it has some working but slow animation.  Overall, its entirely usable for people using decent browsers.</p>
<p>Let me know what you think.  Feel free to use it and improve it.  Its all up on Github.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/05/markdown-tutorial-in-1-step/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/05/markdown-tutorial-in-1-step/</feedburner:origLink></item>
		<item>
		<title>First Nettuts Tutorial – .htaccess</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/EznmI68J8SY/</link>
		<comments>http://blog.bogojoker.com/2009/05/first-nettuts-tutorial-htaccess/#comments</comments>
		<pubDate>Mon, 11 May 2009 15:41:22 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[free]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[nettuts]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=776</guid>
		<description><![CDATA[My First Nettuts Tutorial was published today!  For those who follow my blog every week, this is the reason why I haven&#8217;t been able to post the last few weeks&#8230; because I&#8217;ve been putting all the time I would normally be blogging into a series of Nettuts tutorials.


This tutorial covers the basics of .htaccess, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://net.tutsplus.com/tutorials/other/the-ultimate-guide-to-htaccess-files/">My First Nettuts Tutorial</a> was published today!  For those who follow my blog every week, this is the reason why I haven&#8217;t been able to post the last few weeks&#8230; because I&#8217;ve been putting all the time I would normally be blogging into a series of Nettuts tutorials.</p>
<p><a href="http://net.tutsplus.com/tutorials/other/the-ultimate-guide-to-htaccess-files/"><br />
<img src="http://blog.bogojoker.com/wp-content/uploads/2009/05/picture-1.png" alt="htaccess examples" title="htaccess examples" width="555" height="329" style="border: 1px solid lightGray; margin-left: 10px;" /></a></p>
<p>This tutorial covers the basics of .htaccess, Apache&#8217;s Per Directory Configuration Files.  Fortunately, with the basics out of the way, I can move on to the cooler features such as GZip encoding and mod_rewrite for the next article.</p>
<p>Also the examples can be viewed here:<br />
<a href="http://bogojoker.com/htaccess/part1/">http://bogojoker.com/htaccess/part1/</a></p>
<p>And the examples can be downloaded here:<br />
<a href="http://bogojoker.com/htaccess/part1_examples.zip">http://bogojoker.com/htaccess/part1_examples.zip</a></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/05/first-nettuts-tutorial-htaccess/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/05/first-nettuts-tutorial-htaccess/</feedburner:origLink></item>
		<item>
		<title>Mac OS X – Moving Windows Quick Tip</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/ka8TcNO-ZQA/</link>
		<comments>http://blog.bogojoker.com/2009/04/mac-os-x-moving-windows-quick-tip/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 21:28:04 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=766</guid>
		<description><![CDATA[If your Mac won&#8217;t let you move a window because of a dialog or something, but you really want to move the window, just open Spaces and move the window from there!  This seems to work every time. Its made working with some poorly developed applications a little easier.
Now if I could just make [...]]]></description>
			<content:encoded><![CDATA[<p>If your Mac won&#8217;t let you move a window because of a dialog or something, but you really want to move the window, just open Spaces and move the window from there!  This seems to work every time. Its made working with some poorly developed applications a little easier.</p>
<p>Now if I could just make some dialogs stay in front of the actual application window I would be completely happy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/04/mac-os-x-moving-windows-quick-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/04/mac-os-x-moving-windows-quick-tip/</feedburner:origLink></item>
		<item>
		<title>Favorite Quotes (Alpha Release)</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/-XbGRG3n-Z0/</link>
		<comments>http://blog.bogojoker.com/2009/04/favorite-quotes-alpha-release/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 03:26:41 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[design]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[quotes]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=755</guid>
		<description><![CDATA[Much like my ~/bin page that keeps track of shell scripts I&#8217;ve written I took the time to make a small site to host my favorite quotes.  Again, this lets me experiment with some things.  This is an alpha version showing some progress.  Its just 2 hours of PHP, a text file [...]]]></description>
			<content:encoded><![CDATA[<p>Much like my <a href="http://bogojoker.com/shell">~/bin</a> page that keeps track of shell scripts I&#8217;ve written I took the time to make a small site to host my favorite quotes.  Again, this lets me experiment with some things.  This is an alpha version showing some progress.  Its just 2 hours of PHP, a text file backend, some CSS, and a bunch of minute JS animation.  But its a neat site that I hope can become useful to me:</p>
<p><a href="http://bogojoker.com/quotes"><img src="http://blog.bogojoker.com/wp-content/uploads/2009/04/quotes.png" alt="quotes" title="quotes" width="600" height="508" class="alignnone size-full wp-image-756" /></a></p>
<p>Some semi-novel concepts are that when you scroll 75% down the page the next 10 quotes are automatically loaded and added to the DOM in the background.  This way you can continuously scroll forever and load quotes without ever noticing!  Well, unfortunately you can&#8217;t quite test that yet, because there are only 10 quotes, and 75% is not perfect, it should really have a fixed size from the bottom.  Minor details!</p>
<p>Also, this project allowed my to test my new auto-project-setup shell script.  It worked great.  it got me up and running in a matter of seconds!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/04/favorite-quotes-alpha-release/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/04/favorite-quotes-alpha-release/</feedburner:origLink></item>
		<item>
		<title>Check if Your Ruby Script is in a Pipe</title>
		<link>http://feedproxy.google.com/~r/Bogojoker/~3/giScpTrw9OA/</link>
		<comments>http://blog.bogojoker.com/2009/04/check-if-your-ruby-script-is-in-a-pipe/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 02:20:12 +0000</pubDate>
		<dc:creator>Joseph Pecoraro</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[pipe]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tty]]></category>

		<guid isPermaLink="false">http://blog.bogojoker.com/?p=731</guid>
		<description><![CDATA[Short and simple this week.  When you&#8217;re writing a Ruby script you might want to know if you&#8217;re in a pipe or not.  One reason might be changing how you buffer your input/output.  A number of basic Unix commands do this, they act differently when piped.
I actually wrote a script where I [...]]]></description>
			<content:encoded><![CDATA[<p>Short and simple this week.  When you&#8217;re writing a Ruby script you might want to know if you&#8217;re in a pipe or not.  One reason might be changing how you buffer your input/output.  A number of basic Unix commands do this, they act differently when piped.</p>
<p>I actually wrote a script where I wanted to change the command line arguments if I was in a pipe. This is probably confusing but its really useful!  So there is actually an easy way to do this in Ruby:</p>
<pre class="textmate-source twilight"><span class="source source_ruby"><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>!/usr/bin/env ruby
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Prints if the input or output is regular or piped
</span>puts <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>INPUT:  <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span><span class="support support_class support_class_ruby">STDIN</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>tty?  <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">?</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>regular<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span> <span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">:</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>pipe<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
puts <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>OUTPUT: <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span><span class="support support_class support_class_ruby">STDOUT</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>tty? <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">?</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>regular<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span> <span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">:</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>pipe<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
</span></pre>
<p>Proof that it works as advertised:</p>
<p><img src="http://blog.bogojoker.com/wp-content/uploads/2009/04/isatty.png" alt="IO#tty?" title="IO#tty?" width="560" height="414" class="aligncenter size-full wp-image-733" /></p>
<p>The documentation on <a href="http://www.ruby-doc.org/core-1.9/classes/IO.html#M002108">IO#tty?</a> says the following:</p>
<blockquote><p>Returns true if [the IO stream] is associated with a terminal device (tty), false otherwise.</p></blockquote>
<p>For those that don&#8217;t know, tty is short for <em>teletype writer</em>.  This is an old Unix term for an interactive process that takes in user input.  Nowadays it almost always means a shell/console/terminal.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bogojoker.com/2009/04/check-if-your-ruby-script-is-in-a-pipe/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.bogojoker.com/2009/04/check-if-your-ruby-script-is-in-a-pipe/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 23.465 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-09-07 13:36:48 -->
