<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-241881619290465654</id><updated>2012-02-16T01:33:42.524-08:00</updated><category term='bitbucket'/><category term='mercurical'/><category term='software'/><title type='text'>README.txt</title><subtitle type='html'>Notes on software tech with a special focus on image processing, pattern recognition/machine learning, java open source tools, and high performance computing.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-7475694678303990138</id><published>2010-08-19T17:24:00.000-07:00</published><updated>2010-08-19T17:24:10.187-07:00</updated><title type='text'>Analog makes a comeback?</title><content type='html'>Sounds like a cool idea . . . &lt;a href="http://arstechnica.com/hardware/news/2010/08/probabilistic-processors-possibly-potent.ars"&gt;Probabilistic processors possibly pack potent punch&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-7475694678303990138?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://arstechnica.com/hardware/news/2010/08/probabilistic-processors-possibly-potent.ars' title='Analog makes a comeback?'/><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/7475694678303990138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2010/08/analog-makes-comeback.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/7475694678303990138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/7475694678303990138'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2010/08/analog-makes-comeback.html' title='Analog makes a comeback?'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-1448711732362704086</id><published>2010-07-29T07:18:00.001-07:00</published><updated>2010-07-29T07:23:09.245-07:00</updated><title type='text'>Intel, AMD, NVIDIA and High Performance Computing</title><content type='html'>&lt;p&gt;In the past few weeks we've had a few conversations at work with engineers from ATI/AMD, Intel, and NVIDIA about their offerings for high performance computing.  &lt;/p&gt;

&lt;p&gt;Intel is really pushing their Ct software framework and its benefits around code maintainability.  It is basically C++ and it abstracts away the need for hardware-specific low level code.  For example, to add two 2-d arrays together, you can just write code like:&lt;/p&gt;
&lt;pre brush="c"&gt;
resultArray = array1 + array2;
&lt;/pre&gt;
&lt;p&gt;No need for low level intrinsics to access the SIMD instruction sets.  Ct also supports other higher level abstractions like list homomorphisms.  So theoretically, your code can use nice high level data abstractions and it will run fast.  As new CPU features are added in the future, your same codebase will take advantage of them through Ct.&lt;/p&gt;

&lt;p&gt;As one might expect, Ct is really aimed at intel cpu-like architectures and not GPUs.  Intel does a good job explaining the kinds of algorithms and applications in its sweet spot in its whitepaper  (&lt;a href="http://techresearch.intel.com/UserFiles/en-us/File/terascale/Whitepaper-Ct.pdf"&gt;http://techresearch.intel.com/UserFiles/en-us/File/terascale/Whitepaper-Ct.pdf&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Now, it sounded to me like the Intel team was saying that Ct would also generate code for GPUs.  But as the whitepaper describes, it seeems to me that your algorithm would still need to conform to the limitations and advantages of the GPU in order to run fast on the GPU.&lt;/p&gt;

&lt;p&gt;So for now, I believe that data parallel algorithms that are suited to the GPU will probably need to be implemented using NVIDIA's CUDA or OpenCl.  One interesting tidbit was that NVIDIA claimed to us that their OpenCL drivers should run just as fast as their CUDA drivers.  You might expect that NVIDIA would neglect OpenCL.  CUDA has a strong following already and it gives NVIDIA some vendor lock-in since CUDA is NVIDIA only.  But NVIDIA says they want to differentiate and sell their products on hardware performance not through software API lock-in, which of course, is a good thing and something we developers are happy to hear.  Assuming this is true, I think that OpenCl is very attractive since can run on ATI, NVIDIA, or even CPU architectures with the same codebase.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-1448711732362704086?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/1448711732362704086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2010/07/intel-amd-nvidia-and-high-performance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/1448711732362704086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/1448711732362704086'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2010/07/intel-amd-nvidia-and-high-performance.html' title='Intel, AMD, NVIDIA and High Performance Computing'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-228071019373837270</id><published>2010-04-30T07:28:00.000-07:00</published><updated>2010-05-05T05:40:20.395-07:00</updated><title type='text'>Interest in Google App Engine and Google Web Toolkit Around the World</title><content type='html'>My postings on the Google Web Toolkit and Google App Engine have generated traffic that would be considered very meager by many standards, but I thought it was enough to see some interesting trends in where these Google tools are being used around the world.  This is from my Google Web Analytics account:
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R3oZVH9aohs/S9rqFw_rCkI/AAAAAAAACwA/z-WQFqxhxy0/s1600/visitsToMySite.PNG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 237px;" src="http://3.bp.blogspot.com/_R3oZVH9aohs/S9rqFw_rCkI/AAAAAAAACwA/z-WQFqxhxy0/s400/visitsToMySite.PNG" border="0" alt=""id="BLOGGER_PHOTO_ID_5465938482539727426" /&gt;&lt;/a&gt;
The top countries are:
&lt;ol&gt;
&lt;li&gt;USA&lt;/li&gt;
&lt;li&gt;United Kingdom&lt;/li&gt;
&lt;li&gt;India&lt;/li&gt;
&lt;li&gt;Germany&lt;/li&gt;
&lt;li&gt;Brazil&lt;/li&gt;
&lt;li&gt;Colombia&lt;/li&gt;
&lt;li&gt;Latvia&lt;/li&gt;
&lt;li&gt;France&lt;/li&gt;
&lt;li&gt;Australia&lt;/li&gt;
&lt;li&gt;Ukraine&lt;/li&gt;
&lt;/ol&gt;
Some interesting places on that list!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-228071019373837270?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/228071019373837270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2010/04/interest-in-google-app-engine-and.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/228071019373837270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/228071019373837270'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2010/04/interest-in-google-app-engine-and.html' title='Interest in Google App Engine and Google Web Toolkit Around the World'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_R3oZVH9aohs/S9rqFw_rCkI/AAAAAAAACwA/z-WQFqxhxy0/s72-c/visitsToMySite.PNG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-7563378788527266162</id><published>2010-04-30T07:08:00.000-07:00</published><updated>2010-04-30T07:11:28.013-07:00</updated><title type='text'>Hey, my blog is useful!</title><content type='html'>My &lt;a href="http://peterkenji.blogspot.com/2009/08/using-apache-httpclient-4-with-google.html"&gt;post on getting Apache HttpClient working with Google App Engine&lt;/a&gt; is referenced from &lt;a href="http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine?pli=1"&gt;one of Google's official FAQ pages&lt;/a&gt; (the "Will It Play with Google App Engine" page)!  I feel special.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-7563378788527266162?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/7563378788527266162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2010/04/hey-my-blog-is-useful.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/7563378788527266162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/7563378788527266162'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2010/04/hey-my-blog-is-useful.html' title='Hey, my blog is useful!'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-7537395443342015351</id><published>2010-04-30T07:05:00.000-07:00</published><updated>2010-04-30T08:05:44.762-07:00</updated><title type='text'>Passing JVM arguments for junit with maven</title><content type='html'>Every time I need to do this, google leads me to &lt;a href="http://maven.apache.org/maven-1.x/plugins/test/properties.html"&gt;this help page&lt;/a&gt;, which leads me to the following command, which does &lt;span style="font-weight:bold;"&gt;NOT &lt;/span&gt;work (at least not on my version of Maven):

&lt;pre class="brush: java"&gt;
mvn -Dmaven.junit.jvmargs=-verbose test
&lt;/pre&gt;

The proper help page is for &lt;a href="http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html"&gt;the surefire plugin&lt;/a&gt;.  So the proper way to do it is:

&lt;pre class="brush: java"&gt;
mvn -DargLine=-verbose test
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-7537395443342015351?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/7537395443342015351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2010/04/passing-jvm-arguments-for-junit-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/7537395443342015351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/7537395443342015351'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2010/04/passing-jvm-arguments-for-junit-with.html' title='Passing JVM arguments for junit with maven'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-4862742951864744992</id><published>2010-04-30T07:01:00.000-07:00</published><updated>2010-04-30T07:05:54.363-07:00</updated><title type='text'>Parallel Computing benchmarks</title><content type='html'>I've been doing some benchmarking and hope to post some results soon.  I have some simple, easily-parallelized code that I've been trying different computing architectures on.  These include:
&lt;ul&gt;
&lt;li&gt;Single threaded java&lt;/li&gt;
&lt;li&gt;Single threaded C&lt;/li&gt;
&lt;li&gt;Multithreaded java&lt;/li&gt;
&lt;li&gt;Multithreaded C&lt;/li&gt;
&lt;li&gt;Vectorized C using x64 SSE Instructions&lt;/li&gt;
&lt;li&gt;Multi-core computing on an NVIDIA GPU with CUDA&lt;/li&gt;
&lt;/ul&gt;
It's been an interesting experiment and hopefully I can post results soon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-4862742951864744992?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/4862742951864744992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2010/04/parallel-computing-benchmarks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/4862742951864744992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/4862742951864744992'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2010/04/parallel-computing-benchmarks.html' title='Parallel Computing benchmarks'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-1702838736047608626</id><published>2010-03-19T12:06:00.001-07:00</published><updated>2010-03-19T12:09:47.378-07:00</updated><title type='text'>Installing Java Plugin for Firefox on ubuntu</title><content type='html'>&lt;p&gt;
After reading a bunch of confusing articles describing how to install the java plugin into Firebox on Ubuntu Linux 9.04, I found that there is already a package for it:
&lt;/p&gt;

&lt;pre class="brush: bash"&gt;
sudo apt-get install sun-java6-plugin
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-1702838736047608626?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/1702838736047608626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2010/03/installing-java-plugin-for-firefox-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/1702838736047608626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/1702838736047608626'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2010/03/installing-java-plugin-for-firefox-on.html' title='Installing Java Plugin for Firefox on ubuntu'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-6643570993285901458</id><published>2010-03-18T08:10:00.000-07:00</published><updated>2010-03-18T08:31:36.127-07:00</updated><title type='text'>GWT and Spring / Acegi Security</title><content type='html'>&lt;p&gt;
Using Spring Security with GWT is fairly easy . . . just protect your GWT page and its associated servlets.  
&lt;/p&gt;

&lt;p&gt;
But one tricky thing is handling expired logins.  When your user's login expires, they may be in the middle of using your web application.  They will probably click some widget that will generate a call to the server.  Because the login has expired, Spring Security will return your login page instead the expected server response.  So you need to set up your GWT client code to handle this.
&lt;/p&gt;

&lt;p&gt;
I got some good tips on how to do this &lt;a href="http://www.dotnetguru2.org/bmarchesson/index.php/2007/04/23/technical_tip_using_acegi_with_gwt"&gt;on this page&lt;/a&gt;, but to make the ideas contained there a little more concrete, let me give some example code.
&lt;/p&gt;

&lt;p&gt;
In my case, I wrapped the DisplayCallback class from the &lt;a href="http://code.google.com/p/gwt-presenter/"&gt;GWT Presenter&lt;/a&gt; library, but you should be able to apply these ideas to any gwt AsyncCallback.
&lt;/p&gt;

&lt;pre class="brush: java"&gt;

/**
 * This is a special version of DisplayCallback that will handle Spring/Acegi
 * security errors.  If a 403 Access Denied errors occurs, the user will be
 * shown an error message.  If the server returns a Login page, that means the
 * user's login has presumably expired, so we direct the browser to redirect
 * to our login page.
 * 
 * Credit for these ideas comes from here:  
 * http://www.dotnetguru2.org/bmarchesson/index.php/2007/04/23/technical_tip_using_acegi_with_gwt
 * 
 */
public abstract class MyDisplayCallback&amp;lt;T&gt; extends DisplayCallback&amp;lt;T&gt; {

 private static final String SERVER_ERROR = "An error occurred while "
  + "attempting to contact the server. Please check your network "
  + "connection and try again.";

 public StatProjDisplayCallback(Display display) {
  super(display);
 }
 
 @Override
 protected final void handleFailure(Throwable cause) {
  
  doCleanup();
  
  String errorMessage = cause.toString();
  if (errorMessage.indexOf("403") != -1)
  {
   // Access denied for this role
   Log.debug("login invalid for this resource");
   if (GWT.isClient()) {
    Window.alert("Access denied");
   }
  }
  else if (errorMessage.indexOf("Login") != -1)
  {
   Log.debug("login expired, showing login dialog");
   if (GWT.isClient()) {
    Window.Location.assign("login.jsp?relogin=true");
   }
  }
  else
  { 
   Log.error("Handle Failure:", cause);

   Window.alert(SERVER_ERROR);
  }
  
 }
 
 /**
  * This method can be overriden to include code that should run in case the server call fails.  
  * This method will be called by handleFailure()
  */
 protected void doCleanup() {};

 @Override
 protected abstract void handleSuccess(T value);

}

&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-6643570993285901458?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/6643570993285901458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2010/03/gwt-and-spring-acegi-security.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/6643570993285901458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/6643570993285901458'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2010/03/gwt-and-spring-acegi-security.html' title='GWT and Spring / Acegi Security'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-6584240228831445047</id><published>2010-03-18T07:53:00.000-07:00</published><updated>2010-03-18T07:55:46.908-07:00</updated><title type='text'>favicon.ico and spring/acegi security</title><content type='html'>Don't forget to whitelist favicon.ico in your security.xml file.  Otherwise, when visiting your site, you may be asked to log in, and then you will just be shown a web page consisting only of your little favicon.ico image, which looks pretty weird.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-6584240228831445047?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/6584240228831445047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2010/03/faviconico-and-springacegi-security.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/6584240228831445047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/6584240228831445047'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2010/03/faviconico-and-springacegi-security.html' title='favicon.ico and spring/acegi security'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-3318176913202651455</id><published>2010-03-18T07:35:00.000-07:00</published><updated>2010-03-18T07:38:22.350-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mercurical'/><category scheme='http://www.blogger.com/atom/ns#' term='bitbucket'/><title type='text'>BitBucket</title><content type='html'>I use bitbucket.org to store my mercurial projects.  It works fine for simple pulls/pushes and it has a nice web interface.  My one complaint is that sometimes it is very slow.  This is not a big deal for pull/push since I don't do that a whole lot.  But I've also been using bitbucket's issue tracking features and sometimes that is unusable (it can take over 2 minutes to bring up an issue report).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-3318176913202651455?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/3318176913202651455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2010/03/bitbucket.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/3318176913202651455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/3318176913202651455'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2010/03/bitbucket.html' title='BitBucket'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-4081482975899905993</id><published>2009-12-15T20:01:00.000-08:00</published><updated>2009-12-15T20:12:15.103-08:00</updated><title type='text'>Building OpenCV 2.0 with Visual Studio C++ 2008 Express Edition</title><content type='html'>&lt;p&gt;Hopefully I will spiff this post up with some screenshots, but for now, let me just quickly note the steps that were required to get this to build.&lt;/p&gt;
&lt;p&gt;
&lt;ol&gt;
&lt;li&gt;
Download and install VS C++ Express Edition
&lt;/li&gt;
&lt;li&gt;
Download and install CMake.  When the install asks, don't bother having it put on your System Path.
&lt;/li&gt;
&lt;li&gt;
Download and install OpenCV 2.0.  There is a Windows installer.  &lt;strong&gt;Note:  This does not install a working open cv library . . . it is just the source files.&lt;/strong&gt;  Again, don't bother having the installer put OpenCV on your system path.
&lt;/li&gt;
&lt;li&gt;
Run the CMake GUI in your CMake installation.  For the source directory, indicate the OpenCV directory (probably C:\OpenCV2.0).  For the build directory, specify a build directory that you've created (recommended:  C:\OpenCV2.0\release).
&lt;/li&gt;
&lt;li&gt;
Click the Configure button.
&lt;/li&gt;
&lt;li&gt;
In the configuration options, disable OpenMP.  You probably won't have this if you are using VS C++ Express Edition.
&lt;/li&gt;
&lt;li&gt;
Click the Configure button again.  Then click Generate.
&lt;/li&gt;
&lt;li&gt;
Go to your build directory (C:\OpenCV2.0\release).  Open the Visual Studio Solution file.  Once you're in Visual Studio, build the project (f7).  This will take a while.
&lt;/li&gt;
&lt;li&gt;
You're done.  When you create new projects, use the Lib and Include files in your build directory.  (You'll need to add these to your Project properties).  I'll try to explain more later and maybe include a sample test project.
&lt;/li&gt;
&lt;/ol&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-4081482975899905993?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/4081482975899905993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2009/12/building-opencv-20-with-visual-studio-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/4081482975899905993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/4081482975899905993'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2009/12/building-opencv-20-with-visual-studio-c.html' title='Building OpenCV 2.0 with Visual Studio C++ 2008 Express Edition'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-4756601455376133009</id><published>2009-09-05T10:58:00.000-07:00</published><updated>2009-09-05T18:05:04.354-07:00</updated><title type='text'>Working with GWT / Spring / Dispatch</title><content type='html'>&lt;p&gt;
The &lt;a href="http://blog.hivedevelopment.co.uk/2009_08_21_archive.html"&gt;Hive Development blog has a nice tutorial on setting up a Google Web Toolkit app with the Presenter and Dispatcher patterns&lt;/a&gt;.  This is all based on &lt;a href="http://code.google.com/events/io/sessions/GoogleWebToolkitBestPractices.html"&gt;a nice Google presentation&lt;/a&gt; explaining some useful patterns for developing robust app with GWT.  &lt;/p&gt;
&lt;p&gt;
I recommend watching the video first and then reading the hivedevelopment blog article.  Read through it and then download the full source code using the link near the top of the page.  In the end, it's helpful example starter application for exploring concepts.&lt;/p&gt;
&lt;p&gt;
Anyways, the framework that you end up with uses Google Guice for server-side dependency injection and the servlet config.  I am going to describe how I converted that to use Spring instead, using the GWT-Dispatch-Spring library.  Comments are welcome since I am probably not doing things optimally in some places.
&lt;/p&gt;
&lt;p&gt;
Why would you want to do this?  I think it is personal preference whether you use Guice or Spring (nice discussion/war going on &lt;a href="http://www.jroller.com/habuma/entry/guice_vs_spring_javaconfig_a"&gt;here&lt;/a&gt;).  I am fairly new to both so I don't have a personal opinion.  In the end of this, you will end up with a project using Guice's ally Gin on the client and Spring on the server, so you can be like Switzerland and remain neutral.  ;)
&lt;/p&gt;
&lt;p&gt;
The major steps described here include:
&lt;ul&gt;
&lt;li&gt;Adding the Spring and gwt-dispatch-spring-ext jars to your project&lt;/li&gt;
&lt;li&gt;Eliminating Guice from your server code&lt;/li&gt;
&lt;li&gt;Adding the Spring configuration to your server code&lt;/li&gt;
&lt;li&gt;Switch the client to use the Spring version of the DispatchAsync&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Initial Setup&lt;/h3&gt;
As I mention above, I recommend going through the blog and then downloading the tutorial code.  Import the code into Eclipse (File-&gt;Import-&gt;Existing Projects Into Workspace).  Make sure it all builds and that you can run it in the debugger.
&lt;h3&gt;Add Jars&lt;/h3&gt;
Download the Spring library jars.&lt;br/&gt;
Download the &lt;a href="http://code.google.com/p/gwtrpc-spring/"&gt;gwtrpc-spring library&lt;/a&gt;.&lt;br/&gt;
Download the &lt;a href="http://code.google.com/p/gwt-dispatch-spring-ext/"&gt;GWT-Dispatch-Spring extension library&lt;/a&gt;.&lt;br/&gt;
Import these jars into the project's war/WEB-INF/lib directory (right-click on the directory, Import-&gt;File System):
&lt;ul&gt;
&lt;li&gt;spring-aop-2.0.8.jar&lt;/li&gt;
&lt;li&gt;spring-beans-2.5.6.jar *&lt;/li&gt;
&lt;li&gt;spring-context-2.5.6.jar *&lt;/li&gt;
&lt;li&gt;spring-core-2.5.6.jar&lt;/li&gt;
&lt;li&gt;spring-security-core-2.0.4.jar&lt;/li&gt;
&lt;li&gt;spring-web-2.5.6.jar&lt;/li&gt;
&lt;li&gt;gwtrpc-spring-1.01.jar *&lt;/li&gt;
&lt;li&gt;gwt-dispatch-spring-ext-1.0.0 *&lt;/li&gt;
&lt;/ul&gt;

The jars that I've marked with an asterisk also need to be added to your build path (Right click Referenced Libraries in the package explorer, Build Path-&gt;Configure Build Path).
&lt;/p&gt;
&lt;h3&gt;Eliminate Guice from Server Code&lt;/h3&gt;
Just delete the entire greet.server.guice package. 
&lt;h3&gt;Configure the Server Code Using Spring&lt;/h3&gt;
&lt;h4&gt;Modify SendGreetingHandler&lt;/h4&gt;
There are several things we need to do to adapt the SendGreetingHandler to use Spring:
&lt;ul&gt;
&lt;li&gt;All your Handlers will now inherit from SpringActionHandler instead of implementing the ActionHandler interface.&lt;/li&gt;
&lt;li&gt;To inherit from SpringActionHandler, we need a new constructor since that class requires the ActionHandlerRegistry to be passed in.&lt;/li&gt;
&lt;li&gt;We need to swap out the Guice annotations and replace them with their Spring counterparts.  We use @Autowired instead of @Inject.  We also label the class as a @Component.&lt;/li&gt;
&lt;li&gt;&lt;i&gt;I haven't yet hooked back up the Logging functionality.  An exercise for the reader.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;To get the servlet and http request context, we are using the gwt-spring-rpc library RemoteServiceUtil.&lt;/li&gt;
&lt;/ul&gt;
Here is what my class looks like after making these changes:

&lt;pre class="brush: java"&gt;

@Component
public class SendGreetingHandler extends SpringActionHandler&amp;lt;SendGreeting, SendGreetingResult&amp;gt; {
 
 @Autowired
 public SendGreetingHandler(ActionHandlerRegistry actionHandlerRegistry) {
  super(actionHandlerRegistry);
 }

 @Override
 public SendGreetingResult execute(final SendGreeting action,
       final ExecutionContext context) throws ActionException {
  final String name = action.getName();
   
  try {

      String serverInfo = RemoteServiceUtil.getThreadLocalContext().getServerInfo();
      String userAgent = RemoteServiceUtil.getThreadLocalRequest().getHeader("User-Agent");

      final String message = "Hello, " + name + "!&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;I am running " + serverInfo + ".&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;It looks like you are using:&amp;lt;br&amp;gt;" + userAgent;

   
   //final String message = "Hello " + action.getName(); 
   
   return new SendGreetingResult(name, message);
  }
  catch (Exception cause) {
   
   throw new ActionException(cause);
  }
 }

 @Override
 public void rollback(final SendGreeting action,
        final SendGreetingResult result,
        final ExecutionContext context) throws ActionException {
  // Nothing to do here
 }
 
 @Override
 public Class&amp;lt;SendGreeting&amp;gt; getActionType() {
  return SendGreeting.class;
 }
}
&lt;/pre&gt;
&lt;h4&gt;Create applicationContext.xml&lt;/h4&gt;
This file will configure Spring to do annotation-based dependency injection.  It also indicates to Spring that it should search the Spring/Dispatch package and our own server code package when looking for components to match dependencies.  Place this in war/WEB-INF.


&lt;pre class="brush: xml"&gt;
&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
 xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
 xsi:schemaLocation="
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"&amp;gt;


 &amp;lt;context:annotation-config /&amp;gt;
 &amp;lt;context:component-scan base-package="com.adeoservices.gwt.dispatch.spring.server" /&amp;gt;
 &amp;lt;context:component-scan base-package="co.uk.hivedevelopment.greet.server" /&amp;gt;

&amp;lt;/beans&amp;gt;
&lt;/pre&gt;
&lt;h4&gt;Change web.xml&lt;/h4&gt;
We need to change our servlet to use a RemoteServiceDispatcher servlet.  Change web.xml to this:
&lt;pre class="brush: xml"&gt;
&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd"&amp;gt;

&amp;lt;web-app&amp;gt;

 &amp;lt;listener&amp;gt;
  &amp;lt;listener-class&amp;gt;org.springframework.web.context.ContextLoaderListener&amp;lt;/listener-class&amp;gt;
 &amp;lt;/listener&amp;gt;

 &amp;lt;servlet&amp;gt;
  &amp;lt;servlet-name&amp;gt;dispatcher&amp;lt;/servlet-name&amp;gt;
  &amp;lt;servlet-class&amp;gt;org.gwtrpcspring.RemoteServiceDispatcher&amp;lt;/servlet-class&amp;gt;
 &amp;lt;/servlet&amp;gt;

 &amp;lt;servlet-mapping&amp;gt;
  &amp;lt;servlet-name&amp;gt;dispatcher&amp;lt;/servlet-name&amp;gt;
  &amp;lt;url-pattern&amp;gt;*.rpc&amp;lt;/url-pattern&amp;gt;
 &amp;lt;/servlet-mapping&amp;gt;


 &amp;lt;servlet&amp;gt;
  &amp;lt;servlet-name&amp;gt;remoteLoggerServiceImpl&amp;lt;/servlet-name&amp;gt;
  &amp;lt;servlet-class&amp;gt;com.allen_sauer.gwt.log.server.RemoteLoggerServiceImpl&amp;lt;/servlet-class&amp;gt;
 &amp;lt;/servlet&amp;gt;


 &amp;lt;!-- Default page to serve --&amp;gt;
 &amp;lt;welcome-file-list&amp;gt;
  &amp;lt;welcome-file&amp;gt;GreetMvp.html&amp;lt;/welcome-file&amp;gt;
 &amp;lt;/welcome-file-list&amp;gt;
 
&amp;lt;/web-app&amp;gt;
&lt;/pre&gt;

&lt;h3&gt;Quick Review:  What We Just Did&lt;/h3&gt;
&lt;p&gt;
At this point, we have converted the Server side code to use Spring instead of Guice.  Try running the app.  You will probably notice a bunch of logging statements in the Console regarding the Spring dependency injection scanning:
&lt;pre class="brush: text"&gt;
1253 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating instance of bean 'sendGreetingHandler'
1254 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'springActionHandlerRegistry'
1255 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Autowiring by type from bean name 'sendGreetingHandler' via constructor to bean named 'springActionHandlerRegistry'
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
Try clicking the button to send the GreetAction to the server.  You get an error because we haven't yet adjusted the client to work with Spring and to look for the new Spring RemoteServiceDispatcher that we defined in our new web.xml.
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_R3oZVH9aohs/SqL3rxYe2nI/AAAAAAAABtQ/J6WVY-D4xZY/s1600-h/serverError.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 204px;" src="http://2.bp.blogspot.com/_R3oZVH9aohs/SqL3rxYe2nI/AAAAAAAABtQ/J6WVY-D4xZY/s400/serverError.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5378133236396251762" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;h3&gt;Update Client to Use Spring DispatchAsync&lt;/h3&gt;
&lt;p&gt;First, we need to add the Dispatch-Spring library to our client code.  Add the highlighted line to GreetMvp.gwt.xml:
&lt;pre class="brush: xml; highlight: [2]"&gt;
&amp;lt;inherits name='net.customware.gwt.dispatch.Dispatch' /&amp;gt;
&amp;lt;inherits name="com.adeoservices.gwt.dispatch.spring.Dispatch-Spring"/&amp;gt;
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
Now, we just need to use the Spring-based DispatchAsync.  Here is how I did it.  I don't like it this way, so maybe somebody can help me (I'll explain).  Go to the GreetingPresenter.  Modify the constructor so that it takes a SpringDispatchServiceAsync instead of DispatchAsync:
&lt;pre class="brush: java"&gt;
public GreetingPresenter(final Display display, final EventBus eventBus, final SpringDispatchServiceAsyncImpl dispatcher, final GreetingResponsePresenter greetingResponsePresenter) {
&lt;/pre&gt;
What I don't like is how the GreetingPresenter now requires a specific implementation for DispatchAsync.  What would be more appropriate is to configure Gin to inject the correct implementation in GreetingClientModule.  At this point, I can't figure out how to get this to work:  gin complains that DispatchAsync has been "double-bound".  But I am basically brand new to Gin/Guice so I'm probably missing something.
&lt;/p&gt;
&lt;p&gt;
In any case, the app should be working and the Client should receive a valid response from the server.  You now have a working example using Spring on the server!
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_R3oZVH9aohs/SqMED2rVaCI/AAAAAAAABtY/sIbjYtGcgl4/s1600-h/serverResponse.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 393px; height: 314px;" src="http://2.bp.blogspot.com/_R3oZVH9aohs/SqMED2rVaCI/AAAAAAAABtY/sIbjYtGcgl4/s400/serverResponse.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5378146844273895458" /&gt;&lt;/a&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-4756601455376133009?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/4756601455376133009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2009/09/getting-gwt-spring-dispatch-library.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/4756601455376133009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/4756601455376133009'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2009/09/getting-gwt-spring-dispatch-library.html' title='Working with GWT / Spring / Dispatch'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_R3oZVH9aohs/SqL3rxYe2nI/AAAAAAAABtQ/J6WVY-D4xZY/s72-c/serverError.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-5171180435396331627</id><published>2009-08-30T17:45:00.000-07:00</published><updated>2009-08-30T18:23:55.569-07:00</updated><title type='text'>Using Apache HttpClient 4 with Google App Engine</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R3oZVH9aohs/SpsfyGKJSvI/AAAAAAAABrw/TFQRqPFVlqw/s1600-h/Screenshot.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 299px;" src="http://3.bp.blogspot.com/_R3oZVH9aohs/SpsfyGKJSvI/AAAAAAAABrw/TFQRqPFVlqw/s400/Screenshot.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5375925525703903986" /&gt;&lt;/a&gt;
&lt;p&gt;The &lt;a href="http://esxx.blogspot.com/2009/06/using-apaches-httpclient-on-google-app.html"&gt;ESXX blog has some handy code for integrating Apache HttpClient 4 with Google App Engine&lt;/a&gt;.  Since it includes working source code, everything you need to figure it out is there.  However, it can be a little confusing at first if you try dropping the code directly into an App Engine project.  Your project will &lt;b&gt;fail to compile&lt;/b&gt; as it uses several functions that are not supported by the App Engine SDK.
&lt;/p&gt;
&lt;p&gt;
Instead of putting the problematic source code directly in your project, put them in a separate jar file.  Then you can include that jar file in your project and everything should work fine.
&lt;/p&gt;
&lt;p&gt;I did this by creating a simple java project in eclipse, with just the two adapter code files.  To get this to build, I also included the apache httpclient jars &lt;b&gt;and the app engine sdk jar&lt;/b&gt;.  I've included an image of my simple project structure here.  Eclipse should automatically build the files once those jars are in place.
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_R3oZVH9aohs/SpsjTwVlfWI/AAAAAAAABr4/_I_584L4l3M/s1600-h/projectScreenshot.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 256px;" src="http://2.bp.blogspot.com/_R3oZVH9aohs/SpsjTwVlfWI/AAAAAAAABr4/_I_584L4l3M/s400/projectScreenshot.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5375929402496744802" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Then, at the command line, I simply went to that project's build directory and manually built the jar file using "jar cf GAEHttpClient.jar *".  You can of course use your own jar file name.  Make sure you build the jar at the root of your build directory structure.
&lt;/p&gt;
&lt;p&gt;
Once your jar file is built, you should be able to add it to your main App Engine project (right click on the project in your Package Explorer and go to Build Path-&gt; Configure Build Path-&gt; Add external JARs . . . then add it to your war/WEB-INF/lib directory using File-&gt;Import-&gt;General-&gt;File System . . .)   Once you have that (and the Apache httpclient jars) in place, you should be able to compile your code without error:
&lt;/p&gt;
&lt;pre class="brush: js"&gt;
HttpParams httpParams = new BasicHttpParams();
ClientConnectionManager connectionManager = new GAEConnectionManager();
HttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams);
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-5171180435396331627?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/5171180435396331627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2009/08/using-apache-httpclient-4-with-google.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/5171180435396331627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/5171180435396331627'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2009/08/using-apache-httpclient-4-with-google.html' title='Using Apache HttpClient 4 with Google App Engine'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_R3oZVH9aohs/SpsfyGKJSvI/AAAAAAAABrw/TFQRqPFVlqw/s72-c/Screenshot.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-7412105601708237066</id><published>2009-06-28T18:31:00.000-07:00</published><updated>2009-06-29T13:00:52.987-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software'/><title type='text'>The WebFridge Project</title><content type='html'>&lt;div style="text-align: center;"&gt;
&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R3oZVH9aohs/SkkdATDky0I/AAAAAAAABas/BFpqu4yLlgw/s1600-h/barcodes.jpg"&gt;&lt;/a&gt;&lt;div style="text-align: left;"&gt;A few months ago, in the spirit of our recessionary times, we decided to institute severe household financial austerity measures. Around the same time, I was interested in learning more about the latest java technologies that are being used in enterprise software and web applications. This resulted in . . .&lt;/div&gt;&lt;div style="text-align: left;"&gt;
&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span"  style=" font-weight: bold; font-size:32px;"&gt;Project WebFridge!&lt;/span&gt;&lt;/div&gt;&lt;p&gt;Our housing expenses are the biggest impact on our budget. But
since our housing costs are relatively fixed, it seemed like the
biggest opportunity for improvement was the food budget. But this has
not been easy! I like food.&lt;/p&gt;&lt;p&gt;Here's our food expenditures over the past few months (credit goes
to mint.com for the pretty graph):&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R3oZVH9aohs/SkgZwleitpI/AAAAAAAABZ0/pc-lH6Kr7XY/s1600-h/foodSpending.png"&gt;
&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 246px;" src="http://3.bp.blogspot.com/_R3oZVH9aohs/SkgZwleitpI/AAAAAAAABZ0/pc-lH6Kr7XY/s400/foodSpending.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5352556479614465682" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;A few notes:&lt;/p&gt;&lt;ul&gt; &lt;li&gt;&lt;p&gt;In January, we took a vacation to New Orleans. Lots of good restaurants and bars there. So I view that spike as a special non-recurring charge.&lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p&gt;Our general run rate appears to be in the $500-$800 range, and this reflects a major cutback in our restaurant/bar expenses.  This still seems embarassingly high.&lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p&gt;The green bars supposedly represent U.S. food spending according to Mint.com. Apparently people went on some kind of colossal diet in May.&lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p&gt;Apparently the &lt;a href="http://www.frac.org/pdf/FSC_Toolkit.pdf"&gt;food stamp budget for two people averages around $6/day&lt;/a&gt;, or $180 per
month.  Whoa.  We are nowhere close to that.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Anyways, what I decided to do was build a web application using the latest java technologies to keep an inventory of our foodstuffs.&lt;/p&gt;&lt;p&gt;We do throw out quite a bit of food that goes bad in our fridge or freezer because we basically forget that it's there. The goal of this application is to cut down on that waste. And also make it easier to plan our cooking menus and our shopping.&lt;/p&gt;&lt;p&gt;Here's a quick overview of how my application works. &lt;i&gt;You can take a live look at our current inventory &lt;/i&gt;&lt;a href="http://webfridge.homelinux.net/items.html"&gt;&lt;i&gt;here&lt;/i&gt;&lt;/a&gt;&lt;i&gt;!&lt;/i&gt;&lt;/p&gt;&lt;h2&gt;Logging into the Website&lt;/h2&gt;The system requires a login but you don't have to do it every time if you select the Remember Me checkbox.  There is an Administrator account that allows for managing user accounts.  This all uses Spring Security, which is a great security/authentication toolset.

&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://2.bp.blogspot.com/_R3oZVH9aohs/SkgaZc6S-NI/AAAAAAAABZ8/xBsfmZ6sCvg/s400/webfridgeLogin.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5352557181689592018" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 244px; " /&gt;&lt;/span&gt;
&lt;h2&gt;Reviewing Inventory&lt;/h2&gt;&lt;p&gt;The inventory is displayed in a sortable list.  You can also filter by item location (Fridge, Freezer, Pantry) or by Item Type (Pork, Canned Veggie, etc).
&lt;/p&gt;&lt;p&gt;We often wonder, "what do we need to use in the freezer?".  This can be answered easily by clicking the Freezer button and then sorting by the Days Until Expiration field.
&lt;/p&gt;&lt;div&gt;
&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R3oZVH9aohs/SkgaoxRhvdI/AAAAAAAABaE/hoEt-FXUpyk/s1600-h/webfridgeItemList.png"&gt;&lt;img src="http://3.bp.blogspot.com/_R3oZVH9aohs/SkgaoxRhvdI/AAAAAAAABaE/hoEt-FXUpyk/s400/webfridgeItemList.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5352557444853775826" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 298px; " /&gt;&lt;/a&gt;&lt;p&gt;Note the beautiful Fridge, Freezer, and Pantry icons that I drew.  Need to make some prettier ones.
&lt;/p&gt;&lt;h2&gt;Adding Items using Barcodes and Auto-Lookup&lt;/h2&gt;&lt;p&gt;When you add packaged items, the system lets you scan in the UPC barcode and the item's information will be entered automatically with the system's internal UPC product database.  As soon as you scan in the barcode, the item description fields are automatically filled in.&lt;/p&gt;&lt;p&gt;This process really doesn't take too long.  I don't enter &lt;i&gt;everything&lt;/i&gt;.  For example, individual pieces of fruit that sit in a fruit bowl on our counter, that's not worth tracking since we see it every day and know what's in there.  Lots of the stuff we buy we immediately cook up for dinner so I don't bother entering that either.
&lt;/p&gt;&lt;p&gt;I am using a $10 scanner from ebay, the &lt;a href="http://en.wikipedia.org/wiki/CueCat"&gt;infamous cuecat.&lt;/a&gt;&lt;/p&gt;&lt;div&gt;
&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_R3oZVH9aohs/Skgbj7iA2MI/AAAAAAAABaM/3j2zC0glHDI/s1600-h/webfridgeCuecat.jpg"&gt;&lt;img src="http://2.bp.blogspot.com/_R3oZVH9aohs/Skgbj7iA2MI/AAAAAAAABaM/3j2zC0glHDI/s400/webfridgeCuecat.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5352558461219559618" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 164px; " /&gt;&lt;/a&gt;&lt;p&gt;For other items that do not have official barcodes, I printed out on some removable barcode stickers using my laser printer.  I put these on produce bags, tupperware containers, etc.&lt;/p&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;
&lt;img src="http://1.bp.blogspot.com/_R3oZVH9aohs/SkkdATDky0I/AAAAAAAABas/BFpqu4yLlgw/s400/barcodes.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5352841523059018562" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 300px; height: 400px; " /&gt;&lt;/span&gt;&lt;p&gt;Of course those items are not in the built-in UPC product database, so I have to fill in the item info manually.&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://4.bp.blogspot.com/_R3oZVH9aohs/Skgb8Xq4cCI/AAAAAAAABaU/sub3V3jh7eE/s400/webfridgeItemEntry.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5352558881089810466" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 264px; height: 400px; " /&gt;&lt;/span&gt;Note the Days Until Expiration field.  That field is automatically filled as soon as you pick Item Type (ie- fruit is given 5 days, canned goods 700 days, etc), but you can of course override it.&lt;/p&gt;&lt;h2&gt;Warning Tweets&lt;/h2&gt;
&lt;p&gt;When any item is 3 days from expiration, WebFridge automatically starts sending daily warning messages. This is &lt;i&gt;really&lt;/i&gt; helpful in using up those things in the back of the fridge or freezer before
they go bad.&lt;/p&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://1.bp.blogspot.com/_R3oZVH9aohs/SkgcmczFHEI/AAAAAAAABac/4Msg7Bv1Lzc/s400/webfridgeTweet.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5352559604020878402" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 192px; " /&gt;&lt;/span&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://3.bp.blogspot.com/_R3oZVH9aohs/SkgcwVa7JNI/AAAAAAAABak/WjcAlqLqKXg/s400/webfridgeTweet2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5352559773839205586" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 189px; " /&gt;&lt;/span&gt;&lt;p&gt;I suppose I could have used regular email instead of going through twitter, but hey, it was fun figuring out how to call the Twitter API from my software.&lt;/p&gt;&lt;h2&gt;Future Enhancements&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Right now I don't bother filling in the item size and price.  But it would be cool if I could have stats on item prices that I could check with my iphone when I'm at the store. I have a rough idea of prices for common things like a gallon of milk, but I am less sure of lots of things from apples to greek yogurt.  I'd like to think of some way to make this price entry more automated (perhaps running OCR on the itemized grocery receipt) since this could be a PITA otherwise.&lt;/li&gt;
&lt;li&gt;I want to make a special iphone web app interface.  I already check this webpage in my iphone browser, but Apple has special html tags that allow you to make the page look like a native iphone app.&lt;/li&gt;
&lt;li&gt;I'd like to be able to mark certain items as staples that would be automatically added to our shopping lists (right now we use Evernote for that) whenever they are removed from our inventory.&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;Tech Details&lt;/h2&gt;&lt;p&gt;This application is a customization of the excellent AppFuse tutorial project.  Appfuse is a great starting point for projects using java open source tools.  I am using Hibernate to access a mySql database and Struts 2 for my web framework. It is wired together with Spring. This all running on a ubuntu linux server within Apache Tomcat.  The code is automatically tested using jUnit and jMock and is built using maven.&lt;/p&gt;&lt;p&gt;I am not an html/css/graphic artist, so some of my customizations to the Appfuse web pages are not the prettiest ever.&lt;/p&gt;

&lt;p&gt;


&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-7412105601708237066?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/7412105601708237066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2009/06/webfridge-project.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/7412105601708237066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/7412105601708237066'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2009/06/webfridge-project.html' title='The WebFridge Project'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_R3oZVH9aohs/SkgZwleitpI/AAAAAAAABZ0/pc-lH6Kr7XY/s72-c/foodSpending.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241881619290465654.post-8410188260163052816</id><published>2009-06-17T09:53:00.001-07:00</published><updated>2010-03-18T08:28:22.213-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software'/><title type='text'>Posting Code</title><content type='html'>I figured out a recipe for posting nicely formatted code online, like this:
&lt;pre class="brush: js; highlight:2"&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = "scripts/clipboard.swf";
...
SyntaxHighlighter.all();
&lt;/pre&gt;
I like the nice formatting and colors, including the ability to highlight lines.  This also has a nice floating menu to allow the user to easily copy the code to their editor.

If you are curious how to do this, read on!
&lt;span class="fullpost"&gt;
The key is a &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter"&gt;nice javascript library called Syntax Highlighter&lt;/a&gt; from Alex Gorbatchev.  If you are comfortable with CSS styles and javascript, it should pretty easy to figure out how to use it and incorporate this library into your website or blog.  Alex's website has good reference documentation, but it assumes you know how to hook javascript and css into your website.&lt;p&gt;
If you are like me, and CSS and javascript is still a little unfamiliar, here is the recipe that I figured out.  Note that this also works on Blogger, which is what I'm using right now . . . you'll just need to edit your template html.
&lt;/p&gt;&lt;h3&gt;Step 1:  Add the javascript libraries to your webpage&lt;/h3&gt;
Paste the following into your &amp;lt;head&gt; section:

&lt;pre class="brush: js"&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shCore.js"&gt;  &amp;lt;/script&gt; 
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushBash.js"&gt;  &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushCpp.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushCSharp.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushCss.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushDelphi.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushDiff.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushGroovy.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushJava.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushJScript.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushPhp.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushPlain.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushPython.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushRuby.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushPerl.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushScala.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushSql.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushVb.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushXml.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushAS3.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushJavaFX.js"&gt; &amp;lt;/script&gt;
&amp;lt;script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushPowerShell.js"&gt; &amp;lt;/script&gt;
&lt;/pre&gt;
Note that each script (except for shCore.js) is for a different programming language.  These provide the logic for language-specific highlighting.  As you'll see, when you do your actual posting, you'll indicate which language your code is in.  So, technically, you don't need &lt;i&gt;all&lt;/i&gt; these scripts, just the ones for the languages that you'll be quoting on your page.  But it doesn't hurt to just paste the whole block in for simplicity's sake.
&lt;h3&gt;Step 2:  Link to the SyntaxHighlighter CSS styles&lt;/h3&gt;
Immediately after the stuff you just pasted (and still within the &amp;lt;head &gt; tag), add the following links:
&lt;pre class="brush: plain"&gt;
&amp;lt;link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/2.0.320/styles/shCore.css"/&gt;
&amp;lt;link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/2.0.320/styles/shThemeDefault.css" id="shTheme" /&gt;
&lt;/pre&gt;
&lt;h3&gt;Step 3:  Configure&lt;/h3&gt;
This step may be optional for you.  Basically, we make javascript calls into the library to configure the behavior of SyntaxHighlighter.  These options are documented &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter:Configuration"&gt;here&lt;/a&gt;.  For a start, just paste the following in after the previous stuff:
&lt;pre class="brush: js; highlight:2"&gt;
&amp;lt;script type="text/javascript"&gt;
SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.0.320/scripts/clipboard.swf';
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.gutter = true;

SyntaxHighlighter.all();
&amp;lt;/script&gt;
&lt;/pre&gt;
Note the highlighted line about the clipboardSwf.  This gives the user a nice floating menu that allows them to easily copy your code to the clipboard.
Also note the next line referencing bloggerMode.  That needs to be set to true to have the formatting work correctly from within the Blogger.com framework.
&lt;h3&gt;Step 4: Post your Code!&lt;/h3&gt;
Now, whenever you want to post some code, you can enclose it in a &amp;lt;pre&gt; tag with a special &lt;pre&gt;class&lt;/pre&gt; indicating which language highlighting you would like (java, c#, etc).  The class is of the format:  "brush: &lt;language&gt;" . . . deduce the language string from the javascript filenames in Step 1 above.  Like this:
&lt;pre class="brush: java, html-script= true"&gt;
&amp;lt;pre class="brush: java"&gt;
System.out.println("Hello World!");
&amp;lt;/pre&gt;
&lt;/pre&gt;
Have fun!
&lt;/language&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241881619290465654-8410188260163052816?l=peterkenji.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://peterkenji.blogspot.com/feeds/8410188260163052816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://peterkenji.blogspot.com/2009/06/test.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/8410188260163052816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241881619290465654/posts/default/8410188260163052816'/><link rel='alternate' type='text/html' href='http://peterkenji.blogspot.com/2009/06/test.html' title='Posting Code'/><author><name>Peter</name><uri>http://www.blogger.com/profile/14947760300472400741</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://2.bp.blogspot.com/_R3oZVH9aohs/SqfdPXYjghI/AAAAAAAABzQ/8r2UHpyv40w/s1600-R/DukeJava.jpg'/></author><thr:total>1</thr:total></entry></feed>
