<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Geek Credential</title>
	<atom:link href="http://geekcredential.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://geekcredential.wordpress.com</link>
	<description>Learn from my mistakes</description>
	<lastBuildDate>Tue, 13 Dec 2011 18:56:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='geekcredential.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>The Geek Credential</title>
		<link>http://geekcredential.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://geekcredential.wordpress.com/osd.xml" title="The Geek Credential" />
	<atom:link rel='hub' href='http://geekcredential.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Reproducing Javascript&#8217;s escape() function in Groovy</title>
		<link>http://geekcredential.wordpress.com/2011/06/09/reproducing-javascripts-escape-function-in-groovy/</link>
		<comments>http://geekcredential.wordpress.com/2011/06/09/reproducing-javascripts-escape-function-in-groovy/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 21:21:23 +0000</pubDate>
		<dc:creator>msilverboard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://geekcredential.wordpress.com/?p=302</guid>
		<description><![CDATA[From time to time, I&#8217;ve seen people looking for a way to reproduce Javascript&#8217;s escape() function in this or that language. It&#8217;s not a complex function &#8211; escape() simply replaces characters that aren&#8217;t alphanumeric (and a few symbols) with their Unicode values in hexadecimal. Anyway, I recently had a need to escape something using Groovy. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=302&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>From time to time, I&#8217;ve seen people looking for a way to reproduce Javascript&#8217;s escape() function in this or that language. It&#8217;s not a complex function &#8211; <a href="http://www.devguru.com/technologies/ecmascript/quickref/escape.html" title="DevGuru Javascript reference">escape() simply replaces characters that aren&#8217;t alphanumeric (and a few symbols) with their Unicode values in hexadecimal</a>. Anyway, I recently had a need to escape something using Groovy. Here&#8217;s the method.</p>
<p><code><br />
/* A method to mimic Javascript's escape() function.<br />
 * It replaces 'special characters' with their Unicode hexadecimal<br />
 * equivalent. This simple method is not designed to handle<br />
 * double byte character sets. Feel free to improve it.<br />
 */<br />
String escapeLikeJavascript(String sourceText) {<br />
	def specialCharsRegex = /[^\w@*-+.\/]/<br />
	return sourceText.replaceAll(specialCharsRegex, {<br />
		"%${Integer.toHexString(it.codePointAt(0)).toUpperCase().padLeft(2, '0')}"<br />
	})<br />
}<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekcredential.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekcredential.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/geekcredential.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/geekcredential.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/geekcredential.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/geekcredential.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/geekcredential.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/geekcredential.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/geekcredential.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/geekcredential.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/geekcredential.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/geekcredential.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/geekcredential.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/geekcredential.wordpress.com/302/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=302&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekcredential.wordpress.com/2011/06/09/reproducing-javascripts-escape-function-in-groovy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">geek</media:title>
		</media:content>
	</item>
		<item>
		<title>How to configure Notepad++ to always open in a new window</title>
		<link>http://geekcredential.wordpress.com/2011/02/24/how-to-configure-notepad-to-always-open-in-a-new-window/</link>
		<comments>http://geekcredential.wordpress.com/2011/02/24/how-to-configure-notepad-to-always-open-in-a-new-window/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 16:36:21 +0000</pubDate>
		<dc:creator>msilverboard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[notepad++]]></category>

		<guid isPermaLink="false">http://geekcredential.wordpress.com/?p=277</guid>
		<description><![CDATA[I tend to work with multiple documents open in front of me at once, so I can compare or copy code snippets from different sources. I generally use Notepad++ as my text editor, but the default behavior for Notepad++ is to open multiple documents in tabs within a single instance. There are ways to change [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=277&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I tend to work with multiple documents open in front of me at once, so I can compare or copy code snippets from different sources.  I generally use <a href="http://notepad-plus-plus.org/">Notepad++</a> as my text editor, but the default behavior for Notepad++ is to open multiple documents in tabs within a single instance.  There are ways to change that behavior, and every time I change computers or reinstall Notepad++, I find myself having to go look them up again.  So here they are for my own convenience and maybe yours.</p>
<p>If you&#8217;re launching Notepad++ from a command line or a shortcut, you can simply add <code>-multiInst</code> as a command line argument.</p>
<p><a href="http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Command_Line_Switches#Description">Notepad++ Command Line Switches</a></p>
<p>However, that doesn&#8217;t alter the behavior when you open a document from the Windows Explorer context menu by clicking &#8220;Edit with Notepad++&#8221;.  A more global way of making the application open in a new instance every time is to place an empty file named <code>asNotepad.xml</code> in the Notepad++ Program Files directory.</p>
<p><a href="http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Configuration_Files">Notepad++ Configuration Files</a></p>
<br /> Tagged: <a href='http://geekcredential.wordpress.com/tag/notepad/'>notepad++</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekcredential.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekcredential.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/geekcredential.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/geekcredential.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/geekcredential.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/geekcredential.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/geekcredential.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/geekcredential.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/geekcredential.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/geekcredential.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/geekcredential.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/geekcredential.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/geekcredential.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/geekcredential.wordpress.com/277/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=277&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekcredential.wordpress.com/2011/02/24/how-to-configure-notepad-to-always-open-in-a-new-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">geek</media:title>
		</media:content>
	</item>
		<item>
		<title>Burst.net / Nocster.net</title>
		<link>http://geekcredential.wordpress.com/2011/02/23/burst-net-nocster-net/</link>
		<comments>http://geekcredential.wordpress.com/2011/02/23/burst-net-nocster-net/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 15:25:05 +0000</pubDate>
		<dc:creator>msilverboard</dc:creator>
				<category><![CDATA[Stop Spam]]></category>

		<guid isPermaLink="false">http://geekcredential.wordpress.com/?p=274</guid>
		<description><![CDATA[Friendly to spammers? Or just terrible customer service? Followup: Burst.net responded on 3/24/2011, over a month after I submitted the support request. Matt W has responded to your ticket. Please preserve the subject line. This is important. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; (Matt W) &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; As far as I know that is not a violation of our AUP. I&#8217;m [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=274&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Friendly to spammers?  Or just terrible customer service?</p>
<p><a href="http://geekcredential.files.wordpress.com/2011/02/burstnet2.png"><img src="http://geekcredential.files.wordpress.com/2011/02/burstnet2.png?w=455&#038;h=379" alt="" title="burstnet2" width="455" height="379" class="aligncenter size-full wp-image-275" /></a></p>
<hr />
<p>Followup: Burst.net responded on 3/24/2011, over a month after I submitted the support request.</p>
<blockquote><p>
Matt W has responded to your ticket. </p>
<p>Please preserve the subject line. This is important.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
 (Matt W)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
As far as I know that is not a violation of our AUP. I&#8217;m forwarding this ticket to one of our abuse representatives now for confirmation.</p>
<p>&#8211;<br />
Thank you,</p>
<p>Matt W.<br />
Technical Support Representative<br />
BurstNET Technologies, Inc.<br />
Technical Support is always available via http://support.burst.net
</p></blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekcredential.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekcredential.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/geekcredential.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/geekcredential.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/geekcredential.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/geekcredential.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/geekcredential.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/geekcredential.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/geekcredential.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/geekcredential.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/geekcredential.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/geekcredential.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/geekcredential.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/geekcredential.wordpress.com/274/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=274&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekcredential.wordpress.com/2011/02/23/burst-net-nocster-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">geek</media:title>
		</media:content>

		<media:content url="http://geekcredential.files.wordpress.com/2011/02/burstnet2.png" medium="image">
			<media:title type="html">burstnet2</media:title>
		</media:content>
	</item>
		<item>
		<title></title>
		<link>http://geekcredential.wordpress.com/2011/01/31/271/</link>
		<comments>http://geekcredential.wordpress.com/2011/01/31/271/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 15:30:54 +0000</pubDate>
		<dc:creator>msilverboard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://geekcredential.wordpress.com/?p=271</guid>
		<description><![CDATA[Why You Should Never Set GROOVY_HOME<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=271&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://6by9.wordpress.com/2011/01/31/why-you-should-never-set-groovy_home/">Why You Should Never Set GROOVY_HOME</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekcredential.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekcredential.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/geekcredential.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/geekcredential.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/geekcredential.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/geekcredential.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/geekcredential.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/geekcredential.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/geekcredential.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/geekcredential.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/geekcredential.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/geekcredential.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/geekcredential.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/geekcredential.wordpress.com/271/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=271&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekcredential.wordpress.com/2011/01/31/271/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">geek</media:title>
		</media:content>
	</item>
		<item>
		<title>Configuring Luna HSM Software on AIX</title>
		<link>http://geekcredential.wordpress.com/2010/09/29/configuring-luna-hsm-software-on-aix/</link>
		<comments>http://geekcredential.wordpress.com/2010/09/29/configuring-luna-hsm-software-on-aix/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 14:35:29 +0000</pubDate>
		<dc:creator>msilverboard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Network Admin]]></category>
		<category><![CDATA[AIX]]></category>
		<category><![CDATA[HSM]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Luna]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://geekcredential.wordpress.com/?p=264</guid>
		<description><![CDATA[We&#8217;re using a Luna HSM with Tomcat running on IBM AIX to sign PDFs in a web application. There were a few extra steps required to get the Luna software working with Java that the setup instructions did not mention, so I&#8217;m documenting them here. The LunaSA software installed to /usr/lunasa. The Java Security Provider [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=264&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re using a Luna HSM with Tomcat running on IBM AIX to sign PDFs in a web application. There were a few extra steps required to get the Luna software working with Java that the setup instructions did not mention, so I&#8217;m documenting them here.</p>
<p>The LunaSA software installed to /usr/lunasa.  The Java Security Provider API for the Luna includes three files, which are found in /usr/lunasa/jsp/lib.  They are libLunaAPI.so, the native (C++ I presume) library for accessing the Luna; and LunaJCASP.jar and LunaJCESP.jar, which are the security providers for Java.</p>
<p>First, we verified that we had a randomness generator configured in the right directory, as described by the Luna setup instructions. Then we installed the software. Next we configured a trust relationship between the Luna and our server by exchanging certificates, as per instructions.</p>
<p>The additional steps were setting some environment variables for the user account that Tomcat runs with:</p>
<p><code>JAVA_OPTS</code> should include <code>-Djava.library.path=/usr/lunasa/jsp/lib/</code>. Putting the Luna library directory on java.library.path makes the native libLunaAPI.so library available to the Java Native Interface. If it is not there, any application trying to use the Luna API will throw an &#8221;UnsatisfiedLinkException&#8221;.</p>
<p><code>LIBPATH</code> should be set and should include <code>/usr/lunasa/jsp/lib/</code>. This is another way of getting the native Luna API library on java.library.path. It may not be necessary if the path is set in JAVA_OPTS.</p>
<p><code>CLASSPATH</code> should be set and should include  <code>/usr/lunasa/jsp/lib/LunaJCASP.jar</code> and <code>/usr/lunasa/jsp/lib/LunaJCESP.jar</code>. Contrary to our expectations, just having the jar files in the /lib folder of our war file didn&#8217;t seem to make the jar files available to our web app. Adding them to the Tomcat user&#8217;s classpath made everything work.</p>
<p>We are using the 64-bit Luna software with IBM Java 6, 64-bit. </p>
<br /> Tagged: <a href='http://geekcredential.wordpress.com/tag/aix/'>AIX</a>, <a href='http://geekcredential.wordpress.com/tag/hsm/'>HSM</a>, <a href='http://geekcredential.wordpress.com/tag/java/'>Java</a>, <a href='http://geekcredential.wordpress.com/tag/luna/'>Luna</a>, <a href='http://geekcredential.wordpress.com/tag/tomcat/'>Tomcat</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekcredential.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekcredential.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/geekcredential.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/geekcredential.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/geekcredential.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/geekcredential.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/geekcredential.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/geekcredential.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/geekcredential.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/geekcredential.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/geekcredential.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/geekcredential.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/geekcredential.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/geekcredential.wordpress.com/264/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=264&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekcredential.wordpress.com/2010/09/29/configuring-luna-hsm-software-on-aix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">geek</media:title>
		</media:content>
	</item>
		<item>
		<title>Signature With Timestamp Using iText and Luna HSM</title>
		<link>http://geekcredential.wordpress.com/2010/09/13/signature-with-timestamp-using-itext-and-luna-hsm/</link>
		<comments>http://geekcredential.wordpress.com/2010/09/13/signature-with-timestamp-using-itext-and-luna-hsm/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 19:40:03 +0000</pubDate>
		<dc:creator>msilverboard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Adobe CDS]]></category>
		<category><![CDATA[digital signature]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[HSM]]></category>
		<category><![CDATA[iText]]></category>
		<category><![CDATA[Luna]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://geekcredential.wordpress.com/?p=262</guid>
		<description><![CDATA[import java.security.KeyStore import java.security.MessageDigest import java.security.PrivateKey import java.security.cert.Certificate import com.itextpdf.text.pdf.PdfReader import com.itextpdf.text.pdf.PdfStamper import com.itextpdf.text.pdf.PdfSignatureAppearance import com.itextpdf.text.pdf.PdfName import com.itextpdf.text.Image import com.itextpdf.text.Rectangle import com.itextpdf.text.pdf.PdfEncryptor import com.itextpdf.text.pdf.PdfWriter import com.itextpdf.text.pdf.PdfSignature import com.itextpdf.text.pdf.PdfDate import com.itextpdf.text.pdf.TSAClient import com.itextpdf.text.pdf.TSAClientBouncyCastle import com.itextpdf.text.pdf.PdfPKCS7 import com.itextpdf.text.DocumentException import com.itextpdf.text.pdf.PdfDictionary import com.itextpdf.text.pdf.PdfString import com.chrysalisits.crypto.LunaTokenManager &#8230; String hsmPartitionLabel = "Luna_partition_name" String hsmPassword = "partition_password" String hsmKeyLabel = "private_key_alias" [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=262&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><code><br />
import java.security.KeyStore<br />
import java.security.MessageDigest<br />
import java.security.PrivateKey<br />
import java.security.cert.Certificate<br />
import com.itextpdf.text.pdf.PdfReader<br />
import com.itextpdf.text.pdf.PdfStamper<br />
import com.itextpdf.text.pdf.PdfSignatureAppearance<br />
import com.itextpdf.text.pdf.PdfName<br />
import com.itextpdf.text.Image<br />
import com.itextpdf.text.Rectangle<br />
import com.itextpdf.text.pdf.PdfEncryptor<br />
import com.itextpdf.text.pdf.PdfWriter<br />
import com.itextpdf.text.pdf.PdfSignature<br />
import com.itextpdf.text.pdf.PdfDate<br />
import com.itextpdf.text.pdf.TSAClient<br />
import com.itextpdf.text.pdf.TSAClientBouncyCastle<br />
import com.itextpdf.text.pdf.PdfPKCS7<br />
import com.itextpdf.text.DocumentException<br />
import com.itextpdf.text.pdf.PdfDictionary<br />
import com.itextpdf.text.pdf.PdfString<br />
import com.chrysalisits.crypto.LunaTokenManager<br />
</code><br />
&#8230;<br />
<code><br />
String hsmPartitionLabel = "Luna_partition_name"<br />
String hsmPassword = "partition_password"<br />
String hsmKeyLabel = "private_key_alias"<br />
String hsmCertLabel = "certificate_alias"<br />
String hsmCALabel = "CA_certificate_alias"<br />
String timestampUrl = "URL_of_timestamp_server"<br />
String ownerPassword = "PDF_owner_password"<br />
String inFile = "path_to_unsigned_PDF"<br />
String reason = "signature_reason"<br />
String location = "signature_location"<br />
String contact = "signature_contact_email"<br />
String sealPath = "path_to_an_image_to_be_used_with_signature"<br />
String outFile = "path_to_put_signed_PDF"</p>
<p>// Login to HSM<br />
LunaTokenManager tm = LunaTokenManager.getInstance()<br />
tm.Login(hsmPartitionLabel, hsmPassword)</p>
<p>// Dynamically load security providers<br />
Class providerClass = Class.forName("com.chrysalisits.crypto.LunaJCAProvider")<br />
java.security.Provider provider = (java.security.Provider)providerClass.newInstance()<br />
java.security.Security.removeProvider(provider.getName())<br />
java.security.Security.insertProviderAt(provider, 2)<br />
providerClass = Class.forName("com.chrysalisits.cryptox.LunaJCEProvider")<br />
provider = (java.security.Provider) providerClass.newInstance()<br />
java.security.Security.removeProvider(provider.getName())<br />
java.security.Security.insertProviderAt(provider, 3)</p>
<p>// This syntax gets an instance of a LunaKeystore<br />
KeyStore ks = KeyStore.getInstance("Luna")<br />
ks.load(null, null)<br />
PrivateKey key = (PrivateKey) ks.getKey(hsmKeyLabel, null)<br />
// We need to assemble the certificate chain manually because the HSM doesn't support the<br />
// getCertificateChain method.<br />
Certificate[] chain = new Certificate[2]<br />
chain[0] = ks.getCertificate(hsmCertLabel)<br />
chain[1] = ks.getCertificate(hsmCALabel)</p>
<p>// It seems necessary to load the file into the PdfReader this way to<br />
// avoid a java.io.IOException in sun.nio.ch.FileChannelImpl on AIX.<br />
byte[] content = new File(inFile).readBytes()<br />
PdfReader reader = new PdfReader(content, ownerPassword.getBytes())<br />
FileOutputStream fout = new FileOutputStream(outFile)<br />
// Third param is PDF revision (char).<br />
// Groovy thinks '' is a GString, so we have to be explicit and force it to char.<br />
PdfStamper stp = PdfStamper.createSignature(reader, fout, ''.toCharacter().charValue(), null, true)<br />
PdfSignatureAppearance sap = stp.getSignatureAppearance()<br />
// Instead of reason and location, a graphic image will be rendered. Reason and<br />
// location will still be shown in the signature properties.<br />
sap.setRenderingMode(PdfSignatureAppearance.RenderingMode.GRAPHIC)<br />
Image image = Image.getInstance(sealPath)<br />
sap.setSignatureGraphic(image)<br />
// sap.setVisibleSignature(new Rectangle(x-len, y-len, x-loc, y-loc), page, null for new fieldname)<br />
// Coordinates begin from lower left. Units are 1/72 of an inch. 8.5 x 11 in == 612 x 792<br />
sap.setVisibleSignature(new Rectangle(36, 36, 100, 100), 1, null)<br />
sap.setCrypto(key, chain, null, PdfSignatureAppearance.WINCER_SIGNED)</p>
<p>PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, new PdfName("adbe.pkcs7.detached"))<br />
dic.setReason(reason)<br />
dic.setLocation(location)<br />
dic.setContact(contact)<br />
dic.setDate(new PdfDate(sap.getSignDate()))<br />
sap.setCryptoDictionary(dic)</p>
<p>// This is estimated space for the signature itself.<br />
int contentEstimated = 15000<br />
HashMap exc = new HashMap()<br />
exc.put(PdfName.CONTENTS, new Integer(contentEstimated * 2 + 2))<br />
sap.preClose(exc)</p>
<p>// make the digest<br />
InputStream data = sap.getRangeStream()<br />
MessageDigest messageDigest = MessageDigest.getInstance("SHA1")<br />
byte[] buf = new byte[8192]<br />
int n<br />
while ((n = data.read(buf)) &gt; 0) {<br />
		messageDigest.update(buf, 0, n)<br />
}<br />
byte[] hash = messageDigest.digest()<br />
Calendar cal = Calendar.getInstance()</p>
<p>// If we add a time stamp:<br />
TSAClient tsc = null<br />
String tsa_url    = timestampUrl<br />
// Our provider does not use userid and password; use<br />
// TSAClientBouncyCastle(tsa_url, tsa_userid, tsa_password)<br />
// if yours does.<br />
tsc = new TSAClientBouncyCastle(tsa_url)</p>
<p>byte[] ocsp = null</p>
<p>// Create the signature<br />
PdfPKCS7 sgn = new PdfPKCS7(cert.key, cert.chain, null, "SHA1", null, false)<br />
byte[] sh = sgn.getAuthenticatedAttributeBytes(hash, cal, ocsp)<br />
sgn.update(sh, 0, sh.length)<br />
byte[] encodedSig = sgn.getEncodedPKCS7(hash, cal, tsc, ocsp)</p>
<p>if (contentEstimated + 2 &lt; encodedSig.length)<br />
		throw new DocumentException(&quot;Not enough space&quot;)</p>
<p>byte[] paddedSig = new byte[contentEstimated]<br />
System.arraycopy(encodedSig, 0, paddedSig, 0, encodedSig.length)<br />
// Replace the contents<br />
PdfDictionary dic2 = new PdfDictionary()<br />
dic2.put(PdfName.CONTENTS, new PdfString(paddedSig).setHexWriting(true))<br />
sap.close(dic2)</p>
<p>tm.Logout()</p>
<p>println &quot;Signed PDF saved as ${outFile}.&quot;<br />
</code></p>
<br /> Tagged: <a href='http://geekcredential.wordpress.com/tag/adobe-cds/'>Adobe CDS</a>, <a href='http://geekcredential.wordpress.com/tag/digital-signature/'>digital signature</a>, <a href='http://geekcredential.wordpress.com/tag/groovy/'>Groovy</a>, <a href='http://geekcredential.wordpress.com/tag/hsm/'>HSM</a>, <a href='http://geekcredential.wordpress.com/tag/itext/'>iText</a>, <a href='http://geekcredential.wordpress.com/tag/luna/'>Luna</a>, <a href='http://geekcredential.wordpress.com/tag/pdf/'>PDF</a>, <a href='http://geekcredential.wordpress.com/tag/timestamp/'>timestamp</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekcredential.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekcredential.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/geekcredential.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/geekcredential.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/geekcredential.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/geekcredential.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/geekcredential.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/geekcredential.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/geekcredential.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/geekcredential.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/geekcredential.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/geekcredential.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/geekcredential.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/geekcredential.wordpress.com/262/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=262&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekcredential.wordpress.com/2010/09/13/signature-with-timestamp-using-itext-and-luna-hsm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">geek</media:title>
		</media:content>
	</item>
		<item>
		<title>Signing a PDF with iText and a Luna HSM</title>
		<link>http://geekcredential.wordpress.com/2010/09/13/signing-a-pdf-with-itext-and-a-luna-hsm/</link>
		<comments>http://geekcredential.wordpress.com/2010/09/13/signing-a-pdf-with-itext-and-a-luna-hsm/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 19:22:34 +0000</pubDate>
		<dc:creator>msilverboard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Adobe CDS]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[HSM]]></category>
		<category><![CDATA[iText]]></category>
		<category><![CDATA[Luna]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://geekcredential.wordpress.com/?p=259</guid>
		<description><![CDATA[After obtaining a trial of a Certificate for Adobe CDS, which is only delivered on a hardware storage module (HSM) or a USB key, I had some difficulties adapting the iText examples for signing a PDF to work with the API for the HSM. The code below is the result of trial-and-error. It is based [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=259&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After obtaining a trial of a Certificate for Adobe CDS, which is only delivered on a hardware storage module (HSM) or a USB key, I had some difficulties adapting the iText examples for signing a PDF to work with the API for the HSM.  The code below is the result of trial-and-error. It is based on the examples provided for iText at <a href="http://itextpdf.com/book/examples.php#chapter12">http://itextpdf.com/book/examples.php#chapter12</a>.</p>
<p>I have been told that there is a naming convention for certificates on the HSM that, if followed, makes the KeyStore.getCertificateChain() method usable: The labels for each certificate should all start the same way (in this case, it would be &#8216;mycert&#8217;) and followed by the suffix &#8216;&#8211;cert#&#8217;, where # is the number of the certificate in the chain. In this instance, it would be something like this:</p>
<ul>
<li>mycert&#8211;cert0 (Adobe CDS certificate)</li>
<li>mycert&#8211;cert1 (GlobalSign CA for Adobe certificate)</li>
<li>mycert&#8211;cert2 (Adobe Root CA certificate)</li>
</ul>
<p>If it works, that should make it unnecessary to create the certificate chan manually, as is done in this example.  </p>
<p>This example uses Groovy, but it should translate almost directly to Java.</p>
<p><code><br />
import java.security.KeyStore<br />
import java.security.MessageDigest<br />
import java.security.PrivateKey<br />
import java.security.cert.Certificate<br />
import com.itextpdf.text.pdf.PdfReader<br />
import com.itextpdf.text.pdf.PdfStamper<br />
import com.itextpdf.text.pdf.PdfSignatureAppearance<br />
import com.itextpdf.text.pdf.PdfName<br />
import com.itextpdf.text.Image<br />
import com.itextpdf.text.Rectangle<br />
import com.itextpdf.text.pdf.PdfEncryptor<br />
import com.itextpdf.text.pdf.PdfWriter<br />
import com.itextpdf.text.pdf.PdfSignature<br />
import com.itextpdf.text.pdf.PdfDate<br />
import com.itextpdf.text.pdf.TSAClient<br />
import com.itextpdf.text.pdf.TSAClientBouncyCastle<br />
import com.itextpdf.text.pdf.PdfPKCS7<br />
import com.itextpdf.text.DocumentException<br />
import com.itextpdf.text.pdf.PdfDictionary<br />
import com.itextpdf.text.pdf.PdfString<br />
import com.chrysalisits.crypto.LunaTokenManager<br />
</code><br />
&#8230;<br />
<code><br />
String hsmPartitionLabel = "Luna_partition_name"<br />
String hsmPassword = "partition_password"<br />
String hsmKeyLabel = "private_key_alias"<br />
String hsmCertLabel = "certificate_alias"<br />
String hsmCALabel = "CA_certificate_alias"<br />
String ownerPassword = "PDF_owner_password"<br />
String inFile = "path_to_unsigned_PDF"<br />
String reason = "signature_reason"<br />
String location = "signature_location"<br />
String contact = "signature_contact_email"<br />
String sealPath = "path_to_an_image_to_be_used_with_signature"<br />
String outFile = "path_to_put_signed_PDF"</p>
<p>// Login to HSM<br />
LunaTokenManager tm = LunaTokenManager.getInstance()<br />
tm.Login(hsmPartitionLabel, hsmPassword)</p>
<p>// Dynamically load security providers<br />
Class providerClass = Class.forName("com.chrysalisits.crypto.LunaJCAProvider")<br />
java.security.Provider provider = (java.security.Provider)providerClass.newInstance()<br />
java.security.Security.removeProvider(provider.getName())<br />
java.security.Security.insertProviderAt(provider, 2)<br />
providerClass = Class.forName("com.chrysalisits.cryptox.LunaJCEProvider")<br />
provider = (java.security.Provider) providerClass.newInstance()<br />
java.security.Security.removeProvider(provider.getName())<br />
java.security.Security.insertProviderAt(provider, 3)</p>
<p>// This syntax gets an instance of a LunaKeystore<br />
KeyStore ks = KeyStore.getInstance("Luna")<br />
ks.load(null, null)<br />
PrivateKey key = (PrivateKey) ks.getKey(hsmKeyLabel, null)<br />
// We need to assemble the certificate chain manually because the HSM doesn't support the<br />
// getCertificateChain method.<br />
Certificate[] chain = new Certificate[2]<br />
chain[0] = ks.getCertificate(hsmCertLabel)<br />
chain[1] = ks.getCertificate(hsmCALabel)</p>
<p>// It seems necessary to load the file into the PdfReader this way to<br />
// avoid a java.io.IOException in sun.nio.ch.FileChannelImpl on AIX.<br />
byte[] content = new File(inFile).readBytes()<br />
PdfReader reader = new PdfReader(content, ownerPassword.getBytes())<br />
FileOutputStream fout = new FileOutputStream(outFile)<br />
// Third param is PDF revision (char).<br />
// Groovy thinks '' is a GString, so we have to be explicit and force it to char.<br />
PdfStamper stp = PdfStamper.createSignature(reader, fout, ''.toCharacter().charValue(), null, true)<br />
PdfSignatureAppearance sap = stp.getSignatureAppearance()<br />
sap.setCrypto(cert.key, cert.chain, null, PdfSignatureAppearance.WINCER_SIGNED)<br />
// Instead of reason and location, a graphic image will be rendered. Reason and<br />
// location will still be shown in the signature properties.<br />
sap.setRenderingMode(PdfSignatureAppearance.RenderingMode.GRAPHIC)<br />
sap.setReason(reason)<br />
sap.setLocation(location)<br />
sap.setContact(contact)<br />
Image image = Image.getInstance(sealPath)<br />
sap.setSignatureGraphic(image)<br />
// sap.setVisibleSignature(new Rectangle(x-len, y-len, x-loc, y-loc), page, null for new fieldname)<br />
// Coordinates begin from lower left. Units are 1/72 of an inch. 8.5 x 11 in == 612 x 792<br />
sap.setVisibleSignature(new Rectangle(36, 36, 100, 100), 1, null)<br />
stp.close()</p>
<p>tm.Logout()</p>
<p>println "Signed PDF saved as ${outFile}."<br />
</code></p>
<br /> Tagged: <a href='http://geekcredential.wordpress.com/tag/adobe-cds/'>Adobe CDS</a>, <a href='http://geekcredential.wordpress.com/tag/groovy/'>Groovy</a>, <a href='http://geekcredential.wordpress.com/tag/hsm/'>HSM</a>, <a href='http://geekcredential.wordpress.com/tag/itext/'>iText</a>, <a href='http://geekcredential.wordpress.com/tag/luna/'>Luna</a>, <a href='http://geekcredential.wordpress.com/tag/pdf/'>PDF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekcredential.wordpress.com/259/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekcredential.wordpress.com/259/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/geekcredential.wordpress.com/259/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/geekcredential.wordpress.com/259/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/geekcredential.wordpress.com/259/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/geekcredential.wordpress.com/259/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/geekcredential.wordpress.com/259/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/geekcredential.wordpress.com/259/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/geekcredential.wordpress.com/259/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/geekcredential.wordpress.com/259/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/geekcredential.wordpress.com/259/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/geekcredential.wordpress.com/259/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/geekcredential.wordpress.com/259/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/geekcredential.wordpress.com/259/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=259&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekcredential.wordpress.com/2010/09/13/signing-a-pdf-with-itext-and-a-luna-hsm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">geek</media:title>
		</media:content>
	</item>
		<item>
		<title>Material Spam: Opting Out of AJC Reach</title>
		<link>http://geekcredential.wordpress.com/2010/08/16/material-spam-opting-out-of-ajc-reach/</link>
		<comments>http://geekcredential.wordpress.com/2010/08/16/material-spam-opting-out-of-ajc-reach/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 20:16:41 +0000</pubDate>
		<dc:creator>msilverboard</dc:creator>
				<category><![CDATA[Stop Spam]]></category>
		<category><![CDATA[AJC Reach]]></category>
		<category><![CDATA[litter]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://geekcredential.wordpress.com/?p=255</guid>
		<description><![CDATA[It seems like AJC Reach, the division of the Atlanta Journal-Constitution that deposits a roll of ads on our driveways, has upped their delivery rate to twice per week recently. I&#8217;m getting a little tired of picking up soggy litter from my driveway, so I&#8217;ve been trying to find out who to contact to stop [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=255&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It seems like AJC Reach, the division of the Atlanta Journal-Constitution that deposits a roll of ads on our driveways, has upped their delivery rate to twice per week recently.  I&#8217;m getting a little tired of picking up soggy litter from my driveway, so I&#8217;ve been trying to find out who to contact to stop deliveries.  </p>
<p>I used the <a href="http://projects.ajc.com/customercare/contact-reach/">contact form</a> provided on the AJC Reach website, but that didn&#8217;t seem to get any results.  Luckily, I found a <a href="http://www.stopajcreach.org/2010/08/reader-mail-how-to-opt-out-of-ajc-reach-distribution/comment-page-1/#comment-297">number for the Senior VP for Circulation at the AJC</a> posted at StopAJCReach.org and was able to contact a person in his office who took down my address and name and promised to have the deliveries stopped.  Maybe this will be useful to others who want to opt out too.</p>
<br /> Tagged: <a href='http://geekcredential.wordpress.com/tag/ajc-reach/'>AJC Reach</a>, <a href='http://geekcredential.wordpress.com/tag/litter/'>litter</a>, <a href='http://geekcredential.wordpress.com/tag/spam/'>spam</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekcredential.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekcredential.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/geekcredential.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/geekcredential.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/geekcredential.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/geekcredential.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/geekcredential.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/geekcredential.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/geekcredential.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/geekcredential.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/geekcredential.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/geekcredential.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/geekcredential.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/geekcredential.wordpress.com/255/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=255&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekcredential.wordpress.com/2010/08/16/material-spam-opting-out-of-ajc-reach/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">geek</media:title>
		</media:content>
	</item>
		<item>
		<title>Browser Redisplaying Old PDFs: How to Manage Caching of Dynamically Generated Documents</title>
		<link>http://geekcredential.wordpress.com/2010/07/26/browser-redisplaying-old-pdfs-how-to-manage-caching-of-dynamically-generated-documents/</link>
		<comments>http://geekcredential.wordpress.com/2010/07/26/browser-redisplaying-old-pdfs-how-to-manage-caching-of-dynamically-generated-documents/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 18:03:12 +0000</pubDate>
		<dc:creator>msilverboard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[browser caching]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[Grails hacks]]></category>

		<guid isPermaLink="false">http://geekcredential.wordpress.com/?p=243</guid>
		<description><![CDATA[Last year, I shared an approach for serving PDFs or other content over SSL from a Grails application in a way that wouldn&#8217;t fail due to browser caching constraints. We have used the same approach in several of our controllers to share PDF reports of different kinds, and recently, we encountered a related problem: when [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=243&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last year, I shared <a href="http://geekcredential.wordpress.com/2009/04/21/grails-file-serving-controller-and-tomcat-ssl-problem/">an approach for serving PDFs or other content over SSL</a> from a Grails application in a way that wouldn&#8217;t fail due to browser caching constraints.</p>
<p>We have used the same approach in several of our controllers to share PDF reports of different kinds, and recently, we encountered a related problem: when users requested different PDFs in a short enough time frame, their browser was serving up cached versions of previous PDFs. To the user, it appeared like the web application was sending them an unrelated report.</p>
<p>Once I identified the problem as browser caching &#8211; which was not immediately evident! &#8211; I developed an approach to solve the problem.</p>
<p>First, I shortened the amount of time the browser was instructed to cache the content.  In <a href="http://geekcredential.wordpress.com/2009/04/21/grails-file-serving-controller-and-tomcat-ssl-problem/">my previous example</a>, the browser was instructed to keep the downloaded PDF for 5 minutes:</p>
<p><code><br />
response.setHeader("Cache-Control", "private")<br />
Calendar cal = Calendar.getInstance()<br />
cal.add(Calendar.MINUTE,5)<br />
response.setDateHeader("Expires", cal.getTimeInMillis())<br />
</code></p>
<p>I changed the time to 10 seconds.</p>
<p>I also reasoned that if the filename of each PDF is unique, the browser will not mistake a new PDF for an old one. In our code, we were assigning a fixed name to all output:</p>
<p><code>response.setHeader("Content-Disposition", "inline; filename=report.pdf")</code></p>
<p>Also, the URL was always the same &#8211; and some browsers ignore the content-disposition and name downloaded files using the URI.  (E.g., http://host/contextRoot/pageName becomes pageName.pdf.)  </p>
<p>I used a Grails hack to provide a unique URI for every file: in place of supplying a name:value parameter on the querystring (e.g., http://somepath?id=18), Grails lets you pass an id parameter on the URL itself (e.g., http://somepath/18).  By including a unique value in the id parameter, even one that isn&#8217;t used by my application, we fool browsers into thinking that each PDF download is unique.  In other words, http://somepath/18 gets saved as 18.pdf.  I also put a unique name in the content-disposition header.</p>
<p>In this example from our web application, we are displaying the PDF and making it available for download by embedding it with an object tag in another html page.  This is where I added the id parameter:</p>
<p><code><br />
  &lt;object type="application/pdf"<br />
          name="showpdf" id="showpdf"<br />
          data="${createLink(action: 'getPDF', params:[id: params.unqid?.encodeAsHTML()])}"<br />
          style="width: 800px; height: 800px; border: solid 1px #cccccc;<br />
            background: url(${createLinkTo(dir: 'images', file: 'docloading.png')})<br />
              top center no-repeat;"&gt;<br />
    &lt;p class="error"&gt;It appears that your web browser is not configured to display PDF files.<br />
   &lt;g:link controller="userHelp" action="index"&gt;Click&lt;/g:link&gt; for more information.&lt;/p&gt;<br />
  &lt;/object&gt;<br />
</code></p>
<p>Note that this object tag calls the getPDF action to supply the content of the object.  Here&#8217;s the getPDF action:</p>
<p><code><br />
  def getPDF = {<br />
    try {<br />
      if (!session.pdffile) {<br />
        throw new Exception("Document path not found on session. Unable to retrieve report.")<br />
      }<br />
      def unqid = params.id<br />
      if (!unqid) {<br />
        throw new Exception("Unique report id not provided in parameters.")<br />
      }<br />
      def pdfFile = new File(session.pdffile)<br />
      def b = pdfFile.readBytes()<br />
      response.setContentType("application/pdf")<br />
      response.setHeader("Content-Disposition", "inline; filename=${unqid}.pdf")<br />
      response.setContentLength(b.length)<br />
      response.setHeader("Pragma", "")<br />
      response.setHeader("Cache-Control", "private")<br />
      Calendar cal = Calendar.getInstance()<br />
      cal.add(Calendar.SECOND, 10)<br />
      response.setDateHeader("Expires", cal.getTimeInMillis())<br />
      response.outputStream &lt;&lt; b<br />
    } catch (Throwable t) {<br />
      log.fatal &quot;&quot;&quot;Failure retrieving report document&quot;&quot;&quot;.toString(), t<br />
      flash.error = &quot;Failure retrieving report document: ${t.message}&quot;<br />
      render(view: &quot;errframe&quot;)<br />
    }<br />
  }<br />
</code></p>
<p>Between the shortened expiration time and providing a unique filename, I think we covered every case where a client browser might re-serve old downloads.  At least, this was tested and worked on IE 8, Chrome, and Firefox 3.6.7.</p>
<p>[October 4, 2010] Postscript: Further experimenting has shown that Grails seems to ignore anything on the URL after the action name.  I&#8217;m able to name the file anything I want using this expression for the URL to the file: <code>${createLink(action: 'getPDF')}/${filename}</code>.  I don&#8217;t have to resort to using an id param.</p>
<br /> Tagged: <a href='http://geekcredential.wordpress.com/tag/browser-caching/'>browser caching</a>, <a href='http://geekcredential.wordpress.com/tag/grails/'>Grails</a>, <a href='http://geekcredential.wordpress.com/tag/grails-hacks/'>Grails hacks</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekcredential.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekcredential.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/geekcredential.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/geekcredential.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/geekcredential.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/geekcredential.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/geekcredential.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/geekcredential.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/geekcredential.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/geekcredential.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/geekcredential.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/geekcredential.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/geekcredential.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/geekcredential.wordpress.com/243/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=243&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekcredential.wordpress.com/2010/07/26/browser-redisplaying-old-pdfs-how-to-manage-caching-of-dynamically-generated-documents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">geek</media:title>
		</media:content>
	</item>
		<item>
		<title>Split a PDF into pages with PdfStamper (iText)</title>
		<link>http://geekcredential.wordpress.com/2010/06/21/finding-signature-fields-in-a-split-page/</link>
		<comments>http://geekcredential.wordpress.com/2010/06/21/finding-signature-fields-in-a-split-page/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 19:07:29 +0000</pubDate>
		<dc:creator>msilverboard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[iText]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://geekcredential.wordpress.com/?p=239</guid>
		<description><![CDATA[More help from the iText Questions List: Finding signature fields in a split page Tagged: Groovy, iText, PDF<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=239&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>More help from the iText Questions List:</p>
<p><a href="http://itext-general.2136553.n4.nabble.com/Finding-signature-fields-in-a-split-page-td2262716.html#a2263173">Finding signature fields in a split page</a></p>
<br /> Tagged: <a href='http://geekcredential.wordpress.com/tag/groovy/'>Groovy</a>, <a href='http://geekcredential.wordpress.com/tag/itext/'>iText</a>, <a href='http://geekcredential.wordpress.com/tag/pdf/'>PDF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekcredential.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekcredential.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/geekcredential.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/geekcredential.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/geekcredential.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/geekcredential.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/geekcredential.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/geekcredential.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/geekcredential.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/geekcredential.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/geekcredential.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/geekcredential.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/geekcredential.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/geekcredential.wordpress.com/239/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekcredential.wordpress.com&amp;blog=6748720&amp;post=239&amp;subd=geekcredential&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekcredential.wordpress.com/2010/06/21/finding-signature-fields-in-a-split-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">geek</media:title>
		</media:content>
	</item>
	</channel>
</rss>
