<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Streamhead &#187; Java and JavaScript</title>
	<atom:link href="http://www.streamhead.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.streamhead.com</link>
	<description>multimedia webapplication thoughts and experiments</description>
	<lastBuildDate>Tue, 07 Feb 2012 15:58:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>A Case Study: Save Money, Invest in Software Development</title>
		<link>http://www.streamhead.com/save-money-with-software/</link>
		<comments>http://www.streamhead.com/save-money-with-software/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 15:58:52 +0000</pubDate>
		<dc:creator>Peter Backx</dc:creator>
				<category><![CDATA[Java and JavaScript]]></category>

		<guid isPermaLink="false">http://www.streamhead.com/?p=3383</guid>
		<description><![CDATA[One question many small business owners struggle with is how much to spend on software. Should you get existing software off the shelf? Open Source or proprietary? Or should you invest in custom development? But how much does that cost and is it worth it? Many of the smaller companies I&#8217;ve worked with over the [...]]]></description>
			<content:encoded><![CDATA[<img width="300" height="250" src="http://www.streamhead.com/wp-content/uploads/2012/02/invest.png" class="attachment-post-thumbnail wp-post-image" alt="Invest in Software" title="invest" /><p>One question many small business owners struggle with is how much to spend on software. Should you get existing software off the shelf? Open Source or proprietary? Or should you invest in custom development? But how much does that cost and is it worth it?</p>
<p><span id="more-3383"></span>Many of <a title="Peter Backx on Elance, my profile" href="http://pbackx.elance.com">the smaller companies I&#8217;ve worked with over the last year</a> have similar problems. At some point they decided they needed a website and just went with whatever their cousin recommended. This wasn&#8217;t a bad choice, because the site has brought them new clients and kept them in touch with existing clients.</p>
<p>In short: <strong>the site has made them money</strong>.</p>
<p>Programmer&#8217;s and lean startup aficionados would say that their <a title="Minimum Viable Product" href="http://en.wikipedia.org/wiki/Minimum_viable_product">minimum viable product</a> has validated their assumptions.</p>
<p>The other side of the coin, is that a site like this usually requires a lot of manual maintenance. So now the business is at a point where they want to invest in the improvement and the expansion of the website.</p>
<p>But what to do?</p>
<p>Lets study a fictional example: Huey Bobbie&#8217;s company &#8220;Server Certified Studios&#8221; has a website containing a few modules:</p>
<ul>
<li>A content management system that was created by his nephew as a homework assignment. It works, but for every update to the site, Huey needs to figure out what file to change and if he makes even the smallest error, the entire site goes offline.</li>
<li>An open source application that manages his mailing list.</li>
</ul>
<h2>Calculating expenses</h2>
<p>Huey&#8217;s expenses for the site are:</p>
<ul>
<li>A shared hosting account and a domain name. For about $150/year you can get <strong><a title="Lunarpages web hosting (affiliate link)" href="http://www.lunarpages.com/id/pbackx">a decent package deal</a></strong>.</li>
<li>Initial programming and template for the site. Those are <a title="Sunk costs" href="http://en.wikipedia.org/wiki/Sunk_costs">sunk costs</a>, so they won&#8217;t play into any calculation here.</li>
<li>Every month Huey needs to add a few products to the site, add a bunch of news items and update one or more page. Writing all of those things takes about 1 hour weekly. But because he has to search through the files and be very careful with the syntax, this takes him another 1 hour weekly. Lets assume Huey, as a business owner, values his time at about $100/hour (which is conservative, he could be doing other stuff to make more money).</li>
</ul>
<p>Everything combined, the website costs Huey on a yearly basis:</p>
<p>$150 + 50 (working weeks) * $200 = <strong>$10150 / year</strong></p>
<p>I think this is a fairly realistic number of the cost of a typical small business website that is maintained regularly.</p>
<h2>Profit</h2>
<p>For the sake of argument, lets say Huey has calculated that the site is generating a revenue that is exactly double of what it cost him: $20300 / year.</p>
<p>Or the site is making <strong>a profit of $10150 / year, or a 50% profit margin</strong>.</p>
<p>Just to make this more concrete: $20300 means 203 customers buy $100 worth of product over a year. Or about 17 customers find Server Certified Studios through his website. Not at all impossible.</p>
<h2>Room for Improvement</h2>
<p>That&#8217;s not a bad extra profit to add to the bottom line. But lets see how we can do better.</p>
<p>For instance, lets believe in magic and assume there is <strong>no additional work required</strong> to get a news item that is written on the website. So Huey only need to write 1 hour / week and whatever he has written magically appears on the site.</p>
<p>In that case, the website cost is:</p>
<p>$150 + 50 * $100 = $5150/year</p>
<p><strong>The profit is $15150 or a margin of 75%</strong>. That&#8217;s huge improvement!</p>
<p>But lets try something more realistic. We automate the website a little and improve it&#8217;s administrative interface. Now Huey only needs an hour each month to update the site.</p>
<p>The cost: $150 + 50 * $100 + 12 * $100 = $6350 / year</p>
<p>That&#8217;s <strong>$13950 profit or a margin of 69%</strong>. A nice increase.</p>
<h2>Getting There: Investing</h2>
<p>If Huey wants to recoup this improvement in a year. The investment may not be over $3800 (this is the additional profit over a year: $13950 &#8211; $10150)</p>
<p>Given the size of this website, $3800 can buy a lot. A few example investment opportunities are:</p>
<ul>
<li>Find a WordPress theme expert and let them convert the existing site layout to a WordPress theme: Site maintenance will be drastically easier and finding cheap developers afterwards easier (the WordPress dev community is probably one of the most saturated)</li>
<li>Go on Elance and find a PHP developer that can create a script that automatically converts the input text to the XML format of the site: Not as future proof, but could be even cheaper if you find a good Asian developer.</li>
<li>Hire a Virtual Assistant to put everything online at about 1/10 the cost of you: Easy to set up, but requires continuous payment.</li>
</ul>
<p>If Huey would ask me what to do, I would most certainly recommend the WordPress solution. It&#8217;s a one time investment that will create a site that is ready for further expansion. And the numbers support it.</p>
<p>Huey will find a WordPress theme company that can create this for $1000. Which will repay itself in 4 months. Furthermore, the WordPress powered site will probably have better SEO than whatever was there previously. Thus delivering even more clients to Server Certified Studios.</p>
<h2>Conclusion</h2>
<p>If you are a small business owner and feel your website is sucking up way to much of your energy, it&#8217;s time to evaluate your options. Write down the numbers and see what kind of time and money you are spending and how much it is making you.</p>
<p><strong>Even small investments can tremendously improve your profit margin and reduce your frustration</strong>.</p>
<p>(<a title="Invest on Flickr" href="http://www.flickr.com/photos/wonderwebby/2723279741/">image credit</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamhead.com/save-money-with-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://www.streamhead.com/wp-content/uploads/2012/02/invest.png" />
		<media:content url="http://www.streamhead.com/wp-content/uploads/2012/02/invest.png" medium="image">
			<media:title type="html">invest</media:title>
		</media:content>
		<media:content url="http://www.streamhead.com/wp-content/uploads/2012/02/invest.png" medium="image">
			<media:title type="html">invest</media:title>
		</media:content>
	</item>
		<item>
		<title>ExpensesSpreadsheet.net, Rapid Web App Development with Node.js</title>
		<link>http://www.streamhead.com/expensesspreadsheet-net-node-js/</link>
		<comments>http://www.streamhead.com/expensesspreadsheet-net-node-js/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 14:00:46 +0000</pubDate>
		<dc:creator>Peter Backx</dc:creator>
				<category><![CDATA[Java and JavaScript]]></category>

		<guid isPermaLink="false">http://www.streamhead.com/?p=3343</guid>
		<description><![CDATA[My latest project is ExpensesSpreadsheet.NET. It is the simplest and easiest solution I could come up with to track and categorize expenses &#8230; in a spreadsheet. Let&#8217;s call it a niche web application, so it&#8217;s probably not for every one, but it should fit some extremely well. It runs on Heroku&#8217;s Node.js stack. Over the [...]]]></description>
			<content:encoded><![CDATA[<p>My latest project is <a title="Track your expenses the smart way" href="http://www.expensesspreadsheet.net">ExpensesSpreadsheet.NET</a>. It is the simplest and easiest solution I could come up with to track and categorize expenses &#8230; in a spreadsheet. Let&#8217;s call it a niche web application, so it&#8217;s probably not for every one, but it should fit some extremely well. It runs on Heroku&#8217;s Node.js stack.</p>
<p><span id="more-3343"></span>Over the last month or two, I&#8217;ve been very busy with a few projects. And it was about time to present some. I have many more ideas on how to extend <strong><a title="Track your expenses the smart way" href="http://www.expensesspreadsheet.net">ExpensesSpreadsheet</a></strong>, but I thought it wise to first gauge the reaction of people.</p>
<p>It uses the following technology:</p>
<ul>
<li><strong>Node.js</strong>, the JavaScript event machine that is all the rage now.</li>
<li><strong>RailwayJS</strong>, a Rails-like web framework.</li>
<li><strong>connect-auth</strong> for Facebook integration (and a lot more)</li>
<li><strong>MongoDB</strong> for data storage. Mostly because it was so easy to get started with compared to traditional related databases. But in hindsight, I think it&#8217;s an ok choice. I really don&#8217;t safe any relations anyway.</li>
<li><strong>EJS</strong> JavaScript templates. Although in hindsight, I think I like Jade better.</li>
<li><strong>Heroku</strong>, cloud hosting done right.</li>
</ul>
<p>This was my first experiment with Node.js and Heroku and it was extremely enlightening. JavaScript is not my favorite programming language, but it certainly has a way of reducing boiler plate code (stuff I&#8217;m really starting to hate in Java). Combined with deployment to Heroku, the time between idea and deployed application is so short, it will make any developer smile.</p>
<p>If your day-to-day life involves lots of Java, you owe it to yourself to try out this stack. It&#8217;s not your average hacked together client side JavaScript. It takes a little time to wrap your head around the Node model, but it&#8217;s all worth it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamhead.com/expensesspreadsheet-net-node-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
		<item>
		<title>Permanent Redirect Non-WWW to WWW in Node.JS on Heroku</title>
		<link>http://www.streamhead.com/nodejs-permanent-redirect/</link>
		<comments>http://www.streamhead.com/nodejs-permanent-redirect/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 12:00:41 +0000</pubDate>
		<dc:creator>Peter Backx</dc:creator>
				<category><![CDATA[Java and JavaScript]]></category>

		<guid isPermaLink="false">http://www.streamhead.com/?p=3329</guid>
		<description><![CDATA[For SEO reasons it&#8217;s important to make sure that users only visit your site through a single domain name. Either www.example.com or example.com, but not both. In most cases a .htaccess change is the easiest fix. But not when you&#8217;re deploying to an environment that doesn&#8217;t have Apache, like Heroku. Here&#8217;s a quick way to [...]]]></description>
			<content:encoded><![CDATA[<p>For SEO reasons it&#8217;s important to make sure that users only visit your site through a single domain name. Either www.example.com or example.com, but not both. In most cases a .htaccess change is the easiest fix. But not when you&#8217;re deploying to an environment that doesn&#8217;t have Apache, like Heroku. Here&#8217;s a quick way to get this functionality using Express on Node.JS</p>
<p><span id="more-3329"></span>Since you probably only want to do this in a production environment, I suggest you place this in <a title="Express configuration" href="http://expressjs.com/guide.html#configuration">that configure block</a>.</p>
<p>Before you add any middleware add the following route:</p>

<div class="wp_codebox"><table><tr id="p33292"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p3329code2"><pre class="javascript" style="font-family:monospace;">app.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'*'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>req<span style="color: #339933;">,</span> res<span style="color: #339933;">,</span> next<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #660066;">headers</span>.<span style="color: #660066;">host</span>.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">'www'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    res.<span style="color: #660066;">redirect</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'http://www.'</span> <span style="color: #339933;">+</span> req.<span style="color: #660066;">headers</span>.<span style="color: #660066;">host</span> <span style="color: #339933;">+</span> req.<span style="color: #660066;">url</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">301</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    next<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>That&#8217;s really all there is to it. Since most frameworks have similar routing options, you should be able to adapt this to other frameworks, such as Geddy.</p>
<p>BTW I&#8217;m planning to launch a Node.JS app in November as part of <a title="Launch an app month" href="http://news.ycombinator.com/item?id=3180321">Hacker News&#8217; Launch an App Month</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamhead.com/nodejs-permanent-redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
		<item>
		<title>Updated PayPal AppEngine Servlet</title>
		<link>http://www.streamhead.com/updated-paypal-appengine-servlet/</link>
		<comments>http://www.streamhead.com/updated-paypal-appengine-servlet/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 14:00:24 +0000</pubDate>
		<dc:creator>Peter Backx</dc:creator>
				<category><![CDATA[Java and JavaScript]]></category>

		<guid isPermaLink="false">http://www.streamhead.com/?p=3322</guid>
		<description><![CDATA[If you want to integrate PayPal with your Google AppEngine application, there are a limited number of options available. My own open source project offers a servlet that can parse and log IPN messages. This will quickly get you up and running with PayPal Payments Standard. Since I launched the PayPal servlet, I&#8217;ve had many [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to integrate PayPal with your Google AppEngine application, there are a limited number of options available. My own open source project offers a servlet that can parse and log IPN messages. This will quickly get you up and running with <a title="PayPal payments standard guides" href="https://www.x.com/developers/paypal/development-and-integration-guides#wps">PayPal Payments Standard</a>.</p>
<p><span id="more-3322"></span><a title="Java AppEngine PayPal IPN servlet" href="http://www.streamhead.com/java-paypal-ipn-servlet/">Since I launched the PayPal servlet</a>, I&#8217;ve had many inquiries and I know of at least 2 production deployments of the code. It was about time that I started handling the project a little more professionally.</p>
<p>The first step in this process was completed last weekend: the project is now a Maven project and the Eclipse specific configuration has been removed. I have decided to make this part of my <a title="Powered by Reindeer, quick appengine development" href="http://www.streamhead.com/vaadin-app-engine-in-5-minutes/">Powered by Reindeer initiative</a>. Although it can be used completely independent and will remain so, I believe that there are going to be some nice synergies in the future that I&#8217;ll want to exploit.</p>
<p>My next step will be cleaning up the actual code. I&#8217;m not sure when I&#8217;ll get around to it, but this will involve changing the package names a little to be more in line with the Powered by Reindeer structure. If you think there&#8217;s a good reason to keep the old names, please let me know. Also let me know if you&#8217;d like to get a personal e-mail when the changes will take place.</p>
<p><a title="Java AppEngine PayPal IPN servlet" href="https://github.com/pbackx/PayPalIPNServlet">See the GitHub page for all details</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamhead.com/updated-paypal-appengine-servlet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
		<item>
		<title>AZERTY Keyboard and jMonkeyEngine Quick Tip</title>
		<link>http://www.streamhead.com/azerty-jmonkeyengine/</link>
		<comments>http://www.streamhead.com/azerty-jmonkeyengine/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 14:00:26 +0000</pubDate>
		<dc:creator>Peter Backx</dc:creator>
				<category><![CDATA[Java and JavaScript]]></category>
		<category><![CDATA[jMonkeyEngine]]></category>

		<guid isPermaLink="false">http://www.streamhead.com/?p=3314</guid>
		<description><![CDATA[If you&#8217;ve ever created anything using jMonkeyEngine&#8217;s SimpleApplication and you use something other than the American standard QWERTY keyboard, you might have had the same frustration as me: Why isn&#8217;t there quick way to switch the keyboard layout? The SimpleApplication base class is supposed to make your life easier, yet there you are, completely stuck [...]]]></description>
			<content:encoded><![CDATA[<img width="300" height="250" src="http://www.streamhead.com/wp-content/uploads/2011/08/jMonkeEngine_showcase.png" class="attachment-post-thumbnail wp-post-image" alt="jMonkeEngine_showcase" title="jMonkeEngine_showcase" /><p>If you&#8217;ve ever created anything using jMonkeyEngine&#8217;s SimpleApplication and you use something other than the American standard QWERTY keyboard, you might have had the same frustration as me: Why isn&#8217;t there quick way to switch the keyboard layout? The SimpleApplication base class is supposed to make your life easier, yet there you are, completely stuck with that unnatural keyboard layout. Read on for a quick copy-and-paste solution.</p>
<p><span id="more-3314"></span>The keyboard mapping that SimpleApplication uses for its camera movement is defined in the FlyByCamera. The mapping is hardcoded and the mapping names don&#8217;t even use constant strings. Clearly, no one ever thought about international users. <a title="jMonkeyEngine.org" href="http://jmonkeyengine.org/">jMonkeyEngine</a> does so many things right, yet on this one, it really misses the ball.</p>
<p>Luckily, with a little searching, it&#8217;s fairly easy to redefine the correct mappings. It&#8217;s something I now do in all my experiments.</p>
<p>I just copy and paste the following at the start of every simpleInitApp:</p>

<div class="wp_codebox"><table><tr id="p33145"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p3314code5"><pre class="java" style="font-family:monospace;">inputManager.<span style="color: #006633;">deleteMapping</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;FLYCAM_Forward&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
inputManager.<span style="color: #006633;">deleteMapping</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;FLYCAM_Lower&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
inputManager.<span style="color: #006633;">deleteMapping</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;FLYCAM_StrafeLeft&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
inputManager.<span style="color: #006633;">deleteMapping</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;FLYCAM_Rise&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
inputManager.<span style="color: #006633;">addMapping</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;FLYCAM_Forward&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> KeyTrigger<span style="color: #009900;">&#40;</span>KeyInput.<span style="color: #006633;">KEY_Z</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
inputManager.<span style="color: #006633;">addMapping</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;FLYCAM_Lower&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> KeyTrigger<span style="color: #009900;">&#40;</span>KeyInput.<span style="color: #006633;">KEY_W</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
inputManager.<span style="color: #006633;">addMapping</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;FLYCAM_StrafeLeft&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> KeyTrigger<span style="color: #009900;">&#40;</span>KeyInput.<span style="color: #006633;">KEY_Q</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
inputManager.<span style="color: #006633;">addMapping</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;FLYCAM_Rise&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> KeyTrigger<span style="color: #009900;">&#40;</span>KeyInput.<span style="color: #006633;">KEY_A</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
inputManager.<span style="color: #006633;">addListener</span><span style="color: #009900;">&#40;</span>flyCam, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;FLYCAM_Forward&quot;</span>, <span style="color: #0000ff;">&quot;FLYCAM_Lower&quot;</span>, <span style="color: #0000ff;">&quot;FLYCAM_StrafeLeft&quot;</span>, <span style="color: #0000ff;">&quot;FLYCAM_Rise&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
flyCam.<span style="color: #006633;">setMoveSpeed</span><span style="color: #009900;">&#40;</span>10f<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>(Note that I&#8217;ve also sped up the movement to more easily move around)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamhead.com/azerty-jmonkeyengine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://www.streamhead.com/wp-content/uploads/2011/08/jMonkeEngine_showcase.png" />
		<media:content url="http://www.streamhead.com/wp-content/uploads/2011/08/jMonkeEngine_showcase.png" medium="image">
			<media:title type="html">jMonkeEngine_showcase</media:title>
		</media:content>
		<media:content url="http://www.streamhead.com/wp-content/uploads/2011/08/jMonkeEngine_showcase.png" medium="image">
			<media:title type="html">jMonkeEngine_showcase</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Web Hosting Options Flowchart</title>
		<link>http://www.streamhead.com/java-web-hosting-options-flowchart/</link>
		<comments>http://www.streamhead.com/java-web-hosting-options-flowchart/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 14:00:53 +0000</pubDate>
		<dc:creator>Peter Backx</dc:creator>
				<category><![CDATA[Java and JavaScript]]></category>

		<guid isPermaLink="false">http://www.streamhead.com/?p=3260</guid>
		<description><![CDATA[One question I get asked a lot, is where and how to host your Java web application. It&#8217;s all fine to create it inside Eclipse with an embedded server, but how do you get it to the people? For a long time, there was no answer for enthusiast programmers. There were only expensive and way [...]]]></description>
			<content:encoded><![CDATA[<p>One question I get asked a lot, is where and how to host your Java web application. It&#8217;s all fine to create it inside Eclipse with an embedded server, but how do you get it to the people? For a long time, there was no answer for enthusiast programmers. There were only expensive and way oversized options. Things have changed lately, but it&#8217;s still not an easy choice.</p>
<p>Therefore I have created a small flowchart that will try to guide you in the maze.</p>
<p><span id="more-3260"></span></p>
<p><img class="alignnone size-full wp-image-3264" title="java_hosting_flowchart" src="http://www.streamhead.com/wp-content/uploads/2011/06/java_hosting_flowchart.png" alt="Java Web Application Hosting Options" width="515" height="1399" /></p>
<p>Feel free to submit additions, corrections, comments. I&#8217;ll keep updating the flowchart.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamhead.com/java-web-hosting-options-flowchart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://www.streamhead.com/wp-content/uploads/2011/06/java_hosting_flowchart-300x250.png" />
		<media:content url="http://www.streamhead.com/wp-content/uploads/2011/06/java_hosting_flowchart.png" medium="image">
			<media:title type="html">java_hosting_flowchart</media:title>
			<media:thumbnail url="http://www.streamhead.com/wp-content/uploads/2011/06/java_hosting_flowchart-300x250.png" />
		</media:content>
	</item>
		<item>
		<title>A Google Appengine Staging Server Howto</title>
		<link>http://www.streamhead.com/google-appengine-staging-server/</link>
		<comments>http://www.streamhead.com/google-appengine-staging-server/#comments</comments>
		<pubDate>Tue, 17 May 2011 14:00:59 +0000</pubDate>
		<dc:creator>Peter Backx</dc:creator>
				<category><![CDATA[Java and JavaScript]]></category>

		<guid isPermaLink="false">http://www.streamhead.com/?p=3196</guid>
		<description><![CDATA[Out of the box, Google&#8217;s App Engine supports versioned deployments. You can switch back and forth between revisions very easily, which is a great feature for properly testing an application before going live. There is one major problem: All versions of the application share the same datastore. So if you&#8217;re migrating your data you run [...]]]></description>
			<content:encoded><![CDATA[<p>Out of the box, Google&#8217;s App Engine supports versioned deployments. You can switch back and forth between revisions very easily, which is a great feature for properly testing an application before going live. There is one major problem: All versions of the application share the same datastore. So if you&#8217;re migrating your data you run a serious risk of influencing your current production application. Hence the need for <strong>a proper staging environment</strong>.</p>
<p><span id="more-3196"></span>It&#8217;s no secret, I am a fan of Google&#8217;s App Engine. <a title="Google AppEngine in Practice" href="http://www.streamhead.com/google-appengine-practice/">Once you get used to its peculiarities, it has a number of major advantageous</a>. Since I started incorporating some of the continuous integration/lean startup ideas in <a title="Launching my FCTR invoicing/bookkeeping project" href="http://www.streamhead.com/launching-my-first-vaadin-appengine-project/">my own project</a> I&#8217;ve run into the shared datastore issue and the need for a properly isolated staging environment has become apparent.</p>
<p>Here&#8217;s how I did it.</p>
<h2>Setting up the Staging Application</h2>
<p>It&#8217;s possible to use namespaces to create an isolated datastore, however I didn&#8217;t want to create additional code for testing. So I took another approach, which I believe is a lot easier and less error-prone:</p>
<ol>
<li>In the appengine control panel, create a second application. You have 10 free ones so that shouldn&#8217;t be a problem. I added the &#8220;-staging&#8221; suffix to the name of the application under test, so I won&#8217;t mistake one for the other.</li>
<li>If you want to start from a copy of the existing datastore, you can <a title="Uploading and Downloading Data" href="http://code.google.com/appengine/docs/python/tools/uploadingdata.html">export the entire datastore using the Python development kit</a>. Even if you&#8217;re using the Java development kit, it&#8217;s worth setting this up. It allows you to make backups of your datastore, which might come in handy when something is really messed up.</li>
<li>Next, import the database into your staging application using the same tool.</li>
<li>And finally, deploy your application to the staging application. If you&#8217;re using Eclipse, just change the application id, if not, you can find the property in the appengine-web.xml.</li>
</ol>
<p>A small note on using production data in your tests: Be very careful about it. You may want to anonymize some of the data and remove anything that could be remotely confidential.</p>
<p>That should be it. There really wasn&#8217;t much to it, but you now should have a fully functioning copy of your production application. Surf around a little to make sure everything is working swiftly.</p>
<p>When you&#8217;re happy, lets automate it.</p>
<h2>Automating Deployments</h2>
<p><a title="Alternatives for Maven, Building with less Frustration" href="http://www.streamhead.com/maven-alternatives/">I was about to throw out Maven</a>, but I&#8217;ve now created a setup that I&#8217;m pretty happy with. So Maven is here to stay for now. As are the Maven Eclipse plugin and the <a title="maven-gae-plugin" href="http://code.google.com/p/maven-gae-plugin/">GAE plugin for Maven</a>.</p>
<p>It&#8217;s thanks to the maven-gae-plugin that I could automate the staging and production deployments. Which has given me a very reproducible build and deployment set up.</p>
<p>To seamlessly create a build for both the staging and production server, I&#8217;m using Maven profiles and its ability to <a title="Maven Resources plugin - Filtering" href="http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html">filter resources while copying them</a>.</p>
<p>In the appengine-web.xml I added a gae.application variable:</p>

<div class="wp_codebox"><table><tr id="p319611"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p3196code11"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appengine-web-app</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://appengine.google.com/ns/1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${gae.application}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
...</pre></td></tr></table></div>

<p>Next up I enabled filtering of the appengine-web.xml (all of the next few bits go into the pom.xml):</p>

<div class="wp_codebox"><table><tr id="p319612"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p3196code12"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-war-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;webResources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>src/main/webapp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filtering<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filtering<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;includes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>**/appengine-web.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/include<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/includes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/webResources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>In the properties section, I added the default application, which is the staging one. This gives me the assurance that I&#8217;ll always be deploying to the staging environment, unless I really want to go to production:</p>

<div class="wp_codebox"><table><tr id="p319613"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p3196code13"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gae.application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>myapp-staging<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gae.application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>And for the production deployment I created a profile:</p>

<div class="wp_codebox"><table><tr id="p319614"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p3196code14"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>production<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gae.application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>myapp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gae.application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>With this configuration, I can easily run the local development server:</p>
<pre>> mvn gae:run</pre>
<p>Deploy to the staging server:</p>
<pre>> mvn gae:deploy</pre>
<p>And when I&#8217;m happy, deploy it to the production server:</p>
<pre>> mvn gae:deploy -Pproduction</pre>
<p>In addition to the name of the application, you can also configure other properties that differ between a test setup and a production one. For instance, I use the PayPal development servers locally and on the staging server, but the real PayPal site in production.</p>
<h2>Conclusion</h2>
<p>With a pretty simple Maven configuration, it&#8217;s possible to create a very reproducible build and deployment environment. Add a continuous integration server and you&#8217;re on your way to the perfect lean setup.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamhead.com/google-appengine-staging-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
		<item>
		<title>How to Run Your WordPress.org Blog Locally for Experimentation and Fun</title>
		<link>http://www.streamhead.com/wordpress-locally/</link>
		<comments>http://www.streamhead.com/wordpress-locally/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 14:00:55 +0000</pubDate>
		<dc:creator>Peter Backx</dc:creator>
				<category><![CDATA[Java and JavaScript]]></category>

		<guid isPermaLink="false">http://www.streamhead.com/?p=3164</guid>
		<description><![CDATA[If you have a WordPress.org blog and want to try a new plugin or a new look, you have two options: You could just install it on your running production site and risk crashing it. Or you could first experiment with it on a different test installation. Ideally this test system would resemble the real [...]]]></description>
			<content:encoded><![CDATA[<img width="300" height="250" src="http://www.streamhead.com/wp-content/uploads/2011/04/wordpress-logo-stacked-rgb.png" class="attachment-post-thumbnail wp-post-image" alt="wordpress-logo-stacked-rgb" title="wordpress-logo-stacked-rgb" /><p>If you have a WordPress.org blog and want to try a new plugin or a new look, you have two options: You could just install it on your running production site and risk crashing it. Or you could first experiment with it on a different test installation. Ideally this test system would resemble the real site as closely as possible. I think you can guess which one is the right way and which is the one most people go for. This article show how to copy your existing blog to a local computer and run it there, so you don&#8217;t have to fear trying out something new.</p>
<p><span id="more-3164"></span>This tutorial requires some technical knowledge. How to set up a LAMP/WAMP stack, FTP files and use phpmyadmin. Nothing very complicated, but if you don&#8217;t feel comfortable doing it, I&#8217;d gladly help you out and create a fully working VirtualBox image of your blog for $50 (I&#8217;ll also support you in setting up VirtualBox).</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="86FU84U8WW2HC" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/BE/i/btn/btn_buynowCC_LG.gif" type="image" />
<img src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
<p>(<a title="Why buy from Streamhead?" href="http://www.streamhead.com/about/why-buy-from-streamhead/">why buy from Streamhead?</a>)</p>
<h2>Step 0. Prerequisites</h2>
<p>This tutorial won&#8217;t work for WordPress.com hosted blogs, only for self-hosted WordPress.org blogs. You will need to have an FTP account that can access your WordPress installation files. Every host offers this, so check your hosting details and keep the FTP url, login and password ready.</p>
<p>You will also need to export your database. The easiest way is via phpMyAdmin. I haven&#8217;t seen a host that doesn&#8217;t offer this super-useful application. A link to it is usually located in the control panel of your hosting account.</p>
<h2>Step 1. Operating environment</h2>
<p>Depending on your preferences, there are a wide range of operating systems and environments you can work with.</p>
<ul>
<li>If you&#8217;re used to Windows and you like to keep it simple. You can install everything on Windows.</li>
<li>If you want to create something portable, I suggest running some kind of virtualization software. <a title="VirtualBox Keeps Your Development Environment Tidy" href="http://www.streamhead.com/virtualbox/" target="_blank">I&#8217;m a fan of VirtualBox</a>.</li>
</ul>
<p>Basically, pretty much any operating system will do, but I like to create a virtual <a title="Ubuntu" href="http://www.ubuntu.com/" target="_blank">Ubuntu system</a> in VirtualBox. It&#8217;s a great way to keep the server software that you&#8217;ll install in step 2 away from your &#8220;normal&#8221; operating environment. Shut down the virtual machine and you don&#8217;t need to worry about system processes that keep using memory and CPU that you forgot to shut down.</p>
<h2>Step 2. LAMP</h2>
<p>While there are other ways to run WordPress, the easiest way is to install the Apache web server, MySQL database and PHP language. It&#8217;s the same environment that your blog host uses, so this is the best way to reproduce identical conditions.</p>
<ul>
<li>If you&#8217;re on Windows, you can go for <a title="WAMP, an acronym that actually makes developers' lives easier" href="http://www.streamhead.com/wamp-acronym-developers-lives-easier/" target="_blank">one of the many WAMP distributions</a>.</li>
<li>For Ubuntu there is an <a title="Ubuntu Server Guide" href="https://help.ubuntu.com/10.10/serverguide/C/index.html" target="_blank">in depth guide to setting up a server</a>. Keep in mind that you don&#8217;t need to go through the whole guide. You only need to install Apache2, MySQL and PHP5. I also suggest to add phpMyAdmin while you&#8217;re installing. It isn&#8217;t strictly necessary but will make copying the database easier.</li>
<li>If you&#8217;re on Mac, <a title="MAMP, Mac, Apache, MySQL, PHP" href="http://www.mamp.info/en/index.html" target="_blank">there&#8217;s MAMP</a>.</li>
</ul>
<h2>Step 3. Copy WWW directory</h2>
<p>Now it&#8217;s time to do the actual work. First you need to copy all the blog files locally:</p>
<ul>
<li>Figure out where the local Apache server stores its files. On Ubuntu this will be in /var/www. Many WAMP distributions offer shortcuts to this directory.</li>
<li>Next open an FTP client. I like <a title="21 programs to have on your Windows PC" href="http://www.streamhead.com/21-programs-pc/" target="_blank">FileZilla</a>, but feel free to pick the one you like.</li>
<li>Connect to your blog&#8217;s FTP site and navigate to the WWW directory. Usually it&#8217;s called &#8220;www&#8221;, sometimes &#8220;public_html&#8221; or something similar. There should be 3 directories in there that start with wp (wp-admin, wp-content and wp-includes) plus a bunch of .php files that also start with wp and then a number of miscellaneous files.</li>
<li>Download this entire directory into your local www directory. This might take some time, especially if you have been blogging for a while, have many plugins/themes and/or have uploaded a lot of files.</li>
</ul>
<p>You can already perform steps 4 to 7 while the download continues.</p>
<h2>Step 4. The Database Connection</h2>
<p>In the WWW directory, open the file &#8220;wp-config.php&#8221;. You will see a number of lines that start with &#8220;define&#8221;. There&#8217;s one that defines the name of your database, it&#8217;s &#8220;DB_NAME&#8221;. Write down the name after that. By default it&#8217;s going to be &#8220;wrdp&#8221;, but this can vary. Also write down the values for DB_USER and DB_PASSWORD. You may have entered those at some point but might have forgotten them. Or they could be autogenerated when WordPress was installed.</p>
<h2>Step 5. Export the database</h2>
<p>Fire up phpMyAdmin on your remote host.</p>
<ul>
<li>In the right part of the screen, you&#8217;ll see a number of tabs.</li>
<li>One of those is &#8220;Export&#8221;. Click that one.</li>
<li>You&#8217;ll see a screen divided into two sections: &#8220;Export&#8221; and &#8220;Options&#8221;.</li>
<li>In the &#8220;Export&#8221; section select the database name that you wrote down in step 4.</li>
<li>You don&#8217;t need to change anything in the &#8220;Options&#8221; section.</li>
<li>If you have a large database, select &#8220;gzipped&#8221; compression at the bottom of the screen. This can reduced the file size by a lot (mine was only 30% of the original, uncompressed file)</li>
<li>If you like, you can pick a nice name for the download.</li>
<li>Click &#8220;go&#8221; and remember where you save the file.</li>
</ul>
<h2>Step 6. Import the Database</h2>
<p>Now we are going to import this file into your local database.</p>
<ul>
<li>Fire up phpMyAdmin locally. Again, your AMP distributions will come with a shortcut to it. On Ubuntu you&#8217;ll find it at <a title="Local phpMyAdmin" href="http://localhost/phpmyadmin/" target="_blank">http://localhost/phpmyadmin/</a> by default.</li>
<li>This time pick the &#8220;Import&#8221; tab. It&#8217;s right next to the &#8220;Export&#8221; one.</li>
<li>Browse and select the file you just saved.</li>
<li>Press &#8220;go&#8221;.</li>
</ul>
<h2>Step 7. Set Up the Database User</h2>
<p>Now we need to configure the WordPress database user. Remember you wrote down the name and password in step 4.</p>
<ul>
<li>In the left section of phpMyAdmin, where it shows the databases, you should now see your imported WordPress database.</li>
<li>Click on it and it will show the tables in that database.</li>
<li>Now click on the &#8220;Privileges&#8221; tab.</li>
<li>Enter the username and password.</li>
<li>As host enter * or localhost.</li>
<li>Check all privileges (this will give global privileges, you could also give the user only access to the WordPress database. Since this is a local test system I&#8217;m not too worried about strict security, but keep this in mind)</li>
<li>Click &#8220;go&#8221; to create the user.</li>
</ul>
<h2>Step 8. First Test</h2>
<p>Surf to <a title="Local WordPress install" href="http://localhost" target="_blank">http://localhost</a></p>
<p>You should see the blog appear, but you might notice it downloads all images from your original blog site. All links will also still point to the Internet, not to the local site. You won&#8217;t be able to log into the administration.</p>
<h2>Step 9. Converting to Localhost</h2>
<p>You didn&#8217;t leave phpMyAdmin, did you?</p>
<ul>
<li>In the left column, click on your blog database (if it isn&#8217;t already showing)</li>
<li>Browse the &#8220;wp_options&#8221; table (it&#8217;s the first tiny actions icon)</li>
<li>Find the two options with option_name &#8220;siteurl&#8221; and &#8220;home&#8221;. There are many ways to do this, phpMyAdmin has a search function or you could change the SQL query if you know what you&#8217;re doing.</li>
<li>Change both options (with the little pen icon) so that their &#8220;option_value&#8221; reads &#8220;http://localhost&#8221;</li>
</ul>
<h2>Step 10. You&#8217;re Done</h2>
<p>That&#8217;s it. You now have a fully functioning local copy of your WordPress.org blog.</p>
<h2>Common Issues</h2>
<h3>When importing the database you receive an error that the file is too large.</h3>
<p>In many cases, it might be beneficial to first <a title="Optimize WordPress for shared hosting" href="http://www.streamhead.com/wordpress-shared-hosting/" target="_blank">clean up your database</a>. Also make sure you enable gzip compression. If none of those help, you will need to <a title="PHP File Upload Configuration" href="http://www.radinks.com/upload/config.php" target="_blank">change the default PHP file upload limit</a>.</p>
<h3>Categories or article links don&#8217;t work</h3>
<p>Depending on your permalink structure, you need to have the &#8220;mod_rewrite&#8221; Apache module enabled. I&#8217;m not sure why, but this isn&#8217;t always on by default. There are numerous articles about it if you Google. For instance <a title="Enable mod_rewrite on Apache 2 for Ubuntu" href="http://www.ghacks.net/2009/12/05/enable-mod_rewrite-in-a-ubuntu-server/" target="_blank">here&#8217;s a howto for Ubuntu</a>.</p>
<h3>Can&#8217;t add/configure plugins and themes and other permission issues.</h3>
<p>Again, depending on how your installation is configured, the Apache/PHP process may not have permissions to change or add files in your WWW directory. If you don&#8217;t care about security, I suggest a &#8220;chmod -R 777 *&#8221; in your WWW directory. If you do care, find the group that the Apache process runs in and give that group write access to the entire WWW directory.</p>
<h3>Something else</h3>
<p>I haven&#8217;t run into this issue, but I can imagine there are plugins that won&#8217;t like to be moved to a different server. If you see strange issues, try to disable your plugins and enable them one by one. If you find the culprit, maybe you need to change its options in the wp_options database table.</p>
<h2>Conclusion</h2>
<p>Having a full copy of your blog on your own computer is a great resource to experiment with new themes or plugins. Although it might look daunting, once you&#8217;ve done this procedure, you won&#8217;t know why you didn&#8217;t try this earlier.</p>
<p>If you&#8217;re not very technical, or don&#8217;t feel like going through all the steps, I offer a $50 service for creating a VirtualBox Ubuntu image. Feel free to <a title="Contact me for more information" href="http://www.streamhead.com/contact/" target="_blank">contact me for more information</a>, or you can go straight to PayPal (VirtualBox setup is included).</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="86FU84U8WW2HC" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/BE/i/btn/btn_buynowCC_LG.gif" type="image" />
<img src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /> </form>
<p>(<a title="Why buy from Streamhead?" href="../about/why-buy-from-streamhead/">why buy from Streamhead?</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamhead.com/wordpress-locally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://www.streamhead.com/wp-content/uploads/2011/04/wordpress-logo-stacked-rgb.png" />
		<media:content url="http://www.streamhead.com/wp-content/uploads/2011/04/wordpress-logo-stacked-rgb.png" medium="image">
			<media:title type="html">wordpress-logo-stacked-rgb</media:title>
		</media:content>
		<media:content url="http://www.streamhead.com/wp-content/uploads/2011/04/wordpress-logo-stacked-rgb.png" medium="image">
			<media:title type="html">wordpress-logo-stacked-rgb</media:title>
		</media:content>
		<media:content url="http://www.streamhead.com//www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" medium="image" />
		<media:content url="http://www.streamhead.com//www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" medium="image" />
	</item>
		<item>
		<title>Integrating Vaadin with Google&#8217;s App Engine Blobstore, an Example</title>
		<link>http://www.streamhead.com/vaadin-blobstore/</link>
		<comments>http://www.streamhead.com/vaadin-blobstore/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 14:00:12 +0000</pubDate>
		<dc:creator>Peter Backx</dc:creator>
				<category><![CDATA[Java and JavaScript]]></category>

		<guid isPermaLink="false">http://www.streamhead.com/?p=3086</guid>
		<description><![CDATA[Google&#8217;s AppEngine is a great piece of software. But because of its particular nature, it isn&#8217;t always easy to integrate with existing frameworks such as Vaadin. In this article I take a look at how to integrate the App Engine Blobstore with Vaadin. You aren&#8217;t able to use Vaadin&#8217;s standard Upload component so there are [...]]]></description>
			<content:encoded><![CDATA[<p>Google&#8217;s AppEngine is a great piece of software. But because of its particular nature, it isn&#8217;t always easy to integrate with existing frameworks such as Vaadin. In this article I take a look at how to <strong>integrate the App Engine Blobstore with Vaadin</strong>. You aren&#8217;t able to use Vaadin&#8217;s standard Upload component so there are some workarounds necessary. This is just one, feel free to share yours in the comments.</p>
<p><span id="more-3086"></span>I have created a standalone example project that demonstrates the explanation in this article. The example shows how to upload an image to the App Engine Blobstore and associate it with the current user (which is stored in the Datastore). You can use it with Maven, or load the provided Eclipse project files:</p>
<p><a href="http://www.streamhead.com/wp-content/uploads/2011/03/vaadin-gae-blobstore-example.zip"><img class="alignnone size-full wp-image-498" title="download" src="http://www.streamhead.com/wp-content/uploads/2008/11/download.png" alt="" width="30" height="24" />Vaadin / Google AppEngine integration example project</a></p>
<p>Once the file is extracted, change into the folder and simply run:</p>
<pre>&gt; mvn gae:run</pre>
<p>If Maven is correctly installed this will launch the Google AppEngine development server and when launched, you can point your browser to <a title="blobstore &amp; Vaadin example on localhost" href="http://localhost:8888/">http://localhost:8888/</a>. Enter a username which is persisted in the DataStore and in the next step you can upload an image that will get associated with that user.</p>
<p>To use the Google AppEngine Blobstore with Vaadin, you&#8217;ll need the following 5 components:</p>
<h2>1. Vaadin user management</h2>
<p>This example doesn&#8217;t really go into how to deal with users. But to demonstrate the concepts, there&#8217;s a basic user object. It contains a name and an id. The example uses Objectify for easy persistence to the datastore.</p>
<p>The user object also has 2 more field:</p>
<ul>
<li>a blobkey that points to the uploaded image (if any)</li>
<li>an uploadkey that is only used during the upload. This is explained later on.</li>
</ul>
<p>The user object is stored in the Vaadin application&#8217;s user field.</p>

<div class="wp_codebox"><table><tr id="p308624"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p3086code24"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> User <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399;">Serializable</span> <span style="color: #009900;">&#123;</span>
  @Id <span style="color: #003399;">Long</span> id<span style="color: #339933;">;</span>
  <span style="color: #003399;">String</span> name<span style="color: #339933;">;</span>
  <span style="color: #003399;">String</span> uploadKey<span style="color: #339933;">;</span>
  <span style="color: #003399;">String</span> blobKey<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// skipping getters, setters, constructors, equals and hashcode</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> generateUploadKey<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">uploadKey</span> <span style="color: #339933;">=</span> <span style="color: #003399;">String</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Math</span>.<span style="color: #006633;">round</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Math</span>.<span style="color: #006633;">random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> 100000f<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// you probably want something more robust here</span>
    <span style="color: #000000; font-weight: bold;">return</span> uploadKey<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>2. Blobstore upload form</h2>
<p>The example reuses the upload form that is used in the Blobstore documentation.</p>
<p>There is one difference: we add a hidden field that contains a randomly generated upload key. This key is also stored with the user object in the datastore. This key will be used by the servlet below.</p>

<div class="wp_codebox"><table><tr id="p308625"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p3086code25"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> uploadKey <span style="color: #339933;">=</span> user.<span style="color: #006633;">generateUploadKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> uploadUrl <span style="color: #339933;">=</span> BlobstoreServiceFactory.<span style="color: #006633;">getBlobstoreService</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">createUploadUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/uploadImage&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Label</span> label <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Label</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;form action=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">+</span> uploadUrl <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> enctype=<span style="color: #000099; font-weight: bold;">\&quot;</span>multipart/form-data<span style="color: #000099; font-weight: bold;">\&quot;</span> method=<span style="color: #000099; font-weight: bold;">\&quot;</span>post<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> <span style="color: #339933;">+</span>
  <span style="color: #0000ff;">&quot;&lt;input type=<span style="color: #000099; font-weight: bold;">\&quot;</span>file<span style="color: #000099; font-weight: bold;">\&quot;</span> name=<span style="color: #000099; font-weight: bold;">\&quot;</span>myImage<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&quot;</span> <span style="color: #339933;">+</span>
  <span style="color: #0000ff;">&quot;&lt;input type=<span style="color: #000099; font-weight: bold;">\&quot;</span>hidden<span style="color: #000099; font-weight: bold;">\&quot;</span> name=<span style="color: #000099; font-weight: bold;">\&quot;</span>uploadKey<span style="color: #000099; font-weight: bold;">\&quot;</span> value=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">+</span> uploadKey <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&quot;</span> <span style="color: #339933;">+</span>
  <span style="color: #0000ff;">&quot;&lt;input type=<span style="color: #000099; font-weight: bold;">\&quot;</span>submit<span style="color: #000099; font-weight: bold;">\&quot;</span> value=<span style="color: #000099; font-weight: bold;">\&quot;</span>Upload<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&quot;</span> <span style="color: #339933;">+</span>
  <span style="color: #0000ff;">&quot;&lt;/form&gt;&quot;</span>, <span style="color: #003399;">Label</span>.<span style="color: #006633;">CONTENT_XHTML</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h2>3. Upload servlet</h2>
<p>The Blobstore itself is responsible to handle the upload. So we can&#8217;t use the traditional way of uploading multipart formdata. There is no direct access to the bytes. Instead the Blobstore will save the uploaded file and call a servlet. This servlet can access the uploaded blob via a number of parameters in the request.</p>
<p>Because Vaadin hides this request it is difficult to add the handling of the upload to your Vaadin application. I&#8217;m sure it&#8217;s not impossible, but I decided to create a separate servlet.</p>
<p>The servlet does not have access to the Vaadin application and its associated user object. That is why the servlet gets the upload key from the form. It searches the associated user and can then add put the blobkey into the user object.</p>

<div class="wp_codebox"><table><tr id="p308626"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p3086code26"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doPost<span style="color: #009900;">&#40;</span>HttpServletRequest req, HttpServletResponse resp<span style="color: #009900;">&#41;</span>
      <span style="color: #000000; font-weight: bold;">throws</span> ServletException, <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Map</span> blobs <span style="color: #339933;">=</span> blobstoreService.<span style="color: #006633;">getUploadedBlobs</span><span style="color: #009900;">&#40;</span>req<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">final</span> BlobKey blobKey <span style="color: #339933;">=</span> blobs.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;myImage&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> uploadKey <span style="color: #339933;">=</span> req.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;uploadKey&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">final</span> Objectify ofy <span style="color: #339933;">=</span> ObjectifyService.<span style="color: #006633;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">final</span> User user <span style="color: #339933;">=</span> ofy.<span style="color: #006633;">query</span><span style="color: #009900;">&#40;</span>User.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">filter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;uploadKey&quot;</span>, uploadKey<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  user.<span style="color: #006633;">setBlobKey</span><span style="color: #009900;">&#40;</span>blobKey.<span style="color: #006633;">getKeyString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ofy.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>user<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  resp.<span style="color: #006633;">sendRedirect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/?refresh&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>4. Vaadin refresh parameter handler</h2>
<p>After the upload servlet has done its work, it redirects the user to the Vaadin application. To make sure the application updates it&#8217;s content, an additional parameter is added to the request URL.</p>
<p>This parameter is intercepted by a parameter handler that&#8217;s responsible for refreshing the Vaadin layout.</p>

<div class="wp_codebox"><table><tr id="p308627"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p3086code27"><pre class="java" style="font-family:monospace;">@Override
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> handleParameters<span style="color: #009900;">&#40;</span>Map<span style="color: #339933;">&lt;</span>String, <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span> parameters<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>parameters.<span style="color: #006633;">containsKey</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;refresh&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// refresh the layout ...</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>5. A Vaadin resource for the blobstore</h2>
<p>This is a fairly straightforward implementation of the Vaadin ApplicationResource. It makes it easy to integrate blobs into your application.</p>

<div class="wp_codebox"><table><tr id="p308628"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code" id="p3086code28"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BlobstoreResource <span style="color: #000000; font-weight: bold;">implements</span> ApplicationResource <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// variables skipped</span>
  <span style="color: #000000; font-weight: bold;">public</span> BlobstoreResource<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> keyStr, Application application<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">application</span> <span style="color: #339933;">=</span> application<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">blobKey</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BlobKey<span style="color: #009900;">&#40;</span>keyStr<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">blobInfo</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BlobInfoFactory<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">loadBlobInfo</span><span style="color: #009900;">&#40;</span>blobKey<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>blobInfo <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
      <span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// handle missing blob here</span>
    application.<span style="color: #006633;">addResource</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getMIMEType<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> blobInfo.<span style="color: #006633;">getContentType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> DownloadStream getStream<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">InputStream</span> inputStream<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
      inputStream <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BlobstoreInputStream<span style="color: #009900;">&#40;</span>blobKey<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">final</span> DownloadStream ds <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DownloadStream<span style="color: #009900;">&#40;</span>inputStream,
        getMIMEType<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, getFilename<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ds.<span style="color: #006633;">setBufferSize</span><span style="color: #009900;">&#40;</span>getBufferSize<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ds.<span style="color: #006633;">setCacheTime</span><span style="color: #009900;">&#40;</span>cacheTime<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> ds<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// other methods skipped ...</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Conclusion</h2>
<p>The example demonstrated the basics for integrating the Google AppEngine Blobstore with a Vaadin application. It was a fully functional example, but beware, before you go to production, you&#8217;re going to want to add a whole lot of error handling.</p>
<p><a href="http://www.streamhead.com/wp-content/uploads/2011/03/vaadin-gae-blobstore-example.zip"><img class="alignnone size-full wp-image-498" title="download" src="http://www.streamhead.com/wp-content/uploads/2008/11/download.png" alt="" width="30" height="24" />Vaadin / Google AppEngine integration example project</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamhead.com/vaadin-blobstore/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:thumbnail url="http://www.streamhead.com/wp-content/uploads/2008/11/download.png" />
		<media:content url="http://www.streamhead.com/wp-content/uploads/2008/11/download.png" medium="image">
			<media:title type="html">download</media:title>
		</media:content>
		<media:content url="http://www.streamhead.com/wp-content/uploads/2008/11/download.png" medium="image">
			<media:title type="html">download</media:title>
		</media:content>
	</item>
		<item>
		<title>Tutorial: a Vaadin Application on Google App Engine in 5 Minutes</title>
		<link>http://www.streamhead.com/vaadin-app-engine-in-5-minutes/</link>
		<comments>http://www.streamhead.com/vaadin-app-engine-in-5-minutes/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 14:00:48 +0000</pubDate>
		<dc:creator>Peter Backx</dc:creator>
				<category><![CDATA[Java and JavaScript]]></category>

		<guid isPermaLink="false">http://www.streamhead.com/?p=3071</guid>
		<description><![CDATA[In this tutorial you&#8217;ll learn how to create your very first Vaadin web application, how to run it on a local AppEngine development server and how to deploy it to the Google App Engine infrastructure. And all of that in about 5 to 10 minutes. Yes, if you have the necessary prerequisites installed, you&#8217;ll be [...]]]></description>
			<content:encoded><![CDATA[<img width="300" height="250" src="http://www.streamhead.com/wp-content/uploads/2011/02/vaadin_app_engine_reference_card.png" class="attachment-post-thumbnail wp-post-image" alt="vaadin_app_engine_reference_card" title="vaadin_app_engine_reference_card" /><p>In this tutorial you&#8217;ll learn how to create your very first Vaadin web application, how to run it on a local AppEngine development server and how to deploy it to the Google App Engine infrastructure. And all of that in about 5 to 10 minutes. Yes, if you have the necessary prerequisites installed, you&#8217;ll be up and running straight away. Thanks to the power of Maven.</p>
<p><span id="more-3071"></span>This tutorial is in the form of <a title="Vaadin and Google App Engine in 5 minutes" href="http://www.streamhead.com/wp-content/uploads/2011/02/Vaadin_and_App_Engine_in_5_Minutes.pdf" target="_blank">a nicely formatted, 4-page, quick reference card</a>. You can download it straight away, no sign-ups required.</p>
<p><a title="Vaadin and Google App Engine in 5 minutes" href="http://www.streamhead.com/wp-content/uploads/2011/02/Vaadin_and_App_Engine_in_5_Minutes.pdf" target="_blank"><img class="alignnone size-full wp-image-3072" title="vaadin_google_appengine_in_5_minutes" src="http://www.streamhead.com/wp-content/uploads/2011/02/vaadin_google_appengine_in_5_minutes.png" alt="" width="465" height="164" /></a></p>
<p>The card will guide you through the process of:</p>
<ul>
<li>Setting up your environment.</li>
<li>How to run a Vaadin application on the Google App Engine development server.</li>
<li>How to deploy that application.</li>
<li>How to start customizing the Powered by Reindeer templates.</li>
</ul>
<p>Please leave your feedback. I plan to do follow ups and would love your input.</p>
<p><a title="Vaadin and Google App Engine in 5 minutes" href="http://www.streamhead.com/wp-content/uploads/2011/02/Vaadin_and_App_Engine_in_5_Minutes.pdf" target="_blank">Get started with Vaadin and Google AppEngine right now</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamhead.com/vaadin-app-engine-in-5-minutes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:thumbnail url="http://www.streamhead.com/wp-content/uploads/2011/02/vaadin_app_engine_reference_card.png" />
		<media:content url="http://www.streamhead.com/wp-content/uploads/2011/02/vaadin_app_engine_reference_card.png" medium="image">
			<media:title type="html">vaadin_app_engine_reference_card</media:title>
		</media:content>
		<media:content url="http://www.streamhead.com/wp-content/uploads/2011/02/vaadin_app_engine_reference_card.png" medium="image">
			<media:title type="html">vaadin_app_engine_reference_card</media:title>
		</media:content>
		<media:content url="http://www.streamhead.com/wp-content/uploads/2011/02/vaadin_google_appengine_in_5_minutes.png" medium="image">
			<media:title type="html">vaadin_google_appengine_in_5_minutes</media:title>
			<media:thumbnail url="http://www.streamhead.com/wp-content/uploads/2011/02/vaadin_google_appengine_in_5_minutes-300x164.png" />
		</media:content>
	</item>
	</channel>
</rss>

<!-- Dynamic page generated in 12.447 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-07 19:40:14 -->
<!-- Compression = gzip -->
