<?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>philihp.com</title>
	<atom:link href="http://www.philihp.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.philihp.com/blog</link>
	<description>I do things, and then I tell the internet about them.</description>
	<lastBuildDate>Mon, 06 Feb 2012 05:40:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Chained Struts Actions Accessible Only by Forward</title>
		<link>http://www.philihp.com/blog/2012/chained-struts-actions-that-accessible-only-by-forward/</link>
		<comments>http://www.philihp.com/blog/2012/chained-struts-actions-that-accessible-only-by-forward/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 05:40:05 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Action]]></category>
		<category><![CDATA[Forward]]></category>
		<category><![CDATA[Fragment]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Struts]]></category>
		<category><![CDATA[Struts 1.3]]></category>

		<guid isPermaLink="false">http://www.philihp.com/blog/?p=961</guid>
		<description><![CDATA[So I just stumbled into doing this little trick. It may go against some pattern, or best practice, but I&#8217;m sure there&#8217;s a use for it somewhere. In Struts 1.3 (and probably any Struts 1.x), it is sometimes useful to have a request chain across multiple Action classes, maybe to break them up into more [...]]]></description>
			<content:encoded><![CDATA[<p>So I just stumbled into doing this little trick. It may go against some pattern, or best practice, but I&#8217;m sure there&#8217;s a use for it somewhere.</p>
<p>In <a href="http://struts.apache.org/1.3.10/">Struts 1.3</a> (and probably any Struts 1.x), it is sometimes useful to have a request chain across multiple Action classes, maybe to break them up into more manageable sections. But maybe you don&#8217;t want step-2 of a multi-Action process be accessible externally. If you configure your Actions like this in your <code>struts-config.xml</code>, you can do just that.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;/refresh&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;com.philihp.action.RefreshPartOne&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;forward</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;default&quot;</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;/refresh#2.do&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/action<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;/refresh#2&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;com.philihp.action.RefreshPartTwo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;forward</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;default&quot;</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;/&quot;</span> <span style="color: #000066;">redirect</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/action<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>To trigger it, have the user goto <code>/refresh.do</code>. Struts will call RefreshPartOne.execute(), and assuming it returns the default ActionForward, it will call RefreshPartTwo.execute().</p>
<p>If the user tries to call <code>/refresh#2.do</code>, they will get an error. The browser will strip out the <a href="http://en.wikipedia.org/wiki/Fragment_identifier">fragment identifier</a> from the URL and tell the server it wants to see /refresh, which doesn&#8217;t exist. It may be possible to carefully craft a request to the server though, and it&#8217;s up to your container (e.g. Tomcat, Glassfish) to strip out the fragment. Behavior is probably undefined because <a href="http://www.ietf.org/rfc/rfc1738.txt">RFC 1738</a> says the &#8216;<code>#</code>&#8216; is unsafe and should never be sent in a URL. So test it out if you&#8217;re really curious.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2012/chained-struts-actions-that-accessible-only-by-forward/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New in Java 7: switch()ing on Strings</title>
		<link>http://www.philihp.com/blog/2012/new-in-java-7-switching-on-strings/</link>
		<comments>http://www.philihp.com/blog/2012/new-in-java-7-switching-on-strings/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 04:49:57 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[java 7]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[switch]]></category>

		<guid isPermaLink="false">http://www.philihp.com/blog/?p=946</guid>
		<description><![CDATA[Finally, Java can switch on Strings! No more inefficient strings of if/else chains or Hash lookups or translation into Enums. Finally just clean readable and intuitive code. switch&#40;suit&#41; &#123; case &#34;club&#34;: case &#34;diamond&#34;: trickValue = 20; break; case &#34;heart&#34;: case &#34;spade&#34;: trickValue = 30; break; case &#34;no-trump&#34;: trickValue = 40; break; &#125; It&#8217;s actually just [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, <a href="http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html">Java can switch on Strings</a>! No more inefficient strings of if/else chains or Hash lookups or translation into Enums. Finally just clean readable and intuitive code.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">switch</span><span style="color: #009900;">&#40;</span>suit<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;club&quot;</span><span style="color: #339933;">:</span>
  <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;diamond&quot;</span><span style="color: #339933;">:</span>
    trickValue <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;heart&quot;</span><span style="color: #339933;">:</span>
  <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;spade&quot;</span><span style="color: #339933;">:</span>
    trickValue <span style="color: #339933;">=</span> <span style="color: #cc66cc;">30</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;no-trump&quot;</span><span style="color: #339933;">:</span>
    trickValue <span style="color: #339933;">=</span> <span style="color: #cc66cc;">40</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>It&#8217;s actually just syntactic sugar. The <a href="http://blogs.oracle.com/darcy/entry/project_coin_strings_in_switch">java compiler renders this all down to int switching</a> by pre-computing the <code>.hashcode()</code> of all of the labels since they have to be constants anyway (unlike languages like PHP where you can do <a href="http://programmersnotes.info/2009/03/06/trick-with-php-switch/">some really neat shenanigans</a>). Because this still renders down to primitives, Java still gets the <a href="http://en.wikipedia.org/wiki/Jump_table">jump table optimizations</a> that were the whole motivation of the switch construct in the first place.</p>
<p>If you use Eclipse, switching on a String will still probably give you an error. <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288548#c9">It wasn&#8217;t until September 2011&#8242;s release (3.7.1)</a> that this was implemented. There were versions of Indigo that didn&#8217;t support this, so you&#8217;ll need the latest one.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2012/new-in-java-7-switching-on-strings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SOPA Strike, January 18</title>
		<link>http://www.philihp.com/blog/2012/sopa-strike-january-18/</link>
		<comments>http://www.philihp.com/blog/2012/sopa-strike-january-18/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 07:08:40 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
		
		<guid isPermaLink="false">http://www.philihp.com/blog/?p=939</guid>
		<description><![CDATA[On January 18, this website is going on strike. Your website can too, just put this into the header of your HTML: &#60;script&#62; var a=new Date; if&#40;18==a.getDate&#40;&#41; &#38;&#38; 0==a.getMonth&#40;&#41; &#38;&#38; 2012==a.getFullYear&#40;&#41;&#41; window.location=&#34;http://sopastrike.com/strike&#34;; &#60;/script&#62;]]></description>
			<content:encoded><![CDATA[<p>On January 18, this website is going on strike.</p>
<p>Your website can too, just put this into the header of your HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">var</span> a<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">18</span><span style="color: #339933;">==</span>a.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">==</span>a.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #CC0000;">2012</span><span style="color: #339933;">==</span>a.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  window.<span style="color: #660066;">location</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://sopastrike.com/strike&quot;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2012/sopa-strike-january-18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Create an Empty SAS Dataset</title>
		<link>http://www.philihp.com/blog/2012/how-to-create-an-empty-sas-dataset/</link>
		<comments>http://www.philihp.com/blog/2012/how-to-create-an-empty-sas-dataset/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 07:24:50 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[data step]]></category>
		<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://linode.philihp.com/blog/?p=913</guid>
		<description><![CDATA[If you were to do this in SAS to create an empty SAS dataset: data mytable; run; It would actually create a dataset with one row. The data step cycles through once, hits the end (run), outputs a row, then comes back and finds it has no more rows to process so it stops. To [...]]]></description>
			<content:encoded><![CDATA[<p>If you were to do this in SAS to create an empty SAS dataset:</p>

<div class="wp_syntax"><div class="code"><pre class="sas" style="font-family:monospace;"><span style="color: #000080; font-weight: bold;">data</span> mytable;
<span style="color: #000080; font-weight: bold;">run</span>;</pre></div></div>

<p>It would actually create a dataset with one row. The data step cycles through once, hits the end (run), outputs a row, then comes back and finds it has no more rows to process so it stops. To stop this one row from being output, try this instead:</p>

<div class="wp_syntax"><div class="code"><pre class="sas" style="font-family:monospace;"><span style="color: #000080; font-weight: bold;">data</span> mytable;
  <span style="color: #0000ff;">stop</span>;
<span style="color: #000080; font-weight: bold;">run</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2012/how-to-create-an-empty-sas-dataset/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DIY LED Hula Hoop</title>
		<link>http://www.philihp.com/blog/2011/diy-led-hula-hoop/</link>
		<comments>http://www.philihp.com/blog/2011/diy-led-hula-hoop/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 04:00:15 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[adafruit]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[hula hoop]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[lithium battery]]></category>

		<guid isPermaLink="false">http://www.philihp.com/blog/?p=754</guid>
		<description><![CDATA[UPDATE: I&#8217;ll be making a lot more of these, but I don&#8217;t want to horde the know-how of how to do it. Anyone with a soldering iron can make one, so I&#8217;m sharing what I know. Bill of materials 1 Arduino Pro Mini 328 &#8211; 5V/16MHz 3 meters of Adafruit Digitally Addressable LEDs 1 Tenergy [...]]]></description>
			<content:encoded><![CDATA[<p><b>UPDATE: I&#8217;ll be making a lot more of these, but I don&#8217;t want to horde the know-how of how to do it. Anyone with a soldering iron can make one, so I&#8217;m sharing what I know.</b></p>

<a href='http://www.philihp.com/blog/2011/diy-led-hula-hoop/375356_10100422254570369_11803542_49579939_1731537871_n/' title='Radar inside the hoop'><img width="150" height="150" src="http://www.philihp.com/blog/wp-content/uploads/2011/12/375356_10100422254570369_11803542_49579939_1731537871_n2-150x150.jpg" class="attachment-thumbnail" alt="Radar inside the hoop" title="Radar inside the hoop" /></a>
<a href='http://www.philihp.com/blog/2011/diy-led-hula-hoop/388216_10100424719859909_11803542_49595547_265897678_n/' title='Strobing RGB makes it appear white when still'><img width="150" height="150" src="http://www.philihp.com/blog/wp-content/uploads/2011/12/388216_10100424719859909_11803542_49595547_265897678_n2-150x150.jpg" class="attachment-thumbnail" alt="Strobing RGB makes it appear white when still" title="Strobing RGB makes it appear white when still" /></a>
<a href='http://www.philihp.com/blog/2011/diy-led-hula-hoop/409691_10100424719026579_11803542_49595543_211464412_n/' title='Each LED can be its own color'><img width="150" height="150" src="http://www.philihp.com/blog/wp-content/uploads/2011/12/409691_10100424719026579_11803542_49595543_211464412_n2-150x150.jpg" class="attachment-thumbnail" alt="Each LED can be its own color" title="Each LED can be its own color" /></a>
<a href='http://www.philihp.com/blog/2011/diy-led-hula-hoop/408847_10100424711791079_11803542_49595530_958466730_n/' title='Persistence-of-vision allows the hoop to display messages when moving'><img width="150" height="150" src="http://www.philihp.com/blog/wp-content/uploads/2011/12/408847_10100424711791079_11803542_49595530_958466730_n1-150x150.jpg" class="attachment-thumbnail" alt="Persistence-of-vision allows the hoop to display messages when moving" title="Persistence-of-vision allows the hoop to display messages when moving" /></a>

<h3>Bill of materials</h3>
<ul>
<li>1 <a href="http://www.amazon.com/Arduino-Pro-Mini-328-16MHz/dp/B004G53J5I/">Arduino Pro Mini 328 &#8211; 5V/16MHz</a></li>
<li>3 meters of <a href="http://www.adafruit.com/products/306">Adafruit Digitally Addressable LEDs</a></li>
<li>1 <a href="http://www.batteryjunction.com/prcimopcbfor.html">Tenergy 32003 Protection Circuit Module</a></li>
<li>4 <a href="http://www.batteriesinaflash.com/assembly-cells/li-ion/li-ion-14500-aa-cylindrical-rechargeable-battery-w-tabs-800mah">14500 900mAh Lithium batteries</a> with tabs</li>
<li>3-4 meters of <a href="http://www.mcmaster.com/#50375k55/=fjv23z">1&#8243; HDPE (High-Density Polyethylene) tubing</a></li>
<li>3 <a href="http://www.sparkfun.com/products/97">push-button switches</a></li>
<li>3 resistors (doesn&#8217;t really matter which, any will do)</li>
<li>a bunch of wire.</li>
<li>1 <a href="http://www.radioshack.com/product/index.jsp?productId=2102491">Radio Shack Size M jack receptacle</a></li>
<li>1 <a href="http://www.radioshack.com/product/index.jsp?productId=2102490">Radio Shack Size M power plug</a></a>
<li>1 <a href="http://www.amazon.com/gp/product/B004LHFU62">4.2v power source for a charger</a>
<li>Bubble wrap</li>
</ul>
<p>So I made an LED hula hoop. It has 96 LEDs, 105 different modes, and lasts about 3.5 hours at full brightness. It&#8217;s also the only hoop I&#8217;ve seen that displays a message using <a href="http://www.makershed.com/product_p/mkad1.htm">persistence of vision</a>.</p>
<h3>Batteries</h3>
<p>The batteries are wired in parallel so they basically just add up the mAh capacity. If they were wired up in series, the voltage would add instead. The hoop would work with just one, but then the mass wouldn&#8217;t be evenly distributed and the hoop balance would be a little off. And it would also go dead in half an hour. They start out sending 4.2 volts, but slowly drop until it hits 3.3 volts (the actual <a href="http://www.panasonic.com/industrial/includes/pdf/Panasonic_LiIon_CGR18650CG.pdf">discharge characteristics</a> depend on the temperature). They are the same size and shape as AA batteries, but keep in mind, AA batteries are 1.5v, and these are not.</p>
<p>The batteries are wired up behind a Tenergy 32003 to protect them from overdraining and overcharging. When in use, the hoop will actually cut off before the voltage goes too low to prevent damage to the batteries. The circuit protects from overcharging too, but so does the charger. The 32003 didn&#8217;t want any more than 4.2 volts, so finding a wall-wart charger was a little difficult. I ended up wiring a charger directly into <a href="http://www.amazon.com/gp/product/B004LHFU62">an extra charger for 18650s</a>. It only charges at 600 mA, so I&#8217;m sure there&#8217;s a more appropriate charger out there.</p>
<h3>LEDs</h3>
<p>The LEDs operate on a daisy chained controller, and come printed on a pretty flexible strip. <a href="http://www.superbrightleds.com/moreinfo/component-leds/rgb-5050-smd-led-120-degree-viewing-angle/322/">5050 RGB LEDs</a> are mounted about every 2.5 inches. The LEDs are rated at 5 volts, but will dim when given lower voltage. I was actually able to overcharge them and get them brighter, but was <a href="http://forums.adafruit.com/viewtopic.php?f=47&#038;t=24682&#038;p=127981#p127981">warned</a> this would burn the drivers if I kept at it so I stopped. My original plan was actually to run on 7.4 volts to keep them this bright.</p>
<h3>Arduino</h3>
<p>At <a href="http://www.bonnaroo.com">Bonnaroo 2010</a>, I met <a href="https://www.facebook.com/schimke">this guy</a> who had built his girlfriend a hoop, and was a huge help in this one. He pointed out that the Pro Mini can run off of anywhere from 3 volts to 5 volts. The difference is really just the crystal operating at 8 or 16 mHz (for stability concerns). So that made things a lot simpler.</p>
<p>The LED strip has two inputs for power, and two wires going to the Arduino for data and clock. The <a href="https://github.com/adafruit/LPD8806">library</a> that Adafruit provides for it lets us use any two pins on the Arduino to control it via bit-banged software SPI. However, if you happen to have pins 11 and 13 free (which we do), then you can use hardware SPI and get <a href="http://forums.adafruit.com/viewtopic.php?f=47&#038;t=25050&#038;p=129265#p129265">roughly 3-4 times the speed</a> which makes POV at high speeds (i.e. while hooping) possible. If you edit the source of the LPD8806 library, you can change the SPI clock divider to go even faster, but you&#8217;ll have to worry about interference.</p>
<p>I used pins 2, 3, and 4 for pushbutton switches. 4 can be moved around, but 2 and 3 were pretty important because I send the arduino its <a href="http://donalmorrissey.blogspot.com/2010/04/putting-arduino-diecimila-to-sleep.html">sleep mode</a> to save power. External interrupts pull it out and wake it up, but only pins 2 and 3 can do this.</p>
<p>So basically there&#8217;s an &#8220;off&#8221; button, a &#8220;mode&#8221; button, and a &#8220;color&#8221; button. The modes cycle through various modes of &#8220;Solid&#8221;, &#8220;Dragonfly&#8221;, &#8220;Strobe&#8221;, &#8220;Chasers&#8221;, &#8220;Chasers with statics&#8221;, &#8220;Rainbow&#8221;, and POV. The colors cycle through various colors, except for the chasers, where you can cycle through all the colors, and keep cycling through adding another chaser every time, up to 5. The POV mode displays the logo of <a href="http://carrotcreative.com/">Carrot Creative</a>. Space is pretty cramped on the chip, so it&#8217;s just stored as an on/off bitmask, 32 pixels high (so each column is 1 32-bit int). The first few columns are green, so I just did that bit manually.</p>
<h3>Assembly</h3>
<p>Probably the most frustrating part of this project is the assembly. It&#8217;s important for everything to be snug inside of the hoop so it doesn&#8217;t rattle, and wrapping it in bubble wrap greatly helps this, but the bubble wrap grips the sides of the tube. Taping three unraveled coat hangers together, and using them to pull the strip through helped a lot. Another thing to watch out for is that the contacts need to be insulated and wrapped in electrical tape so you don&#8217;t get shorts inside the tube which are nearly impossible to find and fix without a complete disassembly.</p>
<p><a href="https://github.com/philihp/Jubilee">Source Code &#038; EAGLE Wiring Diagrams</a></p>
<p><img src="https://github.com/philihp/Jubilee/raw/master/wiring.png" style="width:50%" /></p>
<p><iframe width="480" height="360" src="http://www.youtube.com/embed/s0otcdW-98w" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2011/diy-led-hula-hoop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Please stop creating links with target=&#8221;_new&#8221;.</title>
		<link>http://www.philihp.com/blog/2011/please-stop-creating-links-with-target_new/</link>
		<comments>http://www.philihp.com/blog/2011/please-stop-creating-links-with-target_new/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 23:33:26 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[new window]]></category>
		<category><![CDATA[target]]></category>
		<category><![CDATA[_blank]]></category>
		<category><![CDATA[_new]]></category>

		<guid isPermaLink="false">http://www.philihp.com/blog/?p=746</guid>
		<description><![CDATA[Just stop. This is wrong; instead, use this: target="_blank" I don&#8217;t know who started these nasty rumors that &#8220;_new&#8221; would open up in a new browser. As far back as I can tell, no browser has ever recognized &#8220;_new&#8221;. The whole point of the target dates back to when browsers used frames to split up your [...]]]></description>
			<content:encoded><![CDATA[<p>Just stop. This is wrong; instead, use this:</p>
<blockquote><p><code>target="_blank"</code></p></blockquote>
<p>I don&#8217;t know who started these nasty rumors that &#8220;_new&#8221; would open up in a new browser. As far back as I can tell, no browser has ever recognized &#8220;_new&#8221;.</p>
<p>The whole point of the <code>target</code> dates back to when browsers used frames to split up your browser. If you had a link in a sidebar on the left, and you wanted that link to open up in the main frame to the right, you would specify &#8220;main&#8221; as the name of that frame in your frameset page, and target=&#8221;main&#8221; in your links on the sidebar. When the user would click on a link in the sidebar, the browser would say &#8220;hmm, I&#8217;m supposed to open this up in the &#8216;main&#8217; frame, do I have one named that?&#8221;. If it didn&#8217;t, it would open up the link in a new window, and give that window the name of the target of the link. This is what would happen with target=&#8221;_new&#8221;; a new browser would open up with a name of &#8220;_new&#8221;.</p>
<p>The problem is this if you click on this first link, then read it and go &#8220;oh that&#8217;s interesting&#8221; and click on some links in it to goto further pages on it, everything seems fine. But then if you click this second link below, and then the third link, they open up in the same browser!</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Hoag's_Object" target="_new">Link 1</a> target=&#8221;_new&#8221;</li>
<li><a href="http://en.wikipedia.org/wiki/Vlad_III_Dracula" target="_new">Link 2</a> target=&#8221;_new&#8221;</li>
<li><a href="http://en.wikipedia.org/wiki/Jack_(playing_card)#History" target="_new">Link 3</a> target=&#8221;_new&#8221;</li>
</ul>
<p>If only they had a target of &#8220;_blank&#8221;, they would all open up in a new browser every time.</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Hoag's_Object" target="_blank">Link 1</a> target=&#8221;_blank&#8221;</li>
<li><a href="http://en.wikipedia.org/wiki/Vlad_III_Dracula" target="_blank">Link 2</a> target=&#8221;_blank&#8221;</li>
<li><a href="http://en.wikipedia.org/wiki/Jack_(playing_card)#History" target="_blank">Link 3</a> target=&#8221;_blank&#8221;</li>
</ul>
<p>It&#8217;s a simple fix. Just stop using target=&#8221;_new&#8221;.</p>
<blockquote><p>You keep using that word. I do not think it means what you think it means. &#8211; <a href="http://www.imdb.com/title/tt0093779/quotes?qt=qt0482717" target="_blank">Inigo Montoya</a></p></blockquote>
<p>Or just stop opening links in new browsers all together; it has been <a href="http://www.useit.com/alertbox/990530.html">considered bad usability</a> for over a decade now. The user will open your links up in a new window if they want to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2011/please-stop-creating-links-with-target_new/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Eclipse WTP with Maven&#8217;s eclipse:eclipse Goal</title>
		<link>http://www.philihp.com/blog/2011/using-eclipse-wtp-with-mavens-eclipseeclipse-goal/</link>
		<comments>http://www.philihp.com/blog/2011/using-eclipse-wtp-with-mavens-eclipseeclipse-goal/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 05:45:52 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[wtp]]></category>

		<guid isPermaLink="false">http://www.philihp.com/blog/?p=735</guid>
		<description><![CDATA[If you use Maven&#8217;s &#8220;eclipse:eclipse&#8221; goal to generate a project descriptor for eclipse, by default you&#8217;re just going to get a plain Java project. You&#8217;ll have to add in the Dynamic Web facet in order to tell Eclipse that you can deploy this project in a web container. The easy way around this is to [...]]]></description>
			<content:encoded><![CDATA[<p>If you use Maven&#8217;s &#8220;eclipse:eclipse&#8221; goal to generate a project descriptor for eclipse, by default you&#8217;re just going to get a plain Java project. You&#8217;ll have to add in the Dynamic Web facet in order to tell Eclipse that you can deploy this project in a web container. The easy way around this is to configure the maven-eclipse-plugin in the pom.xml file like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-eclipse-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wtpContextName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>some/url/context<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wtpContextName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wtpversion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wtpversion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Also, I like to download sources and Javadoc, which makes navigating in Eclipse a lot easier. This can be done like this.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  ...
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;downloadSources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/downloadSources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;downloadJavadocs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/downloadJavadocs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Supposing you also want your project to have JPA facets, or other additional project facets you could also add them in like this</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  ...
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;additionalProjectFacets<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jpt.jpa<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jpt.jpa<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/additionalProjectFacets<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>And all of these can be combined to do this</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-eclipse-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wtpContextName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>list<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wtpContextName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wtpversion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wtpversion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;downloadSources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/downloadSources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;downloadJavadocs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/downloadJavadocs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;additionalProjectFacets<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jpt.jpa<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jpt.jpa<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/additionalProjectFacets<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2011/using-eclipse-wtp-with-mavens-eclipseeclipse-goal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Servlet Filters mapped to JSPs in Tomcat</title>
		<link>http://www.philihp.com/blog/2011/servlet-filters-mapped-to-jsps-in-tomcat/</link>
		<comments>http://www.philihp.com/blog/2011/servlet-filters-mapped-to-jsps-in-tomcat/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 04:40:00 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[Servlet]]></category>
		<category><![CDATA[servlet-filter]]></category>
		<category><![CDATA[Struts]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.philihp.com/blog/?p=724</guid>
		<description><![CDATA[Servlet filters were introduced in the Servlet 2.3 spec a long time ago. They&#8217;re basically classes that you can add to any Java webapp that intercept every request and can do anything you can imagine (e.g., compress output, translate, handle authentication, the only limit is yourself). They&#8217;re added into the web.xml file where every webapp starts, [...]]]></description>
			<content:encoded><![CDATA[<p>Servlet filters were introduced in the Servlet 2.3 spec a long time ago. They&#8217;re basically classes that you can add to <em>any</em> Java webapp that intercept every request and can do anything you can imagine (e.g., compress output, translate, handle authentication, <a href="http://www.zombo.com">the only limit is yourself</a>). They&#8217;re added into the web.xml file where <em>every</em> webapp starts, and since every webapp framework builds off of a servlet, they can be used with every webapp regardless of the framework. And they&#8217;re part of the Servlet spec, not the J2EE spec, so you don&#8217;t need a bloated container to use them; you can use them in Tomcat. Basically, what I&#8217;m saying is, they&#8217;re really useful wherever you are, no matter what you&#8217;re doing.</p>
<p>To install a servlet filter in your web.xml, you&#8217;d do something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jpa-filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.philihp.utils.EntityManagerFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jpa-filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>action<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Where the filter will filter any servlet named &#8220;action&#8221; &#8212; which in this case is the name of my Struts 1.3 controller that I had defined earlier. Rather than specify a servlet-name, you&#8217;re allowed to use a url-pattern, but <a href="http://java.sun.com/developer/Books/javaserverpages/servlets_javaserver/servlets_javaserver09.pdf">according to Sun</a>, the url-pattern has to begin with a <code>"/"</code> slash, so <strong>the following does not work</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jpa-filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>JSPs are essentially servlets, compiled from JSP code the first time they&#8217;re run. But you don&#8217;t have to define every JSP file in your web.xml file, because they&#8217;re already defined by the container. There&#8217;s a servlet (in tomcat, it&#8217;s the Jasper engine) mapped to <code>/*.jsp</code>. In the Tomcat guts, you can find it at <a href="http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/conf/web.xml"><code>conf/web.xml</code></a>, which is the basis web.xml file; every webapp deployed in Tomcat is actually extended from this file</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.jasper.servlet.JspServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Since JSPs are essentially running as the servlet name &#8220;jsp&#8221;, you can attach a servlet-filter to them with a filter-mapping similar to this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jpa-filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2011/servlet-filters-mapped-to-jsps-in-tomcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get the Last Day of a Month in SAS</title>
		<link>http://www.philihp.com/blog/2011/how-to-get-the-last-day-of-a-month-in-sas/</link>
		<comments>http://www.philihp.com/blog/2011/how-to-get-the-last-day-of-a-month-in-sas/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 23:15:39 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Dates]]></category>
		<category><![CDATA[intnx]]></category>
		<category><![CDATA[magic]]></category>
		<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.philihp.com/blog/?p=713</guid>
		<description><![CDATA[SAS has a really neat function called intnx, which will increment a date to the next of an interval. For example, if you have a date (any date. maybe the current date?), you can get the date of the first day of the next month by doing this: data _null_; d = '11JUN2011'd; format d [...]]]></description>
			<content:encoded><![CDATA[<p>SAS has a really neat function called <a href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212700.htm" target="_blank">intnx</a>, which will increment a date to the next of an interval.</p>
<p>For example, if you have a date (any date. maybe the current date?), you can get the date of the first day of the next month by doing this:</p>

<div class="wp_syntax"><div class="code"><pre class="sas" style="font-family:monospace;"><span style="color: #000080; font-weight: bold;">data</span> <span style="color: #0000ff;">_null_</span>;
  d = <span style="color: #a020f0;">'11JUN2011'</span>d;
  <span style="color: #0000ff;">format</span> d date9.;
  <span style="color: #0000ff;">put</span> d;
  d = <span style="color: #0000ff;">intnx</span><span style="color: #66cc66;">&#40;</span><span style="color: #a020f0;">'month'</span>,d,<span style="color: #2e8b57; font-weight: bold;">1</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #0000ff;">put</span> d;
<span style="color: #000080; font-weight: bold;">run</span>;</pre></div></div>

<p>Which outputs</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">11JUN2011
01JUL2011</pre></div></div>

<p>But to get the &#8220;Last Day&#8221; of the current month, you have to be clever. The last day of the current month is the day before the first day of the next month. SAS Dates are internally stored as a number of days since some point, so just subtract one from it.</p>

<div class="wp_syntax"><div class="code"><pre class="sas" style="font-family:monospace;"><span style="color: #000080; font-weight: bold;">data</span> <span style="color: #0000ff;">_null_</span>;
  d = <span style="color: #a020f0;">'11JUN2011'</span>d;
  <span style="color: #0000ff;">format</span> d date9.;
  <span style="color: #0000ff;">put</span> d;
  d = <span style="color: #0000ff;">intnx</span><span style="color: #66cc66;">&#40;</span><span style="color: #a020f0;">'month'</span>,d,<span style="color: #2e8b57; font-weight: bold;">1</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #2e8b57; font-weight: bold;">1</span>;
  <span style="color: #0000ff;">put</span> d;
<span style="color: #000080; font-weight: bold;">run</span>;</pre></div></div>

<p>Which outputs</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">11JUN2011
30JUN2011</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2011/how-to-get-the-last-day-of-a-month-in-sas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Maximum sizes of MySQL Blob Fields</title>
		<link>http://www.philihp.com/blog/2011/maximum-sizes-of-mysql-blob-fields/</link>
		<comments>http://www.philihp.com/blog/2011/maximum-sizes-of-mysql-blob-fields/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 03:36:26 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.philihp.com/blog/?p=704</guid>
		<description><![CDATA[This is not immediately obvious from the documentation(, which as it seems is often the case, was written for people who just like to read documentation, and not for people who are looking for answers). The maximum sizes of the MySQL Blob fields are as follows: Type What They Say It Needs That Means You Get [...]]]></description>
			<content:encoded><![CDATA[<p>This is not immediately obvious from the <a href="http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html">documentation</a>(, which as it seems is often the case, was written for people who just like to read documentation, and not for people who are looking for answers).</p>
<p>The maximum sizes of the MySQL Blob fields are as follows:</p>
<table border="1" cellspacing="0" cellpadding="4">
<tr>
<th>Type</th>
<th>What They Say It Needs</th>
<th>That Means You Get</th>
</tr>
<tr>
<td>TINYBLOB</td>
<td>L+1 bytes, where L &lt; 2<sup>8</sup></td>
<td>256 bytes</td>
</tr>
<tr>
<td>BLOB</td>
<td>L+2 bytes, where L &lt; 2<sup>16</sup></td>
<td>65 kilobytes</td>
</tr>
<tr>
<td>MEDIUMBLOB</td>
<td>L+3 bytes, where L &lt; 2<sup>24</sup></td>
<td>16 megabytes</td>
</tr>
<tr>
<td>LONGBLOB</td>
<td>L+4 bytes, where L &lt; 2<sup>32</sup></td>
<td>4 gigabytes</td>
</tr>
</table>
<p>There. Now it&#8217;s on the Internet and people can find the answer to this question. The world is a better place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2011/maximum-sizes-of-mysql-blob-fields/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

