<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title>Javanto Blog</title>
	<link href="http://javanto.com/blog/atom.xml" rel="self" />
	<link href="http://javanto.com/blog/" />
	<id>http://javanto.com/blog/</id>
	<updated>2014-11-09T18:01:03+00:00</updated>
	
	<author>
		<name>Hannu Leinonen</name>
		<email>hleinone@gmail.com</email>
	</author>

	
	<entry>
		<title>Android AppCompat ActionBar Advice</title>
		<link href="http://javanto.com/blog/2013/07/30/android-appcompat-actionbar-advice/" />
		<id>http://javanto.com/blog/2013/07/30/android-appcompat-actionbar-advice</id>
		<updated>2013-07-30T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Couple of weeks ago, along with the Android 4.3 Jelly Bean, Google released a new &lt;a href=&quot;http://developer.android.com/tools/support-library/index.html&quot;&gt;AppCompat support library&lt;/a&gt; bringing the &lt;a href=&quot;http://developer.android.com/guide/topics/ui/actionbar.html&quot;&gt;action bar&lt;/a&gt; all the way down to devices running Android 2.1. I couldn&#39;t find a simple example on the web combining Gradle and the new library, so I decided to do it myself.&lt;/p&gt;

&lt;p&gt;First off, I created a new Android project, using the new &lt;a href=&quot;http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Project-Structure&quot;&gt;Gradle project structure&lt;/a&gt; and a simple Gradle build file. In the build file, apart from the basic stuff you can find &lt;a href=&quot;http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Simple-build-files&quot;&gt;all over the place&lt;/a&gt;, you need to add a dependency to the AppCompat library.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-groovy&quot; data-lang=&quot;groovy&quot;&gt;&lt;span class=&quot;n&quot;&gt;dependencies&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;compile&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;com.android.support:appcompat-v7:18.0.+&amp;quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You still need to have your activity to extend &lt;a href=&quot;http://developer.android.com/tools/support-library/index.html&quot;&gt;ActionBarActivity&lt;/a&gt; and set up the theme in your manifest to be one of &lt;code&gt;@style/Theme.AppCompat&lt;/code&gt;, &lt;code&gt;@style/Theme.AppCompat.Light&lt;/code&gt; or &lt;code&gt;@style/Theme.AppCompat.Light.DarkActionBar&lt;/code&gt;, of course it&#39;s also fine to use a theme of your own that derives from one of those. There you have it, the simplest possible action bar supporting 2.1 and up.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../../../../../img/2013/07/30/android-appcompat-actionbar-advice/action-bar-on-android-2.1.png&quot; alt=&quot;Action bar on Android 2.1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I wanted to go one step further and make it more visually appealing. The app I use as an example was made as a joke for &quot;tracking&quot; the birth of &lt;a href=&quot;https://en.wikipedia.org/wiki/Prince_George_of_Cambridge&quot;&gt;Prince George of Cambridge&lt;/a&gt;. The &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.javanto.rbt&quot;&gt;Royal Baby Tracker&lt;/a&gt; was made during my flight to London and took far less time than Catherines labor. After his royal prince-ness was born, I made the changes described here and released the app as &lt;a href=&quot;https://github.com/javanto/royal-baby-tracker&quot;&gt;open source&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, I created a theme of my own that derived from &lt;code&gt;@style/Theme.AppCompat&lt;/code&gt;. The only thing I really wanted to customize was the background color, for which I had to set up the following in &lt;code&gt;values/styles.xml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;style&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Theme.Base.Rbt&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;parent=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;@style/Theme.AppCompat&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;item&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;actionBarStyle&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;@style/Widget.Rbt.ActionBar&lt;span class=&quot;nt&quot;&gt;&amp;lt;/item&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;item&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;windowActionBar&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;true&lt;span class=&quot;nt&quot;&gt;&amp;lt;/item&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;style&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Widget.Rbt.ActionBar&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;parent=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;@style/Widget.AppCompat.ActionBar&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;item&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;background&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;@color/royal_blue&lt;span class=&quot;nt&quot;&gt;&amp;lt;/item&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;That declares the default style ie. style for in pre-&lt;a href=&quot;http://developer.android.com/design/style/themes.html&quot;&gt;Holo&lt;/a&gt; Android versions. In &lt;code&gt;values-v14/styles.xml&lt;/code&gt; I&#39;m then having the following:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;resources&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns:android=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;style&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Theme.Base.Rbt&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;parent=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;@style/Theme.AppCompat&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;item&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;android:actionBarStyle&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;@style/Widget.Rbt.ActionBar&lt;span class=&quot;nt&quot;&gt;&amp;lt;/item&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;item&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;android:windowActionBar&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;true&lt;span class=&quot;nt&quot;&gt;&amp;lt;/item&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;style&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Widget.Rbt.ActionBar&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;parent=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;@android:style/Widget.Holo.ActionBar&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;item&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;android:background&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;@color/royal_blue&lt;span class=&quot;nt&quot;&gt;&amp;lt;/item&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/resources&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The differences between these two files are minimal, but important. In both the &lt;code&gt;Theme.Base.Rbt&lt;/code&gt; derives from the very same AppCompat theme. In the default style I can&#39;t use the &lt;code&gt;android:&lt;/code&gt; namespace since those attributes were only introduced in Holo. But the AppCompat library has the respective attributes in the default namespace. In the v14 version the &lt;code&gt;Widget.Rbt.ActionBar&lt;/code&gt; derives from the Holo version of the widget, which is completely fine as we know that since Ice Cream Sandwich the Holo is there.&lt;/p&gt;

&lt;p&gt;And the end result? I&#39;m just waiting for my knightening!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../../../../../img/2013/07/30/android-appcompat-actionbar-advice/styled-action-bar.png&quot; alt=&quot;Styled action bar&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you found this article useful and for that, or some other reason, want to support me, go and buy the &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.javanto.rbt&quot;&gt;Royal Baby Tracker app on Google Play Store&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>StackMob with PhoneGap</title>
		<link href="http://javanto.com/blog/2012/06/13/stackmob-with-phonegap/" />
		<id>http://javanto.com/blog/2012/06/13/stackmob-with-phonegap</id>
		<updated>2012-06-13T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;&lt;a href=&quot;http://phonegap.com/&quot;&gt;PhoneGap&lt;/a&gt; (also known as &lt;a href=&quot;http://incubator.apache.org/cordova/&quot;&gt;Apache Cordova&lt;/a&gt;), is quite widely known solution to write-once-run-everywhere problem. They solve it in the mobile space by using standard web tools to develop the application. The application is then wrapped in a native one that&#39;s basically just a WebKit browser. So, instead of using the native component model you use HTML components.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://stackmob.com/&quot;&gt;StackMob&lt;/a&gt; is a San Francisco based startup, that gives you a cloud instance and amazingly simple way to create &lt;a href=&quot;http://en.wikipedia.org/wiki/Create,_read,_update_and_delete&quot;&gt;CRUD&lt;/a&gt; app with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Representational_state_transfer&quot;&gt;RESTful&lt;/a&gt; JSON web service. You create the API just by specifying the entities and their relations. You could also upload your own custom code and do more complex things, but it won&#39;t be covered on this post.&lt;/p&gt;

&lt;p&gt;So, I wanted to fiddle with something new and for some reason I came up with these two. But the beginning wasn&#39;t that easy. StackMob requires you to authenticate before you can do anything. For Android an iPhone there are SDKs to use, but neither of them would work with PhoneGap easily. Thankfully, they also support &lt;a href=&quot;http://oauth.net/&quot;&gt;OAuth&lt;/a&gt; authentication. So, I was advised to use &lt;a href=&quot;https://github.com/bytespider/jsOAuth&quot;&gt;jsOAuth&lt;/a&gt; for authenticating from JavaScript.&lt;/p&gt;

&lt;p&gt;When you create a StackMob application, on the App Settings you can find the OAuth keys for both development and production. Depending on the platform you&#39;re planning to use, pick the right ones. Then in JavaScript you initialize an &lt;code&gt;oauth&lt;/code&gt; variable. At this point, I expect you to know your HTML and JavaScript, so I skip the whole setting up of the PhoneGap project. Lookup &lt;a href=&quot;http://wiki.phonegap.com/w/page/35501397/Tutorials&quot;&gt;here for tutorials&lt;/a&gt; on that matter.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;oauth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;OAuth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;enablePrivilege&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;consumerKey&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;YOUR_STACKMOB_PUBLIC_KEY&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;consumerSecret&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;YOUR_STACKMOB_PRIVATE_KEY&amp;quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;IMPORTANT NOTICE: Do not use the above method on a true web application, it&#39;ll compromise your security, as the users have direct access to your keys from the sources. For web purposes use &lt;a href=&quot;https://www.stackmob.com/platform/help/tutorials/html5_js_sdk&quot;&gt;StackMob&#39;s HTML5 SDK&lt;/a&gt;. This is safe though in PhoneGap as the sources are not revealed to the user.&lt;/p&gt;

&lt;p&gt;So, now you&#39;ve got the initial connection to the platform and you can begin using it. For instance, in the StacMob schemas, create an user schema and then an instance with of it in the Test Console. Them we&#39;ll try to log him in using JavaScript.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;oauth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;http://your-stackmob-username.mob1.stackmob.com/api/0/your-stackmob-application-name/user/login?username=&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;username&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;amp;password=&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Login successful&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Login unsuccessful&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Success, right? Well, try creating some other object to the schema and do an insertion through JavaScript. Below&#39;s an example how it could be.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;oauth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;postJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;http://your-stackmob-username.mob1.stackmob.com/api/0/your-stackmob-application-name/employee&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;employee_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Created employee with id &amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Employee creation failed&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;From this point on, you&#39;re on your own and I think you can manage. It&#39;s just a simple JSON API for you to &lt;a href=&quot;http://en.wikipedia.org/wiki/POST_%28HTTP%29&quot;&gt;POST&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/GET_%28HTTP%29#Request_methods&quot;&gt;GET&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/PUT_%28HTTP%29#Request_methods&quot;&gt;PUT&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/DELETE_%28HTTP%29#Request_methods&quot;&gt;DELETE&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Making It on the Mobile Web</title>
		<link href="http://javanto.com/blog/2012/06/11/making-it-on-the-mobile-web/" />
		<id>http://javanto.com/blog/2012/06/11/making-it-on-the-mobile-web</id>
		<updated>2012-06-11T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Yet noticed that this site works on both Android and iOS devices? How was this all achieved? Well, first-of-all you should know about &lt;a href=&quot;http://html5boilerplate.com/&quot;&gt;HTML 5 Boilerplate&lt;/a&gt; a great basis for any website. There&#39;s also &lt;a href=&quot;http://html5boilerplate.com/mobile&quot;&gt;Mobile Boilerplate&lt;/a&gt; that I used as well, combining things from both that I thought were important. The two HTML templates get you pretty far in supporting various screen sizes and they&#39;re also well documented.&lt;/p&gt;

&lt;p&gt;From the JavaScript side both boilerplates utilize &lt;a href=&quot;http://modernizr.com/&quot;&gt;Modernizr&lt;/a&gt; which is an awesome library for feature detection and also includes &lt;a href=&quot;http://yepnopejs.com/&quot;&gt;YepNope&lt;/a&gt;. Them combined with &lt;a href=&quot;https://github.com/pyrsmk/ClassIE&quot;&gt;ClassIE&lt;/a&gt; make loading of JavaScript libraries very efficient, you&#39;ll have full control of the sequence when they&#39;re to be loaded.&lt;/p&gt;

&lt;p&gt;The boilerplates have a slight dependency on &lt;a href=&quot;http://jquery.com/&quot;&gt;jQuery&lt;/a&gt; which I wanted to ditch and move to a more light-weight &lt;a href=&quot;http://xuijs.com/&quot;&gt;Xui&lt;/a&gt;. Xui has separate IE and non-IE versions, loading the correct one with YepNope and ClassIE was super-easy.&lt;/p&gt;

&lt;p&gt;I still want to mention Mobile Boilerplate&#39;s helper.js. A library which contains various fixes for mobile devices. Setting them up is easy, first detecting if we&#39;re on a touch device and then applying the fix by calling the function. With the helper.js you can easily remove the address bar from iOS and Android browsers, giving a bit more space for your relevant content.&lt;/p&gt;

&lt;p&gt;One thing is still to be mentioned, the CSS. CSS is probably the biggest factor in the whole &lt;a href=&quot;http://www.lukew.com/presos/preso.asp?26&quot;&gt;mobile first&lt;/a&gt; and &lt;a href=&quot;http://www.alistapart.com/articles/responsive-web-design/&quot;&gt;responsive web design&lt;/a&gt; approaches. In the boilerplates the base CSS is done so that it looks fine on a small screen, then using &lt;a href=&quot;http://www.w3.org/TR/css3-mediaqueries/&quot;&gt;CSS media-queries&lt;/a&gt; to make changes to the layout when the browser resolution increases. I defined limits on certain absolute resolution width points to make it look different on tablet and desktop displays.&lt;/p&gt;

&lt;p&gt;A bit more difficult part in the whole responsiveness are the HTML elements that need to be responsive, like the img tag for example. For a larger display you may want to load a larger image. There&#39;s really no solution that is both able to run without JavaScript and doesn&#39;t do unnecessary requests. I decided to use &lt;a href=&quot;https://github.com/pyrsmk/molt&quot;&gt;Molt&lt;/a&gt; for its small size, dependency freeness and nice syntax. So using just regular img tags, I define a &lt;code&gt;data-url&lt;/code&gt; attribute that maps the window width to file names. The only compromise is using a different attribute on the img tag, which is in my opinion better than the alternative solutions.&lt;/p&gt;

&lt;p&gt;Allright, that&#39;s about it. You can see the full source of this website on &lt;a href=&quot;https://github.com/javanto/javanto.github.com&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Customizing HTML5 Form Validation Error Messages</title>
		<link href="http://javanto.com/blog/2012/03/03/customizing-html5-form-validation-error-messages/" />
		<id>http://javanto.com/blog/2012/03/03/customizing-html5-form-validation-error-messages</id>
		<updated>2012-03-03T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Ever tried out &lt;a href=&quot;http://www.w3.org/TR/html5/forms.html#client-side-form-validation&quot;&gt;HTML5 form validation&lt;/a&gt;? If not, you should! It&#39;ll save server-side resources and improve the usability. Also &lt;a href=&quot;http://caniuse.com/form-validation&quot;&gt;all the &lt;em&gt;good&lt;/em&gt; browsers support it&lt;/a&gt;. For the not-so-nice browsers, there are &lt;a href=&quot;https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills&quot;&gt;polyfills&lt;/a&gt; for example &lt;a href=&quot;http://www.thecssninja.com/javascript/H5F&quot;&gt;H5F&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Done with the testing? If so, you might&#39;ve noticed some issues with the popping up error messages. They may seem ugly (fixing that is not in the scope of this article) and the text of the error message comes out-of-nowhere. It might be even in incorrect language, depending on the one the browser&#39;s in. So, whether you want to unify the messages with their server-side equivalents or just force them to match the language of your site, you&#39;re in trouble.&lt;/p&gt;

&lt;p&gt;Well, there&#39;s an &lt;a href=&quot;http://www.w3.org/TR/html5/association-of-controls-and-forms.html#dom-cva-setcustomvalidity&quot;&gt;API&lt;/a&gt; for setting the error messages.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;oninvalid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;validity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;valid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCustomValidity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;This field contains errors&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;oninput&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCustomValidity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;But, as you see, you&#39;ll end up messing the content with the logic and writing loads of unnecessary JavaScript. The example above doesn&#39;t even contain the logic for switching between the &lt;a href=&quot;http://dev.w3.org/html5/spec/constraints.html#validitystate&quot;&gt;various error states&lt;/a&gt;. You see where this is going, right?&lt;/p&gt;

&lt;p&gt;So, I wrote &lt;a href=&quot;https://github.com/javanto/civem.js&quot;&gt;civem.js&lt;/a&gt;, it stands for &lt;strong&gt;C&lt;/strong&gt;ustom &lt;strong&gt;I&lt;/strong&gt;nput &lt;strong&gt;V&lt;/strong&gt;alidation &lt;strong&gt;E&lt;/strong&gt;rror &lt;strong&gt;M&lt;/strong&gt;essages. And how do you use it? Simply, &lt;a href=&quot;https://github.com/javanto/civem.js/downloads&quot;&gt;download the latest version&lt;/a&gt;, include it on your page and begin using &lt;code&gt;data-errormessage&lt;/code&gt; and &lt;code&gt;data-errormessage-*&lt;/code&gt; attributes on your form elements to validate. You can go check out &lt;a href=&quot;http://jsfiddle.net/hleinone/njSbH/&quot;&gt;the demo on jsFiddle&lt;/a&gt; or read the &lt;a href=&quot;https://github.com/javanto/civem.js/blob/master/README.md&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;civem-x.x.x.min.js&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;email&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-errormessage-value-missing=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;It says &amp;amp;quot;required&amp;amp;quot; in the HTML!&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-errormessage-type-mismatch=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Let me give you a hint: type=&amp;amp;quot;email&amp;amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-errormessage=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;This is the fallback error message.&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Easy, huh!&lt;/p&gt;

&lt;p&gt;Now, when most of you readers are busy fiddling with it, is time for some warnings. It hasn&#39;t been tested awfully lot by me, so make sure it works for your case, if it doesn&#39;t, file an issue on GitHub, I&#39;ll fix them ASAP. Also, I&#39;m not (yet) a true JavaScript wizard, so the implementation might just suck. Anyhow, feedback is warmly welcome, so please use the comment facility below and the fork button on GitHub!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>GAE + Eclipse + Maven 2.0</title>
		<link href="http://javanto.com/blog/2012/01/11/gae-eclipse-maven-2-0/" />
		<id>http://javanto.com/blog/2012/01/11/gae-eclipse-maven-2-0</id>
		<updated>2012-01-11T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I&#39;ve &lt;a href=&quot;http://javanto.com/blog/2010/07/25/gae-eclipse-maven-update-for-helios&quot;&gt;previously posted&lt;/a&gt; about how to set up a Google App Engine project utilizing Maven to its fullest extent. On a recent update to &lt;a href=&quot;http://code.google.com/eclipse/&quot;&gt;Google Plugin for Eclipse&lt;/a&gt;, they introduced &lt;a href=&quot;http://code.google.com/apis/sql/&quot;&gt;Google Could SQL&lt;/a&gt; which meant changes to the &lt;a href=&quot;https://github.com/javanto/gae-eclipse-maven-archetype&quot;&gt;archetype&lt;/a&gt; I&#39;ve created. Also since the last release I had done some other improvements too, so I decided it&#39;s time for 2.0!&lt;/p&gt;

&lt;p&gt;The POM is huge but it provides as seamless as possible integration of the Maven project to Eclipse. And this is how you use the archetype:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;mvn org.apache.maven.plugins:maven-archetype-plugin:2.2:generate &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeGroupId&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;com.javanto &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeArtifactId&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;gae-eclipse-maven-archetype &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeVersion&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2.0 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeRepository&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;https://raw.github.com/javanto/repository/releases&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;If you, for some reason don&#39;t want to use the archetype but rather see an example project, there&#39;s &lt;a href=&quot;https://github.com/javanto/gae-eclipse-maven-example&quot;&gt;one with pretty much identical content&lt;/a&gt;. You can see that live in action (when the goddamn spammers haven&#39;t flooded the datastore read operations) at &lt;a href=&quot;http://gae-eclipse-maven-example.appspot.com/&quot;&gt;gae-eclipse-maven-example.appspot.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Also, if someone experienced with Eclipse plugin development wants to take the integration a one or two steps further, go ahead and contact me, we should do a m2eclipse plugin!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Moving to GitHub and Jekyll</title>
		<link href="http://javanto.com/blog/2012/01/10/moving-to-github-and-jekyll/" />
		<id>http://javanto.com/blog/2012/01/10/moving-to-github-and-jekyll</id>
		<updated>2012-01-10T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;My blog, formerly known as &lt;a href=&quot;http://hamandeggs.wordpress.com/&quot;&gt;Ham and Eggs&lt;/a&gt; is now &lt;em&gt;the&lt;/em&gt; blog for my company &lt;a href=&quot;http://javanto.com&quot;&gt;Javanto&lt;/a&gt;. On the same move I took it off from Wordpress and deployed it on &lt;a href=&quot;http://github.com/pages&quot;&gt;GitHub pages&lt;/a&gt; which I happen to use for hosting my company&#39;s site.&lt;/p&gt;

&lt;p&gt;With GitHub pages you can use &lt;a href=&quot;https://github.com/mojombo/jekyll&quot;&gt;Jekyll&lt;/a&gt; for generating static pages from &lt;a href=&quot;http://daringfireball.net/projects/markdown/&quot;&gt;Markdown&lt;/a&gt; templates. The dynamism of a blog comes the by doing git pushes to the project. With Jekyll you can use &lt;a href=&quot;https://github.com/Shopify/liquid/wiki/Liquid-for-Designers&quot;&gt;Liquid&lt;/a&gt; for doing some trivial representation logic. And for syntax highlighting there are &lt;a href=&quot;http://pygments.org/&quot;&gt;Pygments&lt;/a&gt;. The problem still is commenting, but it can be solved by using &lt;a href=&quot;http://www.livefyre.com/&quot;&gt;Livefyre&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That&#39;s my stack for the blogging side. Also I transferred most of the writings but transferring comments is yet to come.&lt;/p&gt;

&lt;p&gt;Welcome and enjoy!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>HTML, CSS and Web Design Rant</title>
		<link href="http://javanto.com/blog/2011/01/19/html-css-and-web-design-rant/" />
		<id>http://javanto.com/blog/2011/01/19/html-css-and-web-design-rant</id>
		<updated>2011-01-19T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I don&#39;t know if these are widely accepted, but the following practices in HTML and CSS, or web design in general are pissing me off.&lt;/p&gt;

&lt;p&gt;Using font thickness as a hover effect. Not using this should be quite obvious but still I keep seeing it. Jumpy layouts suck, mmkay?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;br /&amp;gt;&lt;/code&gt; all over the place. It&#39;s okay when formatting text (poems or such), but do not use it for creating empty space in layout, that&#39;s what CSS is for!&lt;/p&gt;

&lt;p&gt;CSS &lt;code&gt;padding&lt;/code&gt; makes me crazy. It&#39;s probably one of the easiest ways to get yourself totally lost in how and why some element you&#39;ve set to occupy 100% of the width, takes some extra space. There&#39;s nothing you can do with it then.&lt;/p&gt;

&lt;p&gt;Probably the most horrible naming I&#39;ve seen has been on CSS classes. Naming them &lt;code&gt;red&lt;/code&gt;, &lt;code&gt;floatRight&lt;/code&gt;, &lt;code&gt;witdh100&lt;/code&gt; etc. is reusable, but utterly retarded if you think about it for a while. Separating the layout from the content is the purpose of CSS, now when you&#39;ve got an element with &lt;code&gt;class=&quot;red floatRight&quot;&lt;/code&gt; it&#39;s no different from &lt;code&gt;color=&quot;red&quot; float=&quot;right&quot;&lt;/code&gt;. You should not use the elements visual properties in class naming! Common properties that tend to become parts of the class name are darkness variations ie. if in a list every other row has to have a different shade of gray, then try not to name the classes as &lt;code&gt;some-list-row-dark&lt;/code&gt; and &lt;code&gt;some-list-row-light&lt;/code&gt;, but instead use the rows&#39; non-visual properties, like odd and even.&lt;/p&gt;

&lt;p&gt;Go ahead and post your biggest annoyances in HTML and CSS implementations!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Running Sinatra on Ruby 1.9.2 Stack at Heroku</title>
		<link href="http://javanto.com/blog/2010/10/20/running-sinatra-on-ruby-1-9-2-stack-at-heroku/" />
		<id>http://javanto.com/blog/2010/10/20/running-sinatra-on-ruby-1-9-2-stack-at-heroku</id>
		<updated>2010-10-20T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;As my dear &lt;a href=&quot;http://twitter.com/hleinone&quot;&gt;Twitter&lt;/a&gt; followers may know, I&#39;ve got a pet project called HashFresh (among others). Originally written in &lt;a href=&quot;http://code.google.com/appengine/docs/python/overview.html&quot;&gt;Python for Google App Engine&lt;/a&gt;, I decided to port it to &lt;a href=&quot;http://www.sinatrarb.com/&quot;&gt;Sinatra&lt;/a&gt; and host it on &lt;a href=&quot;http://heroku.com/&quot;&gt;Heroku&lt;/a&gt;. This post documents the challenges I faced as a Ruby newbie during the work I expected to be pretty trivial.&lt;/p&gt;

&lt;p&gt;First of all, installing the latest Ruby version on Ubuntu. &lt;a href=&quot;http://www.ruby-lang.org/en/news/2010/08/18/ruby-1-9-2-is-released/&quot;&gt;Currently the latest release is 1.9.2&lt;/a&gt; and after reading from &lt;a href=&quot;http://docs.heroku.com/rails3&quot;&gt;Heroku documentation that 1.9.1 has a bug making Rails 3 unusable&lt;/a&gt;, I decided - just to be safe - to go with the newest one. Boom! Lucid Lynx repositories&#39; default Ruby version is 1.8.7 and Ruby 1.9.1 is provided as package named ruby1.9.1. Thankfully the Maverick Meerkat repository was already up and running and it contained Ruby 1.9.2 in the ruby1.9.1 package, oddly enough. Since I was not planning to go back to 1.8 and all the executables were named like ruby1.9.1, I created symbolic links from ruby, gem, rake etc. to ruby1.9.1, gem1.9.1, rake1.9.1 etc.&lt;/p&gt;

&lt;p&gt;After that I had to install the gems my project required; sinatra, heroku, haml and maruku. That being done, I noticed I wasn&#39;t able to use them since they weren&#39;t on the $PATH, so up to editing &lt;code&gt;~/.profile&lt;/code&gt; and adding to the end:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;/var/lib/gems/1.9.1/bin:$PATH&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Sidenote&lt;/strong&gt;: If you want to skip most of the former, use &lt;a href=&quot;http://rvm.beginrescueend.com/&quot;&gt;RVM&lt;/a&gt;. It requires you to edit &lt;code&gt;~/.bashrc&lt;/code&gt; if you&#39;re on Ubuntu as described on &lt;a href=&quot;http://rvm.beginrescueend.com/rvm/install/&quot;&gt;the installation instructions&lt;/a&gt;, but I think it&#39;s definitely worth it. And it allows me to run multiple Ruby environments like &lt;a href=&quot;http://www.jruby.org/&quot;&gt;JRuby&lt;/a&gt;, which is my next take.&lt;/p&gt;

&lt;p&gt;All that Linux stuff now done, I could start the porting work which went all fine until I used &lt;a href=&quot;http://ruby-doc.org/core/classes/String.html#M000803&quot;&gt;String#split&lt;/a&gt;. While working locally, it didn&#39;t work on Heroku. Running &lt;code&gt;heroku stack&lt;/code&gt; showed me why, I was still using Ruby 1.8.7 as the production environment. But that shouldn&#39;t be a problem at all since Heroku supports also 1.9.2 stack.&lt;/p&gt;

&lt;p&gt;But still, something has changed somewhere between the stacks. On 1.9.2 &lt;code&gt;&quot;foo&quot;.split&lt;/code&gt; results &lt;code&gt;[&quot;foo&quot;]&lt;/code&gt; in the HTML whereas on 1.8.7 it results &lt;code&gt;&quot;foo&quot;&lt;/code&gt;. At least it is not the String API that has changed, because on both stack versions return &lt;code&gt;[&quot;foo&quot;]&lt;/code&gt; on &lt;code&gt;heroku console &#39;&quot;foo&quot;.split&#39;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So, running &lt;code&gt;heroku stack:migrate bamboo-mri-1.9.2&lt;/code&gt; was all I need to do for switching to 1.9.2, I thought. The truth is, it wasn&#39;t. The application crashed during startup and &lt;code&gt;heroku logs&lt;/code&gt; didn&#39;t quite explain why. The error message was:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-irb&quot; data-lang=&quot;irb&quot;&gt;&lt;span class=&quot;go&quot;&gt;&amp;lt;internal:lib/rubygems/custom_require&amp;gt;:29:in `require&amp;#39;: no such file to load -- hashfresh (LoadError)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;        from &amp;lt;internal:lib/rubygems/custom_require&amp;gt;:29:in `require&amp;#39;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;        from config.ru:1:in `block (3 levels) in &amp;lt;main&amp;gt;&amp;#39;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;        ...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-----&amp;gt; Your application is requiring a file that it can&amp;#39;t find.&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;       Most often this is due to missing gems, or it could be that you failed&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;       to commit the file to your repo.  See http://docs.heroku.com/gems for&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;       more information on managing gems.&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;       Examine the backtrace above this message to debug.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I did as it told me and examined the trace, but I couldn&#39;t figure out why it couldn&#39;t find the &lt;code&gt;hashfresh.rb&lt;/code&gt; file, which clearly was in the root directory. &lt;code&gt;config.ru&lt;/code&gt; stating &lt;code&gt;require &#39;hashfresh&#39;&lt;/code&gt;, as &lt;a href=&quot;http://blog.heroku.com/archives/2009/3/5/32_deploy_merb_sinatra_or_any_rack_app_to_heroku/&quot;&gt;instructed in the Heroku docs&lt;/a&gt;. After a Heroku support request and a &lt;a href=&quot;http://stackoverflow.com/questions/3973806/heroku-app-fails-to-start-require-no-such-file-to-load-sinatratestapp-lo&quot;&gt;Stack Overflow question&lt;/a&gt;, I found the answer. Between Ruby 1.9.1 and 1.9.2 they&#39;ve changed the $LOAD_PATH not to include &lt;code&gt;.&lt;/code&gt; directory automatically, so I had to state &lt;code&gt;require &#39;./hashfresh&#39;&lt;/code&gt; instead.&lt;/p&gt;

&lt;p&gt;All&#39;s well that ends well. Programming with Sinatra on a simple project like this is very pleasing.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>GAE + Eclipse + Maven - Update for Helios</title>
		<link href="http://javanto.com/blog/2010/07/25/gae-eclipse-maven-update-for-helios/" />
		<id>http://javanto.com/blog/2010/07/25/gae-eclipse-maven-update-for-helios</id>
		<updated>2010-07-25T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;&lt;strong&gt;Help me in making the integration of GAE, Eclipse and Maven smoother and &lt;a href=&quot;http://code.google.com/p/googleappengine/issues/detail?id=5042&quot;&gt;star this issue&lt;/a&gt; in AppEngine&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You may have noticed that &lt;a href=&quot;http://www.eclipse.org/org/press-release/20100623_heliosrelease.php&quot;&gt;Eclipse 3.6 aka Helios is out&lt;/a&gt;. That meant some changes on the m2eclipse plugin, mainly &lt;a href=&quot;https://issues.sonatype.org/browse/MNGECLIPSE-2245&quot;&gt;removal of the external tools Maven builder&lt;/a&gt;, which made &lt;a href=&quot;/blog/2010/01/26/how-to-gae-eclipse-maven/&quot;&gt;the previous GAE + Eclipse + Maven configuration&lt;/a&gt; unusable.&lt;/p&gt;

&lt;p&gt;Sounds horrible? It shouldn&#39;t, since I&#39;ve fixed the archetype and the &lt;a href=&quot;http://beardedgeeks.googlecode.com/svn/gae-eclipse-maven-example/trunk/&quot;&gt;example project&lt;/a&gt; to be compatible with Helios. To create a new project just run:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeGroupId&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;org.beardedgeeks &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeArtifactId&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;gae-eclipse-maven-archetype &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeVersion&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1.3.2 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeRepository&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;http://beardedgeeks.googlecode.com/svn/repository/releases&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;If you already have a project and want to upgrade to Helios, change the contents of the content tag in the MavenBuilder to:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;![CDATA[&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;launchConfiguration type=&amp;quot;org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType&amp;quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;stringAttribute key=&amp;quot;org.eclipse.debug.core.ATTR_REFRESH_SCOPE&amp;quot; value=&amp;quot;$${project}&amp;quot;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;booleanAttribute key=&amp;quot;org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND&amp;quot; value=&amp;quot;false&amp;quot;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;stringAttribute key=&amp;quot;org.eclipse.ui.externaltools.ATTR_LOCATION&amp;quot; value=&amp;quot;${maven.home}/bin/${maven.executable}&amp;quot;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;stringAttribute key=&amp;quot;org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS&amp;quot; value=&amp;quot;full,incremental,auto,&amp;quot;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;stringAttribute key=&amp;quot;org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS&amp;quot; value=&amp;quot;war:exploded&amp;quot;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;booleanAttribute key=&amp;quot;org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;stringAttribute key=&amp;quot;org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY&amp;quot; value=&amp;quot;${basedir}&amp;quot;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;/launchConfiguration&amp;gt;]]&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And set up a the &lt;code&gt;maven.executable&lt;/code&gt; property. By default it&#39;s &lt;code&gt;mvn&lt;/code&gt; and I created a build profile for Windows environments that sets it to &lt;code&gt;mvn.bat&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;With the new 1.3 version the linked war folder is no longer required. Even with an existing project I&#39;d suggest you to check out the new configuration from the example. If you&#39;re facing problems (or just want to praise me), go ahead and comment!&lt;/p&gt;

&lt;p&gt;Update: Version 1.3.1 now has proper support for Windows!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>HOW-TO: GAE + Eclipse + Maven</title>
		<link href="http://javanto.com/blog/2010/01/26/how-to-gae-eclipse-maven/" />
		<id>http://javanto.com/blog/2010/01/26/how-to-gae-eclipse-maven</id>
		<updated>2010-01-26T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;&lt;strong&gt;Help me in making the integration of GAE, Eclipse and Maven smoother and &lt;a href=&quot;http://code.google.com/p/googleappengine/issues/detail?id=5042&quot;&gt;star this issue&lt;/a&gt; in AppEngine&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update: This solution doesn&#39;t work on Eclipse 3.6 Helios and newest version of m2eclipse, check out &lt;a href=&quot;/blog/2010/01/26/how-to-gae-eclipse-maven&quot;&gt;the new solution&lt;/a&gt; if you&#39;re on the newer version.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Nowadays everybody wants to manage their Java projects with &lt;a href=&quot;http://maven.apache.org/&quot;&gt;Maven&lt;/a&gt;. And that&#39;s totally sensible since Maven makes some things pretty damn easy, mostly because there&#39;s a plugin for about everything. Yes, there is a &lt;a href=&quot;http://www.kindleit.net/maven_gae_plugin/index.html&quot;&gt;plugin&lt;/a&gt; for &lt;a href=&quot;http://code.google.com/appengine/&quot;&gt;Google App Engine&lt;/a&gt; (GAE) too, with which you can run the local development server and deploy your app. The same features are available on the &lt;a href=&quot;http://code.google.com/eclipse/&quot;&gt;Google Plugin for Eclipse&lt;/a&gt;, which is the Google preferred way to develop Java-based App Engine applications. So of course you&#39;d like to also utilize the IDE integration, especially when the startup time of the local GAE development server is significally faster, thus increasing your productivity. So far, the problem has been, how to enjoy the benefits of both worlds, and I&#39;ve have to tell you, it is now solved. Another thing I have to tell you is, how, so here we go.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Requirements&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://code.google.com/appengine/downloads.html#Google_App_Engine_SDK_for_Java&quot;&gt;Google App Engine SDK for Java 1.3.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.eclipse.org/downloads/&quot;&gt;Eclipse == 3.5 (with Java Development Tools)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://maven.apache.org/download.html&quot;&gt;Maven &gt;= 2.0.9&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dl.google.com/eclipse/plugin/3.5&quot;&gt;Google Plugin for Eclipse (link to the update site)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://m2eclipse.sonatype.org/sites/m2e&quot;&gt;m2eclipse (link to the update site)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The integration isn&#39;t compatible with m2eclipse, but it&#39;s required for attaching the Maven &lt;code&gt;war:exploded&lt;/code&gt; goal to Eclipse compilation. Also the integration is not perfectly production ready since it has to rely on a snapshot version of &lt;a href=&quot;http://maven.apache.org/plugins/maven-eclipse-plugin/&quot;&gt;maven-eclipse-plugin&lt;/a&gt; hosted at &lt;a href=&quot;http://beardedgeeks.googlecode.com/svn/repository/releases/&quot;&gt;Bearded Geeks&#39; Maven repository&lt;/a&gt;. It&#39;s required for linkedResource configuration and using the Eclipse Java Compiler. For more details see plugin&#39;s issue tracker for &lt;a href=&quot;http://jira.codehaus.org/browse/MECLIPSE-402&quot;&gt;linkedResources&lt;/a&gt; and &lt;a href=&quot;http://jira.codehaus.org/browse/MECLIPSE-422&quot;&gt;output classes&lt;/a&gt; (Voting on the issues and by other means trying to get the patches in will be highly appreciated).&lt;/p&gt;

&lt;p&gt;So, I&#39;ve converted the &lt;a href=&quot;http://code.google.com/appengine/docs/java/gettingstarted/&quot;&gt;Guestbook Example&lt;/a&gt; into a Maven managed one and I&#39;m distributing it as a &lt;a href=&quot;http://maven.apache.org/guides/introduction/introduction-to-archetypes.html&quot;&gt;Maven archetype&lt;/a&gt;. So, here&#39;s how you begin:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeGroupId&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;org.beardedgeeks &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeArtifactId&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;gae-eclipse-maven-archetype &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeVersion&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1.1.2 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -DarchetypeRepository&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;http://beardedgeeks.googlecode.com/svn/repository/releases&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;By running that command you can create a Maven managed GAE app of your own. Just remember to change everything to match your application, like appId etc. To enable Eclipse integration run &lt;code&gt;mvn eclipse:eclipse&lt;/code&gt;. After that you&#39;ll need to import the project to Eclipse and after that and few project refreshs you should be fine (don&#39;t mind it giving warnings about some missing libraries, they shouldn&#39;t affect). Just run it as you usually run App Engine projects in Eclipse. Also on every Eclipse startup the Eclipse might put its GAE libraries back to &lt;code&gt;war/WEB-INF/lib&lt;/code&gt; which&#39;ll cause failure on startup, but cleaning the project solves the problem. You can also run your project using maven-gae-plugin by typing &lt;code&gt;mvn gae:run&lt;/code&gt; on command line or deploy to App Engine by typing &lt;code&gt;mvn gae:deploy&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you&#39;re not that into archetypes, you can find the project sources through SVN at &lt;a href=&quot;http://code.google.com/p/beardedgeeks/source/browse/#svn/gae-eclipse-maven-example&quot;&gt;Bearded Geeks&#39; Google Code project&lt;/a&gt;. The guestbook example can be found up and running at the &lt;a href=&quot;http://gae-eclipse-maven-example.appspot.com/&quot;&gt;project&#39;s GAE page&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>My Jump into the Modern SCMs</title>
		<link href="http://javanto.com/blog/2009/12/25/my-jump-into-the-modern-scms/" />
		<id>http://javanto.com/blog/2009/12/25/my-jump-into-the-modern-scms</id>
		<updated>2009-12-25T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I&#39;ve been a somewhat faithful user of SVN since I started programming some 7 years back. It&#39;s better than CVS (which I&#39;ve used for some time) or - I don&#39;t even know what kind of perverted - methods people used to use before that. It has worked relatively well in my very own projects and inadequately in the company space. I think the case is quite similar for many projects, the switch from CVS to SVN is now being followed with another switch.&lt;/p&gt;

&lt;p&gt;In the last few years I&#39;ve heard rumors about the next-generation SCMs like Mercurial, Git and Bazaar. I&#39;ve heard huge open source projects moving out from SVN to one of those. As far as I understand, they&#39;re all based on similar approach: You clone the whole repository to your computer as a local repository, make your commits to the local repository and then push the changes back to the distributed one. Then the changes from the distributed repository are pulled to other people&#39;s local repositories and so should you do with the changes they have made.&lt;/p&gt;

&lt;p&gt;For a while I&#39;ve thought that the next-generation has already become current and I should really get back on track with the revision control. Few weeks ago a perfect moment appeared when I begun an open source pet project with a good friend of mine. We decided to use some modern technology for sharing the sources with each other. So we went on with Google Code which meant Mercurial.&lt;/p&gt;

&lt;p&gt;First thing I want to know when introducing a new programming-related practice is its integration with the practices I already use. Read: I want IDE integration. And I also want to reserve the ability to change IDE and it still works. Of course I want to run it on multiple platforms, at least Windows and Linux. I want the ability to change from Eclipse + Windows to Netbeans + Linux or any combination of these, also as IntelliJ IDEA is being open sourced why not expect support for it too. I have to admit that that&#39;s a bit tough requirement for any system, but coming from Java world that&#39;s kind of a default expectation.&lt;/p&gt;

&lt;p&gt;Mercurial works nicely out-of-the-box on Netbeans, probably because they use it a lot internally at Sun, for example on &lt;a href=&quot;http://hub.opensolaris.org/bin/view/Community+Group+tools/dcm_evaluation_mercurial&quot;&gt;OpenSolaris&lt;/a&gt;. The Eclipse support is really impressive nowadays, the &lt;a href=&quot;http://javaforge.com/project/HGE&quot;&gt;HgEclipse&lt;/a&gt; is reaching the standards set by Subversive and Subclipse.&lt;/p&gt;

&lt;p&gt;The things are completely the opposite on Git, &lt;a href=&quot;http://www.eclipse.org/egit/&quot;&gt;the Eclipse plugin&lt;/a&gt; is quite good - despite being still in incubation - and integrates well with the Team features. &lt;a href=&quot;http://nbgit.org/&quot;&gt;The Netbeans integration&lt;/a&gt; is not even able to push to the origin, which makes it mostly unusable.&lt;/p&gt;

&lt;p&gt;As a conclusion, my expectations have after all been reached, and I expect to see bigger change in the near future, when the integration level raises on top of that of SVN which might be the reason restricting wider adoption in the enterprise. I don&#39;t know if there will be a single winner in the end. It seems that Mercurial and Git are quite even on features and adaption and Bazaar is not much behind. Mercurial is definitely ahead on IDE integration. If there will be a single winner, as a Finn, I have to hope &lt;a href=&quot;http://en.wikipedia.org/wiki/Linus_Torvalds&quot;&gt;my countryman&lt;/a&gt;&#39;s product Git to be victorious. (For the serious readers, former is intended to be a joke, I&#39;m really not patriotic at all, though Linus is a nice guy) I want to wish a merry Christmas to all my few readers!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Creating A Simple Maven Plugin</title>
		<link href="http://javanto.com/blog/2009/08/30/creating-a-simple-maven-plugin/" />
		<id>http://javanto.com/blog/2009/08/30/creating-a-simple-maven-plugin</id>
		<updated>2009-08-30T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I&#39;ve been a big admirer of &lt;a href=&quot;http://maven.apache.org&quot;&gt;Maven&lt;/a&gt; for a long time. For some reason I have never made a plugin of my own. Today I did it, and I have to say it was a great learning experience. I will introduce all the neat things I figured out during the development. So let the story begin.&lt;/p&gt;

&lt;p&gt;At work there was some need for a plugin that could help us with merging the propreties files. After trying to find a ready made solution it was quite clear that doing it in-house would be a very low priority since the result is already accomplished using Ant. But as the task being quite interesting, straightforward and nicely small, in addition to the fact of me being on a sick leave, I decided to do it on my own and release it under Apache v2 license. The requirement for the plugin was to have environment/user-specific properties files and merge them with some default ones, so that the more specific file&#39;s properties override the ones from the default. The resulting properties files are then mainly used in &lt;a href=&quot;http://www.springsource.org&quot;&gt;Spring&lt;/a&gt; configurations. The fact of this being implemented with Ant has been the main issue preventing us from switching completely to Maven.&lt;/p&gt;

&lt;p&gt;While getting my hands dirty with the code I noticed that all Maven plugins are basically MOJOs (Maven plain Old Java Object). So it was a MOJO that I was after! I created one which I gave the name MergePropertiesMojo. Like all the other MOJOs, it extends the AbstractMojo class which gives access to some project attributes, but for this case I didn&#39;t need any. I was just required to implement the &lt;code&gt;execute()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;In addition to the plain coding I had to figure out how the plugin would be used. After employing the little gray brain cells for a while my conclusion was that: first-of-all the user must configure the plugin by setting up the properties files to be merged, which consist of a target file and a bunch of files to merge. A good example tells more than thousand words:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;configuration&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;merges&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;merge&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;targetFile&amp;gt;&lt;/span&gt;${build.outputDirectory}/application.properties&lt;span class=&quot;nt&quot;&gt;&amp;lt;/targetFile&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;propertiesFiles&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;propertiesFile&amp;gt;&lt;/span&gt;src/main/config/${user.name}/application.properties&lt;span class=&quot;nt&quot;&gt;&amp;lt;/propertiesFile&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;propertiesFile&amp;gt;&lt;/span&gt;src/main/config/default/application.properties&lt;span class=&quot;nt&quot;&gt;&amp;lt;/propertiesFile&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;/propertiesFiles&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/merge&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/merges&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This is the plugin configutation. In this case we have a default properties file which we want to merge with the user&#39;s own properties file. In some other case we could replace ${user.name} with something else. Note that the order of the propertiesFile elements matters since the properties from the file above override the ones from the files below it on the listing. As a result we get an application.properties file with the merged properties to appear in the output directory. As you might have noticed it uses src/main/config as the directory for storing the different properties files. It isn&#39;t that clear (at least for me) what&#39;s the directory for but it suits for this case quite well.&lt;/p&gt;

&lt;p&gt;In Maven plugins the user can set up the execution phase in which the plugin executes. So that, if we want the merging to occur on every time the project is compiled we can do it. Here&#39;s a proof:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;executions&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;execution&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;phase&amp;gt;&lt;/span&gt;compile&lt;span class=&quot;nt&quot;&gt;&amp;lt;/phase&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;goals&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;goal&amp;gt;&lt;/span&gt;merge&lt;span class=&quot;nt&quot;&gt;&amp;lt;/goal&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/goals&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/execution&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/executions&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This makes the merge occur automatically on each compilation. Different executions can also have different configurations, just by putting the configuration element under the execution. We could then merge some files on compilation and others on package for example. The whole execution thing is not mandatory, since the plugin can also be run manually using mvn merge-properties:merge, but it usually makes things easier as learning new goals and remembering to run them is not required.&lt;/p&gt;

&lt;p&gt;Back to the configuration. The merges and merge elements specify that in my MOJO, there&#39;s an array called merges which in my case is of type Merge. Merge is a simple POJO (Plain Old Java Object) that contains the fields targetFile of type File and an array of Files called propertiesFiles. There are some special &lt;a href=&quot;http://maven.apache.org/developers/mojo-api-specification.html&quot;&gt;Maven Javadoc annotations&lt;/a&gt; for both the class and the fields that are required for instance in injection of the configuration values to corresponding fields.&lt;/p&gt;

&lt;p&gt;On the class I used &lt;code&gt;@goal merge&lt;/code&gt; which specifies the name of the plugin goal to start execution (merge in this case) and &lt;code&gt;@requiresProject&lt;/code&gt; which specifies that the plugin is required to be run inside of a project. For the fields I used &lt;code&gt;@description&lt;/code&gt; and &lt;code&gt;@required&lt;/code&gt; which I think are quite self descriptive and &lt;code&gt;@parameter&lt;/code&gt; which specifies the field being Maven injected. The &lt;code&gt;@parameter&lt;/code&gt; also allows us to set a default value or command-line parameter to use instead of configuration, but I didn&#39;t use those. More details on these can be found on the &lt;a href=&quot;http://maven.apache.org/developers/mojo-api-specification.html&quot;&gt;Maven MOJO API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After setting up these, the whole thing was all about implementing the execute() method. Since it&#39;s relatively trivial Java code, it&#39;s not relevant to go through it here. As code without a test doesn&#39;t exist, I made unit test for my MOJO. Using &lt;a href=&quot;http://easymock.org&quot;&gt;EasyMock&lt;/a&gt; and its class extension in addition to &lt;a href=&quot;http://code.google.com/p/powermock&quot;&gt;PowerMock&lt;/a&gt; I was able to test the functionality. Also let&#39;s not go into further detail with that since it&#39;s completely off-topic and the Internet is full of great tutorials regarding that. You can always take a look at my implementation details on &lt;a href=&quot;http://code.google.com/p/beardedgeeks/source/browse/#svn/maven-merge-properties-plugin/trunk&quot;&gt;SVN&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Basically the job was now done, all there was left was the project administration. I chose &lt;a href=&quot;http://code.google.com&quot;&gt;Google Code&lt;/a&gt; as the project hosting platform and SVN as the version control system. I&#39;ve setup these to the plugin&#39;s POM. The nicest thing I found out was that I can use the SVN repository as a Maven repository and even deploy to there using the deploy plugin. How to do that is described in &lt;a href=&quot;https://wagon-svn.dev.java.net&quot;&gt;here&lt;/a&gt;. Now I&#39;m off to making the first release of my plugin. I hope you find the plugin useful, or even better this article useful!&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://code.google.com/p/beardedgeeks&quot;&gt;The home of maven-merge-properties-plugin at Google Code&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Eclipse 3.5 Galileo and Classic Update</title>
		<link href="http://javanto.com/blog/2009/07/13/eclipse-35-galileo-and-classic-update/" />
		<id>http://javanto.com/blog/2009/07/13/eclipse-35-galileo-and-classic-update</id>
		<updated>2009-07-13T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;This is an update of my older &lt;a href=&quot;/blog/2009/01/20/eclipse-34-ganymede-and-classic-update&quot;&gt;post&lt;/a&gt;. Some update sites like the Galileo Discovery Site or Eclipse Project Updates doen&#39;t seem to be compatible with the classic update due to them being solely P2 repositories. I keep getting: &quot;Network connection problems encountered during search&quot; when trying to get the plugin list from any those. Otherwise it seems to work well. Getting some of the Eclipse default plugins from other repositories was bit of a pain-in-the-ass, but after some manual labor the plugins started installing nicely.&lt;/p&gt;

&lt;p&gt;Eclipse plugins are extremely cool, but the way they&#39;re being configured in Galileo (Eclipse 3.5) seems unsuitable for my needs and makes transferring the configuration to another environment difficult. The &quot;new new&quot; software update doesn&#39;t allow you to specify different install locations for different plugins, which is the case I&#39;m after. Galileo - like Ganymede - also includes the &quot;Classic Update&quot;, but in most of the installations it&#39;s not available. In Classic version you can enable it from &lt;strong&gt;Window&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Preferences&lt;/strong&gt; -&amp;gt; &lt;strong&gt;General&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Capabilities&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In reality, enabling that manually is quite simple, just browse to &lt;code&gt;WORKSPACE/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs&lt;/code&gt; and add a new line containing:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;UIActivities.org.eclipse.equinox.p2.ui.sdk.classicUpdate=true
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That&#39;s it, now you have both the new and classic updates available.&lt;/p&gt;

&lt;p&gt;I use the classic update for installing plugins to a directory other than &lt;code&gt;eclipse/plugins&lt;/code&gt;. I&#39;ve been installing for example JDT to &lt;code&gt;eclipse/extensions/jdt&lt;/code&gt; folder. The advantage from this is that when a new plugin breaks your whole installation, removing it is a lot easier. Also transferring the installation to another computer or a different Eclipse version should relatively easy.&lt;/p&gt;

&lt;p&gt;Due to more and more plugin repositories supporting only P2, the classic update will become quite unusable in the future, so enjoy while you still can!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Flex Builder and Maven - Simple SWC Project</title>
		<link href="http://javanto.com/blog/2009/03/22/flex-builder-and-maven-simple-swc-project/" />
		<id>http://javanto.com/blog/2009/03/22/flex-builder-and-maven-simple-swc-project</id>
		<updated>2009-03-22T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I&#39;ve fallen in love with &lt;a href=&quot;http://maven.apache.org/&quot;&gt;Maven&lt;/a&gt;, which is a powerful tool for project (in sense of the environment in the computer) handling.&lt;/p&gt;

&lt;p&gt;I&#39;m doing lots of Flex stuff and Maven - though designed for Java environment - works for that too. Using Maven in a Flex project requires a Maven plugin capable of compiling the AS3/Flex sources to a SWF or SWC. While Adobe has rejected the idea of releasing &lt;a href=&quot;http://bugs.adobe.com/jira/browse/SDK-12730&quot;&gt;official Maven support plugin&lt;/a&gt; they recommend using the most actively developed and probably the best one of the available alternatives, &lt;a href=&quot;https://docs.sonatype.org/display/FLEXMOJOS/Home&quot;&gt;Flex-Mojos&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;From this on I assume that you know the basics of the &lt;a href=&quot;http://maven.apache.org/guides/introduction/introduction-to-the-pom.html&quot;&gt;Maven POM&lt;/a&gt;. In this part I&#39;ll describe how to use Maven and Flex-Mojos to create a Flex Builder Flex library project. Since Flex-Mojos is under heavy development so we&#39;re using 3.1-SNAPSHOT version of it, so some of the mentioned things might be outdated or fixed soon (as of March 22th 2009 they aren&#39;t). In addition we&#39;re using Flex 3.3.0.&lt;/p&gt;

&lt;p&gt;Since Maven projects are based on the POM, a Flex project requires some modifications there. First of all, we need to change the packaging to SWC:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;packaging&amp;gt;&lt;/span&gt;swc&lt;span class=&quot;nt&quot;&gt;&amp;lt;/packaging&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Apart from that we need the dependency to the Flex framework. That is found in the Sonatype public repository:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;repositories&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;repository&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;id&amp;gt;&lt;/span&gt;sonatype-flex&lt;span class=&quot;nt&quot;&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;url&amp;gt;&lt;/span&gt;http://repository.sonatype.org/service/local/repositories/flex/content&lt;span class=&quot;nt&quot;&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/repository&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/repositories&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;dependencies&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;com.adobe.flex.framework&lt;span class=&quot;nt&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;flex-framework&lt;span class=&quot;nt&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;3.3.0.4852&lt;span class=&quot;nt&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;type&amp;gt;&lt;/span&gt;pom&lt;span class=&quot;nt&quot;&gt;&amp;lt;/type&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/dependencies&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The last thing we need is the Flex-Mojos plugin which does all the hard work. It&#39;s also found in the Sonatype repository:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;pluginRepositories&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;pluginRepository&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;id&amp;gt;&lt;/span&gt;sonatype-flexmojos-snapshots&lt;span class=&quot;nt&quot;&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;url&amp;gt;&lt;/span&gt;http://repository.sonatype.org/service/local/repositories/flexmojos-snapshots/content&lt;span class=&quot;nt&quot;&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/pluginRepository&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/pluginRepositories&amp;gt;&lt;/span&gt;

    &lt;span class=&quot;nt&quot;&gt;&amp;lt;build&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;sourceDirectory&amp;gt;&lt;/span&gt;src/main/flex&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sourceDirectory&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;outputDirectory&amp;gt;&lt;/span&gt;target&lt;span class=&quot;nt&quot;&gt;&amp;lt;/outputDirectory&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;plugins&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;plugin&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.sonatype.flexmojos&lt;span class=&quot;nt&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;flexmojos-maven-plugin&lt;span class=&quot;nt&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;3.1-SNAPSHOT&lt;span class=&quot;nt&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;extensions&amp;gt;&lt;/span&gt;true&lt;span class=&quot;nt&quot;&gt;&amp;lt;/extensions&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;configuration&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;includeClasses&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;class&amp;gt;&lt;/span&gt;com.googlecode.phlecks.example.Foo&lt;span class=&quot;nt&quot;&gt;&amp;lt;/class&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/includeClasses&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;includeFiles&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;param&amp;gt;&lt;/span&gt;foo.png&lt;span class=&quot;nt&quot;&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/includeFiles&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;enableM2e&amp;gt;&lt;/span&gt;false&lt;span class=&quot;nt&quot;&gt;&amp;lt;/enableM2e&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/plugins&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/build&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Above we first specify the source folder which is src/main/flex instead of src/main/java. In includeClasses we specify the classes to be included in the library. Similarly we specify the other assets to be included in includeFiles. Also we specify that we&#39;re not using the m2eclipse Eclipse plugin, in case you use that, feel free to set this to true.&lt;/p&gt;

&lt;p&gt;Now we&#39;ve got a POM for our Flex library project, the next thing is to generate the Flex Builder project files with the plugin. So we type:
&lt;code&gt;mvn flexmojos:flexbuilder&lt;/code&gt;
And as the result our project becomes a Flex library project also in Flex Builder after refreshing. If take a look at the project&#39;s properties and Flex library build path we see that in the classes tab src/main/flex is specified as the main source folder. In library path we notice that most of the Flex framework libraries are load from the local repository.&lt;/p&gt;

&lt;p&gt;Also we notice that the current Flex-Mojos snapshot doesn&#39;t yet implement adding the includeClasses or includeFiles to the library, the output folder is still bin-debug and in the source path tab src/main/flex is also added as an additional source folder outside the main source folder.  These are smallish issues in the snapshot version, I&#39;ve supplied the Flex-Mojos team a patch which fixes these.&lt;/p&gt;

&lt;p&gt;So, now we&#39;ve got a mavenized Flex library project that compiles in Flex Builder in the same way it would do if it was a Flex Builder created project. We can also compile it using Maven command:
&lt;code&gt;mvn package&lt;/code&gt;
Which creates the SWC file, which is almost the same as the one created by Flex Builder. I think we&#39;re done by now, &lt;a href=&quot;http://code.google.com/p/phlecks/source/browse/#svn/flex-library-example/trunk&quot;&gt;here&lt;/a&gt;&#39;s the link for a sample project configured this way.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Airfield application in Scala</title>
		<link href="http://javanto.com/blog/2009/01/22/airfield-application-in-scala/" />
		<id>http://javanto.com/blog/2009/01/22/airfield-application-in-scala</id>
		<updated>2009-01-22T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Last summer I went to a &lt;a href=&quot;http://www.scala-lang.org/&quot;&gt;Scala&lt;/a&gt; &lt;a href=&quot;http://www.cs.helsinki.fi/u/pohjalai/ke08/scala/&quot;&gt;course&lt;/a&gt; at my University. There was this exercise to implement a &lt;a href=&quot;http://en.wikipedia.org/wiki/Travelling_salesman_problem&quot;&gt;travelling-salesman-like&lt;/a&gt; application with all the airfields of Finland. The idea was to input a list of airfields to the program as a file and then count the shortest route between those airfields without visiting the same airfield twice in a row.&lt;/p&gt;

&lt;p&gt;I just decided to open-source it under &lt;a href=&quot;http://www.opensource.org/licenses/mit-license.php&quot;&gt;MIT License&lt;/a&gt;. The project is hosted at &lt;a href=&quot;http://code.google.com/p/airfield/&quot;&gt;Google Code&lt;/a&gt; and the direct download link is &lt;a href=&quot;http://airfield.googlecode.com/files/airfield-1.0.jar&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As a learning experience it was my first step into &lt;a href=&quot;http://en.wikipedia.org/wiki/Functional_programming&quot;&gt;functional programming&lt;/a&gt; and trying to create an example of a nice and clean open-source project. Feel free to comment and make suggestions how to make it more functional. As said it was my first case with functional and being used to &lt;a href=&quot;http://en.wikipedia.org/wiki/Object-oriented_programming&quot;&gt;OOP&lt;/a&gt; it was difficult to see situations where functional would be more effective. I&#39;d be extremely glad to hear your comments!&lt;/p&gt;

&lt;p&gt;Documentation and usage instructions are in the project&#39;s &lt;a href=&quot;http://code.google.com/p/airfield/w/list&quot;&gt;wiki&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Eclipse 3.4 Ganymede and Classic Update</title>
		<link href="http://javanto.com/blog/2009/01/20/eclipse-34-ganymede-and-classic-update/" />
		<id>http://javanto.com/blog/2009/01/20/eclipse-34-ganymede-and-classic-update</id>
		<updated>2009-01-20T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Eclipse plugins are extremely cool, but the way they&#39;re being configured in Ganymede (Eclipse 3.4) is awful and makes transferring your configuration to another environment almost impossible. The new software update doesn&#39;t allow you to specify different install locations for the plugins. Ganymede also includes the &quot;Classic Update&quot;, but in most of the installations it&#39;s not available. Some have reported that in the &lt;a href=&quot;http://www.eclipse.org/downloads/packages/&quot;&gt;Eclipse Classic&lt;/a&gt; it can be set through &lt;strong&gt;Window&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Preferences&lt;/strong&gt; -&amp;gt; &lt;strong&gt;General&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Capabilities&lt;/strong&gt;. If that is not your case, please follow, cause I&#39;ll explain to you how to enable the classic update.&lt;/p&gt;

&lt;p&gt;In reality that is quite simple, just browse to &lt;code&gt;WORKSPACE/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs&lt;/code&gt; and add a new line containing:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;UIActivities.org.eclipse.equinox.p2.ui.sdk.classicUpdate=true
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That&#39;s it, now you have both the new and classic updates available.&lt;/p&gt;

&lt;p&gt;I use the classic update for installing plugins to a directory other than &lt;code&gt;eclipse/plugins&lt;/code&gt;. I&#39;ve been installing for example JDT to &lt;code&gt;eclipse/3rdp/jdt&lt;/code&gt; folder. The advantage from this is that when a new plugin breaks your whole installation, removing it is a bit easier. Also transferring the installation to another computer or a different Eclipse version should be easier.&lt;/p&gt;

&lt;p&gt;Hope you find this useful!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Setting up Magento Community Shipping Module</title>
		<link href="http://javanto.com/blog/2009/01/04/setting-up-magento-community-shipping-module/" />
		<id>http://javanto.com/blog/2009/01/04/setting-up-magento-community-shipping-module</id>
		<updated>2009-01-04T00:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I&#39;ve been trying to create a shipping module of my own to &lt;a href=&quot;http://www.magentocommerce.com/&quot;&gt;Magento&lt;/a&gt; webstore. I was familiar with PHP but the Zend framework was (and still is) new to me. Being too lazy to read any documentation (in case of Magento it rarely exists or is outdated) or search the forums, I took the trial and error perspective and some example modules.&lt;/p&gt;

&lt;p&gt;The forthcoming examples are heavily based on &lt;a href=&quot;http://www.collinsharper.com/&quot;&gt;CollinsHarper&lt;/a&gt;&#39;s &lt;a href=&quot;http://www.magentocommerce.com/extension/606/store-pickup-shipping-module&quot;&gt;Store Pickup Shipping Module&lt;/a&gt; and verified to work with Magento 1.1.8. Practically it&#39;s just the same module as  a community module. In case of anyone from CollinsHarper reading, as your module is licenced as &lt;a href=&quot;http://en.wikipedia.org/wiki/Beerware&quot;&gt;beerware&lt;/a&gt;, I hereby state that if you ever visit Helsinki I&#39;ll definitely buy you a beer.&lt;/p&gt;

&lt;p&gt;The Store Pickup Shipping Module consists of four files.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Use app/etc/modules/module name.xml&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app/etc/modules/StorePickup_Shipping.xml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;config&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;modules&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use module name_Shipping --&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;StorePickup_Shipping&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;active&amp;gt;&lt;/span&gt;true&lt;span class=&quot;nt&quot;&gt;&amp;lt;/active&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;codePool&amp;gt;&lt;/span&gt;community&lt;span class=&quot;nt&quot;&gt;&amp;lt;/codePool&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use module name_Shipping --&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/StorePickup_Shipping&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/modules&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/config&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Use app/code/community/module name/Shipping/etc/config.xml&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app/code/community/StorePickup/Shipping/etc/config.xml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;config&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;default&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;carriers&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use group alias --&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;storepickupmodule&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;active&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/active&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use method name --&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;allowed_methods&amp;gt;&lt;/span&gt;pickup&lt;span class=&quot;nt&quot;&gt;&amp;lt;/allowed_methods&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use method name --&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;methods&amp;gt;&lt;/span&gt;pickup&lt;span class=&quot;nt&quot;&gt;&amp;lt;/methods&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;sallowspecific&amp;gt;&lt;/span&gt;0&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sallowspecific&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use module name_Shipping_Model_Carrier_class name --&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;model&amp;gt;&lt;/span&gt;StorePickup_Shipping_Model_Carrier_StorePickup&lt;span class=&quot;nt&quot;&gt;&amp;lt;/model&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;name&amp;gt;&lt;/span&gt;Store Pickup&lt;span class=&quot;nt&quot;&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Store Pickup&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;specificerrmsg&amp;gt;&lt;/span&gt;
                    This shipping method is currently unavailable.
                    If you would like to ship using this shipping
                    method, please contact us.
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;/specificerrmsg&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;handling_type&amp;gt;&lt;/span&gt;F&lt;span class=&quot;nt&quot;&gt;&amp;lt;/handling_type&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use group alias --&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;/storepickupmodule&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/carriers&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/default&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;modules&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- declare module&amp;#39;s version information --&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use module name_Shipping --&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;StorePickup_Shipping&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- this version number will be used for database upgrades --&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;0.1.0&lt;span class=&quot;nt&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use module name_Shipping --&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/StorePickup_Shipping&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/modules&amp;gt;&lt;/span&gt;

    &lt;span class=&quot;nt&quot;&gt;&amp;lt;global&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- declare model group for new module --&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;models&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- model group alias to be used in Mage::getModel() --&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use group alias --&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;storepickupmodule&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- base class name for the model group --&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use module name_Shipping_Model --&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;class&amp;gt;&lt;/span&gt;StorePickup_Shipping_Model&lt;span class=&quot;nt&quot;&gt;&amp;lt;/class&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use group alias --&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;/storepickupmodule&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/models&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- declare resource setup for new module --&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;resources&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- resource identifier --&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use group alias_setup --&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;storepickupmodule_setup&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- specify that this resource is a setup resource and used for upgrades --&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;setup&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- which module to look for install/upgrade files in --&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use module name_Shipping_Model --&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;module&amp;gt;&lt;/span&gt;StorePickup_Shipping&lt;span class=&quot;nt&quot;&gt;&amp;lt;/module&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;/setup&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- specify database connection for this resource --&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;connection&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- do not create new connection, use predefined core setup connection --&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;use&amp;gt;&lt;/span&gt;core_setup&lt;span class=&quot;nt&quot;&gt;&amp;lt;/use&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;/connection&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use group alias_setup --&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;/storepickupmodule_setup&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/resources&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/global&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/config&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Use app/code/community/module name/Shipping/etc/system.xml&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app/code/community/StorePickup/Shipping/etc/system.xml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;config&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;sections&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;carriers&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;groups&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use group alias --&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;storepickupmodule&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;translate=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;label&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;module=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;shipping&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Store Pickup&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_type&amp;gt;&lt;/span&gt;text&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_type&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&amp;gt;&lt;/span&gt;13&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_default&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_default&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_website&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_website&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_store&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_store&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;fields&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;active&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;translate=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;label&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Enabled&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_type&amp;gt;&lt;/span&gt;select&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_type&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;source_model&amp;gt;&lt;/span&gt;adminhtml/system_config_source_yesno&lt;span class=&quot;nt&quot;&gt;&amp;lt;/source_model&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_default&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_default&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_website&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_website&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_store&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_store&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/active&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;translate=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;label&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Sort order&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_type&amp;gt;&lt;/span&gt;text&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_type&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&amp;gt;&lt;/span&gt;100&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_default&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_default&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_website&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_website&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_store&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_store&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;translate=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;label&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Title&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_type&amp;gt;&lt;/span&gt;text&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_type&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&amp;gt;&lt;/span&gt;2&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_default&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_default&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_website&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_website&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_store&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_store&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;methodtitle&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;translate=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;label&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Method Title&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_type&amp;gt;&lt;/span&gt;text&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_type&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&amp;gt;&lt;/span&gt;2&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_default&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_default&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_website&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_website&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_store&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_store&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/methodtitle&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;handling&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;translate=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;label&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Handling fee&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_type&amp;gt;&lt;/span&gt;text&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_type&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&amp;gt;&lt;/span&gt;12&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_default&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_default&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_website&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_website&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_store&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_store&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/handling&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;handling_type&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;translate=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;label&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Calculate Handling Fee&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_type&amp;gt;&lt;/span&gt;select&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_type&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;source_model&amp;gt;&lt;/span&gt;shipping/source_handlingType&lt;span class=&quot;nt&quot;&gt;&amp;lt;/source_model&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&amp;gt;&lt;/span&gt;10&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_default&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_default&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_website&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_website&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_store&amp;gt;&lt;/span&gt;0&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_store&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/handling_type&amp;gt;&lt;/span&gt;

                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;sallowspecific&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;translate=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;label&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Ship to applicable countries&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_type&amp;gt;&lt;/span&gt;select&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_type&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&amp;gt;&lt;/span&gt;90&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_class&amp;gt;&lt;/span&gt;shipping-applicable-country&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_class&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;source_model&amp;gt;&lt;/span&gt;adminhtml/system_config_source_shipping_allspecificcountries&lt;span class=&quot;nt&quot;&gt;&amp;lt;/source_model&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_default&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_default&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_website&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_website&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_store&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_store&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/sallowspecific&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;specificcountry&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;translate=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;label&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Ship to Specific countries&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_type&amp;gt;&lt;/span&gt;multiselect&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_type&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&amp;gt;&lt;/span&gt;91&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;source_model&amp;gt;&lt;/span&gt;adminhtml/system_config_source_country&lt;span class=&quot;nt&quot;&gt;&amp;lt;/source_model&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_default&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_default&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_website&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_website&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_store&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_store&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/specificcountry&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;specificerrmsg&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;translate=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;label&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Displayed Error Message&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;frontend_type&amp;gt;&lt;/span&gt;textarea&lt;span class=&quot;nt&quot;&gt;&amp;lt;/frontend_type&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;sort_order&amp;gt;&lt;/span&gt;80&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sort_order&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_default&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_default&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_website&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_website&amp;gt;&lt;/span&gt;
                            &lt;span class=&quot;nt&quot;&gt;&amp;lt;show_in_store&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/show_in_store&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/specificerrmsg&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/fields&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Use group alias --&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;/storepickupmodule&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;/groups&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/carriers&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/sections&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/config&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Use app/code/community/module name/Shipping/Model/Carrier/class name.php&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app/code/community/StorePickup/Shipping/Model/Carrier/StorePickup.php&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;cm&quot;&gt;/*&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;* use at your own risk!&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;* This is totally beerware, they wouldn&amp;#39;t let me select that on the Mag. Connect site. But I&amp;#39;m still standing by it!&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;*/&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;/* Use module name_Shipping_Model_Carrier_class name */&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StorePickup_Shipping_Model_Carrier_StorePickup&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Mage_Shipping_Model_Carrier_Abstract&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;cm&quot;&gt;/* Use group alias */&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_code&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;storepickupmodule&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;collectRates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Mage_Shipping_Model_Rate_Request&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// skip if not enabled&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Mage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getStoreConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;carriers/&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_code&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/active&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Mage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;shipping/rate_result&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$handling&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Mage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getStoreConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;carriers/&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_code&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/handling&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$handling&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Mage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getStoreConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;carriers/&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_code&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/handling&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Mage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getStoreConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;carriers/&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_code&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/handling_type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;P&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;amp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;amp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;amp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;amp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getPackageValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$handling&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getPackageValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$handling&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;nv&quot;&gt;$method&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Mage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;shipping/rate_result_method&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCarrier&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCarrierTitle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Mage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getStoreConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;carriers/&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_code&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/title&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;cm&quot;&gt;/* Use method name */&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;pickup&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setMethodTitle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Mage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getStoreConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;carriers/&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_code&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/methodtitle&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCost&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$handling&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setPrice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$handling&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// it doesnt do anything if there was an error just returns blank - maybe there should be a default shipping incase of problem? or email sysadmin?&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The biggest problems I faced with the naming conventions, so incase you&#39;re interested in creating a shipping module of your own, note these.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;module name (StorePickup)&lt;/li&gt;
&lt;li&gt;class name (StorePickup)&lt;/li&gt;
&lt;li&gt;group alias (storepickupmodule)&lt;/li&gt;
&lt;li&gt;method name (pickup)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I have marked all occurences of these as comments on the files. These occur also in the file paths. Replace all these with the ones from your module if you wish.&lt;/p&gt;
</content>
	</entry>
	
</feed>
