<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.nileshk.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
 
 <title>Nilesh D Kapadia</title>
 
 <link href="http://nileshk.com/" />
 <updated>2011-10-10T09:16:43-04:00</updated>
 <id>http://nileshk.com/</id>
 <author>
   <name>Nilesh Kapadia</name>
   <email>feed@nileshk.com</email>
 </author>

 
 <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.nileshk.com/nileshk" /><feedburner:info uri="nileshk" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><entry>
   <title>Jekyll and WEBrick with HTML5 audio</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2010/08/29/jekyll-webrick-with-html5-audio.html" />
   <updated>2010-08-29T00:00:00-04:00</updated>
   <id>http://nileshk.com/2010/08/29/jekyll-webrick-with-html5-audio</id>
   <content type="html">&lt;p&gt;I am working on a site that uses &lt;a href='http://github.com/mojombo/jekyll'&gt;Jekyll&lt;/a&gt; and also HTML5 audio. When running the server locally (which uses &lt;a href='http://en.wikipedia.org/wiki/WEBrick'&gt;WEBrick&lt;/a&gt;), I had issues with playing OGG files using HTML5 audio (MP3 files would play at least in Safari, OGG files would not play in Firefox). Though the GET request to the server was being received, the browser simply wouldn&amp;#8217;t play the music files.&lt;/p&gt;

&lt;p&gt;It turns out that &lt;a href='http://www.happyworm.com/jquery/jplayer/latest/developer-guide.htm#jPlayer-server-mp3-ogg-response'&gt;certain MIME types are required&lt;/a&gt;, at least for OGG files. OGG files should be &lt;code&gt;audio/ogg&lt;/code&gt; and MP3 files should be &lt;code&gt;audio/mpeg&lt;/code&gt;. WEBrick&amp;#8217;s &lt;a href='http://ruby-doc.org/stdlib/libdoc/webrick/rdoc/classes/WEBrick/HTTPUtils.html'&gt;default configuration&lt;/a&gt; did not include these mime types, and Jekyll did not add them.&lt;/p&gt;

&lt;p&gt;To configure this for Jekyll, I edited the jekyll&amp;#8217;s &lt;a href='http://github.com/mojombo/jekyll/blob/master/bin/jekyll'&gt;startup script&lt;/a&gt; like this:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='ruby'&gt;  &lt;span class='n'&gt;mime_types&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='no'&gt;WEBrick&lt;/span&gt;&lt;span class='o'&gt;::&lt;/span&gt;&lt;span class='no'&gt;HTTPUtils&lt;/span&gt;&lt;span class='o'&gt;::&lt;/span&gt;&lt;span class='no'&gt;DefaultMimeTypes&lt;/span&gt;
  &lt;span class='n'&gt;mime_types&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;store&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;js&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;application/javascript&amp;#39;&lt;/span&gt;

&lt;span class='c1'&gt;# START mime type edit&lt;/span&gt;
  &lt;span class='n'&gt;mime_types&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;store&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;mp3&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;audio/mpeg&amp;#39;&lt;/span&gt;
  &lt;span class='n'&gt;mime_types&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;store&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;ogg&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;audio/ogg&amp;#39;&lt;/span&gt;
&lt;span class='c1'&gt;#  mime_types = WEBrick::HTTPUtils::load_mime_types(&amp;#39;/etc/apache2/mime.types&amp;#39;)&lt;/span&gt;
&lt;span class='c1'&gt;# END mime type edit&lt;/span&gt;

  &lt;span class='n'&gt;s&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='no'&gt;HTTPServer&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;new&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This adds the mime types for MP3 and OGG files to the default mime types. Alternatively, you could use the commented-out line that uses &lt;code&gt;load_mime_types&lt;/code&gt; to load Apache&amp;#8217;s &lt;code&gt;mime.types&lt;/code&gt; file. Note that this will completely ignore WEBrick&amp;#8217;s defaults and use whatever is in Apache&amp;#8217;s &lt;code&gt;mime.types&lt;/code&gt; file (or whatever file you point it to). The version of that file in my Apache2 installation did have the necessary mime types.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Embedding Apache Tomcat 7.0</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2010/08/25/emdedding-apache-tomcat-7-0.html" />
   <updated>2010-08-25T00:00:00-04:00</updated>
   <id>http://nileshk.com/2010/08/25/emdedding-apache-tomcat-7-0</id>
   <content type="html">&lt;p&gt;&lt;a href='http://tomcat.apache.org/'&gt;Apache Tomcat&lt;/a&gt; 7.0 now has a &lt;a href='http://tomcat.apache.org/download-70.cgi'&gt;beta release&lt;/a&gt; out. One of it&amp;#8217;s features is improved support for embedding. I have been &lt;a href='/2009/05/02/embedded-jetty-with-a-spring-web-app.html'&gt;embedding Jetty&lt;/a&gt; successfully in various projects, so I was hoping that Tomcat&amp;#8217;s support for embedding was on par with Jetty&amp;#8217;s. So far, Tomcat 7.0&amp;#8217;s embedding API is quite easy to use and has been working well. However, I did not find any documentation on how to actually use it, so it took a small bit of digging to figure out how.&lt;/p&gt;

&lt;h2 id='details'&gt;Details&lt;/h2&gt;

&lt;p&gt;The one suggestion I read was to look at the test cases, because they used embedded Tomcat. So I checked out the source code, and found &lt;a href='http://svn.apache.org/repos/asf/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java'&gt;TomcatBaseTest&lt;/a&gt; which was an abstract class that tests were subclassing which provided a running embedded Tomcat. The &lt;code&gt;org.apache.catalina.startup.Tomcat&lt;/code&gt; class is what you need to use. After setting various settings, adding the application(s), you then call the &lt;code&gt;start()&lt;/code&gt; to start Tomcat. Note that &lt;code&gt;start()&lt;/code&gt; does not block, so if you exit your &lt;code&gt;main&lt;/code&gt; method, Tomcat will quit.&lt;/p&gt;

&lt;p&gt;Like it&amp;#8217;s non-embedded version, embedded Tomcat needs to create a &lt;code&gt;work&lt;/code&gt; directory for temporary files. You specify a base directory which the &lt;code&gt;work&lt;/code&gt; directory will be created in. I believe this base directory is the equivalent to Tomcat home directory. Use the &lt;code&gt;setBaseDir(String baseDir)&lt;/code&gt; method to set this. Looking at the source for &lt;code&gt;Tomcat.initBaseDir()&lt;/code&gt; method, it looks like if you don&amp;#8217;t set it using this method, it will try to obtain this by trying:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;From the &lt;code&gt;catalina.base&lt;/code&gt; system property&lt;/li&gt;

&lt;li&gt;Failing that, from the &lt;code&gt;catalina.base&lt;/code&gt; system property&lt;/li&gt;

&lt;li&gt;Create a temp directory using &lt;code&gt;user.dir&lt;/code&gt; system property as a base and tomcat.&lt;em&gt;PORT_NUMBER&lt;/em&gt; as the temp directory it creates (replacing &lt;em&gt;PORT_NUMBER&lt;/em&gt; with the actual port number.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can set a port number with &lt;code&gt;setPort(int port)&lt;/code&gt;. This defaults to 8080 if not set.&lt;/p&gt;

&lt;p&gt;To add an application, use the &lt;code&gt;addWebapp(String contextPath, String baseDir)&lt;/code&gt; method, setting the webapp&amp;#8217;s context path and specifying the location of the webapp folder for baseDir.&lt;/p&gt;

&lt;p&gt;Once you are configured, you can call the &lt;code&gt;start()&lt;/code&gt; method. Then you need to make sure your app doesn&amp;#8217;t exit, the simplest way is to do an infinite loop, e.g. &lt;code&gt;while(true) { Thread.sleep(999999999); }&lt;/code&gt;&lt;/p&gt;

&lt;h2 id='necessary_jar_files'&gt;Necessary JAR files&lt;/h2&gt;

&lt;p&gt;From the Tomcat 7.0.2 distribution, I put the following jar files in my classpath (not sure if &lt;em&gt;all&lt;/em&gt; of them are necessary):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;annotations-api.jar&lt;/li&gt;

&lt;li&gt;catalina-ant.jar&lt;/li&gt;

&lt;li&gt;catalina-ha.jar&lt;/li&gt;

&lt;li&gt;catalina-tribes.jar&lt;/li&gt;

&lt;li&gt;catalina.jar&lt;/li&gt;

&lt;li&gt;ecj-3.6.jar&lt;/li&gt;

&lt;li&gt;el-api.jar&lt;/li&gt;

&lt;li&gt;jasper-el.jar&lt;/li&gt;

&lt;li&gt;jasper.jar&lt;/li&gt;

&lt;li&gt;jsp-api.jar&lt;/li&gt;

&lt;li&gt;servlet-api.jar&lt;/li&gt;

&lt;li&gt;tomcat-api.jar&lt;/li&gt;

&lt;li&gt;tomcat-coyote.jar&lt;/li&gt;

&lt;li&gt;tomcat-dbcp.jar&lt;/li&gt;

&lt;li&gt;tomcat-i18n-es.jar&lt;/li&gt;

&lt;li&gt;tomcat-i18n-fr.jar&lt;/li&gt;

&lt;li&gt;tomcat-i18n-ja.jar&lt;/li&gt;

&lt;li&gt;tomcat-juli.jar&lt;/li&gt;

&lt;li&gt;tomcat-util.jar&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;tomcat-juli.jar was found in the &lt;code&gt;TOMCAT_HOME/bin&lt;/code&gt; folder, whereas the rest were in the &lt;code&gt;TOMCAT_HOME/lib&lt;/code&gt; folder&lt;/li&gt;

&lt;li&gt;servlet-api.jar is for the Servlet 3.0 spec. Make sure you don&amp;#8217;t have any Servlet 2.x versions of this jar, otherwise Tomcat will throw an exception and fail to work.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id='example'&gt;Example&lt;/h2&gt;

&lt;p&gt;Here is a little example app that assumes you have a webapp (WEB-INF with a web.xml in it) in the folder &lt;code&gt;examplewebapp&lt;/code&gt;:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='java'&gt;&lt;span class='kn'&gt;import&lt;/span&gt; &lt;span class='nn'&gt;java.io.File&lt;/span&gt;&lt;span class='o'&gt;;&lt;/span&gt;
&lt;span class='kn'&gt;import&lt;/span&gt; &lt;span class='nn'&gt;java.io.IOException&lt;/span&gt;&lt;span class='o'&gt;;&lt;/span&gt;
&lt;span class='kn'&gt;import&lt;/span&gt; &lt;span class='nn'&gt;java.lang.InterruptedException&lt;/span&gt;&lt;span class='o'&gt;;&lt;/span&gt;

&lt;span class='kn'&gt;import&lt;/span&gt; &lt;span class='nn'&gt;javax.servlet.ServletException&lt;/span&gt;&lt;span class='o'&gt;;&lt;/span&gt;

&lt;span class='kn'&gt;import&lt;/span&gt; &lt;span class='nn'&gt;org.apache.catalina.LifecycleException&lt;/span&gt;&lt;span class='o'&gt;;&lt;/span&gt;
&lt;span class='kn'&gt;import&lt;/span&gt; &lt;span class='nn'&gt;org.apache.catalina.startup.Tomcat&lt;/span&gt;&lt;span class='o'&gt;;&lt;/span&gt;

&lt;span class='kd'&gt;public&lt;/span&gt; &lt;span class='kd'&gt;class&lt;/span&gt; &lt;span class='nc'&gt;TomcatEmbedExample&lt;/span&gt; &lt;span class='o'&gt;{&lt;/span&gt;

    &lt;span class='kd'&gt;public&lt;/span&gt; &lt;span class='kd'&gt;static&lt;/span&gt; &lt;span class='kt'&gt;void&lt;/span&gt; &lt;span class='nf'&gt;main&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;String&lt;/span&gt;&lt;span class='o'&gt;[]&lt;/span&gt; &lt;span class='n'&gt;args&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt; 
        &lt;span class='kd'&gt;throws&lt;/span&gt; &lt;span class='n'&gt;IOException&lt;/span&gt;&lt;span class='o'&gt;,&lt;/span&gt; &lt;span class='n'&gt;ServletException&lt;/span&gt;&lt;span class='o'&gt;,&lt;/span&gt; 
               &lt;span class='n'&gt;LifecycleException&lt;/span&gt;&lt;span class='o'&gt;,&lt;/span&gt; &lt;span class='n'&gt;InterruptedException&lt;/span&gt; &lt;span class='o'&gt;{&lt;/span&gt;

        &lt;span class='n'&gt;String&lt;/span&gt; &lt;span class='n'&gt;currentDir&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='k'&gt;new&lt;/span&gt; &lt;span class='n'&gt;File&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span class='o'&gt;).&lt;/span&gt;&lt;span class='na'&gt;getCanonicalPath&lt;/span&gt;&lt;span class='o'&gt;();&lt;/span&gt;
        &lt;span class='n'&gt;String&lt;/span&gt; &lt;span class='n'&gt;tomcatDir&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;currentDir&lt;/span&gt; &lt;span class='o'&gt;+&lt;/span&gt; &lt;span class='n'&gt;File&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;separatorChar&lt;/span&gt; &lt;span class='o'&gt;+&lt;/span&gt; &lt;span class='s'&gt;&amp;quot;tomcat&amp;quot;&lt;/span&gt;&lt;span class='o'&gt;;&lt;/span&gt;
        &lt;span class='n'&gt;String&lt;/span&gt; &lt;span class='n'&gt;webRoot&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;currentDir&lt;/span&gt; &lt;span class='o'&gt;+&lt;/span&gt; &lt;span class='n'&gt;File&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;separatorChar&lt;/span&gt; &lt;span class='o'&gt;+&lt;/span&gt; &lt;span class='s'&gt;&amp;quot;examplewebapp&amp;quot;&lt;/span&gt;&lt;span class='o'&gt;;&lt;/span&gt;

        &lt;span class='n'&gt;Tomcat&lt;/span&gt; &lt;span class='n'&gt;tomcat&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='k'&gt;new&lt;/span&gt; &lt;span class='n'&gt;Tomcat&lt;/span&gt;&lt;span class='o'&gt;();&lt;/span&gt;
        &lt;span class='n'&gt;tomcat&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;setBaseDir&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;tomcatDir&lt;/span&gt;&lt;span class='o'&gt;);&lt;/span&gt;
        &lt;span class='n'&gt;tomcat&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;setPort&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='mi'&gt;4040&lt;/span&gt;&lt;span class='o'&gt;);&lt;/span&gt;
        &lt;span class='n'&gt;tomcat&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;addWebapp&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;/examplewebapp&amp;quot;&lt;/span&gt;&lt;span class='o'&gt;,&lt;/span&gt; &lt;span class='n'&gt;webRoot&lt;/span&gt;&lt;span class='o'&gt;);&lt;/span&gt;
        &lt;span class='c1'&gt;// or we could do this for root context:&lt;/span&gt;
        &lt;span class='c1'&gt;// tomcat.addWebapp(&amp;quot;/&amp;quot;, webRoot);&lt;/span&gt;
        &lt;span class='n'&gt;tomcat&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;start&lt;/span&gt;&lt;span class='o'&gt;();&lt;/span&gt;

        &lt;span class='k'&gt;while&lt;/span&gt; &lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='kc'&gt;true&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt; &lt;span class='o'&gt;{&lt;/span&gt;
            &lt;span class='n'&gt;Thread&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;sleep&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='mi'&gt;999999999&lt;/span&gt;&lt;span class='o'&gt;);&lt;/span&gt;
        &lt;span class='o'&gt;}&lt;/span&gt;
    &lt;span class='o'&gt;}&lt;/span&gt;

&lt;span class='o'&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h2 id='ideas_on_what_this_can_be_used_for'&gt;Ideas on what this can be used for&lt;/h2&gt;

&lt;p&gt;This has replace embedded Jetty as my development server. I run it inside of a debugger (Eclipse), and Java hot code replace works nicely. One thing that I am experimenting with is monitoring specific files to know when to restart the app. I am currently using &lt;a href='http://jnotify.sourceforge.net/'&gt;JNotify&lt;/a&gt; to monitor file changes, and restart the app when XML files or other configuration files change that need a restart to get applied. It is working great so far, and I no longer have to manually restart the server or sacrifice Java hot code replace.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>New site using Jekyll static site generator</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2010/08/16/new-site-using-jekyll.html" />
   <updated>2010-08-16T00:00:00-04:00</updated>
   <id>http://nileshk.com/2010/08/16/new-site-using-jekyll</id>
   <content type="html">&lt;p&gt;I have switched from using &lt;a href='http://drupal.org/'&gt;Drupal&lt;/a&gt; for my blog to using &lt;a href='http://github.com/mojombo/jekyll'&gt;Jekyll&lt;/a&gt;, a static site generator. Drupal has served me well for the last 6 years, but for this site it has been overkill and keeping up with the frequent security updates has been a chore.&lt;/p&gt;

&lt;h3 id='how_this_works'&gt;How this works&lt;/h3&gt;

&lt;p&gt;What Jekyll does is use templates to generate static HTML pages. This means for each update to my site, I simply redeploy a new set of static HTML pages that I have generated using Jekyll. I am storing my site data in a &lt;a href='http://git-scm.com/'&gt;Git&lt;/a&gt; repository. On the server, I use an update script to fetch the latest from Git, and generate the new version of the site.&lt;/p&gt;

&lt;p&gt;I also store and work on my site data in my &lt;a href='https://www.dropbox.com/referrals/NTE0MjUzNjQ5'&gt;Dropbox&lt;/a&gt; folder. I work on this site on more than one computer, and relying on a SCM alone to synchronize would be way too cumbersome. Dropbox has been great for automatically synchronizing the project between machines, and seems to handle synchronizing Git metadata fine. I&amp;#8217;m actually doing this for all my personal projects these days.&lt;/p&gt;

&lt;h3 id='my_old_workflow_with_drupal'&gt;My old workflow with Drupal&lt;/h3&gt;

&lt;p&gt;My workflow for writing entries in Drupal was to edit posts in &lt;a href='http://www.gnu.org/software/emacs/'&gt;Emacs&lt;/a&gt; using &lt;a href='http://jblevins.org/projects/markdown-mode/'&gt;markdown-mode&lt;/a&gt; (as I was using &lt;a href='http://daringfireball.net/projects/markdown/'&gt;Markdown&lt;/a&gt; for posts, though initially I was using filtered HTML). Once a post was in Drupal, if I needed to make changes, I would use the Firefox extension &lt;a href='https://addons.mozilla.org/en-US/firefox/addon/394/'&gt;ViewSourceWith&lt;/a&gt; to conveniently load the entry back into Emacs, edit it, then have it auto-load it back into the browser textbox once I was done editing. This worked, but it&amp;#8217;s not as convenient or straightforward as editing a file sitting on my hard drive.&lt;/p&gt;

&lt;h3 id='advantages'&gt;Advantages&lt;/h3&gt;

&lt;p&gt;With Jekyll, all posts are stored in files, so naturally the normal workflow is to edit files directly with a text editor. I expect this to be a lot nicer than working with a web interface.&lt;/p&gt;

&lt;p&gt;Security is less of an issue with static HTML files. I only need to worry about security updates to the web server I am using, which is much less frequent than that of the typical PHP app such as Drupal (or Wordpress for that matter).&lt;/p&gt;

&lt;p&gt;Though this site has never seen any heavy traffic that would test the limits of the server it was hosted on, I expect the performance of the static site to be much better than that of what a PHP / MySQL app can achieve (without proper caching at least).&lt;/p&gt;

&lt;p&gt;I feel like I more empowered to customize and modify my site&amp;#8217;s layout because it&amp;#8217;s just HTML/CSS/JavaScript with a simple template engine (Jekyll uses &lt;a href='http://www.liquidmarkup.org/'&gt;Liquid&lt;/a&gt;).&lt;/p&gt;

&lt;h3 id='switched_from_shared_hosting_to_a_vps'&gt;Switched from shared hosting to a VPS&lt;/h3&gt;

&lt;p&gt;In this process I have also moved the site from a shared hosting provider to a Linux VPS (&lt;a href='http://www.linode.com/?r=00acb2139b7de30d5754c91bdabbe2d808c2e453'&gt;Linode&lt;/a&gt;). I am using &lt;a href='http://wiki.nginx.org/'&gt;nginx&lt;/a&gt; as the web server, whereas my previous host was using Apache.&lt;/p&gt;

&lt;p&gt;Now that this is all in place, I need to get back to writing blog entries&amp;#8230;&lt;/p&gt;

&lt;h3 id='script_for_drupal_to_jekyll_conversion'&gt;Script for Drupal to Jekyll conversion&lt;/h3&gt;

&lt;p&gt;It is in no way complete, but I wrote this script for converting Drupal posts to Jekyll: &lt;a href='http://gist.github.com/528382'&gt;jekyll_drupal_conversion.rb&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is rather specific to my site, and may not work with someone else&amp;#8217;s Drupal site, but could be a good starting point if you are looking for a conversion script. Be prepared to modify it if you plan to use this.&lt;/p&gt;

&lt;p&gt;The script attempts to convert Drupal&amp;#8217;s Filtered HTML format to normal HTML, but those HTML files probably needed additional work. It also attempts to convert the syntax highlighting tags I was using to those for Jekyll&amp;#8217;s liquid tags which uses &lt;a href='http://pygments.org/'&gt;pygments&lt;/a&gt;, a Python based syntax highlighter. I actually ended up manually converting most of my HTML posts to markdown in the end.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>The Rise of the Web OS</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/07/08/rise-of-the-web-os.html" />
   <updated>2009-07-08T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/07/08/rise-of-the-web-os</id>
   <content type="html">&lt;p&gt;I&amp;#8217;ve been thinking about personal computers in general and its usage by non-technical people. Things are far from ideal, with Microsoft not getting any closer to making computing accessible to regular people, yet still remaining the dominant computing platform. But in observing the recent occurrences and in thinking about the future of personal computing, I think we are poised for a change. With the recent &lt;a href='http://googleblog.blogspot.com/2009/07/introducing-google-chrome-os.html'&gt;announcement of Google Chrome OS&lt;/a&gt;, I have some (long, rambling) thoughts on the subject which include why a web OS is the likely next step in personal computing and some predictions on it: &lt;!--break--&gt;&lt;/p&gt;

&lt;h2 id='the_problem'&gt;The Problem&lt;/h2&gt;

&lt;p&gt;Let&amp;#8217;s face it, personal computers are too difficult to use. The average non-technical person has difficulty using personal computers, regardless of whether they are using Windows, Mac OS X, or Linux (though the Mac OS X users are marginally better off). If a non-technical user isn&amp;#8217;t having any problems its probably because they have a very thorough technical person managing things for them. Even the highly technical person who spends 60/hours a week using personal computers is going to run into some problem that is going to require a good deal of effort on their part to troubleshoot. Having troubleshooting skills is in fact a requirement to be able to use personal computers without help. But why should it be?&lt;/p&gt;

&lt;h2 id='why_are_personal_computers_such_a_pain'&gt;Why Are Personal Computers Such a Pain?&lt;/h2&gt;

&lt;p&gt;Why are personal computers such a pain? One word: Complexity. Ridiculous amounts of complexity. Windows users have to deal with often difficult non-standardized software installation processes, having to install hardware drivers which are often of poor quality and difficult to install and use, having to edit the registry when things go wrong with updates, having to protect themselves from malware, etc. OS X users have a significantly better experience in these areas, but things are nowhere near perfect. Many Linux users sacrifice being to able to use the latest versions of software in the interest of simplicity as provided by their package managers. In all cases software updates and installations can and will cause problems. People are afraid to update their software as they have been burned by updates screwing things up. There are so many &amp;#8220;moving parts&amp;#8221; in a typical desktop operating system that there is a high likelihood that something will go wrong.&lt;/p&gt;

&lt;p&gt;Complexity in the user interfaces increases the pain. Even OS X can only get so far in making a complex interfaces accessible.&lt;/p&gt;

&lt;h2 id='what_we_need_in_a_solution'&gt;What We Need in a Solution&lt;/h2&gt;

&lt;p&gt;The opposite of complexity is of course simplicity. To make computers accessible and manageable by everyone, we need to make them significantly more simple.&lt;/p&gt;

&lt;p&gt;The user needs to interact as little as possible with functions that are not purely just using the applications they wish to use. They need to forget about the intricacies of software installation, updates, hardware setup, and even managing individual files.&lt;/p&gt;

&lt;p&gt;The web offers to push many of these problems to the server, where there are technical people handling the issues instead of end users. And the users only have to worry about keeping their web browser updated (assuming the web sites don&amp;#8217;t require some obscure plugins) and figuring out whatever UI the web sites offer. Even installing a decent web browser and keeping it updated appears to be a challenge for the majority of people, though.&lt;/p&gt;

&lt;p&gt;What we need is a focused device that has a modern web browser (not Internet Explorer) and makes keeping that web browser updated as easy as possible if not completely automatic. And the web browser needs to be a first class citizen in the device&amp;#8217;s user interface.&lt;/p&gt;

&lt;h2 id='the_browser_interface_needs_to_change'&gt;The Browser Interface Needs to Change&lt;/h2&gt;

&lt;p&gt;The iPhone and Google Android start to hint at what this might be like, but they don&amp;#8217;t go far enough. What I mean by the web browser needs to be a first class citizen in the device&amp;#8217;s user interface is that the &lt;em&gt;web applications&lt;/em&gt; need to be the focus of the interface. Want to get your web mail or todo list? They should each be directly accessible from the main interface and you should be able to easily return the currently open session you have for the web application.&lt;/p&gt;

&lt;p&gt;To take the example of the iPhone, the web application should be an icon on the home screen (which you can do), but instead of opening up the browser application and either opening a new page or switching a currently open page if it exists, it should just open up to the web applications. Admittedly, the iPhone&amp;#8217;s way of handling this is good enough, but if we are going to build a whole device around browsing the web, we need to lose the idea of the web browser being an individual application. The web browser is no longer the application, the &lt;em&gt;web applications&lt;/em&gt; are. Those of you who are familiar with &lt;a href='http://prism.mozilla.com/'&gt;Mozilla Prism&lt;/a&gt; you know what I&amp;#8217;m talking.&lt;/p&gt;

&lt;p&gt;I really hope that Google Chrome OS and any other emerging &amp;#8220;web OS&amp;#8221; gets this part right.&lt;/p&gt;

&lt;h2 id='whats_wrong_with_traditional_applications'&gt;What&amp;#8217;s Wrong With Traditional Applications?&lt;/h2&gt;

&lt;p&gt;A common response is that what&amp;#8217;s wrong with traditional native/desktop applications (on the desktop or for specific devices such as iPhone apps). Why would you want to &lt;em&gt;only&lt;/em&gt; use web apps? Well, we are making a sacrifice in the name of making things easier, but I think in the long run this sacrifice will be worth it. There are a number of problems which web applications and a web OS can solve:&lt;/p&gt;

&lt;h3 id='cross_platform'&gt;Cross Platform&lt;/h3&gt;

&lt;p&gt;Native/desktop apps are either not cross platform, have separate builds for various platforms, or use a cross-platform toolkit or runtime. But even using a cross-platform toolkit or runtime only puts it on a limited number of devices. Web browsers on the other hand are &lt;em&gt;everywhere&lt;/em&gt;. This may seem like an issue that only helps developers, and it does help developers as they can just make a web version and instantly have their applications available on more devices than any other method of app delivery would. But as a user, this gives you choice in where you can use the application. A web application can be used from all of your desktop computers, your netbook, your phone, etc. And it doesn&amp;#8217;t matter which brand of device and OS you are using, as long as a competent web browser is available for it.&lt;/p&gt;

&lt;h3 id='updates'&gt;Updates&lt;/h3&gt;

&lt;p&gt;Users of web applications no longer have to worry about updates. They are automatically using the current version. Granted, this means the service provider is in control of what versions the users use, but its a trade-off that significantly reduces the work the users have to do.&lt;/p&gt;

&lt;p&gt;A &amp;#8220;web OS&amp;#8221; that is basically just an interface around web browsing has a lot less to worry about updating. It&amp;#8217;s main concern will be updating the web browser (especially security updates). There may also be some less frequent updates to things like the general user interface, the hardware drivers, etc. There&amp;#8217;s no guarantee that updates won&amp;#8217;t break things, but the less to update the better.&lt;/p&gt;

&lt;h3 id='convenience'&gt;Convenience&lt;/h3&gt;

&lt;p&gt;I&amp;#8217;ve already mentioned how you can use web apps on just about any device. Did I mention you could use them on &lt;em&gt;any&lt;/em&gt; device? What I mean is that for most web apps you don&amp;#8217;t have to carry around all your data as its stored on a server. So you can get on any internet-connected device with a browser to use a web app and have all your data available to you.&lt;/p&gt;

&lt;h3 id='interapplication_connectivity'&gt;Inter-Application Connectivity&lt;/h3&gt;

&lt;p&gt;Web applications offer connectivity between each other in ways desktop apps can only scratch the surface of. This is a minor point at present, but we will see much more of it in the future.&lt;/p&gt;

&lt;h2 id='web_applications_can_have_all_the_power_of_native_apps'&gt;Web Applications Can Have All the Power of Native Apps&lt;/h2&gt;

&lt;p&gt;If done right (both the web OS and the web application), web applications have the potential to provide an identical experience to desktop apps. Most of this is thanks to the use of plugins which give browsers functionality outside of what the web standards provide. While plugins start to erode the benefit that standards-compliant web browsers provide, I think they are necessary to push browsers into desktop territory. I think they could be a good thing if they are open source and accessible via standard web technology (JavaScript or HTML). I think Flash, Java, and Silverlight go a little too far away from the standard web technologies to be used prevalently (and their main implementations are not open source and are non-trivial to duplicate), but they do currently fill in missing pieces such as watching video, playing audio, and accessing webcams/microphones. But I think plugins that extend and build upon the standard web tech is a better idea than a plugin that provides an entirely different and separate runtime. Maybe things will look different 10 years from now.&lt;/p&gt;

&lt;h3 id='local_storage'&gt;Local Storage&lt;/h3&gt;

&lt;p&gt;Google Gears or HTML5 provide local storage. This answers some of the complaints about not having your data local, though it seems to be more often used for caching data locally (for offline use or for fast access) then as the primary means of storage.&lt;/p&gt;

&lt;h3 id='google_native_client'&gt;Google Native Client&lt;/h3&gt;

&lt;p&gt;I almost view Google&amp;#8217;s &lt;a href='http://code.google.com/p/nativeclient/'&gt;Native Client&lt;/a&gt; as cheating, as it removes the cross platform advantage. And the security implications are not to be taken lightly. But it does open up a huge amount of possibilities.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m not sure what the best way to approach actual plugins in web OS. The problem is that they are basically native applications. If you open up a web OS to allowing installation of arbitrary plugins, there is the potential for losing the advantages that a web OS is pushing (especially the cross platform advantage). Maybe its better for the web OS vendor to be in control of this.&lt;/p&gt;

&lt;p&gt;Unfortunately, the locked down nature of the iPhone may actually be a good model for a web OS. Though ideally, the locked down should only be on the surface. The web OS would ideally be open source and allow for those wishing to break out of the lock down to be able to do so; but this is not something that the average user should be doing.&lt;/p&gt;

&lt;h2 id='not_everything_is_perfect_in_web_os_land'&gt;Not Everything is Perfect in Web OS Land&lt;/h2&gt;

&lt;p&gt;Of course, a &amp;#8220;Web OS&amp;#8221; is a trade-off and there are going to be disadvantages over traditional desktop/native software. Here are a few of the disadvantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Despite the possibility of local storage, in general, using web applications involves trusting a third party to store your data. This raises privacy concerns in some situations. Another problem is that you are trusting the third party to maintain integrity and reliability of your data. But I think most of these services are much better about backing up than the average user (though there is sometimes the odd web service that loses all its data and had never made a backup).&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Security is a more significant issue on the internet. While viruses and malware can reach desktop applications, your data that is stored by third parties is open to attack 24/7, while your the data on your personal computer is only open to attack when your computer is on and connected to the internet. The security of the web browser is especially important, but I don&amp;#8217;t think that is anything new.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Browser-based web apps are still catching up to native desktop apps. Even with Flash and Silverlight it&amp;#8217;s difficult to deliver the same experience that native apps can deliver. I think in time we may see all the missing pieces get filled in, but this will be a slow process.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;User interfaces are more the responsibility of the web applications. There is much less standardization among web apps. Similarities among the UI for web applications is generally due to them copying each other and not as much anything inherent in the platform (though there is a bit of it that is due to the platform). You don&amp;#8217;t get the same kind of uniformity you would get with a toolkit such as Cocoa or GTK+ once you get into the more &amp;#8220;rich&amp;#8221; web applications. Maybe this is all a good thing and that more variations in UI will cause more rapid improvements in UI. But there is something to be said for having a consistent UI across applications that you use, especially for things like keyboard shortcuts. I hope that some consistency arrives for keyboard shortcuts in web applications, because the current state of keyboard shortcuts are not very good.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But these are all tradeoffs and not show-stopping problems.&lt;/p&gt;

&lt;h2 id='not_for_everyone_and_every_task'&gt;Not For Everyone and Every Task&lt;/h2&gt;

&lt;p&gt;Let&amp;#8217;s be clear, the web OS isn&amp;#8217;t necessarilly going to be for everyone and every kind of task. The traditional desktop OS is still going to be alive and well and in use for a long time. But the web OS is going to become ubiquitous like televisions and telephones are. Though some of the devices it will end up on may be typical desktop and notebook computers, it will be even more prevalent on devices like small tablets and small notebooks (&amp;#8220;netbooks&amp;#8221; as they are currently called). I guess I sort of see the iPhone, Android, and the Palm Pre as devices that can be or are at least partially a &amp;#8220;web OS&amp;#8221;. And we are seeing Android being used in places where I think a &amp;#8220;web OS&amp;#8221; is appropriate.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s interesting that Google is creating a whole separate OS from Android, but I guess if you are really going to create a &amp;#8220;web OS&amp;#8221; there is no need for many of the things that Android provides.&lt;/p&gt;

&lt;h2 id='conclusion'&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;So in conclusion, a &amp;#8220;web OS&amp;#8221; needs the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A competent modern web browser&lt;/li&gt;

&lt;li&gt;Web applications need to be first class citizens&lt;/li&gt;

&lt;li&gt;Automatic or extremely easy updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If done correctly, I think this could be a good thing in that it could make personal computers much more accessible.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>VMWare Fusion: Assigning IP Addresses for NAT-Configured VMs via DHCP and Port Forwarding</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/06/24/vmware-fusion-nat-dhcp-and-port-forwarding.html" />
   <updated>2009-06-24T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/06/24/vmware-fusion-nat-dhcp-and-port-forwarding</id>
   <content type="html">&lt;p&gt;In VMWare Fusion, when using NAT, you often times want the IP addresses for the VMs to always be the same, so that you can connect to them from the host using the same IP address every time (and probably assign an entry in your /etc/hosts file). You may also want to connect to the host from the guests using a constant IP address. And finally, with VMs that use NAT, you may want to setup port forwarding so that machines outside of the host can connect to services on your VM (and this relies on the IP addresses remaining the same).&lt;/p&gt;

&lt;p&gt;The configuration files for doing this reside in &lt;code&gt;/Library/Application Support/VMware Fusion/vmnet8/&lt;/code&gt; (the NAT interface is called &amp;#8220;vmnet8&amp;#8221; hence why configuration for it is here), specifically &lt;code&gt;dhcpd.conf&lt;/code&gt; and &lt;code&gt;nat.conf&lt;/code&gt;. These files may be read-only (even for root), so make sure to give root write permission before you edit them.&lt;/p&gt;

&lt;p&gt;Any changes to these files requires that the following be executed before they take effect:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;sudo &lt;span class='s2'&gt;&amp;quot;/Library/Application Support/VMware Fusion/boot.sh&amp;quot;&lt;/span&gt; --restart
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;!--break--&gt;
&lt;h2 id='assigning_consistent_ip_addresses'&gt;Assigning consistent IP addresses&lt;/h2&gt;

&lt;p&gt;As explained by &lt;a href='http://www.thirdbit.net/articles/2008/03/04/dhcp-on-vmware-fusion/'&gt;this blog entry&lt;/a&gt; you can edit the &lt;code&gt;dhcpd.conf&lt;/code&gt; file to configure VMWare Fusion&amp;#8217;s DHCP server to assign specific IP addresses to a VM based on its MAC address. You should see something like this in your dhcpd.conf file:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;subnet 192.168.87.0 netmask 255.255.255.0 &lt;span class='o'&gt;{&lt;/span&gt;
    range 192.168.87.128 192.168.87.254;
    option broadcast-address 192.168.87.255;
    option domain-name-servers 192.168.87.2;
    option netbios-name-servers 192.168.87.2;
    option domain-name &lt;span class='s2'&gt;&amp;quot;localdomain&amp;quot;&lt;/span&gt;;
    option routers 192.168.87.2;
&lt;span class='o'&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;For our IP address assignments, we want to pick an IP address that is &lt;strong&gt;outside&lt;/strong&gt; of the range that is set above. So in my case I picked 192.168.87.100 and 192.168.87.101 for two VMs that I wanted to configure.&lt;/p&gt;

&lt;p&gt;We also need to get the MAC addresses for the VMs. We can either get it from the VM&amp;#8217;s &lt;code&gt;.vmx&lt;/code&gt; file under the property &lt;code&gt;ethernet0.generatedAddress&lt;/code&gt; or if the VM is currently running we can run &lt;code&gt;ipconfig&lt;/code&gt; if it is UNIX/Linux or &lt;code&gt;ipconfig /all&lt;/code&gt; if it is Windows.&lt;/p&gt;

&lt;p&gt;So if we were to configure two VM&amp;#8217;s to have fixed IP addresses, we would add something like this to the &lt;code&gt;dhcpd.conf&lt;/code&gt; file:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;host uvm &lt;span class='o'&gt;{&lt;/span&gt;
    hardware ethernet 00:0c:29:02:00:f1;
    fixed-address 192.168.87.100;
&lt;span class='o'&gt;}&lt;/span&gt;

host wvm &lt;span class='o'&gt;{&lt;/span&gt;
    hardware ethernet 00:0c:29:44:57:46;
    fixed-address 192.168.87.101;
&lt;span class='o'&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;I put entries in my /etc/hosts to point to these, so I don&amp;#8217;t have to remember IP addresses:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='c'&gt;# Ubuntu VM&lt;/span&gt;
192.168.87.100        uvm
&lt;span class='c'&gt;# Windows XP VM&lt;/span&gt;
192.168.87.101        wvm
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h2 id='connecting_to_the_host_from_the_guests'&gt;Connecting to the host from the guests&lt;/h2&gt;

&lt;p&gt;Since the host acts as a router, we can use the router IP address as configured in &lt;code&gt;dhcpd.conf&lt;/code&gt; to connect to the host from our VMs. From the above excerpt, this is the line that describes what the router IP address is:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;    option routers 192.168.87.2;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And inside of the VMs, I add an entry to my &lt;code&gt;/etc/hosts&lt;/code&gt; file so I don&amp;#8217;t have to remember this IP address. Note that the VMs can see each other, so it&amp;#8217;s a good idea to put IP addresses of other VMs in &lt;code&gt;/etc/hosts&lt;/code&gt; as well if you are going to make connections between VMs.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='c'&gt;# As defined in the VMWare host&amp;#39;s dhcp.conf&lt;/span&gt;
192.168.87.2    vmhost
&lt;span class='c'&gt;# Ubuntu VM&lt;/span&gt;
192.168.87.100    uvm
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h2 id='port_forwarding'&gt;Port forwarding&lt;/h2&gt;

&lt;p&gt;To make services in NAT-configured VMs available outside of the host OS, we need to set up port forwarding. To do this edit the &lt;code&gt;nat.conf&lt;/code&gt; file. Add entries under &lt;code&gt;[incomingtcp]&lt;/code&gt; if you are forwarding a TCP connection and under &lt;code&gt;[incomingudp]&lt;/code&gt; for a UDP connection. There are examples in this file, but to go along with our above examples, we might do something like this:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='o'&gt;[&lt;/span&gt;incomingtcp&lt;span class='o'&gt;]&lt;/span&gt;
&lt;span class='c'&gt;# Forward host port 2222 to SSH on Ubuntu VM&lt;/span&gt;
&lt;span class='nv'&gt;2222&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; 192.168.87.100:22
&lt;span class='c'&gt;# Forward Remote Desktop connections to Windows VM&lt;/span&gt;
&lt;span class='nv'&gt;3389&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; 192.168.87.101:3389

&lt;span class='o'&gt;[&lt;/span&gt;incomingudp&lt;span class='o'&gt;]&lt;/span&gt;
&lt;span class='c'&gt;# Forward Remote Desktop connections to Windows VM&lt;/span&gt;
&lt;span class='nv'&gt;3389&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; 192.168.87.101:3389
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h2 id='restarting_vmware_services_on_host'&gt;Restarting VMWare services on host&lt;/h2&gt;

&lt;p&gt;Don&amp;#8217;t forget that after we make any of the above changes, we need to restart the VMWare services using this command:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;sudo &lt;span class='s2'&gt;&amp;quot;/Library/Application Support/VMware Fusion/boot.sh&amp;quot;&lt;/span&gt; --restart
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Prompt Before Closing Emacs</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/06/13/prompt-before-closing-emacs.html" />
   <updated>2009-06-13T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/06/13/prompt-before-closing-emacs</id>
   <content type="html">&lt;p&gt;I developed a bad habit of quitting Emacs from my earlier days of using Emacs mostly in a terminal session (where even there quitting it is not the best idea). Using GUI versions of Emacs, I sometimes find myself hitting &lt;code&gt;C-x C-c&lt;/code&gt; and wishing I didn&amp;#8217;t because I really intended to kill the current buffer, not completely close Emacs. So what I have done to deal with this is, when running a GUI version (which can be detected by checking the &lt;code&gt;window-system&lt;/code&gt; variable), I always prompt to ask if I really want to quit. Here is the code I use:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='scheme'&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nf'&gt;defun&lt;/span&gt; &lt;span class='nv'&gt;ask-before-closing&lt;/span&gt; &lt;span class='p'&gt;()&lt;/span&gt;
  &lt;span class='s'&gt;&amp;quot;Ask whether or not to close, and then close if y was pressed&amp;quot;&lt;/span&gt;
  &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nf'&gt;interactive&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
  &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='k'&gt;if &lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nf'&gt;y-or-n-p&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nf'&gt;format&lt;/span&gt; &lt;span class='s'&gt;&amp;quot;Are you sure you want to exit Emacs? &amp;quot;&lt;/span&gt;&lt;span class='p'&gt;))&lt;/span&gt;
      &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='k'&gt;if &lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nb'&gt;&amp;lt; &lt;/span&gt;&lt;span class='nv'&gt;emacs-major-version&lt;/span&gt; &lt;span class='mi'&gt;22&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
          &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nf'&gt;save-buffers-kill-terminal&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
        &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nf'&gt;save-buffers-kill-emacs&lt;/span&gt;&lt;span class='p'&gt;))&lt;/span&gt;
    &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nf'&gt;message&lt;/span&gt; &lt;span class='s'&gt;&amp;quot;Canceled exit&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;)))&lt;/span&gt;

&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nf'&gt;when&lt;/span&gt; &lt;span class='nv'&gt;window-system&lt;/span&gt;
  &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nf'&gt;global-set-key&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nf'&gt;kbd&lt;/span&gt; &lt;span class='s'&gt;&amp;quot;C-x C-c&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='ss'&gt;&amp;#39;ask-before-closing&lt;/span&gt;&lt;span class='p'&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;I do this only for the GUI version, but you could remove the check for &lt;code&gt;window-system&lt;/code&gt; if you want it to work in the terminal version as well. I use &lt;code&gt;when&lt;/code&gt; instead of &lt;code&gt;if&lt;/code&gt; in this case, because I do other things if I am running the GUI version, like &lt;code&gt;(server-start)&lt;/code&gt;, which I have excluded from this code sample.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>SVN in Eclipse: Subversive and SVNKit for Subversion 1.6</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/06/05/svn-in-eclipse-subversive-and-svnkit-for-subversion.html" />
   <updated>2009-06-05T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/06/05/svn-in-eclipse-subversive-and-svnkit-for-subversion</id>
   <content type="html">Previously &lt;a href="/2005/11/22/subclipse-in-ubuntu-linux.html"&gt;I had blogged about&lt;/a&gt; using JavaHL in Linux.  &lt;a href="http://subclipse.tigris.org/wiki/JavaHL"&gt;JavaHL&lt;/a&gt; is the bindings to the native Subversion libraries which uses JNI, and it sometimes requires a bit of effort to get working.  I no longer find using JavaHL necessary as I no longer have problems with the pure Java library &lt;a href="http://svnkit.com/"&gt;SVNKit&lt;/a&gt; (formerly known as JavaSVN).  I also have switched to &lt;a href="http://www.eclipse.org/subversive/"&gt;Subversive&lt;/a&gt; instead of Subclipse because I have found it to be less problematic.&lt;br&gt;
&lt;br&gt;
Despite being an official Eclipse project now, Subversive won't install from Eclipse 3.4's default repository, and you still need to get some plugins directly from Polarion.  If you want to use the latest Subversive and SVNKit that supports Subversion 1.6, add the following update sites:&lt;br&gt;
&lt;br&gt;
&lt;ul&gt;&lt;br&gt;
&lt;li&gt;&lt;a href="http://download.eclipse.org/technology/subversive/0.7/update-site/"&gt;http://download.eclipse.org/technology/subversive/0.7/update-site/&lt;/a&gt;&lt;/li&gt;&lt;br&gt;
&lt;li&gt;&lt;a href="http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/"&gt;http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/&lt;/a&gt;&lt;/li&gt;&lt;br&gt;
&lt;/ul&gt;&lt;br&gt;
&lt;br&gt;
And then install the following from those update sites:&lt;br&gt;
&lt;ul&gt;&lt;br&gt;
&lt;li&gt;Subversive SVN Connectors (2.2.0)&lt;/li&gt;&lt;br&gt;
&lt;li&gt;Subversive SVN Team Provider (0.7.8)&lt;/li&gt;&lt;br&gt;
&lt;li&gt;SVNKit 1.3.0 Implementation (2.2.0)&lt;/li&gt;&lt;br&gt;
&lt;/ul&gt;&lt;br&gt;
&lt;br&gt;
Note that the version numbers will change in the future, but these are the current versions that work with 1.6.&lt;br&gt;
</content>
 </entry>
 
 <entry>
   <title>URL Shortener Web Application Using Django</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/06/02/url-shortener-web-app-using-django.html" />
   <updated>2009-06-02T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/06/02/url-shortener-web-app-using-django</id>
   <content type="html">I created a URL shortener web application using &lt;a href="http://www.djangoproject.com/"&gt;Django&lt;/a&gt; (a Python web framework).  I have made the &lt;b&gt;&lt;a href="http://github.com/nileshk/url-shortener"&gt;source code available on GitHub&lt;/a&gt;&lt;/b&gt; and it is under an open source license (MIT license).&lt;br&gt;
&lt;br&gt;
The shortened URLs use the base 62 value of ids of the model they are stored in, using the code from &lt;a href="http://www.djangosnippets.org/snippets/1431/"&gt;here&lt;/a&gt; (it uses A-Z, a-z, and 0-9), which should be fairly compact for a long time.  A count of how many times the URLs are used is kept.  The main page shows the 10 most recent and 10 most popular URLs.&lt;br&gt;
&lt;br&gt;
You can see a running instance at &lt;a href="http://n1l.us/"&gt;n1l.us&lt;/a&gt; (which I am using to link to this blog and other links to my own content) and &lt;a href="http://uu4.us/"&gt;uu4.us&lt;/a&gt; (which I am using for all other URLs).  I currently don't allow public submissions of URLs on either of those sites, but I will be opening it up for &lt;a href="http://uu4.us/"&gt;uu4.us&lt;/a&gt; at some point (perhaps once I add some defenses against spammers).  The application itself has a configuration option to be able to require or not require login to be able to submit URLs (the REQUIRE_LOGIN setting in settings.py).  Note that if you require logins, you have to use the admin app (at /admin/) as I have not created a separate login page.&lt;br&gt;
&lt;br&gt;
I've so far done the bare minimum as far as HTML/JavaScript is concerned (and there is no CSS to speak of yet).  Just enough to get things working.  So don't expect a good looking site with this yet.  It does produce a functional bookmarklet, assuming that you set SITE_NAME correctly for your site.  Though I should probably make the bookmarklet check for &lt;a href="http://simonwillison.net/2009/Apr/11/revcanonical/"&gt;rev=canonical&lt;/a&gt; to be a good web citizen.&lt;br&gt;
&lt;!--break--&gt;&lt;br&gt;
This was developed using the current Django from SVN.  I don't believe I used any features specific to 1.1, so it may work with 1.0.x, but I'm not absolutely sure.&lt;br&gt;
&lt;br&gt;
Note that &lt;a href="http://github.com/jacobian/django-shorturls"&gt;django-shorturls&lt;/a&gt; solves a different problem and is not a general URL shortener.  It is to be used in an existing Django application to automatically map short urls to specific model instances and to produce the &lt;code&gt;&lt;link rev="canonical" href="..."&gt;&lt;/code&gt; containing the short url in the templates.
</content>
 </entry>
 
 <entry>
   <title>The biggest issue with Adobe Flash Player</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/06/02/the-biggest-issue-with-adobe-flash-player.html" />
   <updated>2009-06-02T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/06/02/the-biggest-issue-with-adobe-flash-player</id>
   <content type="html">&lt;b&gt;Update:&lt;/b&gt; Looks like they &lt;a href="http://www.adobe.com/devnet/logged_in/jchurch_flashplayer10.1.html?devcon=f2"&gt;have fixed this&lt;/a&gt; in &lt;a href="http://labs.adobe.com/technologies/flashplayer10/"&gt;Flash Player&lt;/a&gt; 10.1&lt;br&gt;
&lt;br&gt;
The biggest issue with Flash Player at the moment is that there is no way to create a top-level exception handler.  What this means is that there will be exceptions (errors) that you simply cannot trap in your application code, even if you put try/catch all over your code (and especially if you are using Flex's MXML).  This means that &lt;b&gt;creating things like an error reporting tool are impossible&lt;/b&gt; for applications that run in the Flash Player (that includes AIR apps, too, not just browser apps).  If you are running the debug version of the Flash Player, you will see uncaught exceptions, but the typical user is not going to be running the debug version.  In the regular version of the Flash Player, uncaught exceptions just fail silently (often causing strange behavior), giving no indication to the user that an error occurred.&lt;br&gt;
&lt;br&gt;
There is an issue in Adobe's issue tracker for this:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://bugs.adobe.com/jira/browse/FP-444"&gt;http://bugs.adobe.com/jira/browse/FP-444&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
It is the highest-voted issue specifically for the Flash Player.  It is only surpassed by &lt;a href="http://bugs.adobe.com/jira/browse/FB-19053"&gt;the request to keep developing Flash Builder for Linux&lt;/a&gt;, which &lt;a href="/2009/05/03/future-of-flex-builder-for-linux-in-question.html"&gt;I think is an important issue&lt;/a&gt;, but this issue is much more important.  If you haven't already, create an account on Adobe's issue tracker and vote for this issue.&lt;br&gt;
</content>
 </entry>
 
 <entry>
   <title>Bash Completion</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/05/23/bash-completion.html" />
   <updated>2009-05-23T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/05/23/bash-completion</id>
   <content type="html">&lt;p&gt;The &lt;a href='http://en.wikipedia.org/wiki/Bash'&gt;Bash&lt;/a&gt; shell does tab completion executables, bash commands, and files/folders out of box. But it&amp;#8217;s completion can be extended to support even more types of completion including arguments for commands and things like hostnames through the use of &lt;a href='http://www.gnu.org/software/bash/manual/bashref.html#Programmable-Completion'&gt;programmable completion&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There is a package called &lt;a href='http://www.caliban.org/bash/index.shtml#completion'&gt;bash-completion&lt;/a&gt; which includes a set of completions for various utilities. For example, for &lt;a href='http://subversion.tigris.org/'&gt;Subversion&lt;/a&gt;, if you type &lt;code&gt;svn &amp;lt;tab&amp;gt;&amp;lt;tab&amp;gt;&lt;/code&gt; (replacing &lt;code&gt;&amp;lt;tab&amp;gt;&lt;/code&gt; with actually pressing tab) it will give you a list of all the svn subcommands that are available. If you type &lt;code&gt;svn rev&amp;lt;tab&amp;gt;&lt;/code&gt; it will complete it to &lt;code&gt;svn revert&lt;/code&gt;. For ssh, if you type &lt;code&gt;ssh &amp;lt;tab&amp;gt;&amp;lt;tab&amp;gt;&lt;/code&gt; it will list all the hostnames and IP addresses it knows about (it looks like it uses a combination of what&amp;#8217;s in &lt;code&gt;/etc/hosts&lt;/code&gt; and &lt;code&gt;~/.ssh/known_hosts&lt;/code&gt;). You can of course do &lt;code&gt;ssh username@&amp;lt;tab&amp;gt;&amp;lt;tab&amp;gt;&lt;/code&gt; if you are using a specific username.&lt;/p&gt;

&lt;p&gt;Once the &lt;code&gt;bash-completion&lt;/code&gt; package is installed, you can copy additional completion scripts to &lt;code&gt;/etc/bash_completion.d&lt;/code&gt; and they will be automatically included. I did this with the &lt;a href='http://maven.apache.org/guides/mini/guide-bash-m2-completion.html'&gt;Maven 2.x completion script&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://git-scm.com/'&gt;Git&lt;/a&gt; has a completion script that is included in its standard distribution. Find out where you have Git installed, and source the script &lt;em&gt;&lt;code&gt;GIT_INSTALL_DIR&lt;/code&gt;&lt;/em&gt;&lt;code&gt;/contrib/completion/git-completion.bash&lt;/code&gt; in your &lt;code&gt;.bash_profile&lt;/code&gt;. For example, I have Git installed via the &lt;a href='http://code.google.com/p/git-osx-installer/downloads/list?can=3'&gt;binary installer for OS X Leopard&lt;/a&gt;, and thus I added this line to my &lt;code&gt;.bash_profile&lt;/code&gt;:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nb'&gt;source&lt;/span&gt; /usr/local/git/contrib/completion/git-completion.bash
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Note that this is independent of the bash-completion package described above and does not require it (since we are sourcing it directly).&lt;/p&gt;

&lt;p&gt;&lt;a href='http://www.djangoproject.com'&gt;Django&lt;/a&gt; also has bash completion script included in its distribution. Replacing &lt;code&gt;$DJANGO_DIR&lt;/code&gt; where you have the release extracted (or checked out from version control):&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nb'&gt;source&lt;/span&gt; &lt;span class='nv'&gt;$DJANGO_DIR&lt;/span&gt;/extra/django_bash_completion
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;With this, you get completion for &lt;code&gt;django-admin.py&lt;/code&gt; and &lt;code&gt;manage.py&lt;/code&gt;. For &lt;code&gt;manage.py&lt;/code&gt; you need to set execute permissions and run it as &lt;code&gt;./manage.py&lt;/code&gt; on the command line rather than &lt;code&gt;python manage.py&lt;/code&gt; in order to get completion for it. &lt;!--break--&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Suppress unchecked warnings on method calls in Java</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/05/21/suppress-unchecked-warnings-on-method-call-in-java.html" />
   <updated>2009-05-21T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/05/21/suppress-unchecked-warnings-on-method-call-in-java</id>
   <content type="html">&lt;p&gt;Let&amp;#8217;s say you have a method call like this:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='java'&gt;&lt;span class='n'&gt;List&lt;/span&gt;&lt;span class='o'&gt;&amp;lt;&lt;/span&gt;&lt;span class='n'&gt;Object&lt;/span&gt;&lt;span class='o'&gt;&amp;gt;&lt;/span&gt; &lt;span class='n'&gt;list&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;List&lt;/span&gt;&lt;span class='o'&gt;&amp;lt;&lt;/span&gt;&lt;span class='n'&gt;Object&lt;/span&gt;&lt;span class='o'&gt;&amp;gt;)&lt;/span&gt; &lt;span class='n'&gt;beanWrapper&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;getPropertyValue&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;key&lt;/span&gt;&lt;span class='o'&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And &lt;a href='http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/beans/PropertyAccessor.html#getPropertyValue(java.lang.String'&gt;&lt;code&gt;beanWrapper.getPropertyValue&lt;/code&gt;&lt;/a&gt;)&amp;lt;/a&amp;gt; returns an Object. If you have the &amp;#8220;Unchecked generic type operation&amp;#8221; compiler setting set to warning, you will get the following warning:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='java'&gt;&lt;span class='n'&gt;Type&lt;/span&gt; &lt;span class='nl'&gt;safety:&lt;/span&gt; &lt;span class='n'&gt;Unchecked&lt;/span&gt; &lt;span class='n'&gt;cast&lt;/span&gt; &lt;span class='n'&gt;from&lt;/span&gt; &lt;span class='n'&gt;Object&lt;/span&gt; &lt;span class='n'&gt;to&lt;/span&gt; &lt;span class='n'&gt;List&lt;/span&gt;&lt;span class='o'&gt;&amp;lt;&lt;/span&gt;&lt;span class='n'&gt;Object&lt;/span&gt;&lt;span class='o'&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you are using Eclipse, it will give you a quick fix to add a &lt;code&gt;@SuppressWarnings(value = &amp;quot;unchecked&amp;quot;)&lt;/code&gt; annotation, but only give you the option to add it to the current method.&lt;/p&gt;

&lt;p&gt;&lt;img alt='Unchecked quickfix' src='/img/eclipse_unchecked_quickfix.png' /&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(the current method in this case is &lt;code&gt;getBean()&lt;/code&gt;)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But we may not want to suppress warnings for the entire method. We can just put the annotation on the method call itself:&lt;/p&gt;

&lt;p&gt;&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='java'&gt;&lt;span class='nd'&gt;@SuppressWarnings&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;value&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s'&gt;&amp;quot;unchecked&amp;quot;&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt;
&lt;span class='n'&gt;List&lt;/span&gt;&lt;span class='o'&gt;&amp;lt;&lt;/span&gt;&lt;span class='n'&gt;Object&lt;/span&gt;&lt;span class='o'&gt;&amp;gt;&lt;/span&gt; &lt;span class='n'&gt;list&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;List&lt;/span&gt;&lt;span class='o'&gt;&amp;lt;&lt;/span&gt;&lt;span class='n'&gt;Object&lt;/span&gt;&lt;span class='o'&gt;&amp;gt;)&lt;/span&gt; &lt;span class='n'&gt;beanWrapper&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;getPropertyValue&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;key&lt;/span&gt;&lt;span class='o'&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>CXF SOAP client built using Maven</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/05/20/cxf-soap-client-using-maven.html" />
   <updated>2009-05-20T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/05/20/cxf-soap-client-using-maven</id>
   <content type="html">&lt;p&gt;I recently created some SOAP web service clients using &lt;a href='http://cxf.apache.org/'&gt;Apache CXF&lt;/a&gt; (which is a project that resulted from the merging of &lt;a href='http://xfire.codehaus.org/'&gt;XFire&lt;/a&gt; and &lt;a href='http://celtix.ow2.org/'&gt;Celtix&lt;/a&gt;). Rather than hunt down all the jar files I needed and write an Ant script to do the build, I decided to use Maven for this. It worked nicely and saved me some time (I can&amp;#8217;t say the same for some of the more complex projects I&amp;#8217;ve tried to use Maven with).&lt;/p&gt;

&lt;p&gt;I found the following blog entry very useful for setting this up:&lt;/p&gt;

&lt;p&gt;&lt;a href='http://logicsector.wordpress.com/2008/10/19/how-to-create-a-wsdl-first-soap-client-in-java-with-cxf-and-maven/'&gt;How to create a WSDL-first SOAP client in Java with CXF and Maven&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One thing I did different was use a property to specify the CXF version in one place:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='xml'&gt;  &lt;span class='nt'&gt;&amp;lt;properties&amp;gt;&lt;/span&gt;
    &lt;span class='nt'&gt;&amp;lt;project.build.sourceEncoding&amp;gt;&lt;/span&gt;UTF-8&lt;span class='nt'&gt;&amp;lt;/project.build.sourceEncoding&amp;gt;&lt;/span&gt;
    &lt;span class='nt'&gt;&amp;lt;cxf.version&amp;gt;&lt;/span&gt;2.2.1&lt;span class='nt'&gt;&amp;lt;/cxf.version&amp;gt;&lt;/span&gt;
  &lt;span class='nt'&gt;&amp;lt;/properties&amp;gt;&lt;/span&gt;
  &lt;span class='nt'&gt;&amp;lt;dependencies&amp;gt;&lt;/span&gt;
    &lt;span class='nt'&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
      &lt;span class='nt'&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.apache.cxf&lt;span class='nt'&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
      &lt;span class='nt'&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;cxf-rt-frontend-jaxws&lt;span class='nt'&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
      &lt;span class='nt'&gt;&amp;lt;version&amp;gt;&lt;/span&gt;${cxf.version}&lt;span class='nt'&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
    &lt;span class='nt'&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
    &lt;span class='nt'&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
      &lt;span class='nt'&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.apache.cxf&lt;span class='nt'&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
      &lt;span class='nt'&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;cxf-rt-transports-http&lt;span class='nt'&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
      &lt;span class='nt'&gt;&amp;lt;version&amp;gt;&lt;/span&gt;${cxf.version}&lt;span class='nt'&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
    &lt;span class='nt'&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Pay attention to what it says about the &lt;code&gt;cxf.xml&lt;/code&gt; file. I used the &lt;a href='http://maven.apache.org/plugins/maven-eclipse-plugin/'&gt;Maven Eclipse Plugin&lt;/a&gt; to generate my Eclipse project files. If you do this, but forget the cxf.xml file, your client may still work fine in Eclipse, but when you try to use the Maven-built jar file, you will get an error like this:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='java'&gt;&lt;span class='n'&gt;javax&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;xml&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;ws&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;WebServiceException&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt; &lt;span class='n'&gt;org&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;apache&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;cxf&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;service&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;factory&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;ServiceConstructionException&lt;/span&gt;
	&lt;span class='n'&gt;at&lt;/span&gt; &lt;span class='n'&gt;org&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;apache&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;cxf&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;jaxws&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;ServiceImpl&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;getPort&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;ServiceImpl&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;java&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt;&lt;span class='mi'&gt;314&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt;
	&lt;span class='n'&gt;at&lt;/span&gt; &lt;span class='n'&gt;org&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;apache&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;cxf&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;jaxws&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;ServiceImpl&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;getPort&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;ServiceImpl&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;java&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt;&lt;span class='mi'&gt;299&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt;
	&lt;span class='n'&gt;at&lt;/span&gt; &lt;span class='n'&gt;javax&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;xml&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;ws&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;Service&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;getPort&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;Service&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;java&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt;&lt;span class='mi'&gt;40&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt;
&lt;span class='o'&gt;...&lt;/span&gt;
&lt;span class='n'&gt;Caused&lt;/span&gt; &lt;span class='nl'&gt;by:&lt;/span&gt; &lt;span class='n'&gt;org&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;apache&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;cxf&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;service&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;factory&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;ServiceConstructionException&lt;/span&gt;
	&lt;span class='n'&gt;at&lt;/span&gt; &lt;span class='n'&gt;org&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;apache&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;cxf&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;frontend&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;ClientFactoryBean&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;create&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;ClientFactoryBean&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;java&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt;&lt;span class='mi'&gt;59&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt;
	&lt;span class='n'&gt;at&lt;/span&gt; &lt;span class='n'&gt;org&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;apache&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;cxf&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;frontend&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;ClientProxyFactoryBean&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;create&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;ClientProxyFactoryBean&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;java&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt;&lt;span class='mi'&gt;102&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt;
	&lt;span class='n'&gt;at&lt;/span&gt; &lt;span class='n'&gt;org&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;apache&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;cxf&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;jaxws&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;JaxWsProxyFactoryBean&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;create&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;JaxWsProxyFactoryBean&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;java&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt;&lt;span class='mi'&gt;115&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt;
	&lt;span class='n'&gt;at&lt;/span&gt; &lt;span class='n'&gt;org&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;apache&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;cxf&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;jaxws&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;ServiceImpl&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;createPort&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;ServiceImpl&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;java&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt;&lt;span class='mi'&gt;434&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt;
	&lt;span class='n'&gt;at&lt;/span&gt; &lt;span class='n'&gt;org&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;apache&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;cxf&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;jaxws&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;ServiceImpl&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;getPort&lt;/span&gt;&lt;span class='o'&gt;(&lt;/span&gt;&lt;span class='n'&gt;ServiceImpl&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;java&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt;&lt;span class='mi'&gt;312&lt;/span&gt;&lt;span class='o'&gt;)&lt;/span&gt;
	&lt;span class='o'&gt;...&lt;/span&gt; &lt;span class='mi'&gt;33&lt;/span&gt; &lt;span class='n'&gt;more&lt;/span&gt;
&lt;span class='n'&gt;Caused&lt;/span&gt; &lt;span class='nl'&gt;by:&lt;/span&gt; &lt;span class='n'&gt;org&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;apache&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;cxf&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='na'&gt;BusException&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt; &lt;span class='n'&gt;No&lt;/span&gt; &lt;span class='n'&gt;binding&lt;/span&gt; &lt;span class='n'&gt;factory&lt;/span&gt; &lt;span class='k'&gt;for&lt;/span&gt; &lt;span class='n'&gt;namespace&lt;/span&gt; &lt;span class='nl'&gt;http:&lt;/span&gt;&lt;span class='c1'&gt;//schemas.xmlsoap.org/wsdl/soap/ registered.&lt;/span&gt;
&lt;span class='o'&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;So make sure to put the &lt;code&gt;cxf.xml&lt;/code&gt; file in your &lt;code&gt;src/main/resources&lt;/code&gt; folder (create that folder if it doesn&amp;#8217;t exist).&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Use web applications more like desktop apps with Prism (or Fluid)</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/05/10/use-webapps-more-like-desktop-apps-with-prism-or-fluid.html" />
   <updated>2009-05-10T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/05/10/use-webapps-more-like-desktop-apps-with-prism-or-fluid</id>
   <content type="html">Many web applications these days work more like desktop apps and/or are applications that you use throughout your day.  Using the applications through your regular browser presents a problem: to get to the application you have to switch to your web browser, find the window that you have webapp open in (or open a new window or tab if you're launching it for the first time), and possibly switch to the tab it is in.  The steps it takes to get to an already open webapp vary depending on the current state of your browser and what windows and tabs you have open.&lt;br&gt;
&lt;br&gt;
Instead, it would be much nicer if the webapp had its own entry in your operating system's taskbar or dock (or possibly in the tray if you are on Windows).  With the help of Mozilla's &lt;a href="http://prism.mozilla.com/"&gt;Prism&lt;/a&gt; you can achieve just that.  If you are using Mac OS X, you also have the option of using &lt;a href="http://fluidapp.com/"&gt;Fluid&lt;/a&gt; which uses the same rendering engine as Safari (Webkit).&lt;br&gt;
&lt;!--break--&gt;&lt;br&gt;
What both of these do is build a standalone executable based on a given URL, title, and icon.  This could even be useful for those deploying webapps to end users.  I've seen &lt;a href="http://www.adobe.com/products/air/"&gt;Adobe Air&lt;/a&gt; used for this purpose, but Prism provides an open source alternative to this which doesn't require any additional runtime.&lt;br&gt;
&lt;p&gt;&lt;br&gt;
&lt;a href="http://prism.mozilla.com/"&gt;&lt;img src="http://prism.mozilla.com/_media/logo_prism.png" style="float:right;"/&gt;&lt;/a&gt;&lt;br&gt;
I've been using Prism for my GMail accounts and web-based todo list for a while now, and it makes using those very convenient (especially since these are apps that I use frequently throughout the day).  The latest version (1.0 beta) has some support for badges (for example, can be used for showing number of emails in dock icon), but it looks like that is up to the web app itself to implement that (or possibly through an extension or through &lt;a href="https://wiki.mozilla.org/WebRunner:Scripting"&gt;scripting&lt;/a&gt;).  If you select "Show status messages and progress" when creating the app with Prism, the app will have to ability to install extensions, though I have not yet been able to successfully install the Firefox extensions I've wanted to.&lt;br&gt;
&lt;br&gt;
&lt;img src="http://prism.mozilla.com/_media/getstarted_icon.png" style="float:left; padding:5px;"/&gt;&lt;br&gt;
&lt;img src="http://people.mozilla.com/~faaborg/files/prism/announcement/prism08500.png"/&gt;&lt;br&gt;
&lt;/p&gt;&lt;br&gt;
&lt;p&gt;&lt;br&gt;
&lt;a href="http://fluidapp.com/"&gt;&lt;img src="http://fluidapp.com/i/header.png" style="float:right;"/&gt;&lt;/a&gt;&lt;br&gt;
Fluid, on the other hand, appears to have more features, such as a Greasemonkey-like "Userscripting", but I have had trouble getting it to actually work.  For GMail, it tries to open the app up in my default browser when I try to login.&lt;br&gt;
&lt;br&gt;
&lt;img src="http://fluidapp.com/i/dock_small.png"/&gt;&lt;br&gt;
&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Use rlwrap to wrap command line apps with readline</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/05/08/rlwrap.html" />
   <updated>2009-05-08T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/05/08/rlwrap</id>
   <content type="html">&lt;a href="http://utopia.knoware.nl/~hlub/rlwrap/"&gt;rlwrap&lt;/a&gt; wraps any command line utility with the GNU &lt;a href="http://tiswww.case.edu/php/chet/readline/rltop.html"&gt;readline&lt;/a&gt; library, which gives you history and Emacs-style keyboard commands for line editing that you'd get with anything that uses the readline library (such as the Bash shell).&lt;br&gt;
&lt;br&gt;
I started using it with Oracle's &lt;a href="http://en.wikipedia.org/wiki/SQL*Plus"&gt;SQL*Plus&lt;/a&gt; command-line utility which lacks history and decent editing capabilities.  rlwrap makes it much more pleasant to use.&lt;br&gt;
&lt;br&gt;
There is a package for rlwrap in Ubuntu 9.04, so it is likely to be in other recent Linux distros.  If you're on Mac OS X, &lt;a href="http://www.finkproject.org/"&gt;Fink&lt;/a&gt; has a package for this.  If you're on Windows, it &lt;a href="http://cygwin.com/packages/rlwrap/rlwrap-0.24-1"&gt;looks like&lt;/a&gt; there is a package for &lt;a href="http://www.cygwin.com/"&gt;Cygwin&lt;/a&gt;.
</content>
 </entry>
 
 <entry>
   <title>Get Emacs-style keyboard shortcuts in Cocoa text widgets</title>
   <author>
     <name>Nilesh Kapadia</name>
   </author>
   <link href="http://nileshk.com/2009/05/05/emacs-style-keyboard-shortcuts-in-cocoa.html" />
   <updated>2009-05-05T00:00:00-04:00</updated>
   <id>http://nileshk.com/2009/05/05/emacs-style-keyboard-shortcuts-in-cocoa</id>
   <content type="html">Mac OS X already has defined some basic Emacs-style keyboard shortcuts (CTRL-N/P/B/F/K/Y/T/etc) which are available in Cocoa text widgets.  But Cocoa is highly configurable, and allows for configuring a larger subset of Emacs-style keybindings (among many other possibilities).&lt;br&gt;
&lt;br&gt;
These two references written by &lt;a href="http://www.hcs.harvard.edu/~jrus/"&gt;Jacob Rus&lt;/a&gt; are very useful for understanding what you can do with the Cocoa text system:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.hcs.harvard.edu/~jrus/Site/cocoa-text.html"&gt;Customizing the Cocoa Text System&lt;/a&gt;&lt;br&gt;
&lt;a href="http://www.macosxhints.com/article.php?story=20060317045211408"&gt;Customize the Cocoa text binding system&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
If you want to see my Emacs-style keybindings &lt;a href="http://github.com/nileshk/mac-configuration/blob/99eef47cd434fd3d6f4f1f9e2f50321f32179b88/Library/KeyBindings/DefaultKeyBinding.dict"&gt;you can get it here&lt;/a&gt;.  I did not enable incremental search yet as I couldn't get the input manager for it working yet.&lt;br&gt;
&lt;br&gt;
Now this only gives you these keybindings when you're editing text in a Cocoa application.  Non-Cocoa applications will not be affected.  Firefox is not affected even though it uses Cocoa.  It does appear to affect Java Swing apps, though, such as IntelliJ IDEA and Oracle SQL Developer, which both have Emacs keybindings that don't work properly until you make these changes (combinations such as Option-v output a special character otherwise, rather than performing M-v).&lt;br&gt;
&lt;br&gt;
In a future entry I will talk about how to use &lt;a href="http://manytricks.com/butler/"&gt;Butler&lt;/a&gt; and &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/4141"&gt;Firemacs&lt;/a&gt; to give Firefox more Emacs-style text editing and keyboard shortcuts.  Butler's ability to simulate keystrokes (and trigger on keyboard combinations) is pretty powerful.
</content>
 </entry>
 
 
</feed>

