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

<channel>
	<title>Peter Friese &#187; Java</title>
	<atom:link href="http://www.peterfriese.de/category/computer/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peterfriese.de</link>
	<description>mobile / model-driven</description>
	<lastBuildDate>Mon, 14 Nov 2011 16:14:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Tired of Typing? Speak to Your Computer!</title>
		<link>http://www.peterfriese.de/tired-of-typing-speak-to-your-computer/</link>
		<comments>http://www.peterfriese.de/tired-of-typing-speak-to-your-computer/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 14:54:39 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[speech]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=773</guid>
		<description><![CDATA[For some reason, humans have always dreamt of using natural language to communicate with computers. Quite a number of movies have been made that revolve around this theme, 2001: A Space Odyssey and I, Robot (named after the great collection of SF stories by Isaac Asimov) just being two of them. Well, we've come a [...]]]></description>
			<content:encoded><![CDATA[<p>For some reason, humans have always dreamt of using natural language to communicate with computers. Quite a number of movies have been made that revolve around this theme, <a href="http://en.wikipedia.org/wiki/2001:_A_Space_Odyssey">2001: A Space Odyssey</a> and <a href="http://en.wikipedia.org/wiki/I,_Robot_(film)">I, Robot</a> (named after the <a href="http://en.wikipedia.org/wiki/I_robot">great collection of SF stories</a> by <a href="http://en.wikipedia.org/wiki/Isaac_Asimov">Isaac Asimov</a>) just being two of them.<br />
<span id="more-773"></span><br />
Well, we've come a long way since then and computers are more powerful than ever before. I remember using one of the first versions of <a href="http://www.research.ibm.com/hlt/html/body_history.html">IBM ViaVoice</a> which would quite literally bog down my computer when I tried using it. The quality of speech recognition software has vastly improved and using a clever stack of technology, you can even use speech recognition on your iPhone (the <a href="http://www.tuaw.com/2009/12/08/dragon-dictation-comes-to-the-iphone-wow/">actual recognition is performed on a server</a>, but the effect is stunning nevertheless).</p>
<p>With all the hoopla around HTML 5, it would be quite a surprise if modern browsers didn't have something in store with regard to voice recognition. And sure enough, there is a W3C specification for a <a href="http://lists.w3.org/Archives/Public/public-xg-htmlspeech/2011Feb/att-0020/api-draft.html">Speech Input API</a>. Looking at the list of authors might give us a hint as to which browser might support this API...</p>
<p>Using the speech input API is rather easy. All you have to do is to add the <code>x-webkit-speech</code> attribute to any <code>input</code> tag and you're done. If you're on a speech-enabled browsers (as of this writing, <a href="http://chrome.blogspot.com/2011/04/everybodys-talking-and-translating-with.html">only Chrome 11</a> supports this out of the box), you can check it out in the input field below. Just click on the microphone icon and start speaking:</p>
<input name="speechinput" size="40" placeholder="click the mic and start speaking" x-webkit-speech/>
<p>So, the other day I thought, "wouldn't it be cool if I could use voice recognition to look up my contacts on the social networks I am on?". Adding voice recognition support to a website you own is rather easy, as you only have to add the <code>x-webkit-speech</code> attribute to the respective input fields. Enhancing foreign sites, however, turns out to be a little bit more involved. Fortunately, Chrome can augment existing websites by way of so-called <a href="http://code.google.com/chrome/extensions/content_scripts.html">Content Scripts</a>, which are a part of the <a href="http://code.google.com/chrome/extensions/getstarted.html">Chrome Extensions API</a>.</p>
<p>Writing a Chrome Extension for speech-enabling existing text input fields on just about any website <a href="http://github.com/peterfriese/Speak2Search">was a matter of minutes</a>, thanks to the good documentation and some <a href="http://jquery.com/">jQuery</a> to walk the DOM. Putting on the finishing touches took me some more time, and I am proud to present you <a href="http://chrome.google.com/webstore/detail/peldinpdedgdcbdehomnpfndejpoibeb">Speak to Search</a> - a Chrome Extension that lets you talk with your browser. It works with virtually every website that uses regular HTML input fields. By making some smart assumptions, the extension will automatically submit the current form if the input field is a search field. If it is not, the focus will remain in the field and the form will not be submitted. That way, you can fill out e.g. an address form.</p>
<p>Here is a short video of me using Speak to Search to search for some people on Xing and LinkedIn. Please note that the extension is making sure the speech recognition engine is configured to recognize German names on Xing.</p>
<p><iframe width="610" height="347" src="http://www.youtube.com/embed/syMpQqMJcKU?hd=1" frameborder="0" allowfullscreen></iframe></p>
<p>Language makes us human - this is a quote from a <a href="http://www.pbs.org/wnet/humanspark/video/spark-blog-video-dr-steven-pinker-language-makes-us-human/212/">video</a> I found during the research for this blog post. I don't necessarily think voice recognition and speech synthesis will make computers more human, but both technologies certainly can help to create a more immersive experience. I am looking forward to seeing a broader use of the new audio capabilities of modern browsers. Feel free to <a href="http://github.com/peterfriese/Speak2Search">grab my code from Github</a> and create something new and exciting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/tired-of-typing-speak-to-your-computer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Save a Tree, Put EclipseCon 2011 in Your Pocket</title>
		<link>http://www.peterfriese.de/save-a-tree-put-eclipsecon-2011-in-your-pocket/</link>
		<comments>http://www.peterfriese.de/save-a-tree-put-eclipsecon-2011-in-your-pocket/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 20:15:57 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=709</guid>
		<description><![CDATA[After the huge success of the mobile apps for Eclipse Summit Europe, we decided to provide mobile apps for EclipseCon 2011, too. So instead of using a printed copy of the conference program, you can browse the schedule on your smart phone - wherever you are! This year, we're providing a rather impressive lineup of [...]]]></description>
			<content:encoded><![CDATA[<p>After the huge success of the mobile apps for Eclipse Summit Europe, we decided to provide mobile apps for EclipseCon 2011, too. So instead of using a printed copy of the conference program, you can browse the schedule on your smart phone - wherever you are! <span id="more-709"></span>This year, we're providing a rather impressive lineup of mobile apps for iPhone, iPod Touch, iPad (thanks to <a href="http://www.compeople.eu/blog/?p=786">Christian Campo who created a stand-alone iPad app</a>), BlackBerry (<a href="http://ekkes-apps.org/">Ekke is working on a updated version, AFAIK</a>), and all other smart phones that feature a browser.</p>
<p>All apps allow you to browse the program, select your favorite talks and get to know the speakers (with headshots so you recognise them in the hallways). We also have included maps of the convention center as well as Santa Clara.</p>
<p>For a first glimpse, watch our video:</p>
<p><iframe src="http://player.vimeo.com/video/20377509?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=1&amp;loop=1" width="501" height="313" frameborder="0" style="display:block; margin-left:auto; margin-right:auto;"></iframe></p>
<p>As of today, both iPhone and Android users can download the apps from the Apple App Store respectively the Android Marketplace. Here are the links:</p>
<ol>
<li><a href="http://bit.ly/econ2011iphone">EclipseCon 2011 iPhone App</a></li>
<li><a href="http://bit.ly/econ2011android">EclipseCon 2011 Android App</a></li>
</ol>
<p>If you don't own an iPhone or Android, you can always use the HTML-only version of the conference program available at <a href="http://bit.ly/econ2011html">http://bit.ly/econ2011html</a>.</p>
<p>The iPad and BlackBerry apps will be available soon, so stay tuned!</p>
<p>By the way, if <strong>you</strong> run a conference and are interested in having an app like this, <a href="http://mobile.itemis.com">get in touch with us</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/save-a-tree-put-eclipsecon-2011-in-your-pocket/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to Use the Gyroscope of Your iPhone in a Mobile Web App</title>
		<link>http://www.peterfriese.de/how-to-use-the-gyroscope-of-your-iphone-in-a-mobile-web-app/</link>
		<comments>http://www.peterfriese.de/how-to-use-the-gyroscope-of-your-iphone-in-a-mobile-web-app/#comments</comments>
		<pubDate>Thu, 25 Nov 2010 10:00:43 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[accelerometer]]></category>
		<category><![CDATA[gyrosope]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=633</guid>
		<description><![CDATA[This week's release of iOS 4.2 for iPad and iPhone comes with some nice little features most people will not immediately become aware of as they're neither directly visible in the iOS UI nor are they mentioned in Apple's official release notes. You have to dig a little deeper to find them. One of them [...]]]></description>
			<content:encoded><![CDATA[<p>This week's release of iOS 4.2 for iPad and iPhone comes with some nice little features most people will not immediately become aware of as they're neither directly visible in the iOS UI nor are they mentioned in Apple's official release notes. You have to dig a little deeper to find them. One of them is a JavaScript API for the iPhone's gyroscope. Read on to see it in action and learn how to use it.<span id="more-633"></span>Your iPhone has a number of sensors, some of which are rather essential for the phone's operation (such as the microphone). While the accelerometer and the gyroscope might not be the most essential sensors for a phone, they're certainly the most exciting ones. While accelerometer measures the acceleration you induce on the phone, the gyroscope gives a rather precise feedback on the orientation of the phone.</p>
<p>Until now, web developers didn't have access to the accelerometer sensor and the gyroscope sensor. With this week's release of iOS 4.2, this has changed and we can now use <a href="https://developer.apple.com/library/safari/#documentation/SafariDOMAdditions/Reference/DeviceMotionEventClassRef/DeviceMotionEvent/DeviceMotionEvent.html">DeviceMotionEvent</a> and <a href="https://developer.apple.com/library/safari/#documentation/SafariDOMAdditions/Reference/DeviceOrientationEventClassRef/DeviceOrientationEvent/DeviceOrientationEvent.html">DeviceOrientationEvent</a> to determine the acceleration and orientation data of the phone.</p>
<p>Let's first determine whether the current browser supports device orientation sensing:</p>
<pre>
if (window.DeviceMotionEvent==undefined) {
}
</pre>
<p>We can then read the sensor data by registering the respective callbacks. Here's how you read the accelerometer's data:</p>
<pre>
window.ondevicemotion = function(event) {
  ax = event.accelerationIncludingGravity.x
  ay = event.accelerationIncludingGravity.y
  az = event.accelerationIncludingGravity.z
  rotation = event.rotationRate;
  if (rotation != null) {
    arAlpha = Math.round(rotation.alpha);
    arBeta = Math.round(rotation.beta);
    arGamma = Math.round(rotation.gamma);
  }
}
</pre>
<p>The gyroscope's data can be read like this:</p>
<pre>
window.ondeviceorientation = function(event) {
  alpha = Math.round(event.alpha);
  beta = Math.round(event.beta);
  gamma = Math.round(event.gamma);
}
</pre>
<p>I've put together a little demo that uses the sensor data to color some boxes on the phone's screen. Here's a short video showing it in action:</p>
<p><iframe border="0" style="display:block; margin-left:auto; margin-right:auto;" src="http://player.vimeo.com/video/17182364?title=0&amp;byline=0&amp;portrait=0" width="500" height="370" frameborder="0"></iframe></p>
<p>If you want to take it for a spin, open this URL in mobile safari on your phone: <a href="http://demos.peterfriese.de/gyro/gyro.html">http://demos.peterfriese.de/gyro/gyro.html</a>.</p>
<p><small>(image of Gyroscope by stop that pigeon! taken from http://www.flickr.com/photos/25312309@N05/2651042796/)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/how-to-use-the-gyroscope-of-your-iphone-in-a-mobile-web-app/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Eclipse DemoCamp Hamburg November 2010</title>
		<link>http://www.peterfriese.de/eclipse-democamp-hamburg-november-2010/</link>
		<comments>http://www.peterfriese.de/eclipse-democamp-hamburg-november-2010/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 05:28:17 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=624</guid>
		<description><![CDATA[Last Friday was a happy day for Java developers in Hamburg: not only did Apple and Oracle announce their plan to continue development of Java on the Mac OSX platform, but we also had the pleasure to host this fall's instance of Eclipse DemoCamp Hamburg in a bookstore! We had a nice lineup of four [...]]]></description>
			<content:encoded><![CDATA[<p>Last Friday was a happy day for Java developers in Hamburg: not only did Apple and Oracle announce their plan to continue development of Java on the Mac OSX platform, but we also had the pleasure to host this fall's instance of Eclipse DemoCamp Hamburg in a bookstore!<br />
<span id="more-624"></span></p>
<p>We had a nice lineup of four speakers - unfortunately not all of them were able to attend due to a cold, but we were lucky enough to find one additional speaker - thanks Jan!</p>
<p>After a casual meet-and-greet with <a href="http://www.fritz-kola.de/">Fritz Kola</a> and Pretzels, <a href="http://twitter.com/#!/robilad">Dalibor Topic</a> opened the official part of the evening with an overview of what's coming up in JDK7 and JDK8. Here's a list of things that sound quite interesting:</p>
<ul>
<li>Support for dynamically-typed languages (InvokeDynamic) (<a href="http://openjdk.java.net/projects/mlvm">project page</a>)</li>
<li>Small language enhancements (Project Coin) (<a href="http://openjdk.java.net/projects/coin/">project page</a>)</li>
<li>An even newer NIO (<a href="http://openjdk.java.net/projects/nio/">project page</a>)</li>
</ul>
<p>The good news of the day of course was a <a href="http://blogs.oracle.com/henrik/2010/11/oracle_and_apple_announce_openjdk_project_for_osx.html">press release announcing OpenJDK for Mac OSX</a>. Nevertheless, <a href="http://twitter.com/#!/robilad/status/3129373515321344">Dalibor demoed a freshly built OpenJDK 7 BSD port</a> on his MacBook.</p>
<p><a class="lightbox"  title ="IMG_0792.JPG" href="http://www.peterfriese.de/wp-content/IMG_0792.jpg"><img src="http://www.peterfriese.de/wp-content/IMG_0792.jpg" alt="" title="IMG_0792.JPG" width="300" height="224" class="aligncenter size-full wp-image-622" /></a></p>
<p>After a short break, it was <a href="http://eclipsesource.com/blogs/author/rsternberg/">Ralf Sternberg's turn</a> to give an overview of <a href="http://www.eclipse.org/rap/">RAP</a> and explain what Single Sourcing is. With the help of RAP, it is rather easy to bring Eclipse RCP applications to the web. Of course, you'll have to pay attention to a few things, as Ralf pointed out: usually, RCP applications are single-user apps, whereas web applications are inherently multi-user enabled. Fortunately, RAP comes with a few utilities that cater for this fact.</p>
<p>One thing I was delighted to learn: not only do RAP applications run on the iPad, but also do they support drawing using the SWT API, as you can see in the following video:</p>
<p><center><iframe src="http://player.vimeo.com/video/16829527" width="400" height="300" frameborder="0"></iframe></center></p>
<p>In the last sessions, <a href="http://www.eclipse.org/Xtext/">Xtext</a> committer <a href="http://koehnlein.blogspot.com/">Jan Köhnlein</a> showed us some of the things coming up in Xtext 2.0. Being text-addicted, Jan refrained from using slides and used the IDE instead to deliver his talk:</p>
<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://www.peterfriese.de/wp-content/IMG_0804.jpg" alt="Jan Köhnlein talking about Xbase and Xtext" title="IMG_0804.JPG" border="0" width="300" height="224" /></p>
<p>Jan showed us how Xbase (no, not <a href="http://en.wikipedia.org/wiki/Xbase">xBase</a>) can be used to develop DSLs (and even GPLs) that not only describe structural features but also behavior. He also demoed Xdoc, a newly invented documentation language, and the fancy new Xtext syntax view (featuring <a href="http://en.wikipedia.org/wiki/Syntax_diagram">railroad diagrams</a>).</p>
<p>After the demoes, we had some time for chats and impromptu hack sessions. Given the event took place in a book store (many thanks to Lehmanns for having us!), you could also browse and buy books.</p>
<p>Thanks to the fact we only had about 40 attendees, there were plenty of chances for networking which people really seemed to enjoy.</p>
<p>I'd like to thank everybody who attended the DemoCamp or gave a demo! <a href="http://twitter.com/#!/peterfriese">Follow me on twitter</a> to be informed ahead of time for the next DemoCamp!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/eclipse-democamp-hamburg-november-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Updated] Use your iPhone, Android, or BlackBerry to build Your Eclipse Summit Europe 2010</title>
		<link>http://www.peterfriese.de/updated-use-your-iphone-android-or-blackberry-to-build-your-eclipse-summit-europe-2010/</link>
		<comments>http://www.peterfriese.de/updated-use-your-iphone-android-or-blackberry-to-build-your-eclipse-summit-europe-2010/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 09:45:02 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[mobile web]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=596</guid>
		<description><![CDATA[As I'm writing this, Eclipse Summit Europe 2010 is merely hours away and everyone is getting excited to get there and meet Eclipse family. I think the program committee have done a great job at putting together an exciting conference program with lots of technical sessions, interactive tutorials and inspiring keynotes. As a special treat [...]]]></description>
			<content:encoded><![CDATA[<p>As I'm writing this, Eclipse Summit Europe 2010 is merely hours away and everyone is getting excited to get there and meet Eclipse family.</p>
<p>I think the program committee have done a great job at putting together an exciting conference program with lots of technical sessions, interactive tutorials and inspiring keynotes.</p>
<p>As a special treat for smart phone users, we're offering a conference schedule app for iPhone, Android and all other smart phones that come with a browser. <span id="more-596"></span>Besides reviewing the <strong>conference schedule</strong> and getting to know the <strong>speakers</strong> you can use the apps to create your very <strong>own personal conference schedule</strong>. Usually, conference attendees will use the printed conference program to mark their favorite talks - and then leave their personalized copy of the program in their hotel room or elsewhere in the conference halls!</p>
<p>This will probably not happen with the smart phone app, although I can recall somebody lost their iPhone at this year's EclipseCon...</p>
<p>Without further ado, here's a preview of the iPhone app in action:</p>
<p><iframe border="0" style="display:block; margin-left:auto; margin-right:auto;" src="http://player.vimeo.com/video/16367311?loop=1" width="500" height="370" frameborder="0"></iframe></p>
<p>You can download the <strong>iPhone app</strong> from the App Store. It is available world-wide and we already have a few downloads from Singapore, Korea and India! For your convenience, <a href="http://bit.ly/ese_app_intl">here's the link to the app</a>.</p>
<p>We also prepared a version for <strong>Android</strong> users. Here's how it will look like on your Android device:<br />
<img style="display:block; margin-left:auto; margin-right:auto;" src="http://www.peterfriese.de/wp-content/ESE_Android.png" alt="ESE_Android.png" title="ESE_Android.png" border="0" width="151" height="300" /></p>
<p>Head over to the Android Marketplace and search for "eclipse summit", or use your barcode scanner: <br><br />
<img border="0" style="display:block; margin-left:auto; margin-right:auto;" src="http://fs01.androidpit.info/aqr/x16/1078516-1288452914800.png"></p>
<p>The <strong>mobile web app</strong> <del datetime="2010-11-02T10:48:53+00:00">will be available from the Wifi landing page at the conference venue</del> is available via the following URL: <a href="http://bit.ly/ese_app_mobile2">http://bit.ly/ese_app_mobile2/</a>.</p>
<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://www.peterfriese.de/wp-content/mobileweb3.png" alt="mobileweb.png" title="mobileweb.png" border="0" width="150" height="192" /></p>
<p><del datetime="2010-11-02T10:48:53+00:00">Rumor has it even BlackBerry users will get a native app.</del> <a href="http://ekkescorner.wordpress.com/2010/11/02/ese-app-for-blackberry/">Ekke</a> has created a native app for BlackBerry. </p>
<p>Using these applications, you'll be able to put together <strong>your Eclipse Summit Europe 2010</strong> in no time. Enjoy!</p>
<p>The iPhone, Android and mobile web apps have been built by a dedicated team of software engineers at itemis I have the pleasure to work with. If you want to learn how we build applications like these, attend our sessions:</p>
<ul>
<li>Tuesday, 14:00 - <a href="http://www.eclipsecon.org/summiteurope2010/sessions/?page=sessions&id=1940">Mobile Development Symposium</a></li>
<li>Thursday 10:30 - <a href="http://www.eclipsecon.org/summiteurope2010/sessions/?page=sessions&id=1733">Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse</a>
</ul>
<p>Also, be sure to drop by the new website for our mobile business: <a href="http://mobile.itemis.com">http://mobile.itemis.com</a> and follow us on Twitter: <a href="http://twitter.com/itemismobile">@itemismobile</a>.</p>
<p>Enjoy <del datetime="2010-11-02T10:48:53+00:00">the</del> your conference!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/updated-use-your-iphone-android-or-blackberry-to-build-your-eclipse-summit-europe-2010/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apple’s Updated Developer License – This Changes Everything. Again.</title>
		<link>http://www.peterfriese.de/apples-updated-developer-license-this-changes-everything-again/</link>
		<comments>http://www.peterfriese.de/apples-updated-developer-license-this-changes-everything-again/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 18:15:30 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[DSLs]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Xtext]]></category>
		<category><![CDATA[331]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[section331]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=585</guid>
		<description><![CDATA[A few days ago, Apple made some small, but very important changes to the iOS Developer Program Agreement - a document which you must agree to before you can download the iOS SDK and start developing software for the iOS platform. These changes will drastically change the way we will build software for the iPhone, [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, Apple made some small, but very important changes to the iOS Developer Program Agreement - a document which you must agree to before you can download the iOS SDK and start developing software for the iOS platform. These changes will drastically change the way we will build software for the iPhone, iPad and iPod and any other device that runs iOS.</p>
<p><span id="more-585"></span>In April 2010, together with the release of iOS 4, Apple changed the terms of the iOS Developer Program License in a way which basically prohibited creating software for iOS using languages other than Objective-C, C, C++ or JavaScript:</p>
<blockquote><p>3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).</p></blockquote>
<p>Back then, pretty much everyone was sure this update to section 3.3.1 of the license really was just one strike in <a href="http://www.apple.com/hotnews/thoughts-on-flash/">Apple's crusade against Flash</a>. Adobe had been working on a tool called <a href="http://labs.adobe.com/technologies/packagerforiphone/">Flash Packager</a>, which allows Flash designers to cross-compile their applications for the iPhone. While this must have been bad news for Adobe (they effectively needed to write off development costs for the entire development team working on Flash Packager), it posed a serious threat to companies whose business model relied upon creating iPhone apps using tools and languages other than Xcode and Objective-C. The future for Novell's <a href="http://monotouch.net/">Mono Touch</a>, <a href="http://www.appcelerator.com/">Appcelerator Titanium</a>, <a href="http://www.phonegap.com/">PhoneGap</a> and <a href="http://www.xmlvm.org/iphone/">XMLVM/iPhone</a> didn't look very bright.</p>
<p>No need to say there was quite an uproar and people came up with all sorts of creative interpretations of the terms stated in section 3.3.1 to avoid being rejected from the App Store.</p>
<p>Of course, if a monopolist starts endangering other, dependent companies, this soon will call the Federal Trade Commission to action. It doesn't come that much of a surprise Apple published a new, very relaxed version of the iOS Developer Program Agreement just a few days ago. The new version (which is publicly available at <a href="http://developer.apple.com/programs/terms/ios/standard/ios_standard_agreement_20100909.pdf">http://developer.apple.com/programs/terms/ios/standard/ios_standard_agreement_20100909.pdf</a> does not limit the programming languages you may use to create applications for the iOS platform any more. In particular, section 3.3.1 now reads:</p>
<blockquote><p>3.3.1	Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs.</p></blockquote>
<p>You might think that a small paragraph in a license agreement doesn't mean that much, but I think the new section will fundamentally change the way we write software for the iPhone in the next few years. Let me explain:</p>
<p>The new section 3.3.1 means you may write iOS software using any language you like. Yes, ANY language - there is no if and when. This means you will not only be able to write iOS software in Objective-C (which is a great language as soon as you come to grips with it), but you will be able to use language like Java, Scala, Haskell, Ruby, etc. Some people are <a href="http://twitter.com/mattgemmell/status/24014145904">even dreaming of using REALBasic</a> for iOS apps.</p>
<p>Vendors of tools such as Mono Touch, Titanium and PhoneGap will be glad, as their business models now have a solid foundation (well, Apple may of course change the license again but I doubt they'll ever restrict the usage of other languages again). Given the <a href="http://labs.adobe.com/technologies/packagerforiphone/">announcement on Adobe Labs</a>, I guess we will very soon see Adobe release their highly acclaimed Flash Packager for iPhone (I don't think people will seriously use this tool to create data-driven applications, but it's probably a great tool to develop games. If you're a Flash designer / developer, that is).</p>
<p>For the development community at large, this is great news: freedom to choose the language that fits your needs best has always been a cornerstone of successfully creating great software. People have expressed their desire to use languages such as Haskell and Ruby to build iPhone apps. Rumor has it Apple engineers have even been working on a version of MacRuby for iPhone - there you go.</p>
<p>At <a href="http://www.itemis.com">itemis</a>, we're very much into programming languages. We're even building our own language development toolkit to support development of programming languages - <a href="http://www.xtext.org">Xtext</a>. With this toolkit, it is very easy to create your own domain specific programming languages (DSLs). In the past, we've mainly been using it to create languages for enterprise and web applications. We're also helping others to (re-)build languages such as SQL. Of course, Xtext is being used to build itself - isn't that nice?  About one year ago, we started implementing a programming language tailored towards creating data-driven mobile applications for the iOS platform. We're not aiming at creating a language you can use to build arbitrary iOS applications. Instead, we're focussing on data-driven applications with a drill-down metaphor. Something you can find in many applications such as FaceBook, LinkedIn, Kayak and the like. Watch the following video to see it in action:</p>
<div style="text-align:center;">
<iframe src="http://player.vimeo.com/video/15018235?title=0&amp;byline=0&amp;portrait=0" width="400" height="280" frameborder="0"></iframe>
</div>
<p>If you're interested in learning more about APPlause, get in touch with us by mail [heiko.behrens|peter.friese]@itemis.de, subscribe to <a href="http://www.heikobehrens.net">our</a> <a href="http://www.peterfriese.de">blogs</a> and follow us on Twitter (<a href="http://www.twitter.com/peterfriese">@peterfriese</a>, <a href="http://www.twitter.com/HBehrens">@HBehrens</a>, <a href="http://www.twitter.com/applausedsl">@APPlauseDSL</a>).</p>
<p>In a few years, I guess, Objective-C will be just one language among many others you can choose from if you want to build iOS applications.</p>
<p>But why would you want to write iOS applications in languages other than Objective-C? There are many reasons:</p>
<ul>
<li>Use the language you feel most comfortable with. Maybe Objective-C's square brackets look scary to you?</li>
<li>Use the language you have most experience with. Maybe you're a company and have a tight schedule. Writing your application using the language your developers have the most skills in helps you to meet your deadline. In fact, a friend just recently told me they used Appcelerator "because we've got JavaScript and HTML knowledge in-house, but none of our developers had experience with Objective-C"!</li>
<li>use the language you use for developing your backend system. So you've got this huge backend system written C#, running on the .NT platform. Why not write all the front-end code in C# as well?</li>
<li>Maybe you're a start-up in the social media realm and your website is written all in Ruby and Ruby on Rails. So why not write the iPhone app in Ruby as well?</li>
</ul>
<p>It all boils down to being more productive and ensuring better sustainability. Using the right tool for the job helps you to achieve a faster time to market. If you're able to use the same language on the frontend and the backend, this will help you to secure your investment in this technology.</p>
<p>Please note that I'm not saying you should by all means write your frontend and your backend using the same technology and language. The first and foremost question you need to answer is, "what's the right tool for this job". Being able to make a real choice will help you to give a better answer to this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/apples-updated-developer-license-this-changes-everything-again/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Why Your Next App Should be Open Sourced</title>
		<link>http://www.peterfriese.de/why-your-next-app-should-be-open-sourced/</link>
		<comments>http://www.peterfriese.de/why-your-next-app-should-be-open-sourced/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 11:15:17 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[license]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=575</guid>
		<description><![CDATA[I've been doing all sorts of software development over the past few years, from closed-source in-house software for companies to closed-source product development to open-source frameworks and tools development to close-source app development. Looking back on my experience with the various drawbacks and benefits of each of those development modes, I hereby recommend your next [...]]]></description>
			<content:encoded><![CDATA[<p>I've been doing all sorts of software development over the past few years, from closed-source in-house software for companies to closed-source product development to open-source frameworks and tools development to close-source app development. </p>
<p>Looking back on my experience with the various drawbacks and benefits of each of those development modes, I hereby recommend your next app be open sourced.<br />
<span id="more-575"></span>Here is why:</p>
<h3>Reasons pro Open Source</h3>
<p>We all heard it before, "Open Source will make the world a better place" - but why? Well, let me give you a few reasons:</p>
<p>
<strong>First</strong>, by open sourcing your code, your code will become better. If everybody can see what your code looks like, you will do your best to make sure it's clean code. Jeff LaMarche calls this "<a href="http://iphonedevelopment.blogspot.com/2010/06/code-as-if.html">coding as if everybody is watching</a>". Clean code has less errors than quick-and-dirty code, so that's a good thing.
</p>
<p>
<strong>Enabling others to contribute</strong> will further improve your code. Should you decide to invite other developers to your project, you'll want to add some documentation to make it easier for them to get a jump start. Writing documentation will force you to think through your code and its overall structure. You might find you want to perform some refactorings before you actually let other developers work on your code. This will improve the quality of your code even more.
</p>
<p>
<strong>Enabling others to participate will make your app more attractive</strong>. Didn't you experience this before: the app you just downloaded is almost perfect - if it only had this one missing feature. For example, I really love <a href="http://www.tweetdeck.com/iphone/">TweetDeck for iPhone</a>, but I'm dearly missing an <a href="http://www.instapaper.com/">Instapaper</a> integration. If TweetDeck was open source, I would've added Instapaper integration to the code and submitted a patch to the creators of TweetDeck for the benefit of the entire user base. But unfortunately, TweetDeck is not open source - what a pity.
</p>
<p>
By <strong>building a team of skilled people</strong>, you'll be able to deliver more features in a shorter amount of time than you can ever hope to achieve if you work alone. Successful open source projects are made up of a bunch of gifted individuals with diverse skills. This is even more important for mobile applications, as you not only have to develop the code that makes your app work. You also have to create a great looking UI, so might need a great designer. If you want to promote your app on a website, you might also consider teaming up with a web designer.
</p>
<p>
<strong>Speaking of contributions</strong>, you might be a bit hesitant to let other people work on your code. That's alright. Usually, contributors do not get commit rights right away. Instead, you ask them to contribute to the project by submitting patches via your bug tracker (you do use a bug tracker, don't you?). This enables you to review their code before actually committing it to the code base. If you're not satisfied, let them know (in a friendly way) what you would like them to improve. If a contributor delivers a number of great patches in a row, you can consider to promote him/her to be a committer.
</p>
<h3>Reasons against Open Source</h3>
<p>There are a few reasons why your next app maybe should not be open sourced:</p>
<p>
<strong>Others might steal your ideas!</strong> I keep hearing this argument over and over again. Yes, if you open source your app, other developers might check out the code, re-brand it and sell it on the app store as their invention. Well, they can steal your ideas anyway - just by looking at your app and building an app that looks and feels the same. Granted, re-writing an app consumes considerably more time than re-branding an existing code base. But I doubt anybody dares to submit a blatant 1:1 copy of an app to the app store. At the very least, you should choose a suitable license for your code. There are a number of great open source licenses you might consider check out the <a href="http://www.opensource.org/licenses>OSI website for a list of open source licenses</a>. <a href="http://blog.robrhyne.com/">Rob Rhyne</a> even had his <a href="http://jdrhyne.tumblr.com/">brother</a> (who is a lawyer) create a <a href="http://github.com/capttaco/Briefs/blob/master/LICENSE">new app-store compatible license</a> for his app, <a href="http://giveabrief.com/">Briefs</a>. Read his blog post "<a href="http://blog.robrhyne.com/post/1043407467/selling-open-source">Selling Open Source</a>" for the rationale behind this step.
</p>
<p>
Even if other people don't copy your entire app, <strong>they still might copy some cool UI tricks</strong> you do. Maybe you've gone to great lengths to create some really cool frameworks that make your life easier or make your app behave in a very cool and new way. You might not want other apps to look as cool as your app does. Well, it's your right. In my opinion, the app store contains way too many badly designed apps. You would do the world a favour by releasing your great library to the public. Really.
</p>
<p>And finally, you might not be able to open source your next app because your client or the <strong>company you're working for is against open source</strong>. Maybe they have good reasons for it, maybe they just don't know enough about open source. If the latter is the case, let them read this blog post or drop me a line - I'm available for consulting.
</p>
<h3>Business Models for Open Source Apps</h3>
<p>You might have a different point of view (and if you do, please leave a comment - I'm eager to hear your thoughts), but in my opinion open source is not a threat but a chance for your app. If we take this for granted, the question remains, how can you make money with an open sourced app? Here are some suggestions:</p>
<p>
<strong>Sell it on the App Store</strong>. Yes, this might sound a little strange after all my raving about open source. If something is open source, how can you sell it? Well, it turns out selling apps on the App Store is a great idea, especially for open source apps. The app store is the only way how your clients can get hold of your application. Of course - they might check out your code, compile it and upload it to their iPhone. But to do so, they'd need to be registered iPhone developers, meaning they'd need to buy an iPhone developer certificate. Don't you think it is cheaper to just buy your app than shelling out 99 USD for the developer certificate?
</p>
<p>If you're developing a library or framework, you might consider getting <strong>funding on <a href="http://www.kickstarter.com/">Kickstarter</a></strong>. Kickstarter is a great way to get funding for your project: you define the deliverable and how much funds you want to raise and people can back your project by pledging a variable amount of money. This way, <a href="http://www.penandthink.com/">John Wain</a> of <a href="http://glyphish.com/">Glyphish</a> fame <a href="http://www.kickstarter.com/projects/jpwain/great-icons-for-iphone-4-apps">managed to raise more than 27.000 USD</a> for developing an iPhone 4 compatible version of his great Glyphish icon set. His original goal was to raise 2.000 USD, by the way.
</p>
<p>
I hope I could encourage you to try open source as a strategy for your next application or framework. If I did, let me know! Chances are I might want to submit a patch to add that tiny little feature I think your app is lacking <img src='http://www.peterfriese.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/why-your-next-app-should-be-open-sourced/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t attend the Eclipse DemoCamp in Hamburg this Friday&#8230;</title>
		<link>http://www.peterfriese.de/dont-attend-the-eclipse-democamp-in-hamburg-this-friday/</link>
		<comments>http://www.peterfriese.de/dont-attend-the-eclipse-democamp-in-hamburg-this-friday/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 22:36:08 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[democamp]]></category>
		<category><![CDATA[hamburg]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=522</guid>
		<description><![CDATA[... if you're not interested in meeting local (and non-local) Eclipse enthusiasts and committers, learning something about Eclipse, Git, SWT, Qt, e4 and the iPhone, watching some nice Pixar short films in a cosy cinema, and frosty beverages. On the other hand, if you are interested in at least one of those things, I encourage [...]]]></description>
			<content:encoded><![CDATA[<p>... if you're not interested in meeting local (and non-local) Eclipse enthusiasts and committers, learning something about Eclipse, Git, SWT, Qt, e4 and the iPhone, watching some nice Pixar short films in a cosy cinema, and frosty beverages.<br />
<span id="more-522"></span><br />
On the other hand, if you <strong>are</strong> interested in at least one of those things, I encourage you to sign up for the DemoCamp <a href="http://wiki.eclipse.org/Eclipse_DemoCamps_Helios_2010/Hamburg">here</a> or <a href="http://www.twitter.com/peterfriese">ping me on Twitter</a> or just send me a mail so I can add you to the list.</p>
<p>Here's the detailed program:</p>
<ul>
<li>18:00 - 18:40 Welcome / Short films</li>
<li>18:45 - 19:15 <a href="http://twitter.com/vogella">Lars Vogel</a>, Developing with e4</li>
<li>19:20 - 19:50 <a href="http://twitter.com/szarnekow">Sebastian Zarnekow</a>, Xtext - A Language Development Framework, Live demo of new and noteworthy features in Xtext</li>
<li>19:50 - 20:20 Break + Surprise</li>
<li>20:20 - 20:35 <a href="http://www.xing.com/profile/Juergen_Becker">Jürgen Becker</a>, UI with style - a new SWT platform that is based on Qt</li>
<li>20:40 - 21:10 <a href="http://twitter.com/ralfebert">Ralf Ebert</a>, Introduction to distributed version control with Git</li>
<li>21:15 - 21:45 <a href="http://twitter.com/HBehrens">Heiko Behrens</a>, Build your own iPhone app within minutes - thanks to Eclipse</li>
<li>21:45 - open end Closing remarks / Frosty beverages</li>
</ul>
<p>The DemoCamp will take place in the <a href="http://www.magazinfilmkunst.de">MAGAZIN Cinema</a> in Hamburg (<a href="http://www.magazinfilmkunst.de/anfahrt.html">directions</a>) and yes, we will show some short films at the beginning of the camp for your entertainment.</p>
<p><a href="http://twitter.com/martinlippert">Martin Lippert</a> and I are happy to be able to present a great lineup of speakers and demos, so do yourself a favor and join us this Friday from 18:00 (6pm).</p>
<p>As always, the event if <strong>free of charge</strong> thanks to the generous support of <a href="http://www.it-agile.de/">it-agile</a>, <a href="http://www.itemis.com">itemis</a> and the <a href="http://www.eclipse.org">Eclipse Foundation</a>.</p>
<p>Looking forward to seeing you on Friday!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/dont-attend-the-eclipse-democamp-in-hamburg-this-friday/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OSGi &amp; Servlets: Flexibility by Simplicity</title>
		<link>http://www.peterfriese.de/osgi-servlets-flexibility-by-simplicity/</link>
		<comments>http://www.peterfriese.de/osgi-servlets-flexibility-by-simplicity/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 08:24:03 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[JEE]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=426</guid>
		<description><![CDATA[Strangely enough, simple things tend to be more flexible than complex things. I bet you too have seen people go to great lengths to ensure a certain solution provides utmost flexibility. Often, this flexibility isn't needed, so you're introducing accidental complexity. In a recent post, I showed you how to create a plain servlet and [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Strangely enough</strong>, simple things tend to be more flexible than complex things. I bet you too have seen people go to great lengths to ensure a certain solution provides utmost flexibility. <span id="more-426"></span>Often, this flexibility isn't needed, so you're introducing accidental complexity.</p>
<p>In <a href="http://www.peterfriese.de/osgi-servlets-a-happy-marriage/">a recent post</a>, I showed you how to create a plain servlet and register it in an OSGi environment. As both <a href="http://eclipsesource.com/blogs/author/jeff/">Jeff</a> and <a href="http://www.composent.com/">Scott</a> pointed out, my using a <em>ServiceTracker</em> to register and unregister the servlet is a little bit clumsy and can be improved by using Declarative Services.</p>
<p>I highly recommend reading chapter 15 in "<a href="http://my.safaribooksonline.com/9780321561510">OSGi and Equinox</a>", but in a nutshell Declarative Services allow you to define <em>components</em> which can provide and consume <em>services</em>. <em>Binding</em> and <em>unbinding</em> references between components and services is performed by the DS runtime (also known as the Service Component Runtime).</p>
<p>Without further ado, here are the changes I had to make to DS-ify my simple servlet:</p>
<ol>
<li>Remove the activator. Yes, that's true: we don't need an Activator any more. Delete the class and also remove it from <em>META-INF/MANIFEST.MF</em></li>
<li>Delete <em>HttpServiceTracker</em>. Registering the servlet with the <em>HTTPService</em> will be handled by the DS runtime.</li>
<li>Implement a <em>component</em> to register and unregister the servlet with the <em>HttpService</em>:
<pre class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SimpleComponent <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> SERVLET_ALIAS = <span style="color: #ff0000;">&quot;/hellods&quot;</span>;
  <span style="color: #000000; font-weight: bold;">private</span> HttpService httpService;
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setHttpService<span style="color: #66cc66;">&#40;</span>HttpService httpService<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">httpService</span> = httpService;
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #993333;">void</span> startup<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Staring up sevlet at &quot;</span> + SERVLET_ALIAS<span style="color: #66cc66;">&#41;</span>;
      SimpleServlet servlet = <span style="color: #000000; font-weight: bold;">new</span> SimpleServlet<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
      httpService.<span style="color: #006600;">registerServlet</span><span style="color: #66cc66;">&#40;</span>SERVLET_ALIAS, servlet, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>ServletException e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>NamespaceException e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #993333;">void</span> shutdown<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    httpService.<span style="color: #006600;">unregister</span><span style="color: #66cc66;">&#40;</span>SERVLET_ALIAS<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>As you can see, the <em>HttpService</em> will be injected into this component using it's setter method, <em>setHttpService</em>.</p>
</li>
<li>Register this component with the DS runtime by adding a component description:
<pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&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="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;scr:component</span>
  <span style="color: #000066;">xmlns:scr</span>=<span style="color: #ff0000;">&quot;http://www.osgi.org/xmlns/scr/v1.1.0&quot;</span>
  <span style="color: #000066;">activate</span>=<span style="color: #ff0000;">&quot;startup&quot;</span>
  <span style="color: #000066;">deactivate</span>=<span style="color: #ff0000;">&quot;shutdown&quot;</span>
  <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;simple.ds.component&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;implementation</span>
    <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;simple.ds.servlet.SimpleComponent&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;reference</span>
    <span style="color: #000066;">bind</span>=<span style="color: #ff0000;">&quot;setHttpService&quot;</span>
    <span style="color: #000066;">interface</span>=<span style="color: #ff0000;">&quot;org.osgi.service.http.HttpService&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/scr:component<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre>
<p>I saved this file in <em>OSGI-INF/component.xml</em> and added it to the <em>Service-Component</em> section of <em>META-INF/MANIFEST.MF</em>. In fact, as I used the <em>Create New OSGi Component</em> wizard, the wizard added the entry to the <em>ServiceComponent</em> section - it's really easy to forget this if you do it manually!</p>
</li>
</ol>
<p>That's it!</p>
<p><strong>Please note</strong> that I did not change the servlet implementation at all (apart form issuing a different text to make it easier to tell the servlets apart)!</p>
<p><strong>Before launching</strong>, please make sure to add <em>org.eclipse.equinox.ds</em> and <em>org.eclipse.equinox.util</em> to your launch config to enable Declarative Services.</p>
<p>The biggest advantage of this approach is that you do not have to take care of acquiring the <em>HTTPService</em>. The DS runtime will <em>only</em> activate your component when all prerequisites have been met, i.e., all dependencies are available. If the <em>HttpService</em> is not available for any reason, your component will not be started. This makes the code for registering the servlet simpler and cleaner.</p>
<p>You can <a href="http://code.google.com/p/peterfriese/source/browse/#svn/osgi/trunk/simple.ds.servlet">download the source for the DS-ified servlet</a> from my SVN repository on Google Code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/osgi-servlets-flexibility-by-simplicity/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OSGi &amp; Servlets: Deploying on Amazon EC2</title>
		<link>http://www.peterfriese.de/osgi-servlets-deploying-on-amazon-ec2/</link>
		<comments>http://www.peterfriese.de/osgi-servlets-deploying-on-amazon-ec2/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 23:04:09 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[JEE]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=422</guid>
		<description><![CDATA[Last week, I showed you how to create a very simple OSGi-based servlet and run it locally on Jetty. Today, I will show you how to deploy this servlet to an Amazon EC2 instance. We will first set up an Amazon EC2 instance and then export the servlet and install it in this instance. Setting [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, <a href="http://www.peterfriese.de/osgi-servlets-a-happy-marriage/">I showed you how to create a very simple OSGi-based servlet</a> and run it locally on Jetty. Today, I will show you how to deploy this servlet to an Amazon EC2 instance.</p>
<p><span id="more-422"></span></p>
<p>We will first set up an Amazon EC2 instance and then export the servlet and install it in this instance.</p>
<h2>Setting up an Amazon EC2 instance</h2>
<p>Scott Lewis <a href="http://eclipseecf.blogspot.com/2010/03/osgieclipsert-in-amazon-cloud.html">was kind enough to prepare an Amazon EC2 Machine Image (AMI)</a> that already contains Jetty, Equinox and p2 - everything we need to get our servlet running. So let's use this AMI to provision our instance:</p>
<ol>
<li>Sign in to the <a href="https://console.aws.amazon.com/ec2/home">AWS web console</a></li>
<li>Click on <em>Launch instance</em> to create a new instance</li>
<li>In the <em>Request Instances Wizard</em>, jump over to the <em>Community AMIs</em> tab</li>
<li>Type <em>OSGi</em> in the search field to search for <strong><em>ami-69d93600</em></strong></li>
<li>Select the AMI</li>
<li>In the next step, you get to configure the instance. A small instance will do for now.</li>
<li>Leave the <em>Advanced Instance</em> options as-is</li>
<li>Next, you need to create a key pair (this will allow you to sign in to the instance using SSH). If you haven't created an EC2 instance before, select <em>Create a new Key Pair</em> and follow the instructions. Otherwise, select an existing key pair</li>
<li>To access the instance from outside using HTTP and SSH, you need to create and assign a <em>security group</em>. Make sure to add SSH and HTTP port configurations to this security group. Unfortunately, it is not possible to freely choose the port ranges, so we need to edit the security group after we're finished with the wizard.</li>
<li>On the summary page, review the configuration and click on <em>Launch</em> to actually start your instance.</li>
</ol>
<p>After a little while, the newly created instance will show up in the list of AMIs. You can test your instance by opening a terminal window and SSH'ing to your instance:</p>
<pre>
  ssh -i path/to/your/privatekey.pem root@ec2-xxx-xx-xx-xx.compute-1.amazonaws.com
</pre>
<p>You should be greeted with a prompt like this:</p>
<pre class="bash">        __|  __|_  <span style="color: #7a0874; font-weight: bold;">&#41;</span>  Fedora <span style="color: #000000;">8</span>
        _|  <span style="color: #7a0874; font-weight: bold;">&#40;</span>     /    <span style="color: #000000;">32</span>-bit
       ___|\___|___|
&nbsp;
Welcome to an EC2 Public Image
                      :- <span style="color: #7a0874; font-weight: bold;">&#41;</span>
   Base</pre>
<p>Start the EclipseRT server as follows:</p>
<pre class="bash"><span style="color: #7a0874; font-weight: bold;">cd</span> /<span style="color: #c20cb9; font-weight: bold;">env</span>/osgi_eclipsert36_sb_p2_jetty_7_0_1_linux_x86/jetty-distribution<span style="color: #000000;">-7.0</span><span style="color: #000000;">.1</span>.v20091125/
./eclipsert36.<span style="color: #c20cb9; font-weight: bold;">sh</span></pre>
<p>Your Eclipse RT Equinox server is now up and running. Time to export the servlet!</p>
<h2>Exporting the servlet</h2>
<p>We will export our simple servlet using a feature based update site, so it can be installed using p2.</p>
<p><strong>First,</strong> create a new feature project, naming it <em>simple.servlet.feature</em>. Provide the following details to the wizard:</p>
<ol>
<li><em>ID:</em> simple.servlet.feature</li>
<li><em>Version:</em> 1.0.0.qualifier</li>
<li><em>Name:</em> Simple Servlet Feature</li>
<li><em>Provider:</em> Your name</li>
</ol>
<p>Open the <em>Plug-ins</em> page and add <em>simple.servlet</em> to the list of packages plug-ins.</p>
<p><strong>Now,</strong> we can create the update site. It will only contain the feature we just created. Using the <em>New Update Site</em> wizard, create a new update site project, naming it <em>simple.servlet.updatesite</em>. Add the feature we just created to the list of features on the first page of the <em>site.xml</em> Update Site Map.</p>
<p><strong>When you're done with that, </strong>, you can build the update site by pressing the <em>Build All</em> button. This will build the servlet plug-in, the feature and finally the update site. After that, we're ready to deploy.</p>
<h2>Installing the servlet</h2>
<p>Installing the servlet into our Amazon EC2 instance is quite easy, as we can leverage p2:</p>
<p><strong>Using your favourite SFTP client,</strong> copy the entire update into the <em>/tmp</em> directory of your Amazon EC2 instance. When that's done, hop over to your terminal window that's connected to the OSGi console of your Eclipse RT server (remember, we started this server when setting up the Amazon EC2 instance). Issue the following commands:</p>
<pre class="bash">provaddrepo <span style="color: #c20cb9; font-weight: bold;">file</span>:/tmp/simple.servlet.updatesite
provliu
provinstall simple.servlet  <span style="color: #000000;">1.0</span><span style="color: #000000;">.0</span><span style="color: #000000;">.201004091446</span>
confapply</pre>
<p><strong>Make sure you use the correct version identifier, it is likely to be different from the one I used here!</strong></p>
<p>You can now list the installed bundles by invoking <em>ss</em>:</p>
<pre class="bash">ss
...
<span style="color: #000000;">38</span>      ACTIVE      org.eclipse.equinox.preferences_3<span style="color: #000000;">.3</span><span style="color: #000000;">.0</span>.v20100208
<span style="color: #000000;">39</span>      ACTIVE      org.eclipse.equinox.registry_3<span style="color: #000000;">.5</span><span style="color: #000000;">.0</span>.v20100301
<span style="color: #000000;">40</span>      ACTIVE      org.eclipse.equinox.security_1<span style="color: #000000;">.0</span><span style="color: #000000;">.200</span>.v20100301
<span style="color: #000000;">41</span>      ACTIVE      org.eclipse.equinox.server.examples.hello_1<span style="color: #000000;">.0</span><span style="color: #000000;">.0</span><span style="color: #000000;">.201003111015</span>
<span style="color: #000000;">42</span>      ACTIVE      org.eclipse.equinox.simpleconfigurator.manipulator_2<span style="color: #000000;">.0</span><span style="color: #000000;">.0</span>.v20100304
<span style="color: #000000;">43</span>      ACTIVE      org.eclipse.equinox.util_1<span style="color: #000000;">.0</span><span style="color: #000000;">.100</span>.v20090520<span style="color: #000000;">-1800</span>
<span style="color: #000000;">44</span>      RESOLVED    org.eclipse.osgi.services_3<span style="color: #000000;">.2</span><span style="color: #000000;">.100</span>.v20100108
<span style="color: #000000;">45</span>      RESOLVED    org.sat4j.core_2<span style="color: #000000;">.2</span><span style="color: #000000;">.0</span>.v20100225
<span style="color: #000000;">46</span>      RESOLVED    org.sat4j.pb_2<span style="color: #000000;">.2</span><span style="color: #000000;">.0</span>.v20100225
<span style="color: #000000;">47</span>      RESOLVED    simple.servlet_1<span style="color: #000000;">.0</span><span style="color: #000000;">.0</span><span style="color: #000000;">.201004081743</span></pre>
<p><strong>Start</strong> the servlet by typing <em>start 47</em> (again, please use the bundle ID issued by <em>ss</em>).</p>
<p><strong>Open a webbrowser</strong> and navigate to ec2-xxx-xx-xx-xx.compute-1.amazonaws.com:8080/simple (the DNS address is the same you used to SSH to your instance) and you should see the servlet output:</p>
<pre class="bash">Hello from the cloud!</pre>
<h2>Conclusion</h2>
<p>In this post, you saw how easy it is to create an Amazon EC2 instance and deploy an OSGi-based servlet on it. With this knowledge, you can now start sky-diving into the joys of cloud computing. Have fun!</p>
<p>Most of this information has been taken from the <a href="http://wiki.eclipse.org/EclipseRT_for_Amazon_EC2">Eclipse Wiki</a>. You are encouraged to add your own tips &amp; tricks to this <a href="http://wiki.eclipse.org/EclipseRT_for_Amazon_EC2">wiki page</a>. All you need is an Eclipse Bugzilla account. Setting one up is easy, start <a href="https://bugs.eclipse.org/bugs/createaccount.cgi">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/osgi-servlets-deploying-on-amazon-ec2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

