<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Honolulu Hacker</title>
	<atom:link href="http://honoluluhacker.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://honoluluhacker.com</link>
	<description>Tech, Linux, Rails by Holululu-based Kevin English</description>
	<lastBuildDate>Wed, 24 Feb 2010 01:26:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Has comedy changed as a result of the internet?</title>
		<link>http://honoluluhacker.com/2010/02/21/has-comedy-as-a-result-of-the-internet/</link>
		<comments>http://honoluluhacker.com/2010/02/21/has-comedy-as-a-result-of-the-internet/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 04:40:56 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=1050</guid>
		<description><![CDATA[Let&#8217;s think about how comedy has changed since we&#8217;ve started consuming digital video on the internet. Prior to the Internet, comedy media was consumed primarily through movies and television. However, the internet has made comedy infinitely more accessible and thus we&#8217;ve been laughing a lot harder these days at a lot of different things. 
To [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s think about how comedy has changed since we&#8217;ve started consuming digital video on the internet. Prior to the Internet, comedy media was consumed primarily through movies and television. However, the internet has made comedy infinitely more accessible and thus we&#8217;ve been laughing a lot harder these days at a lot of different things. </p>
<p>To begin, what is Comedy? The following summarizes a popular book about comedy:</p>
<p><a href="http://www.amazon.com/Comedy-Writing-Secrets-Best-Selling-Think/dp/1582973571/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1266906094&#038;sr=8-1">Comedy Writing Secrets by Mel Helitzer</a></p>
<p>Why We laugh?<br />
  The two main motivations:</p>
<ul>
<li>We laugh out of surprise.</li>
<li>We laugh when we feel superior.</li>
</ul>
<p>  There are six additional motivations each which supports the first two.</p>
<ul>
<li>We laugh out of Instinct</li>
<li>We laugh at incongruity</li>
<li>We laugh out of ambivalence</li>
<li>We laugh out of release</li>
<li>We laugh when we solve a puzzle</li>
<li>We laugh to regress.</li>
</ul>
<p>Recipe for Humor:</p>
<p>The following six elements must be present for any humor to work:</p>
<ul>
<li>Target</li>
<li>Hostility</li>
<li>Realism</li>
<li>Exaggeration</li>
<li>Emotion</li>
<li>Surprise</li>
</ul>
<p>These elements have not changed much, what has changed is the content. </p>
<p>How do I consume great comedy vidoes?</p>
<ul>
<li><a href="http://www.comedycentral.com/tosh.0/">Tosh.O Blog</a></li>
<li><a href="http://reddit.tv/">Redit.tv</a> (click Happy)</li>
</ul>
<p>This is my internet Comedy Highlight real. Since I won&#8217;t have time to show all these videos in class, I hope that the other students will visit my blog and watch them on their own time.</p>
<p><strong>Early history:</strong><br />
<a href="http://www.atom.com/fun_games/gangsta_rap/">Star Wars Gangsta Rap</a>: The most popular flash-video of all time</p>
<p>Lenny Bruce, Eddy Murphy, Richard Pryor were all considered vulgar for their time. Now, notice that vulgarity is almost expected in interactions on the internet.</p>
<p>Popular Targets: Technology and Technology Workers</p>
<ul>
<li><a href="http://www.collegehumor.com/video:1907543">We didn&#8217;t start the flame war</a></li>
<li><a href="http://www.youtube.com/watch?v=W8_Kfjo3VjU">The Website is Down: Web dude vs Sales Guy</a> </li>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/yg7Xh0m_Oco&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/yg7Xh0m_Oco&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
Mac Parody
</ul>
<p>There is a hostility towards traditional media. Even though we&#8217;re consuming more traditional media than ever, it&#8217;s easier to make fun of it now:<br />
<object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/YtGSXMuWMR4&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/YtGSXMuWMR4&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object><br />
Charlie Brooker &#8211; How To Report The News<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/3eooXNd0heM&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/3eooXNd0heM&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
Auto-tune the news with Joe Biden singing</p>
<p>Mixing Media:</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/luVjkTEIoJc&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/luVjkTEIoJc&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
Star Trek and Monty Python.<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/Xzkd_m4ivmc&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Xzkd_m4ivmc&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
Don&#8217;t Taze me and MC Hammer.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/iORpLPmFfHU&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/iORpLPmFfHU&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
Kesha/cops parody uses many internet based images.</p>
<p>Target/ Hostility: Popular Movies<br />
<object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/1bXeQ7baYEE&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/1bXeQ7baYEE&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object><br />
Twilight &#8216;New Moon&#8217; in one minute.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/zzoeEdW-EDQ&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/zzoeEdW-EDQ&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
How Star Wars should have ended.</p>
<p>Realism (Fail Videos) Top 100 Fail Clips of 2009:<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/QNbpIwS_kCA&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/QNbpIwS_kCA&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>Tons of Suprises:<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/judWB4Bn-3c&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/judWB4Bn-3c&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
 Misheard Metal Lyrics.</p>
<p>Digital video can be used to parody how ridiculous Television video is. Does this render Television obsolete or<br />
engage us more in it. For example, before watching the Rap Chop video, I knew very little about the slap chop. Now I always check it out in the &#8220;As seen on TV&#8221; store.<br />
Slap Chop Video.</p>
<p><a href="http://www.rooftopcomedy.com/watch/FacebookBreastFeeding">Rooftop Comedy</a> introduces us to new comedians in short, easy to consume forms.</p>
<p>Comedy by Consensus? Pride of origination?</p>
<p> So, has comedy changed? Not much. Our tolerance for bad comedy has certainly gone. Nothing is is off limits these days and technology has given comedy infinite more possibilities to expand.</p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2010/02/21/has-comedy-as-a-result-of-the-internet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Best Music of 2007: My picks</title>
		<link>http://honoluluhacker.com/2010/02/15/best-music-of-2007-my-picks/</link>
		<comments>http://honoluluhacker.com/2010/02/15/best-music-of-2007-my-picks/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 06:55:55 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=994</guid>
		<description><![CDATA[1) The Shins : Wincing the Night Away
 This album represents a change of direction for the James Mercer and his little outfit from Portland. At first I didn&#8217;t like it. There&#8217;s still a pair of traditional catchy indie-pop songs that caught my attention, (&#8220;Australia&#8221; and &#8220;Phantom Limb&#8220;) and great pop songs they are. The [...]]]></description>
			<content:encoded><![CDATA[<h1>1) The Shins : Wincing the Night Away</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2010/01/200px-Wincing_the_Night_Away.jpg" alt="200px-Wincing_the_Night_Away" title="200px-Wincing_the_Night_Away" width="200" height="200" class="alignleft size-full wp-image-995" /> This album represents a change of direction for the James Mercer and his little outfit from Portland. At first I didn&#8217;t like it. There&#8217;s still a pair of traditional catchy indie-pop songs that caught my attention, (&#8220;<em>Australia</em>&#8221; and &#8220;<em>Phantom Limb</em>&#8220;) and great pop songs they are. The rest of the album felt uneven but after a few listens, it occurred to me this unevenness is really bold experimentation: &#8220;Sea Legs&#8221; a Pink Floyd-ish funk song with a great instrumental break at the end, &#8220;Split Needle&#8221; displays something darker and &#8220;Red Rabbits&#8221; and &#8220;The Comet Appears&#8221; the sweet but oddly textured acoustic numbers. All around great music. </p>
<h1>2) Pinback : Autumn of the Seraphs</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2010/01/PinbackAOTSCover.jpg" alt="PinbackAOTSCover" title="PinbackAOTSCover" width="200" height="200" class="alignright size-full wp-image-1007" />San Diego based Pinback is one my favorite bands of the past decade. Even when they aren&#8217;t writing good songs (see &#8220;<em>Devil You Know</em>&#8221; and &#8220;I&#8217;m A Pretty Lady&#8221;), they sound awesome. The first 6 songs of this album blend together like Sgt. Pepper. While this isn&#8217;t the classic that <em>Summer in Abaddon</em> was, it&#8217;s proof that Pinback will continue to make great music.</p>
<h1> 3) José González : In Our Nature</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2010/01/JoseGonzalez-InNature.jpg" alt="JoseGonzalez-InNature" title="JoseGonzalez-InNature" width="200" height="200" class="alignleft size-full wp-image-1009" /> It&#8217;s hard to create a unique sound with just an accoustic guitar but this guy has done it. His playing and singing are so very distinct, almost mesmerizing. &#8220;How Low&#8221;, &#8220;Down the Line&#8221;, &#8220;Cycling Trivialities&#8221; and the cover version of Massive Attack&#8217;s &#8220;Teardrop&#8221; are the stand out tracks here. </p>
<h1> 4) French Kicks: Two Thousand</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2010/01/French_Kicks-Two_Thousand.jpg" alt="French_Kicks-Two_Thousand" title="French_Kicks-Two_Thousand" width="200" height="200" class="alignright size-full wp-image-1013" />This New York band adds more focus to their new wavish, retro-80s sound. This album is significant progression from &#8220;Trial of the Century&#8221; mainly because the songwriting and arrangements are better.  Only &#8220;Hey I Wait&#8221; disappoints, the rest of the album is full of some great indie-pop (&#8220;So Far We Are&#8221;, &#8220;No Mean Time&#8221;). My favorite song on the album is &#8220;Knee High&#8221; which builds from drums and a synth to a wall of the classic Kicks  sound.</p>
<h1> 5) Spoon: Ga Ga Ga Ga Ga </h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2010/01/Spoon-GaGaGaGaGa.jpg" alt="Spoon-GaGaGaGaGa" title="Spoon-GaGaGaGaGa" width="200" height="198" class="alignleft size-full wp-image-1016" /> IMHO, there&#8217;s a room for Spoon in everyone&#8217;s catalog. Their music has so many hooks it&#8217;s almost ridiculous. With this 2007 release, they seem to be repeating themselves adding horns here and there but why change a formula that works so well.</p>
<h1> 6) Blonde Redhead: 23</h1>
<p> <img src="http://honoluluhacker.com/wp-content/uploads/2010/01/BlondeRedhead23.jpg" alt="BlondeRedhead23" title="BlondeRedhead23" width="200" height="193" class="alignleft size-full wp-image-1019" />From the opening chords of the title track to the soft intro of &#8220;<em>Silently</em>&#8221; this records seems to blend together. My only complaint is that it would have been a perfect record if they would have left off the last two songs. &#8220;Top Ranking&#8221; sounds more like something from an earlier period of the band and &#8220;My Impure Hair&#8221; just plain drags. Other than that, BR is at top form: &#8220;Spring And By Summer Fall&#8221; rocks,  &#8220;Herione&#8221; is absolutely lovely and the sound of &#8220;Dr. Strangeluv&#8221; could only come from this band.</p>
<h1> 7) Thurston Moore: Trees Outside the Academy </h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2010/01/Thurstontreesoutsidetheacademy.jpg" alt="Thurstontreesoutsidetheacademy" title="Thurstontreesoutsidetheacademy" width="200" height="200" class="alignright size-full wp-image-1020" />To most people a Thurston Moore solo album will just sound like a Sonic Youth album without Kim and Renaldo singing. To some extents this is true. The basic SY elements of dark, subculture music are here but the songs have more accoustic guitar than you will ever encounter on an SY cut. &#8220;Honest James&#8221; shines as the best track: a lovely guitar dual. Of course there&#8217;s a few token noise songs here to blow your eardrums out but the rest is solid from a solid veteran indie-rocker.</p>
<h1> 8.) Panda Bear: Trees Outside the Academy </h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2010/01/Pandabearpersonpitch.jpg" alt="Pandabearpersonpitch" title="Pandabearpersonpitch" width="200" height="200" class="alignleft size-full wp-image-1021" />A solo album from one of the <em>Animal Colletive</em> guys and like that group, this album tries to one up <a href="http://en.wikipedia.org/wiki/Pet_Sounds">Pet Sounds</a> but it does a damn good job. The reverby effects and repetiveness make this album seem almost like an orchestral achievement. The melodies are very catchy and I found myself humming them quite regularly. Play  &#8220;Bro&#8221; or &#8220;Take Pills&#8221; regularly and you will see what I mean.</p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2010/02/15/best-music-of-2007-my-picks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Force download of fasta files and aln files with Apache</title>
		<link>http://honoluluhacker.com/2010/01/14/force-download-of-fasta-files-and-aln-files-with-apache/</link>
		<comments>http://honoluluhacker.com/2010/01/14/force-download-of-fasta-files-and-aln-files-with-apache/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 20:11:19 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Bioinformatics]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=998</guid>
		<description><![CDATA[If you are serving fasta files or alignment files on your server, you may want to force users to download them instead of previewing them in the browser. My application would return the fasta files as Content-Type text/plain. I wanted to force it to application/x-fasta and force download. This is accomplished rather easily in Apache [...]]]></description>
			<content:encoded><![CDATA[<p>If you are serving fasta files or alignment files on your server, you may want to force users to download them instead of previewing them in the browser. My application would return the fasta files as Content-Type text/plain. I wanted to force it to application/x-fasta and force download. This is accomplished rather easily in Apache with the following directive:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">  &lt;<span style="color: #000000; font-weight:bold;">FilesMatch</span> <span style="color: #7f007f;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>(?i:fasta)$&quot;</span>&gt;
    <span style="color: #00007f;">ForceType</span> application/x-fasta
    <span style="color: #00007f;">Header</span> set Content-Disposition attachment
  &lt;/<span style="color: #000000; font-weight:bold;">FilesMatch</span>&gt;
  &lt;<span style="color: #000000; font-weight:bold;">FilesMatch</span> <span style="color: #7f007f;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>(?i:aln)$&quot;</span>&gt;
    <span style="color: #00007f;">ForceType</span> application/x-aln
    <span style="color: #00007f;">Header</span> set Content-Disposition attachment
  &lt;/<span style="color: #000000; font-weight:bold;">FilesMatch</span>&gt;</pre></div></div>

<p>You will have to enable the apache module &#8220;mod_header&#8221; for this to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2010/01/14/force-download-of-fasta-files-and-aln-files-with-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Music of 2008: My picks</title>
		<link>http://honoluluhacker.com/2010/01/04/best-music-of-2008-my-picks/</link>
		<comments>http://honoluluhacker.com/2010/01/04/best-music-of-2008-my-picks/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 21:37:07 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=936</guid>
		<description><![CDATA[1) R.E.M. : Accelerate
The 3 remaining veteran musicians of R.E.M. returned to the sound of Life Rich Paegent and Document to breath life back into a band that was one of the fore-bearers of alternative music in the 80s and 90s.  At only 34 minutes, this record is perfectly paced. The majority of the [...]]]></description>
			<content:encoded><![CDATA[<h1>1) R.E.M. : Accelerate</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2009/12/200px-R.E.M._-_Accelerate.jpg" alt="200px-R.E.M._-_Accelerate" title="200px-R.E.M._-_Accelerate" width="200" height="200" class="alignleft size-full wp-image-937" />The 3 remaining veteran musicians of R.E.M. returned to the sound of <em>Life Rich Paegent</em> and <em>Document</em> to breath life back into a band that was one of the fore-bearers of alternative music in the 80s and 90s.  At only 34 minutes, this record is perfectly paced. The majority of the songs are loud, distortion, garage rockers. &#8220;Man-sized Wreath&#8221; and &#8220;Supernatural Superserious&#8221; have that pop  feel that could only be R.E.M. The title track and &#8220;Sing for the Submarine&#8221; explored darker territory while &#8220;Houston&#8221; and &#8220;Until the Day Is Done&#8221; show that they are still masters of acoustic rock. The highlight of the album for me is &#8220;Mr. Richards&#8221;, a poetic, political critique of the Bush Administration decorated in a great melodies and metaphors. Like &#8220;Exhuming McCarthy&#8221;, &#8220;Disturbance at the Heron House&#8221; and &#8220;Fall on Me&#8221;, that song will still sound good in 10-15 years.</p>
<h1>2) Air France: No Way Down</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2009/12/200px-NoWayDown.jpg" alt="200px-NoWayDown" title="200px-NoWayDown" width="200" height="201" class="alignright size-full wp-image-939" />I discovered this album on accident. This group from Sweden combines ambient sounds, dance beats and symphonic arrangements with just enough vocals to keep it out the instrumental category. Another short record, this one is only 22 minutes, the songs blend into one another. The best song is &#8220;No Excuses.&#8221;</p>
<h1>3) Bob Dylan: Tell Tale Signs</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2009/12/200px-Bobdylan-telltalesignscover.jpg" alt="200px-Bobdylan-telltalesignscover" title="200px-Bobdylan-telltalesignscover" width="200" height="180" class="alignleft size-full wp-image-941" />A co-worker told me that PBS was making available a streaming version of this Dylan album when it was released. I listened to it online for about 2 weeks and fell in love. I&#8217;m not one of those who thinks that <em>Love and Theft</em> and <em>Modern Times</em> are the awesome masterpieces that critics and other fans declare. However, this release is a great sample of his last 15 years of material. It makes you wonder how some of the version of these songs never ended up on albums. &#8220;<em>Born in Time</em>&#8221; in particular memorizes the ears here whereas the original version is awful. Other stand outs in clude &#8220;<em>Tel Ol&#8217; Bill</em>&#8220;, &#8220;<em>Someday Baby</em>&#8221; &#038; &#8220;<em>Dreamin&#8217; of You</em>.&#8221;</p>
<h1>4) Torche: Meanderthal</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2009/12/200px-Torche_Meanderthal.jpg" alt="200px-Torche_Meanderthal" title="200px-Torche_Meanderthal" width="200" height="200" class="alignright size-full wp-image-942" />This music isn&#8217;t for everyone. It&#8217;s pretty heavy but it&#8217;s the perfect combination of melodic and hard for me. &#8220;Grenades&#8221; feels like it could be the anthem of a new generation, &#8220;Sundown&#8221; a Jawboxish slow epic and the short instrumentals (&#8220;Triumph of Venus&#8221;,  &#8220;Little Champion&#8221;) like every song on the album let the band showcase their technical chops. Only the last 3 songs are longer than 3:30 minutes. Watch out for the long octave solo in &#8220;<em>Fat Waves.</em>&#8221;</p>
<h1>5) Cervantes: Making Friends and Enemies</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2009/12/cervantes-friends-and-enemies.gif" alt="cervantes-friends-and-enemies" title="cervantes-friends-and-enemies" width="257" height="257" class="alignleft size-full wp-image-943" />Perhaps this decade&#8217;s most underrated act in San Francisco, Cervantes (formerly Dumbwaiter) has undergone a number of personnel changes over the years but the core members and songwriters remain to help the band reinvigorate and reinvent themselves each time. This album represent the pinnacle of their effort. The guitar work, the angst-driven vocals, the creative song structures and the hat-tips to their influences forge this record. This is one album that should be in your collection.</p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2010/01/04/best-music-of-2008-my-picks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Ruby &amp; Hpricot to find lowest mortgage rate in Hawaii</title>
		<link>http://honoluluhacker.com/2009/12/14/using-ruby-hpricot-to-find-lowest-mortgage-rate-in-hawaii/</link>
		<comments>http://honoluluhacker.com/2009/12/14/using-ruby-hpricot-to-find-lowest-mortgage-rate-in-hawaii/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 05:39:27 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=958</guid>
		<description><![CDATA[Each week the Honolulu Board of Realtors publishes a report of Hawaii Mortgage Rates. To find the lowest rate for your category is difficult. A non-programming solution would be to copy it into excel, delete all the rows that you need and then sort by the rate column. This takes too much time so I [...]]]></description>
			<content:encoded><![CDATA[<p>Each week the Honolulu Board of Realtors publishes a report of <a href="http://www.hicentral.com/MortgageRates.asp">Hawaii Mortgage Rates</a>. To find the lowest rate for your category is difficult. A non-programming solution would be to copy it into excel, delete all the rows that you need and then sort by the rate column. This takes too much time so I wrote a ruby script that parses this data. This is also a demonstration of how to use the ruby tool Hpricot, an HTML Parser. You will need to install the Hpricot gem for this to work</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'hpricot'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'open-uri'</span>
&nbsp;
<span style="color:#008000; font-style:italic;">#term = '1-YR ARM'</span>
<span style="color:#008000; font-style:italic;">#term = '30-YR Fixed'</span>
term = <span style="color:#996600;">'15-YR Fixed'</span>
&nbsp;
doc = Hpricot.<span style="color:#9900CC;">parse</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;http://www.hicentral.com/MortgageRates.asp&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
rates = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> 
lender_name = <span style="color:#996600;">&quot;&quot;</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&#40;</span>doc<span style="color:#006600; font-weight:bold;">/</span><span style="color:#996600;">&quot;table&quot;</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#996600;">&quot;table&quot;</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#996600;">&quot;tr&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span> row <span style="color:#006600; font-weight:bold;">|</span>
   arr =<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
   <span style="color:#006600; font-weight:bold;">&#40;</span>row<span style="color:#006600; font-weight:bold;">/</span><span style="color:#996600;">&quot;td&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span> cell<span style="color:#006600; font-weight:bold;">|</span>  
     arr <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> cell.<span style="color:#9900CC;">inner_html</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
   <span style="color:#9966CC; font-weight:bold;">end</span>
   <span style="color:#9966CC; font-weight:bold;">if</span> arr<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> =~ <span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">15</span><span style="color:#006600; font-weight:bold;">-</span>YR Fixed<span style="color:#006600; font-weight:bold;">/</span>
      lender_name = arr<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      arr.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span>lender_name<span style="color:#006600; font-weight:bold;">&#41;</span> 
      lender_name.<span style="color:#CC0066; font-weight:bold;">sub!</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'&lt;br /&gt;'</span>,<span style="color:#996600;">' - '</span><span style="color:#006600; font-weight:bold;">&#41;</span>
   <span style="color:#9966CC; font-weight:bold;">end</span>
   <span style="color:#9966CC; font-weight:bold;">next</span> <span style="color:#9966CC; font-weight:bold;">unless</span> arr<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> =~ <span style="color:#006600; font-weight:bold;">/</span><span style="color:#008000; font-style:italic;">#{term}/</span>
   lender_data =<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span> 
   lender_data<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:lender_name</span><span style="color:#006600; font-weight:bold;">&#93;</span> = lender_name    
   lender_data<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:term</span><span style="color:#006600; font-weight:bold;">&#93;</span> = arr<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> 
   lender_data<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:apr</span><span style="color:#006600; font-weight:bold;">&#93;</span> = arr<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_f</span>
   rates <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> lender_data
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
5.<span style="color:#9900CC;">times</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span> rank <span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;Losest Rate ##{rank+1}&quot;</span>
  row = rates.<span style="color:#9900CC;">min</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>a,b<span style="color:#006600; font-weight:bold;">|</span> a<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:apr</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&lt;=&gt;</span> b<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:apr</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> 
  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;  Name: #{row[:lender_name]}&quot;</span>  
  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;  Term: #{row[:term]}&quot;</span> 
  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;  APR: #{row[:apr]}&quot;</span>  
  rates.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span>row<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Here&#8217;s what&#8217;s going on:</p>
<ul>
<li>On line 7 you will notice that I am interested in the 15-Year mortgage rate. You can change this value to get the report for the term you want. </li>
<li>On line 9, the program will download the latest rates from the hicentral.com website and parse the page returning an hpricot doc object.</li>
<li>From line 14 to 30, the program parses each line in the mortgage rate table. The logic is custom to this table. The table is unusual because the lender name is first cell only on the first line (15-YR Fixed) for each lender. To accommodate this, we match the line that has &#8220;15-YR Fixed&#8221; in second position and delete the lender name from the array (lines 19-23). We then assign the data to our summary data structure (lines 25-29)</li>
<li>Finally, we show the top 5 lowest mortgage rates (lines 32-38). To do this we use the Ruby <a href="http://ruby-doc.org/core/classes/Enumerable.html#M003134">max</a> method (line 34). We delete the current max element so it is not counted in the next loop iteration (line 38).
</ul>
<p>Thomas Lecklider has a great tutorial on how to use  <a href="http://hpricot.com/">Hpricot</a> called <a href="http://lecklider.com/posts/4-using-hpricot-to-traverse-and-parse-html">Using Hpricot to Traverse and Parse HTML.</a></p>
<p>Your commends are welcome. Give some refactoring advice if you like. I have wordpress plugin for pre tag so to write ruby code just do:</p>
<p>&lt;pre lang=&quot;ruby&quot;&gt;<br />
puts YEAH<br />
&lt;/pre&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2009/12/14/using-ruby-hpricot-to-find-lowest-mortgage-rate-in-hawaii/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Best Music of 2009: My picks</title>
		<link>http://honoluluhacker.com/2009/12/04/best-music-of-2009-my-picks/</link>
		<comments>http://honoluluhacker.com/2009/12/04/best-music-of-2009-my-picks/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 08:19:37 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=836</guid>
		<description><![CDATA[1) Neko Case: Middle Cyclone
Fox Confessor Brings the Flood seemed a little off and it didn&#8217;t warm up to me the way Blacklisted, and Furnace Room Lullaby did but this record was on rotation in my music player for countless weeks. Radio friendly tracks like &#8220;This Tornado Loves You&#8221;, &#8220;People Got A Lotta Nerve&#8221; and [...]]]></description>
			<content:encoded><![CDATA[<h1>1) Neko Case: Middle Cyclone</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2009/11/200px-Middle_cyclone_album_cover.jpg" alt="200px-Middle_cyclone_album_cover" title="200px-Middle_cyclone_album_cover" width="200" height="200" class="alignleft size-full wp-image-850" /><em>Fox Confessor Brings the Flood</em> seemed a little off and it didn&#8217;t warm up to me the way <em>Blacklisted</em>, and <em>Furnace Room Lullaby</em> did but this record was on rotation in my music player for countless weeks. Radio friendly tracks like &#8220;This Tornado Loves You&#8221;, &#8220;People Got A Lotta Nerve&#8221; and &#8220;Red Tide&#8221; have a sleek, polished feel that could some day make them Alt-Country classics but the real gems here are the acoustic, non-traditional songs like &#8220;Polar Nettles&#8221;, &#8220;Fever&#8221;, &#8220;<a href="http://www.youtube.com/watch?v=-FEYxc14ZUQ&#038;feature=related">Vengenance is Sleeping</a>&#8221; and the title track. These numbers weave in lovely harmonies, melodies and lyrics that are nothing more than memorizing. </p>
<h1>2) Islands: Vapours</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2009/11/200px-IslandsVapours.jpg" alt="200px-IslandsVapours" title="200px-IslandsVapours" width="200" height="200" class="alignright size-full wp-image-871" />This album actually surprised me. Islands, a montreal based band, followed their remarkable 2005 debut <em>Return to the Sea</em> with a disappointing, overproduced and swollen album <em>Arm&#8217;s Way</em>. <em>Vapours</em> doesn&#8217;t revert to the sound of <em>Return to the Sea</em>. It&#8217;s more like a new beginning. It pulls the best sounds from the 80s and lays them on top of some very cleverly crafted indie-synth-pop tunes. This is fun music and each time I listen to this record I marvel at how well these songs are arranged. &#8220;Tender Torture&#8221;, &#8220;Devout&#8221; and &#8220;Switched On&#8221; are my favorites.</p>
<h1>3) U2: No Line on the Horizon</h1>
<p><img class="size-full wp-image-837 alignnone" title="NoLineU2Promo" src="http://honoluluhacker.com/wp-content/uploads/2009/11/NoLineU2Promo.jpg" alt="NoLineU2Promo" width="200" height="179" align="left" />I was talking to a guy at a campout this summer who described U2 as the &#8220;Beatles of our generation.&#8221; This pisses music critics off. When at the beginning of Rattle &amp; Hum Bona said, &#8220;This song Charles Mason stole from the Beatles and now we&#8217;re stealing it back&#8221; wasn&#8217;t he implying that U2 was good enough or better than the Beatles and thus claiming their spot as the top rock act of all time? Oh, the nerve. As clique as it sounds, U2 does know how to reinvent itself very well and on this record they did it again while maintaining their core unique elements: Edges infinite guitar notes, Larry Mullen Jr&#8217;s creative rock drumming and Bono&#8217;s soulful, rock vocals. Great songs: &#8220;Breathe&#8221;, &#8220;Magnificent&#8221;, &#8220;Fez&#8221;</p>
<h1>4) Morrissey : Years of Refusal </h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2009/11/200px-YearsOfRefusal.jpg" alt="200px-YearsOfRefusal" title="200px-YearsOfRefusal" width="200" height="201" class="alignright size-full wp-image-873" />It&#8217;s not that obsessed with my 7th grade heroes, it&#8217;s just that they are still putting out great music. Morrissey returns from the melodrama of <em>Ringleader of the Tormentor</em> with an album that has much heavier, rock influences. His new band is tight, full of punk/pop hooks, raw and energetic. Of course, the lyrics are great too. Only one voice can successfully belt out lines like  &#8220;It&#8217;s not your birthday anymore, did you really think we meant all of those syrupy, sentimental things that we said yesterday&#8221;. </p>
<h1>5) George Jones Musicor Recordings Box Sets (1965-1971)</h1>
<p><img src="http://honoluluhacker.com/wp-content/uploads/2009/11/good-year-for-the-roses.jpg" alt="good-year-for-the-roses" title="good-year-for-the-roses" width="200" height="207" class="alignleft size-full wp-image-858" />While this isn&#8217;t &#8220;new&#8221; music, these   two box sets were released this year and are must haves for any fan of old country. They are appropriately titled <em>Walk Through This World with Me</em> and <em>A Good Year for the Roses</em> after two of his biggest hits of the era, possibly of his career.  You&#8217;ll find plenty of saloon jumping honky tonks and soothing &#8220;lost my wife&#8221; ballads (literally, one is called &#8220;When The Wife Runs Off&#8221;). All of these are decorated with beautiful piano parts, thick female background harmonies, whiny slide guitars and one of the greatest voices in country music. Due to pressure from his manager and a changing country scene, this was a very productive period for George. The sheer size of these 2 box sets is a tribute to that: <img src="http://honoluluhacker.com/wp-content/uploads/2009/11/walk-through-this-world-with-me.jpg" alt="walk-through-this-world-with-me" title="walk-through-this-world-with-me" width="200" height="200" class="alignright size-full wp-image-852" />10 Discs, 320 songs and 12 hours and 38 minutes of music. Not every song is a gem but that&#8217;s why there&#8217;s a next button on your mp3 player. However, there are songs here that you can&#8217;t miss: &#8220;Love Bug&#8221;, &#8220;I Cried Myself Awake&#8221;, &#8220;No Blues is Good News&#8221;, and one my all time favorites, &#8220;You&#8217;re Still On My Mind.&#8221;  Country gets a bad rap from a lot of folks these days but this box set is simple, American music at its finest.</p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2009/12/04/best-music-of-2009-my-picks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A SQL Server file &#8216;basename&#8217; function</title>
		<link>http://honoluluhacker.com/2009/11/24/a-sql-server-file-basename-function/</link>
		<comments>http://honoluluhacker.com/2009/11/24/a-sql-server-file-basename-function/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 03:31:29 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=901</guid>
		<description><![CDATA[Given a file path: /var/www/html/index.html
Returns: index.html
Pretty common, here&#8217;s how you do it:
Perl:

use File::Basename; 
$fullname = &#34;/usr/local/src/perl-5.6.1.tar.gz&#34;; 
$file = basename&#40;$fullname&#41;;

PHP:

$path = &#34;/home/httpd/html/index.php&#34;;
$file = basename&#40;$path&#41;;

Ruby:

path = &#34;/usr/lib/ruby/site_ruby/1.8/rubygems/version.rb&#34;
File.basename path

Python:

import os.path
path =  &#34;/usr/local/bin/python&#34;
os.path.basename&#40;path&#41;

T-SQL (MsSQL Server):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
CREATE FUNCTION &#91;dbo&#93;.&#91;fn_file_basename&#93;
&#40;
	-- Add the parameters for the function here
	@file_path Varchar&#40;255&#41;
&#41;
RETURNS Varchar&#40;255&#41;
AS
BEGIN
    declare @file_basename varchar&#40;255&#41;
    IF charindex&#40;'\', @file_path) [...]]]></description>
			<content:encoded><![CDATA[<p>Given a file path: /var/www/html/index.html<br />
Returns: index.html</p>
<p>Pretty common, here&#8217;s how you do it:</p>
<p><b>Perl:</b></p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">use</span> File<span style="color: #339933;">::</span><span style="color: #006600;">Basename</span><span style="color: #339933;">;</span> 
<span style="color: #0000ff;">$fullname</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/usr/local/src/perl-5.6.1.tar.gz&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #0000ff;">$file</span> <span style="color: #339933;">=</span> basename<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$fullname</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><b>PHP:</b></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/home/httpd/html/index.php&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><b>Ruby:</b></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">path = <span style="color:#996600;">&quot;/usr/lib/ruby/site_ruby/1.8/rubygems/version.rb&quot;</span>
<span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">basename</span> path</pre></div></div>

<p><b>Python:</b></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>
path =  <span style="color: #483d8b;">&quot;/usr/local/bin/python&quot;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">basename</span><span style="color: black;">&#40;</span>path<span style="color: black;">&#41;</span></pre></div></div>

<p><b>T-SQL (MsSQL Server):</b></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">FUNCTION</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>fn_file_basename<span style="color: #66cc66;">&#93;</span>
<span style="color: #66cc66;">&#40;</span>
	<span style="color: #808080; font-style: italic;">-- Add the parameters for the function here</span>
	@file_path Varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>
RETURNS Varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">AS</span>
BEGIN
    declare @file_basename varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #993333; font-weight: bold;">IF</span> charindex<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\'</span>, @file_path) != 0 
	   set @file_basename= reverse(substring(reverse(@file_path), 1, charindex('</span>\<span style="color: #ff0000;">', reverse(@file_path))-1))
	else
	   set @file_basename=@file_path
&nbsp;
	return @file_basename
END</span></pre></td></tr></table></div>

<p>My brilliant co-worker figured this out. The magic is done on line 11:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">reverse<span style="color: #66cc66;">&#40;</span>substring<span style="color: #66cc66;">&#40;</span>reverse<span style="color: #66cc66;">&#40;</span>@file_path<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> charindex<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\'</span>, reverse(@file_path))-1))</span></pre></div></div>

<p>It reverses the string, find the first occurance of the character &#8216;\&#8217;, takes the substring to that character and the reverses again. How elegant!</p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2009/11/24/a-sql-server-file-basename-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove Invalid XML Characters with an SSIS Visual Basic Script</title>
		<link>http://honoluluhacker.com/2009/11/24/remove-invalid-xml-characters-with-a-ssis-visual-basic-script/</link>
		<comments>http://honoluluhacker.com/2009/11/24/remove-invalid-xml-characters-with-a-ssis-visual-basic-script/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 03:05:47 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=895</guid>
		<description><![CDATA[My boss is forcing us to use Microsoft SQL Service Intergration Services for our ETL process. I Googled around for a bit and could not find a good example of how to do this simple task: open an XML file, read the text, replace any invalid characters and write it back out to the same [...]]]></description>
			<content:encoded><![CDATA[<p>My boss is forcing us to use Microsoft SQL Service Intergration Services for our ETL process. I Googled around for a bit and could not find a good example of how to do this simple task: open an XML file, read the text, replace any invalid characters and write it back out to the same file. My VB is very rusty but this works pretty well. The ReadVariable portion  is specific to SSIS but the rest should be generic. Hopefully, the next poor who needs to do this will be able to find this blog entry!</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">&nbsp;
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.Text.RegularExpressions
Imports System.<span style="color: #000080;">Object</span>
&nbsp;
&nbsp;
<span style="color: #000080;">Public</span> Class ScriptMain
&nbsp;
    <span style="color: #000080;">Public</span> <span style="color: #000080;">Sub</span> Main()
        Dts.TaskResult = Dts.Results.Success
        <span style="color: #000080;">Dim</span> strPath, strXML <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
        strPath = <span style="color: #000080;">CStr</span>(ReadVariable(<span style="color: #800000;">&quot;User::strFileName&quot;</span>))
        strXML = FileIO.FileSystem.ReadAllText(strPath)
&nbsp;
        <span style="color: #000080;">Dim</span> rgx <span style="color: #000080;">As</span> Regex = <span style="color: #000080;">New</span> Regex(<span style="color: #800000;">&quot;[\x00-\x08\x0B-\x0C\x0E-\x1F]&quot;</span>, RegexOptions.None)
        rgx.Replace(strXML, <span style="color: #800000;">&quot; &quot;</span>)
        FileIO.FileSystem.WriteAllText(strPath, strXML, <span style="color: #000080;">False</span>)
    <span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
&nbsp;
    <span style="color: #000080;">Private</span> <span style="color: #000080;">Function</span> ReadVariable(<span style="color: #000080;">ByVal</span> varName <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>
        <span style="color: #000080;">Dim</span> result <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>
&nbsp;
        Try
            <span style="color: #000080;">Dim</span> vars <span style="color: #000080;">As</span> Variables
            Dts.VariableDispenser.LockForRead(varName)
            Dts.VariableDispenser.GetVariables(vars)
            Try
                result = vars(varName).Value
            Catch ex <span style="color: #000080;">As</span> Exception
                Throw ex
            Finally
                vars.Unlock()
            <span style="color: #000080;">End</span> Try
        Catch ex <span style="color: #000080;">As</span> Exception
            Throw ex
        <span style="color: #000080;">End</span> Try
&nbsp;
        Return result
    <span style="color: #000080;">End</span> <span style="color: #000080;">Function</span>
&nbsp;
<span style="color: #000080;">End</span> Class</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2009/11/24/remove-invalid-xml-characters-with-a-ssis-visual-basic-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install NetBeans jVi plugin</title>
		<link>http://honoluluhacker.com/2009/11/22/install-netbeans-jvi-plugin/</link>
		<comments>http://honoluluhacker.com/2009/11/22/install-netbeans-jvi-plugin/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 21:34:08 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=828</guid>
		<description><![CDATA[NetBeans is the only IDE with a great VI key binding plugin. This was the sole reason I switched to NetBeans as my Ruby/Rails IDE of choice this year. There are 2 vi plugins for Eclipse: one you have to pay for and the other relies on gVIM. The NetBeans Vi plugin is called jVi [...]]]></description>
			<content:encoded><![CDATA[<p>NetBeans is the only IDE with a great VI key binding plugin. This was the sole reason I switched to NetBeans as my Ruby/Rails IDE of choice this year. There are 2 vi plugins for Eclipse: one you have to pay for and the other relies on gVIM. The NetBeans Vi plugin is called <a href="http://jvi.sourceforge.net/">jVi</a> and can be found at <a href="http://jvi.sourceforge.net/">http://jvi.sourceforge.net</a>. There are a few caveats and extra configuration options that you need to set. </p>
<ol>
<li><a href="http://sourceforge.net/projects/jvi/">Download the latest jVi release</a>. Unzip the file in your home directory. This will create the directory nbvi-1.2.6.</li>
<li>In the Netbeans menu bar, select Tools | Plugins. Click on the Downloaded tab.</li>
<li>Press the &#8220;Add Plugin&#8221; button. Browse to the nbvi-1.2.6 directory and select the two file: org-netbeans-modules-jvi.nbm and com-raelity-jvi.nbm. You should now have 2 plugins availabe in the downloaded list: jVi Key Bindings and jVi Core.</li>
<li>Click Install and then click through the installation process. NetBeans will need to restart.</li>
<li>After NetBeans has restarted, from the menu bar, select Tools | Options. Click on the last tab which should be jVi Config. </li>
<li>Select the &#8220;Buffer Modifications&#8221; panel in the jVi Config screen. </li>
<li>Make sure the &#8216;expandtab&#8217; value is checked. </li>
<li>Change the value of  &#8217;shiftwidth&#8217; to 2. </li>
<li>Change the value of  &#8216;tabstop&#8217; to 2.</li>
</ol>
<p>The last option for setting the tabstop and expandtab are pretty important. If you don&#8217;t use these, jVi will insert tabs into your Ruby files. This could cause your co-workers to complain about you ruining the formatting in the project. </p>
<p>Congratuations, jVi is now setup in NetBeans. Enjoy. </p>
<p><em>This blog entry was written for NetBeans 6.7 and with jVi version 1.2.6.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2009/11/22/install-netbeans-jvi-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Parsing Emboss Water output with Ruby</title>
		<link>http://honoluluhacker.com/2009/11/20/parsing-emboss-water-output-with-ruby/</link>
		<comments>http://honoluluhacker.com/2009/11/20/parsing-emboss-water-output-with-ruby/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 18:29:14 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Bioinformatics]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=812</guid>
		<description><![CDATA[First, you will need to install the emboss suite on your computer:

sudo apt-get install emboss emboss-lib

If don&#8217;t already have the BioRuby installed, you will need that too:

sudo gem install bio --no-ri --no-rdoc

Your first ruby script calling Emboss Water from Ruby:

1
2
3
4
5
require 'rubygems'
require 'bio'
test_filename =ARGV.shift
target_filename =ARGV.shift
result = Bio::EMBOSS.run&#40;'water', '-asequence', test_filename, '-bsequence', target_filename&#41;

Unforntunately, there is not a nice [...]]]></description>
			<content:encoded><![CDATA[<p>First, you will need to install the emboss suite on your computer:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> emboss emboss-lib</pre></div></div>

<p>If don&#8217;t already have the <a href="http://bioruby.org/">BioRuby</a> installed, you will need that too:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> bio <span style="color: #660033;">--no-ri</span> <span style="color: #660033;">--no-rdoc</span></pre></div></div>

<p>Your first ruby script calling Emboss Water from Ruby:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'bio'</span>
test_filename =ARGV.<span style="color:#9900CC;">shift</span>
target_filename =ARGV.<span style="color:#9900CC;">shift</span>
result = <span style="color:#6666ff; font-weight:bold;">Bio::EMBOSS</span>.<span style="color:#9900CC;">run</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'water'</span>, <span style="color:#996600;">'-asequence'</span>, test_filename, <span style="color:#996600;">'-bsequence'</span>, target_filename<span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div>

<p>Unforntunately, there is not a nice report result class in BioRuby for Emboss Water so you will have to parse the output yourself. Here&#8217;s an example script that finds percent similarity:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'bio'</span>
test_filename =ARGV.<span style="color:#9900CC;">shift</span>
target_filename =ARGV.<span style="color:#9900CC;">shift</span>
result = <span style="color:#6666ff; font-weight:bold;">Bio::EMBOSS</span>.<span style="color:#9900CC;">run</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'water'</span>, <span style="color:#996600;">'-asequence'</span>, test_filename, <span style="color:#996600;">'-bsequence'</span>, target_filename<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#008000; font-style:italic;"># result now has the text output of water...</span>
<span style="color:#008000; font-style:italic;"># Here's an example of looping through each line of the result to get the similary:</span>
&nbsp;
test_seq = <span style="color:#996600;">&quot;&quot;</span>
target_seq = <span style="color:#996600;">&quot;&quot;</span>
similarity = <span style="color:#996600;">''</span>
&nbsp;
&nbsp;
result.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span> line <span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#008000; font-style:italic;"># This mean</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> line =~ <span style="color:#006600; font-weight:bold;">/</span>^<span style="color:#008000; font-style:italic;"># Aligned_sequences/</span>
    <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;Seq '#{test_seq}' has similarity to Seq '#{target_seq}' of #{similarity}&quot;</span>  <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#006600; font-weight:bold;">&#40;</span>test_seq == <span style="color:#996600;">&quot;&quot;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>target_seq == <span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    test_seq = <span style="color:#996600;">&quot;&quot;</span>
    target_seq = <span style="color:#996600;">&quot;&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#008000; font-style:italic;"># Get sequence numbers </span>
  <span style="color:#9966CC; font-weight:bold;">if</span> line =~ <span style="color:#006600; font-weight:bold;">/</span>^<span style="color:#008000; font-style:italic;"># (\d+): (\d+)/</span>
     test_seq  = $<span style="color:#006666;">2</span> <span style="color:#9966CC; font-weight:bold;">if</span> $<span style="color:#006666;">1</span> == <span style="color:#996600;">'1'</span>
     target_seq = $<span style="color:#006666;">2</span> <span style="color:#9966CC; font-weight:bold;">if</span> $<span style="color:#006666;">1</span> == <span style="color:#996600;">'2'</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#008000; font-style:italic;"># parse similarity</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> line =~ <span style="color:#006600; font-weight:bold;">/</span>^<span style="color:#008000; font-style:italic;"># Similarity:.*\((.*)%\)/</span>
    similarity  = $<span style="color:#006666;">1</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;Seq '#{test_seq}' has similarity to Seq '#{target_seq}' of #{similarity}&quot;</span></pre></div></div>

<p>Place this in a file called water.rb and run it with <a href="http://github.com/kenglishhi/ics632/blob/master/ics675/emboss/fastas/frags.fasta">frags.fasta</a> and <a href="http://github.com/kenglishhi/ics632/blob/master/ics675/emboss/fastas/frags1.fasta">frags1.fasta</a> and the above script will output this.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ ruby water.rb fastas<span style="color: #000000; font-weight: bold;">/</span>frags1.fasta frags.fasta 
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'1'</span> of <span style="color: #000000;">100.0</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'2'</span> of <span style="color: #000000;">96.6</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'3'</span> of <span style="color: #000000;">64.3</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'4'</span> of <span style="color: #000000;">97.9</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'5'</span> of <span style="color: #000000;">96.9</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'6'</span> of <span style="color: #000000;">94.1</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'7'</span> of <span style="color: #000000;">62.5</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'8'</span> of <span style="color: #000000;">61.1</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'9'</span> of <span style="color: #000000;">62.5</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'10'</span> of <span style="color: #000000;">57.1</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'11'</span> of <span style="color: #000000;">57.4</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'12'</span> of <span style="color: #000000;">97.8</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'13'</span> of <span style="color: #000000;">50.0</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'14'</span> of <span style="color: #000000;">62.5</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'15'</span> of <span style="color: #000000;">97.9</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'16'</span> of <span style="color: #000000;">62.5</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'17'</span> of <span style="color: #000000;">59.1</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'18'</span> of <span style="color: #000000;">55.9</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'19'</span> of <span style="color: #000000;">61.9</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'20'</span> of <span style="color: #000000;">60.0</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'21'</span> of <span style="color: #000000;">56.4</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'22'</span> of <span style="color: #000000;">56.2</span></pre></div></div>

<p>Water is the worse name for a program, EVER. Because it is impossible to Google&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2009/11/20/parsing-emboss-water-output-with-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
