<?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>c01001111de</title>
	
	<link>http://01001111.net/code</link>
	<description />
	<lastBuildDate>Tue, 22 Mar 2011 00:08:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/C01001111de" /><feedburner:info uri="c01001111de" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>os x terminal title</title>
		<link>http://feedproxy.google.com/~r/C01001111de/~3/Mp-sxRlRT3w/</link>
		<comments>http://01001111.net/code/?p=195#comments</comments>
		<pubDate>Tue, 22 Mar 2011 00:08:05 +0000</pubDate>
		<dc:creator>01001111</dc:creator>
				<category><![CDATA[os x]]></category>

		<guid isPermaLink="false">http://01001111.net/code/?p=195</guid>
		<description><![CDATA[Because sometimes I want to give my terminal tabs some sort of context indicator: Stick that in .profile and there&#8217;s no more need to scan the output for clues as to what that terminal tab is responsible for.]]></description>
			<content:encoded><![CDATA[<p>Because sometimes I want to give my terminal tabs some sort of context indicator:</p>
<p><script src="https://gist.github.com/879945.js?file=title.sh"></script></p>
<p>Stick that in <strong>.profile</strong> and there&#8217;s no more need to scan the output for clues as to what that terminal tab is responsible for.</p>
<div class='s0cial_submit'><a class='DiggThisButton' href='http://digg.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D195&title=os+x+terminal+title'><img src='http://widgets.digg.com/img/button/diggThisCompact.png' alt='DiggThis' /></a><a class='RedditButton' href='http://www.reddit.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D195&title=os+x+terminal+title'><img src='http://www.reddit.com/static/spreddit7.gif' alt='submit to reddit' /></a></div>]]></content:encoded>
			<wfw:commentRss>http://01001111.net/code/?feed=rss2&amp;p=195</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://01001111.net/code/?p=195</feedburner:origLink></item>
		<item>
		<title>adding a custom framework to an XCode project</title>
		<link>http://feedproxy.google.com/~r/C01001111de/~3/JHFIyehPS_4/</link>
		<comments>http://01001111.net/code/?p=189#comments</comments>
		<pubDate>Wed, 05 Jan 2011 03:07:02 +0000</pubDate>
		<dc:creator>01001111</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://01001111.net/code/?p=189</guid>
		<description><![CDATA[&#8220;Right Click&#8221; the Frameworks group, select Add -> Existing Frameworks. Select the target framework, click Add. &#8220;Right Click&#8221; the target in the Targets group and select Add -> New Build Phase -> New Copy Files Build Phase. Choose Destination: Frameworks and close window. Drag the framework added in step one into the Copy Files build [...]]]></description>
			<content:encoded><![CDATA[<p></p>
<ol>
<li>&#8220;Right Click&#8221; the Frameworks group, select <strong>Add -> Existing Frameworks</strong>.  Select the target framework, click <strong>Add</strong>.
	</li>
<li>&#8220;Right Click&#8221; the target in the Targets group and select <strong>Add -> New Build Phase -> New Copy Files Build Phase</strong>.  Choose Destination: Frameworks and close window.
	</li>
<li>Drag the framework added in step one into the Copy Files build phase created in step two.
	</li>
</ol>
<div class='s0cial_submit'><a class='DiggThisButton' href='http://digg.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D189&title=adding+a+custom+framework+to+an+XCode+project'><img src='http://widgets.digg.com/img/button/diggThisCompact.png' alt='DiggThis' /></a><a class='RedditButton' href='http://www.reddit.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D189&title=adding+a+custom+framework+to+an+XCode+project'><img src='http://www.reddit.com/static/spreddit7.gif' alt='submit to reddit' /></a></div>]]></content:encoded>
			<wfw:commentRss>http://01001111.net/code/?feed=rss2&amp;p=189</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://01001111.net/code/?p=189</feedburner:origLink></item>
		<item>
		<title>Configuring a Spring3 Web App on Google AppEngine</title>
		<link>http://feedproxy.google.com/~r/C01001111de/~3/0jIKGW14rp0/</link>
		<comments>http://01001111.net/code/?p=179#comments</comments>
		<pubDate>Sun, 05 Dec 2010 03:59:15 +0000</pubDate>
		<dc:creator>01001111</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://01001111.net/code/?p=179</guid>
		<description><![CDATA[appengine-web.xml: web.xml: dispatcher-servlet.xml: sitemesh.xml:]]></description>
			<content:encoded><![CDATA[<p><strong>appengine-web.xml:</strong><br />
<script src="https://gist.github.com/728747.js"></script></p>
<p><strong>web.xml:</strong><br />
<script src="https://gist.github.com/728750.js"> </script></p>
<p><strong>dispatcher-servlet.xml:</strong><br />
<script src="https://gist.github.com/728749.js"> </script></p>
<p><strong>sitemesh.xml:</strong><br />
<script src="https://gist.github.com/728753.js"> </script></p>
<div class='s0cial_submit'><a class='DiggThisButton' href='http://digg.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D179&title=Configuring+a+Spring3+Web+App+on+Google+AppEngine'><img src='http://widgets.digg.com/img/button/diggThisCompact.png' alt='DiggThis' /></a><a class='RedditButton' href='http://www.reddit.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D179&title=Configuring+a+Spring3+Web+App+on+Google+AppEngine'><img src='http://www.reddit.com/static/spreddit7.gif' alt='submit to reddit' /></a></div>]]></content:encoded>
			<wfw:commentRss>http://01001111.net/code/?feed=rss2&amp;p=179</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://01001111.net/code/?p=179</feedburner:origLink></item>
		<item>
		<title>get name of current junit test</title>
		<link>http://feedproxy.google.com/~r/C01001111de/~3/YMl8XcHaDeE/</link>
		<comments>http://01001111.net/code/?p=170#comments</comments>
		<pubDate>Wed, 08 Sep 2010 02:34:33 +0000</pubDate>
		<dc:creator>01001111</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://01001111.net/code/?p=170</guid>
		<description><![CDATA[There have been a few times when it was helpful for me know the name of the currently running JUnit test method. In one particular case I was using a method in the test class to perform a series of routine assertions along with some debug level logging but the logging tools would only go [...]]]></description>
			<content:encoded><![CDATA[<p>There have been a few times when it was helpful for me know the name of the currently running JUnit test method.  In one particular case I was using a method in the test class to perform a series of routine assertions along with some debug level logging but the logging tools would only go so far as to print the name of this helper method, not the name of the test being executed.</p>
<p>Since JUnit 4.7 there has been some support for retrieving information about the current test using the <strong>@Rule</strong> annotation and the <strong>TestName</strong> class.  Use it like so:</p>
<p><script src="http://gist.github.com/569488.js?file=testname_junit4.java"></script></p>
<p>Note: The TestName variable must be public or you&#8217;ll get an initialization error.  This is due to the restrictions on fields annotated with <strong>@Rule</strong>  which, according to the <a href="http://kentbeck.github.com/junit/javadoc/latest/org/junit/Rule.html">JUnit documentation</a>, must be public, not static, and a subtype of MethodRule.</p>
<div class='s0cial_submit'><a class='DiggThisButton' href='http://digg.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D170&title=get+name+of+current+junit+test'><img src='http://widgets.digg.com/img/button/diggThisCompact.png' alt='DiggThis' /></a><a class='RedditButton' href='http://www.reddit.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D170&title=get+name+of+current+junit+test'><img src='http://www.reddit.com/static/spreddit7.gif' alt='submit to reddit' /></a></div>]]></content:encoded>
			<wfw:commentRss>http://01001111.net/code/?feed=rss2&amp;p=170</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://01001111.net/code/?p=170</feedburner:origLink></item>
		<item>
		<title>IE’s 31 style limit</title>
		<link>http://feedproxy.google.com/~r/C01001111de/~3/k7J30PSw8gk/</link>
		<comments>http://01001111.net/code/?p=161#comments</comments>
		<pubDate>Wed, 01 Sep 2010 02:38:43 +0000</pubDate>
		<dc:creator>01001111</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[ie]]></category>

		<guid isPermaLink="false">http://01001111.net/code/?p=161</guid>
		<description><![CDATA[Recently, after hours of life-threatening frustration and anger, I discovered a little-publicized limitation of Internet Explorer: you can only have 31 stylesheets. Whether they be included via &#60;link&#62; tags or as separate &#60;style&#62; blocks, 31 is the maximum number of distinct style sections Internet Explorer will recognize; everything appearing afterwards is indiscriminately ignored. Under normal [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, after hours of life-threatening frustration and anger, I discovered a little-publicized limitation of Internet Explorer: you can only have 31 stylesheets.</p>
<p>Whether they be included via <strong>&lt;link&gt; tags</strong> or as separate <strong>&lt;style&gt; blocks</strong>, 31 is the maximum number of distinct style sections Internet Explorer will recognize; everything appearing afterwards is indiscriminately ignored.</p>
<p>Under normal circumstances this shouldn&#8217;t be an issue but at my job we use a CSS / Javascript packaging utility and organize the styles into smaller, more manageable files.  In debug mode, the individual stylesheets and script files are included to facilitate error tracking and, consequently, to elicit all of IE&#8217;s inadequacies.</p>
<p>Here&#8217;s a little page I made to test my theory that the stylesheets were being limited:</p>
<p><script src="http://gist.github.com/560104.js?file=IE_31_style_limit.html"></script></p>
<p>Here&#8217;s what it should look like in a competent browser (left) and in IE (right):</p>
<div style="text-align:center;"><img src="http://i34.photobucket.com/albums/d117/01001111/32right.png" style="width:250px;" /> <img src="http://i34.photobucket.com/albums/d117/01001111/32wrong.png" style="width:250px;" /></div>
<p>This issue is nothing new, it goes back years but is something one typically encounters without warning, resulting in the unrecoverable loss of many hours that could have otherwise been spent on some productive endeavor.</p>
<p>To read more about this atrocity, visit <a href="http://support.microsoft.com/kb/262161">Microsoft&#8217;s official documentation</a> for the tech writing equivalent of smug shoulder shrug.</p>
<div class='s0cial_submit'><a class='DiggThisButton' href='http://digg.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D161&title=IE%26%238217%3Bs+31+style+limit'><img src='http://widgets.digg.com/img/button/diggThisCompact.png' alt='DiggThis' /></a><a class='RedditButton' href='http://www.reddit.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D161&title=IE%26%238217%3Bs+31+style+limit'><img src='http://www.reddit.com/static/spreddit7.gif' alt='submit to reddit' /></a></div>]]></content:encoded>
			<wfw:commentRss>http://01001111.net/code/?feed=rss2&amp;p=161</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://01001111.net/code/?p=161</feedburner:origLink></item>
		<item>
		<title>Synchronous NSTask</title>
		<link>http://feedproxy.google.com/~r/C01001111de/~3/IBPDWhPpg90/</link>
		<comments>http://01001111.net/code/?p=159#comments</comments>
		<pubDate>Wed, 19 May 2010 02:16:52 +0000</pubDate>
		<dc:creator>01001111</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://01001111.net/code/?p=159</guid>
		<description><![CDATA[The NSTask class allows developers to run another program from within a Cocoa Application and monitor its execution without sharing memory space. By nature it is asynchronous but there are times when you may wish to run the task and halt the execution of your current application until the subprocess has finished. One example would [...]]]></description>
			<content:encoded><![CDATA[<p>The <strong>NSTask</strong> class allows developers to run another program from within a Cocoa Application and monitor its execution without sharing memory space.  By nature it is asynchronous but there are times when you may wish to run the task and halt the execution of your current application until the subprocess has finished.  One example would be during the saving of a file.</p>
<p>When using the save file hooks provided by Cocoa, you write a file to a temporary location and return a boolean indicating the success of the write operation which tells the framework to move the file to its target location.  If your write operation relies on the execution of an external program, a shell script for instance, then you will want to wait for the execution to complete before indicating the success of the write to the caller.</p>
<p>One way to accomplish this synchronous execution is to set up an <strong>NSPipe</strong>, a one-way communications channel between processes; one process writes data, the other reads it.  Set the standard out and standard error of the NSTask to the pipe and, after launching the task, read from the pipe until the process ends.  </p>
<p><script src="http://gist.github.com/405835.js"></script></p>
<p>This will allow you to both run the task synchronously and return the output to the caller for analysis.</p>
<div class='s0cial_submit'><a class='DiggThisButton' href='http://digg.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D159&title=Synchronous+NSTask'><img src='http://widgets.digg.com/img/button/diggThisCompact.png' alt='DiggThis' /></a><a class='RedditButton' href='http://www.reddit.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D159&title=Synchronous+NSTask'><img src='http://www.reddit.com/static/spreddit7.gif' alt='submit to reddit' /></a></div>]]></content:encoded>
			<wfw:commentRss>http://01001111.net/code/?feed=rss2&amp;p=159</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://01001111.net/code/?p=159</feedburner:origLink></item>
		<item>
		<title>combine + compress</title>
		<link>http://feedproxy.google.com/~r/C01001111de/~3/EpJCFINQkf0/</link>
		<comments>http://01001111.net/code/?p=141#comments</comments>
		<pubDate>Sun, 27 Dec 2009 19:09:19 +0000</pubDate>
		<dc:creator>01001111</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://01001111.net/code/?p=141</guid>
		<description><![CDATA[YUI Compressor is a popular tool that allows web developers to easily and reliably minify / munge Javascript and CSS files. The one common complaint amongst users is that it doesn&#8217;t allow you to combine files into a consolidated package prior to minification. As I discussed a while back, JAWR takes care of this automatically [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a> is a popular tool that allows web developers to easily and reliably minify / munge Javascript and CSS files.  The one common complaint amongst users is that it doesn&#8217;t allow you to combine files into a consolidated package prior to minification.  As I discussed a while back, JAWR takes care of this automatically for Java based web apps but automated solutions aren&#8217;t very efficient for small, script-based web apps.  Hence, I wrote a small shell script that will combined a list of files into one and then run them through the yuicompressor.</p>
<p>Now, before you run the script, you either need to move the <b>yuicompressor.jar</b> to <b>/usr/share/yui/yuicompressor.jar</b> or just edit the first line of the script to point to the location of your yuicompressor jar file.</p>
<p>yuicompress.sh</p>
<pre class="code"><span class="syntax0"><span class="syntax-COMMENT1">#</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">yuicompress</span>
<span class="syntax-COMMENT1">#</span>
<span class="syntax-COMMENT1">#</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">combine</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">files</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">and</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">then</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">compress</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">the</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">result</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">with</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">yuicompressor</span>
<span class="syntax-COMMENT1">#</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">note:</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">yuicompressor</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">jar</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">must</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">be</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">at</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">/usr/share/yui/yuicompressor.jar</span>
<span class="syntax-COMMENT1">#</span>
<span class="syntax-COMMENT1">#</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">usage:</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">yuicompress</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">[-o</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">outfile]</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">[-t</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">type]</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">args</span>

<span class="syntax-COMMENT1">#</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">check</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">for</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">yui</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">compressor</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">-----------------------------------------------------</span>
<span class="syntax-KEYWORD2">yuipath</span><span class="syntax-OPERATOR">=</span><span class="syntax-LITERAL1">&quot;</span><span class="syntax-LITERAL1">/</span><span class="syntax-LITERAL1">usr</span><span class="syntax-LITERAL1">/</span><span class="syntax-LITERAL1">share</span><span class="syntax-LITERAL1">/</span><span class="syntax-LITERAL1">yui</span><span class="syntax-LITERAL1">/</span><span class="syntax-LITERAL1">yuicompressor</span><span class="syntax-LITERAL1">.</span><span class="syntax-LITERAL1">jar</span><span class="syntax-LITERAL1">&quot;</span>
<span class="syntax-KEYWORD1">if</span> <span class="syntax-OPERATOR">!</span> test -f <span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">yuipath</span>
<span class="syntax-KEYWORD1">then</span>
        echo <span class="syntax-LITERAL1">&quot;</span><span class="syntax-LITERAL1">cannot</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">find</span><span class="syntax-LITERAL1"> </span><span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">yuipath</span><span class="syntax-LITERAL1">&quot;</span>
        exit
<span class="syntax-KEYWORD1">fi</span>

<span class="syntax-COMMENT1">#</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">get</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">options</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">------------------------------------------------------------------</span>
<span class="syntax-KEYWORD2">ofile</span><span class="syntax-OPERATOR">=</span><span class="syntax-LITERAL1">&quot;</span><span class="syntax-LITERAL1">compressed</span><span class="syntax-LITERAL1">.</span><span class="syntax-LITERAL1">txt</span><span class="syntax-LITERAL1">&quot;</span>
<span class="syntax-KEYWORD2">type</span><span class="syntax-OPERATOR">=</span><span class="syntax-LITERAL1">&quot;</span><span class="syntax-LITERAL1">js</span><span class="syntax-LITERAL1">&quot;</span>
<span class="syntax-KEYWORD2">preserveLicense</span><span class="syntax-OPERATOR">=</span>false
<span class="syntax-KEYWORD1">while</span> getopts <span class="syntax-LITERAL1">'</span><span class="syntax-LITERAL1">o:t:</span><span class="syntax-LITERAL1">'</span> OPTION
<span class="syntax-KEYWORD1">do</span>
        <span class="syntax-KEYWORD1">case</span> <span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">OPTION</span> <span class="syntax-KEYWORD1">in</span>
        o<span class="syntax-OPERATOR">)</span>      <span class="syntax-KEYWORD2">ofile</span><span class="syntax-OPERATOR">=</span><span class="syntax-LITERAL1">&quot;</span><span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">OPTARG</span><span class="syntax-LITERAL1">&quot;</span>
                <span class="syntax-OPERATOR">;;</span>
        t<span class="syntax-OPERATOR">)</span>      <span class="syntax-KEYWORD2">type</span><span class="syntax-OPERATOR">=</span><span class="syntax-LITERAL1">&quot;</span><span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">OPTARG</span><span class="syntax-LITERAL1">&quot;</span>
                <span class="syntax-OPERATOR">;;</span>
        ?<span class="syntax-OPERATOR">)</span>      printf <span class="syntax-LITERAL1">&quot;</span><span class="syntax-LITERAL1">Usage</span><span class="syntax-LITERAL1">:</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">%</span><span class="syntax-LITERAL1">s</span><span class="syntax-LITERAL1">:</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">[</span><span class="syntax-LITERAL1">-</span><span class="syntax-LITERAL1">o</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">outfile</span><span class="syntax-LITERAL1">]</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">[</span><span class="syntax-LITERAL1">-</span><span class="syntax-LITERAL1">t</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">type</span><span class="syntax-LITERAL1">]</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">args\n</span><span class="syntax-LITERAL1">&quot;</span> <span class="syntax-KEYWORD2">$</span><span class="syntax-OPERATOR">(</span>basename <span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">0</span><span class="syntax-OPERATOR">)</span> <span class="syntax-OPERATOR">&gt;</span><span class="syntax-OPERATOR">&amp;</span><span class="syntax-DIGIT">2</span>
                exit <span class="syntax-DIGIT">2</span>
                <span class="syntax-OPERATOR">;;</span>
        <span class="syntax-KEYWORD1">esac</span>
<span class="syntax-KEYWORD1">done</span>
shift <span class="syntax-KEYWORD2">$</span><span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">(</span><span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">OPTIND</span> - <span class="syntax-DIGIT">1</span><span class="syntax-OPERATOR">)</span><span class="syntax-OPERATOR">)</span>

<span class="syntax-COMMENT1">#</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">get</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">files</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">--------------------------------------------------------------------</span>
<span class="syntax-KEYWORD1">if</span> <span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">(</span> <span class="syntax-KEYWORD2">$#</span> <span class="syntax-OPERATOR">&lt;</span> <span class="syntax-DIGIT">1</span> <span class="syntax-OPERATOR">)</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">then</span>
        echo <span class="syntax-LITERAL1">&quot;</span><span class="syntax-LITERAL1">no</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">files</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">specified</span><span class="syntax-LITERAL1">&quot;</span>
        exit
<span class="syntax-KEYWORD1">fi</span>
<span class="syntax-KEYWORD2">files</span><span class="syntax-OPERATOR">=</span><span class="syntax-KEYWORD2">$*</span>

<span class="syntax-COMMENT1">#</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">combine</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">files</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">----------------------------------------------------------------</span>
cat <span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">files</span> <span class="syntax-OPERATOR">&gt;</span> <span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">ofile</span>

<span class="syntax-COMMENT1">#</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">compress</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">results</span><span class="syntax-COMMENT1"> </span><span class="syntax-COMMENT1">-------------------------------------------------------------</span>
java -jar <span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">yuipath</span> --type <span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">type</span> -o <span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">ofile</span> <span class="syntax-KEYWORD2">$</span><span class="syntax-KEYWORD2">ofile</span>

</span></pre>
<p>The usage is illustrated in the script itself but here are a few examples just to get you started:</p>
<pre class="code">./yuicompress -o lib.js lib/js/*.js
./yuicompress -o all.css -t css css/*.css
./yuicompress -o some.css -t css css/main.css css/misc.css</pre>
<div class='s0cial_submit'><a class='DiggThisButton' href='http://digg.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D141&title=combine+%2B+compress'><img src='http://widgets.digg.com/img/button/diggThisCompact.png' alt='DiggThis' /></a><a class='RedditButton' href='http://www.reddit.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D141&title=combine+%2B+compress'><img src='http://www.reddit.com/static/spreddit7.gif' alt='submit to reddit' /></a></div>]]></content:encoded>
			<wfw:commentRss>http://01001111.net/code/?feed=rss2&amp;p=141</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://01001111.net/code/?p=141</feedburner:origLink></item>
		<item>
		<title>update maven on os x</title>
		<link>http://feedproxy.google.com/~r/C01001111de/~3/2OTCzYu8nvM/</link>
		<comments>http://01001111.net/code/?p=136#comments</comments>
		<pubDate>Sun, 30 Aug 2009 01:11:31 +0000</pubDate>
		<dc:creator>01001111</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[os x]]></category>

		<guid isPermaLink="false">http://01001111.net/code/?p=136</guid>
		<description><![CDATA[Downloaded the latest version of Maven and don&#8217;t know what to do with all of those files? Run this shell script (with sudo for the appropriate privileges) on the directory containing all of the maven files (usually called apache-maven-[version#]): mvnupdate.sh #check for directory argument -------------------------------------------------- if [ $# -lt 1 ] then echo &#34;no directory [...]]]></description>
			<content:encoded><![CDATA[<p>Downloaded the latest version of Maven and don&#8217;t know what to do with all of those files?  Run this shell script (with sudo for the appropriate privileges) on the directory containing all of the maven files (usually called apache-maven-[version#]):</p>
<p>mvnupdate.sh</p>
<pre class="code"><span class="syntax0"><span class="syntax1">#</span><span class="syntax1">check</span><span class="syntax1"> </span><span class="syntax1">for</span><span class="syntax1"> </span><span class="syntax1">directory</span><span class="syntax1"> </span><span class="syntax1">argument</span><span class="syntax1"> </span><span class="syntax1">--------------------------------------------------</span>
<span class="syntax8">if</span> [ <span class="syntax9">$#</span> -lt <span class="syntax5">1</span> ]
<span class="syntax8">then</span>
        echo <span class="syntax13">&quot;</span><span class="syntax13">no</span><span class="syntax13"> </span><span class="syntax13">directory</span><span class="syntax13"> </span><span class="syntax13">name</span><span class="syntax13"> </span><span class="syntax13">specified</span><span class="syntax13">&quot;</span>
        exit
<span class="syntax8">fi</span>
<span class="syntax1">#</span><span class="syntax1">check</span><span class="syntax1"> </span><span class="syntax1">directory</span><span class="syntax1"> </span><span class="syntax1">exists</span><span class="syntax1"> </span><span class="syntax1">--------------------------------------------------------</span>
<span class="syntax8">if</span> <span class="syntax18">!</span> test -d <span class="syntax9">$</span><span class="syntax9">1</span>
<span class="syntax8">then</span>
        echo <span class="syntax13">&quot;</span><span class="syntax9">$</span><span class="syntax9">1</span><span class="syntax13"> </span><span class="syntax13">is</span><span class="syntax13"> </span><span class="syntax13">not</span><span class="syntax13"> </span><span class="syntax13">a</span><span class="syntax13"> </span><span class="syntax13">directory</span><span class="syntax13">&quot;</span>
        exit
<span class="syntax8">fi</span>
<span class="syntax1">#</span><span class="syntax1">move</span><span class="syntax1"> </span><span class="syntax1">previous</span><span class="syntax1"> </span><span class="syntax1">version</span><span class="syntax1"> </span><span class="syntax1">---------------------------------------------------------</span>
<span class="syntax9">MVN</span><span class="syntax18">=</span><span class="syntax13">&quot;</span><span class="syntax13">/</span><span class="syntax13">usr</span><span class="syntax13">/</span><span class="syntax13">share</span><span class="syntax13">/</span><span class="syntax13">maven</span><span class="syntax13">&quot;</span>
<span class="syntax9">oldMVN</span><span class="syntax18">=</span><span class="syntax9">$</span><span class="syntax9">MVN</span><span class="syntax10">`</span><span class="syntax10">date</span><span class="syntax10"> </span><span class="syntax10">+</span><span class="syntax10">&quot;</span><span class="syntax10">%</span><span class="syntax10">Y</span><span class="syntax10">%</span><span class="syntax10">m</span><span class="syntax10">%</span><span class="syntax10">d</span><span class="syntax10">%</span><span class="syntax10">H</span><span class="syntax10">%</span><span class="syntax10">M</span><span class="syntax10">%</span><span class="syntax10">S</span><span class="syntax10">&quot;</span><span class="syntax10">`</span>
<span class="syntax8">if</span> test -d <span class="syntax9">$</span><span class="syntax9">MVN</span>
<span class="syntax8">then</span>
        sudo mv <span class="syntax9">$</span><span class="syntax9">MVN</span> <span class="syntax9">$</span><span class="syntax9">oldMVN</span>
<span class="syntax8">fi</span>
<span class="syntax1">#</span><span class="syntax1">move</span><span class="syntax1"> </span><span class="syntax1">new</span><span class="syntax1"> </span><span class="syntax1">version</span><span class="syntax1"> </span><span class="syntax1">--------------------------------------------------------------</span>
sudo cp -r <span class="syntax9">$</span><span class="syntax9">1</span> <span class="syntax9">$</span><span class="syntax9">MVN</span>
</span></pre>
<div class='s0cial_submit'><a class='DiggThisButton' href='http://digg.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D136&title=update+maven+on+os+x'><img src='http://widgets.digg.com/img/button/diggThisCompact.png' alt='DiggThis' /></a><a class='RedditButton' href='http://www.reddit.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D136&title=update+maven+on+os+x'><img src='http://www.reddit.com/static/spreddit7.gif' alt='submit to reddit' /></a></div>]]></content:encoded>
			<wfw:commentRss>http://01001111.net/code/?feed=rss2&amp;p=136</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://01001111.net/code/?p=136</feedburner:origLink></item>
		<item>
		<title>remove ugly outlines in Firefox</title>
		<link>http://feedproxy.google.com/~r/C01001111de/~3/NAkEbP6pHZ0/</link>
		<comments>http://01001111.net/code/?p=133#comments</comments>
		<pubDate>Tue, 18 Aug 2009 00:17:35 +0000</pubDate>
		<dc:creator>01001111</dc:creator>
				<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://01001111.net/code/?p=133</guid>
		<description><![CDATA[You know those ugly outlines that Firefox puts around links and buttons when you click on them? Yeah, I don&#8217;t get it either. From a developer&#8217;s standpoint, IE is by far the worst browser to support but Firefox also has its share of baffling behaviors and deviations from the standards. So, how do you remove [...]]]></description>
			<content:encoded><![CDATA[<p>You know those ugly outlines that Firefox puts around links and buttons when you click on them?  Yeah, I don&#8217;t get it either.  From a developer&#8217;s standpoint, IE is by far the worst browser to support but Firefox also has its share of baffling behaviors and deviations from the standards.</p>
<p>So, how do you remove those ugly outlines from your site?  Add this to your style sheet and it <i>should</i> do the trick.</p>
<pre class="code">*, *:hover, *:active, *:link { outline: none; }</pre>
<p>It might be overkill but it takes care of most situations involving links.  Unfortunately there&#8217;s no easy way to get rid of the outlines around buttons that are styled with images but this at least minimizes the number of visual abominations.</p>
<div class='s0cial_submit'><a class='DiggThisButton' href='http://digg.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D133&title=remove+ugly+outlines+in+Firefox'><img src='http://widgets.digg.com/img/button/diggThisCompact.png' alt='DiggThis' /></a><a class='RedditButton' href='http://www.reddit.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D133&title=remove+ugly+outlines+in+Firefox'><img src='http://www.reddit.com/static/spreddit7.gif' alt='submit to reddit' /></a></div>]]></content:encoded>
			<wfw:commentRss>http://01001111.net/code/?feed=rss2&amp;p=133</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://01001111.net/code/?p=133</feedburner:origLink></item>
		<item>
		<title>JAWR</title>
		<link>http://feedproxy.google.com/~r/C01001111de/~3/x57Id0Jhz_I/</link>
		<comments>http://01001111.net/code/?p=122#comments</comments>
		<pubDate>Sat, 01 Aug 2009 20:57:52 +0000</pubDate>
		<dc:creator>01001111</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://01001111.net/code/?p=122</guid>
		<description><![CDATA[Recently I gave a presentation to colleagues on Jawr and the general merits of Javascript/CSS minification. Most of the material was pilfered from the official Jawr site but it may be easier to digest for those of us with shorter attention spans. So, first an introduction: Jawr &#8220;Jawr is a tunable packaging solution for Javascript [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I gave a presentation to colleagues on Jawr and the general merits of Javascript/CSS minification.  Most of the material was pilfered from the <a href="https://jawr.dev.java.net/">official Jawr site</a> but it may be easier to digest for those of us with shorter attention spans.</p>
<p>So, first an introduction:</p>
<h2>Jawr</h2>
<p style="text-align:center;"><img src="images/jawr/jawrlogo.png" /></p>
<p><quote>&#8220;Jawr is a tunable packaging solution for Javascript and CSS which allows for rapid development of resources in separate module files. Developers can work with a large set of split javascript files in development mode, then Jawr bundles all together into one or several files in a configurable way.&#8221;</quote></p>
<p>And why should we care about any of this?  Before answering this question, let&#39;s step back for a moment and discuss an important concept in web application development:</p>
<h2>Minification</h2>
<p>	Minification (n), also called minimization, or minimisation (for those who speake the Queen&#39;s English):  the process of removing all unnecessary characters from code without altering its functionality.  This typically includes all non-critical whitespace and newlines that are not included in string literals and most comments.</p>
<p>	Verb form: minify.</p>
<h2>Why minify (and bundle)?</h2>
<h4>‚Ä¢ Improves load times for the client</h4>
<h4>‚Ä¢ Less data being transmitted by the server</h4>
<h2>How?</h2>
<h4>‚Ä¢ Minification reduces the size of HTTP responses.</h4>
<p>	Why should we be sending unnecessary data?  The spaces, tabs, and newlines are valuable only in development so we should keep them to ourselves.</p>
<h4>‚Ä¢ Bundling reduces the number of HTTP requests.</h4>
<p>	The HTTP protocol is fairly inefficient when it comes to retrieving lots of files.  First a TCP connection must be established.  This requires a three-way handshake.   The client sends a connection request, the server responds, and then the client acknowledges the response.</p>
<p>Now the client sends the HTTP request itself.  HTTP, Hypertext Transfer Protocol, is, as the name indicates, a text based protocol with all information being sent as human readable text.  This means that the speed, small size, and efficiency of a rigid bit and byte based based protocol are sacrificed in favor of versatility and comprehensibility.</p>
<p>I&#39;m not going to get into the details of the TCP/IP stack and talk about maximum transmission units or fragmentation but, for those of you unfamiliar with the specifics, I&#39;ll just stress that there&#39;s even more overhead in the transmission of these bloated requests and responses in addition to the initial handshake and large, text -based headers.</p>
<p>The response, with a larger set of headers, comes back from the server and, if this is an HTML document, the client begins sending requests for the other documents referenced therein.  This includes scripts, style sheets, and pictures.  All browsers have a limit on the number of concurrent connections allowed to a single domain per page and for a while this was a whopping 2 (this is still effectively the case for IE).  Additionally, unless the Keep Alive flag is set, each request requires a new TCP connection to be negotiated.</p>
<p>Multiple script files, which halt the execution of the page due to the assumed requirement that they be loaded and executed in order, will make initial page load times uncomfortably long unless the files are cached.  Therefore, reducing the number of files that need to be downloaded means fewer HTTP requests resulting in faster load times.</p>
<h2>And why should we care about load times?</h2>
<h4>‚Ä¢ Web applications and the culture of instant gratification</h4>
<p>	If we, as web application developers, truly want to compete with desktop applications then we strive to match their responsiveness.  This is why the whole AJAX paradigm has become such a phenomenon  (and poorly misused buzzword) over these past four years.  When we perform an action within the context of a web page, we don&#39;t want to wait ages while the screen reloads.  Even in cases where a full page transition is necessary, slow load times can mean the death of a project where alternatives are available.</p>
<h4>‚Ä¢ Mobile browsers</h4>
<p>	My iPhone is faster and has more storage space than the iMac I bought back  in 1999 and a much better downstream than the 56K modem bundled within.  It weighs as much as my wallet and enables me to check my email from places where laptops are socially forbidden.  Mobile browsing is becoming ever more prevalent and it would be a serious mistake on the part of any web application developer to neglect making optimizations for their sake.</p>
<h4>‚Ä¢ Some people still use dial-up</h4>
<p>	&#8230;and some people still use AOL&#8230; and a lot of people still use IE.  Strange, I know, particularly the last point, but whatever the reason for the circumstances may be, they may not have a choice but we certainly do have the choice to optimize.</p>
<h2>So why don&#39;t we just use one big script file and one big style file?</h2>
<h4>‚Ä¢ Development is much more efficient when using multiple, logically separated files and good organization is integral to good programming.</h4>
<p>	Editing or debugging large script files is a nightmare.  Editing or debugging large, minified script files is impossible.</p>
<h4>‚Ä¢ Some components need to be included on every page whereas other components or groups of components need to be included in particular sections of the site.</h4>
<p>	Optimization doesn&#39;t mean simply getting rid of meaningless text, it also means excluding useless code.  If I have an admin section of a site and a client section of a site, there is no need whatsoever for scripts specific to the admin to be sent to the client and vice-versa.  In the case of styles, there could be CSS conflicts between these two sections so we certainly wouldn&#39;t want to bundle section specific stylesheets together.</p>
<h2>Other options</h2>
<p>	‚Ä¢ YUI compressor (no grouping) (http://developer.yahoo.com/yui/compressor/) Java app, minify and compress.<br />
	‚Ä¢ Minify (PHP) http://code.google.com/p/minify/</p>
<h2>Jawr</h2>
<p>	‚Ä¢ Minifies<br />
	‚Ä¢ Munges<br />
	‚Ä¢ Bundles<br />
	‚Ä¢ Compresses<br />
	‚Ä¢ Enforces Caching<br />
	‚Ä¢ Does all this on demand<br />
	‚Ä¢ Has debug and production modes<br />
	‚Ä¢¬†Built in JSP tag library for including the scripts and styles</p>
<h2>Additionally</h2>
<p>	‚Ä¢ Free and open source<br />
	‚Ä¢ Easy to set up<br />
	‚Ä¢ Easy to configure<br />
	‚Ä¢¬†Plays nice with others (Spring MVC, JSF/Facelets, Grails, pure HTML)</p>
<h2>Setup (web.xml)</h2>
<p style="text-align:center;"><a href="images/jawr/web.xml.png"><img src="images/jawr/thumb/web.xml.png" /></a></p>
<h2>Setup (jawr.properties)</h2>
<p style="text-align:center;"><a href="images/jawr/jawr.properties.png"><img src="images/jawr/thumb/jawr.properties.png" /></a></p>
<h2>Setup (JSP)</h2>
<p style="text-align:center;"><a href="images/jawr/default.jsp.png"><img src="images/jawr/thumb/default.jsp.png" /></a></p>
<h2>Result (debug)</h2>
<p style="text-align:center;"><a href="images/jawr/jawr-debug.html.png"><img src="images/jawr/thumb/jawr-debug.html.png" /></a></p>
<h2>Result (production)</h2>
<p style="text-align:center;"><a href="images/jawr/default.jsp.png"><img src="images/jawr/thumb/default.jsp.png" /></a></p>
<h2>File Sizes</h2>
<pre>
	 16532 autocomplete.js
	  1176 binder.js
	   367 console-noop.js
	  1617 effects-ext.js
	 38986 effects.js
	  1543 form-highlighter.js
	 11809 global.js
	   822 modalbox-ext.js
	 22778 modalbox.js
	  2625 prototype-ext.js
	124000 prototype.js

	<b>All files</b>
		244 KB

	<b>core.js (minified and bundled)</b>
		156 KB

	<b>core.js (minified, bundled, and gzipped)</b>
		40 KB
</pre>
<h2>Load times (in debug mode)</h2>
<p style="text-align:center;"><a href="images/jawr/loadtime-debugmode.png"><img src="images/jawr/thumb/loadtime-debugmode.png" /></a></p>
<h2>Load times (in production mode)</h2>
<p style="text-align:center;"><a href="images/jawr/loadtime-prodmode.png"><img src="images/jawr/thumb/loadtime-prodmode.png" /></a></p>
<h2>Load times (with caching)</h2>
<p style="text-align:center;"><a href="images/jawr/loadtime-cached.png"><img src="images/jawr/thumb/loadtime-cached.png" /></a></p>
<div class='s0cial_submit'><a class='DiggThisButton' href='http://digg.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D122&title=JAWR'><img src='http://widgets.digg.com/img/button/diggThisCompact.png' alt='DiggThis' /></a><a class='RedditButton' href='http://www.reddit.com/submit?url=http%3A%2F%2F01001111.net%2Fcode%2F%3Fp%3D122&title=JAWR'><img src='http://www.reddit.com/static/spreddit7.gif' alt='submit to reddit' /></a></div>]]></content:encoded>
			<wfw:commentRss>http://01001111.net/code/?feed=rss2&amp;p=122</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://01001111.net/code/?p=122</feedburner:origLink></item>
	</channel>
</rss>

