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

<channel>
	<title>Dev Discoveries</title>
	<atom:link href="http://devdiscoveries.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://devdiscoveries.wordpress.com</link>
	<description>discoveries of a developer</description>
	<lastBuildDate>Thu, 12 Jan 2012 05:29:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='devdiscoveries.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Dev Discoveries</title>
		<link>http://devdiscoveries.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://devdiscoveries.wordpress.com/osd.xml" title="Dev Discoveries" />
	<atom:link rel='hub' href='http://devdiscoveries.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Up to 100%?</title>
		<link>http://devdiscoveries.wordpress.com/2012/01/11/up-to-100/</link>
		<comments>http://devdiscoveries.wordpress.com/2012/01/11/up-to-100/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 21:00:28 +0000</pubDate>
		<dc:creator>devdiscoveries</dc:creator>
				<category><![CDATA[Software development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">https://devdiscoveries.wordpress.com/?p=101</guid>
		<description><![CDATA[Where in software development are we striving to 100%? Among others, unit test code coverage. We have all learned that unit tests are a good thing and that you cannot have enough of them. When your system has a production issue, people will tell you that it could have been prevented by writing a unit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=101&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:left;">Where in software development are we striving to 100%? Among others, unit test code coverage. We have all learned that unit tests are a good thing and that you cannot have enough of them. When your system has a production issue, people will tell you that it could have been prevented by writing a unit test for that specific scenario. But how far do you need to go in writing unit tests? A recent training of James Coplien about Lean Architecture got me thinking about this subject and I want to share a few considerations with you. Tell me what you think in the comments.</p>
<p style="text-align:left;">Now, I would certainly not advise you to not do unit testing, but to me it seems that there is a trade-off. Let’s look at an example. What about domain objects? When they are dumb (no business logic), it seems that there is little need to test all the getters and setters right? (Actually, these getters and setters are mostly waste as well and luckily there are programming languages in which this is a bit more transparent. Maybe I will write another post on encapsulation at some point&#8230;)</p>
<p style="text-align:left;">Well, then surely we unit test the view layer? Technically you can, but mostly it is a lot of work, because you have to mock around your view framework. A lot of things cannot easily be tested at all, like jsps for example. It seems that using Selenium or other automated test tools can do this far more efficiently. I have seen that the view layer generally has the lowest unit test coverage of all.</p>
<p style="text-align:left;">Now the only thing that is really left over is business logic. And there unit tests show their real value. It is easy to mock around all business logic you are not testing at that moment, because that dependent logic will likely just deliver a domain object for you.</p>
<p style="text-align:left;">Furthermore, business logic can have a lot of assumptions, and you must test what happens when these are not met. These unit tests are simple, relatively easy to maintain. The mock plumbing is likely manageable.</p>
<p style="text-align:left;">So what are unit tests? They are used to test small units of your code, to test for bugs. Well let’s just test the relevant parts of an application and not waste time. View layers and integration with other systems are likely better tested with integration tests or automated functional tests (like Selenium).</p>
<p style="text-align:left;">Now I want to ask you, what would my unit test code coverage be when applying the above? 30 percent? 50 percent maybe? I think for business logic it is good to have 100%. Regarding the rest, the effortt might be wasted! But then again, if everybody says these tests are needed, but I cannot see a lot of value in most of them, am I then missing something?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devdiscoveries.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devdiscoveries.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devdiscoveries.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devdiscoveries.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devdiscoveries.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devdiscoveries.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devdiscoveries.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devdiscoveries.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devdiscoveries.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devdiscoveries.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devdiscoveries.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devdiscoveries.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devdiscoveries.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devdiscoveries.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=101&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devdiscoveries.wordpress.com/2012/01/11/up-to-100/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a8596bb7cd94fa786ea5822ed087108c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdiscoveries</media:title>
		</media:content>
	</item>
		<item>
		<title>How to achieve mobile presence for your company?</title>
		<link>http://devdiscoveries.wordpress.com/2011/01/17/how-to-achieve-mobile-presence-for-your-company/</link>
		<comments>http://devdiscoveries.wordpress.com/2011/01/17/how-to-achieve-mobile-presence-for-your-company/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 06:40:16 +0000</pubDate>
		<dc:creator>devdiscoveries</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[strategy]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">https://devdiscoveries.wordpress.com/2011/01/17/how-to-achieve-mobile-presence-for-your-company/</guid>
		<description><![CDATA[Recently, I had the need to address this issue for some people. Therefore I am writing my thoughts on this subject in a blog post, so I can refer people to it. The increase of mobile devices and services makes a lot of companies and organizations wonder if they should just not be in the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=100&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to address this issue for some people. Therefore I am writing my thoughts on this subject in a blog post, so I can refer people to it.</p>
<p>The increase of mobile devices and services makes a lot of companies and organizations wonder if they should just not be in the mobile space as well. Of course, I cannot decide if this is necessary for a company or not, but I do happen to have some ideas on how one can achieve a mobile presence for his company.</p>
<p>Nowadays you might jump up and say: “I know that: write an app!”. Now wait a minute here. There are still a lot of people around who do not have a smartphone. But you can still serve those people as well.</p>
<p>Plain old SMS might serve your goals very well. Let people submit data to you by sending an SMS to a certain number. Let them be notified with an SMS about important events. Let them request information by sending an SMS to you. Everybody with a mobile phone, how old it might be, can use these kind of services.</p>
<p>If you have rich content to share with your customers, you might want to consider a mobile website, to complement your desktop website. With a well-designed mobile website, you avoid being bound to a certain mobile platform (like Apple, Android, Blackberry). With a well-designed mobile website, you might just be able to serve your customers with everything they need.</p>
<p>The best user experience is actually achieved with native applications. These can take full advantages of the hardware capabilities and are designed specifically to the platform they run on, therefore providing premium look and feel.</p>
<p>A sort of in-between is a multi platform app solution, like PhoneGap. You will be able to use a lot of the hardware functions and generally achieve a better user interface (compared to a mobile website). Although real native applications look better, this can be a cheaper alternative.</p>
<p>Now that I have presented you a few ways to mobilize your business, which of them are you going to choose? One aspect is always money. If there is no money, there is no way you are going to get what you want. But there is also the aspect of maintenance of the chosen solution.</p>
<p>Native applications are very expensive to develop and to maintain. And when you have paid all the costs you only have an app on one platform (say iPhone). If you want to cover Android as well, you need to develop the app again with a different technology.<br />
There is a way to avoid some of the costs; you can use multi platform solutions like PhoneGap. There you develop the app only once and you will be able to deploy to multiple devices.</p>
<p>A mobile website is a lot cheaper. It runs on every browser (provided that you account for the major browser versions, but that is quite doable).</p>
<p>A multi platform app or a website is cheaper, however a native app looks better and you will have support for all the hardware functions. You will have to balance the costs versus the features.</p>
<p>Keep in mind that when you have an app, you also need to maintain it. There will always be new versions of the operating systems of the iPhone, Android, Blackberry etc. and you must make sure that your app does not break in these newer versions. You must also make sure that there is a support channel for the users (support email address and special web page) where people can come to with questions about the app. Especially for a small company this can be a burden. A mobile website is then easier to maintain and support.</p>
<p>I hope you found this discussion useful and I wish you good luck implementing your own mobile strategy.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devdiscoveries.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devdiscoveries.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devdiscoveries.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devdiscoveries.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devdiscoveries.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devdiscoveries.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devdiscoveries.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devdiscoveries.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devdiscoveries.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devdiscoveries.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devdiscoveries.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devdiscoveries.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devdiscoveries.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devdiscoveries.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=100&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devdiscoveries.wordpress.com/2011/01/17/how-to-achieve-mobile-presence-for-your-company/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a8596bb7cd94fa786ea5822ed087108c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdiscoveries</media:title>
		</media:content>
	</item>
		<item>
		<title>Have your own UITabBar background</title>
		<link>http://devdiscoveries.wordpress.com/2010/05/31/have-your-own-uitabbar-background/</link>
		<comments>http://devdiscoveries.wordpress.com/2010/05/31/have-your-own-uitabbar-background/#comments</comments>
		<pubDate>Mon, 31 May 2010 20:06:19 +0000</pubDate>
		<dc:creator>devdiscoveries</dc:creator>
				<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[tab bar]]></category>
		<category><![CDATA[UITabBar]]></category>

		<guid isPermaLink="false">http://devdiscoveries.wordpress.com/?p=82</guid>
		<description><![CDATA[A short post with a code snippet that allows you to use your own background in a tab bar on the iPhone. You can basically subclass the UITabBar and override the drawRect: method. I hope this will help some of you.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=82&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A short post with a code snippet that allows you to use your own background in a tab bar on the iPhone. You can basically subclass the UITabBar and override the drawRect: method. I hope this will help some of you. </p>
<p><pre class="brush: objc;">
#import &lt;Foundation/Foundation.h&gt;

@interface YourTabBar : UITabBar {
}
@end



#import &quot;YourTabBar.h&quot;

@implementation YourTabBar

- (void)drawRect:(CGRect)rect
{
	[super drawRect:rect];
	UIImage *image = [UIImage imageNamed:@&quot;tabbar-background.png&quot;];
	[image drawInRect:rect];
}
@end
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devdiscoveries.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devdiscoveries.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devdiscoveries.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devdiscoveries.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devdiscoveries.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devdiscoveries.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devdiscoveries.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devdiscoveries.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devdiscoveries.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devdiscoveries.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devdiscoveries.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devdiscoveries.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devdiscoveries.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devdiscoveries.wordpress.com/82/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=82&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devdiscoveries.wordpress.com/2010/05/31/have-your-own-uitabbar-background/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a8596bb7cd94fa786ea5822ed087108c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdiscoveries</media:title>
		</media:content>
	</item>
		<item>
		<title>Android &#8211; Use background task</title>
		<link>http://devdiscoveries.wordpress.com/2010/03/19/android-use-background-task/</link>
		<comments>http://devdiscoveries.wordpress.com/2010/03/19/android-use-background-task/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 08:18:42 +0000</pubDate>
		<dc:creator>devdiscoveries</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[background task]]></category>
		<category><![CDATA[blocking UI]]></category>

		<guid isPermaLink="false">http://devdiscoveries.wordpress.com/?p=74</guid>
		<description><![CDATA[For the user it is very important to keep a responsive user interface. Therefore it is wise to defer heavy tasks to a background thread and not to execute them in the main thread. The main thread does the handling of UI input (like touches) and the updating of the screen with data. In this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=74&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For the user it is very important to keep a responsive user interface. Therefore it is wise to defer heavy tasks to a background thread and not to execute them in the main thread. The main thread does the handling of UI input (like touches) and the updating of the screen with data.<br />
In this post I will show a short code fragment that will defer a task to a background thread. It will also show how you can display the results on your screen.<br />
<pre class="brush: java;">
package ....

import android.os.Handler;
import ...

public class MyActivity extends Activity {

// The android.os.Handler can be used to execute tasks 
// in the thread where it has been initialized. 
private Handler handler;

[...]

public boolean onOptionsItemSelected(MenuItem item) {
	switch(item.getItemId()) {
	case 1:
		doHeavyTask();
		return true;
	} 
	return false;
}

/** {@inheritDoc} */
@Override
public void onCreate(Bundle savedInstanceState) {
...
// Create a new Handler that is being associated to the 
// main thread.
handler = new Handler();
...
}

private void doHeavyTask() {
	// Show a progress bar
	findViewById(R.id.Waiter).setVisibility(View.VISIBLE);
	new Thread(new Runnable() {
		public void run() {
			// Do heavy calculation
			[...]
			
			// Use the handler to execute a Runnable on the 
			// main thread in order to have access to the 
			// UI elements. 
			handler.postDelayed(new Runnable() {
				public void run() {
					// Update UI
					((TextView)findViewById(R.id.text))
						.setText(&quot;calculation finished&quot;);
					// Hide the progress bar
					findViewById(R.id.Waiter)
						.setVisibility(View.INVISIBLE);
				}
			}, 0);
		}
	}).start();
}

}
</pre></p>
<p>This Activity contains a progress bar (rotating spinner) and some text field. The text needs to be updated when a heavy calculation has been finished. The UI will still be responsive. A rotating spinner is also shown and hidden again after the calculation finished.<br />
The postDelayed() method on the Handler ensures that you can do another task on the thread where the Handler has been initialized. This can be used to post results of your calculation back to the main thread. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devdiscoveries.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devdiscoveries.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devdiscoveries.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devdiscoveries.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devdiscoveries.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devdiscoveries.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devdiscoveries.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devdiscoveries.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devdiscoveries.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devdiscoveries.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devdiscoveries.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devdiscoveries.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devdiscoveries.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devdiscoveries.wordpress.com/74/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=74&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devdiscoveries.wordpress.com/2010/03/19/android-use-background-task/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a8596bb7cd94fa786ea5822ed087108c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdiscoveries</media:title>
		</media:content>
	</item>
		<item>
		<title>Mobile platforms and their differences</title>
		<link>http://devdiscoveries.wordpress.com/2010/03/16/mobile-platforms-and-how-they-are-used/</link>
		<comments>http://devdiscoveries.wordpress.com/2010/03/16/mobile-platforms-and-how-they-are-used/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 22:13:26 +0000</pubDate>
		<dc:creator>devdiscoveries</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://devdiscoveries.wordpress.com/2010/03/16/mobile-platforms-and-how-they-are-used/</guid>
		<description><![CDATA[While developing and working with multiple mobile devices, I had some thoughts on the different mobile platforms and their differences. I can only really talk about iPhone and Android, since I currently have only hands on experience with those two devices. So, is there any fundamental difference between iPhone and Android? Maybe at first glance [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=66&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>While developing and working with multiple mobile devices, I had some thoughts on the different mobile platforms and their differences. I can only really talk about iPhone and Android, since I currently have only hands on experience with those two  devices. </p>
<p>So, is there any fundamental difference between iPhone and Android? Maybe at first glance not really. Both platforms offer communication services (phone, sms, email), internet and a market or app store, where users can find applications they need. </p>
<p>However, when looking more closely, one may conclude that the iPhone is really a Swiss army knife. A device loaded with utilities that help you online or offline with multiple tasks. For example, I manage my agenda, email and twitter with it. But I also grab it to use the calculator, I have a metronome on it, a unit converter, games, ebooks, all my relevant music, etc. Occasionally I even watch a movie with it. I must admit that the iPod touch I own really has become an almost indispensable thing in my life. </p>
<p>But what about the Android? I have also used an Android for a while. To me, Android does not provide me with such an extensive toolbox. The Android market has only a fraction of the number of apps available in Apple’s App Store. But, something the Android aims at (in my opinion) is Information. The disclosure of information (preferably from online sources) is to me the main focus of the Android platform. It shows off from the home screen right away with the search box. This search box will not only do a Google search, it will also connect with all apps on the device that support this to fetch information about the keywords. </p>
<p>So, Android is about information. The iPhone does not have such an integrated search option. The iPhone however provides a lot of utilities to the user to help him with his daily life. Here I spot a basic difference in the two platforms, which I think is worthwhile to consider when you plan to buy a smartphone. </p>
<p>How does this compare to the other platforms available? Unfortunately I do not have hands on experience with them. However, I still think I can say something about them. </p>
<p>Blackberry is a platform that seems to be targeted to business people. It is all about managing agendas, mail, etc. It is not so much meant to access a lot of information or to provide a lot of tools to the user. </p>
<p>The new Windows Phone is primarily targeted to social media, at least I think I can infer that from the media event in January. Sure there is Bing, there is the XBox live connection, but the home screen shows primarily your friends, how you can contact them, what their statuses are on the different social media platforms. The XBox live feature seems to be more about your avatar and connections with other players online. </p>
<p>To summarize (while probably doing a lot of injustice to the platforms):<br />
iPhone:                   Swiss army knife<br />
Android:                 Find me information about everything<br />
Blackberry:             Manage my business<br />
Windows Phone:     Keep in touch with my contacts</p>
<p>I think it is very wise that, if someone wants to expose some services or utilities or games or whatever via the mobile platforms, he should be aware of the differences between the platforms. Because the differences I have highlighted here, will be reflected in how users use their phones. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devdiscoveries.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devdiscoveries.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devdiscoveries.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devdiscoveries.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devdiscoveries.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devdiscoveries.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devdiscoveries.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devdiscoveries.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devdiscoveries.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devdiscoveries.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devdiscoveries.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devdiscoveries.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devdiscoveries.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devdiscoveries.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=66&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devdiscoveries.wordpress.com/2010/03/16/mobile-platforms-and-how-they-are-used/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a8596bb7cd94fa786ea5822ed087108c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdiscoveries</media:title>
		</media:content>
	</item>
		<item>
		<title>iPad &#8211; the next big thing?</title>
		<link>http://devdiscoveries.wordpress.com/2010/02/04/ipad/</link>
		<comments>http://devdiscoveries.wordpress.com/2010/02/04/ipad/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 13:55:02 +0000</pubDate>
		<dc:creator>devdiscoveries</dc:creator>
				<category><![CDATA[iPad]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[apple]]></category>

		<guid isPermaLink="false">http://devdiscoveries.wordpress.com/?p=57</guid>
		<description><![CDATA[A lot has been said and written about the iPad since it has been officially launched. Some people are disappointed, some are highly enthousiastic. What can we make from it? In the days after the anouncement of Steve Jobs I have read a lot about the iPad and what it is supposed to mean. Now [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=57&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A lot has been said and written about the iPad since it has been officially launched. Some people are disappointed, some are highly enthousiastic. What can we make from it? In the days after the anouncement of Steve Jobs I have read a lot about the iPad and what it is supposed to mean. Now I would like to ahare some of my thoughts with you.</p>
<p>I must admit that I am quite a fan of the products that are made by Apple. So I was quite excited when the event finally arrived. Steve&#8217;s presentation completely blew me away at that moment. </p>
<p>Next morning I started to think everything over and I actually realized what the iPad did not have. It has been mentioned quite a bit on the web: no flash, no multitasking, closed system, etc. At that point I grew disappointed with the device as well. Is this everything? Could Apple not do more than this?</p>
<p>But let us see if everything really iz that bad. All these so-called missing &#8216;open doors&#8217;, are they really important? After all, the hype had risen to enormous heights. People were making the wildest guesses. Let me review a few of the complaints.</p>
<p>A very serious problem in the minds of people is the lack of multitasking. People think they are severely hampered in their productivity when they are.not able to grab something from the web or to listen to some music while they Are working on some document, presentation or something else. However, I would like to question the necessity for this. Most of the time while you are working with some application, I would argue that you need only a few secondary apps. Probably the browser, a music player, and maybe a dictionary, but most of your needs would be covered. </p>
<p>Well, even the iPhone allows you already to listen to your music library while doing something else. And how many windows are you planning to put next to each other on a 10 inch screen? In.my opinion it is all about how quickly can you change between apps. Now, just like the iPhone, thw iPad has a dock where you can put your most used secondary apps in. You can switch apps by pressing the home button and the app icon when you go back to your main app, you do the same thing. One button and one touch, that does not sound more invasive than the use of option-tab on your mac.<br />
However, this will only work when apps launch fast and when they will bring you back right where you left of. If these two conditions are not met, this will not work. This leaves a responsibility on developers to preserve those two conditions. </p>
<p>I wonder if the closed retail system of Apple is a real problem either. After all, there are so many apps out there, that are immediately useable on the iPad that there is not much need for an open system. People can just download what they need, and what&#8217;s more, apps downloaded on their iPhones don&#8217;t need to be bought again. &#8216;Techies&#8217; might complain that they cannot do with the device what they like, but all other people will probably not care. And one might add that the iPad will probably undergo jailbreaks as well. </p>
<p>A few other issues are not so convenient for the end user, as the lack of flash (how buggy or detestable it may be to some people, it is still much used) or the difficulty in sharing files with other devices. Still, for browsing, light office work, quick email, reading, watching movies on the go, digital photo frame, etc. it is a useful device. I think Apple might indeed fill a gap in a lot of households. The inconveniences might be fixed in later releases as well. </p>
<p>And what will the future bring? The first iPhone version was not very well received either and &#8216;could never work&#8217;. The same counts for the App Store. Still, nowadays both are highly successful and will keep being successful for the coming time. Who knows where the iPad may evolve to&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devdiscoveries.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devdiscoveries.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devdiscoveries.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devdiscoveries.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devdiscoveries.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devdiscoveries.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devdiscoveries.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devdiscoveries.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devdiscoveries.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devdiscoveries.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devdiscoveries.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devdiscoveries.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devdiscoveries.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devdiscoveries.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=57&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devdiscoveries.wordpress.com/2010/02/04/ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a8596bb7cd94fa786ea5822ed087108c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdiscoveries</media:title>
		</media:content>
	</item>
		<item>
		<title>Android &#8211; Use location services</title>
		<link>http://devdiscoveries.wordpress.com/2010/02/04/android-use-location-services/</link>
		<comments>http://devdiscoveries.wordpress.com/2010/02/04/android-use-location-services/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 13:26:47 +0000</pubDate>
		<dc:creator>devdiscoveries</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[location]]></category>
		<category><![CDATA[network]]></category>

		<guid isPermaLink="false">http://devdiscoveries.wordpress.com/?p=46</guid>
		<description><![CDATA[Since my last post on the Android platform was about calculating the distance between two geolocations, I thought it might be usefull to discuss how you can actually get your own position on earth with the Location services from the Android platform. The Android platform gets its location data from two sources. I think the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=46&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Since my last post on the Android platform was about calculating the distance between two geolocations, I thought it might be usefull to discuss how you can actually get your own position on earth with the Location services from the Android platform. </p>
<p>The Android platform gets its location data from two sources. I think the best known source is the GPS that is built in the device. It will give you an accuracy up to a few meters under good conditions. However, it can take quite some time for a device to get a GPS fix from the satelites. Therefore it is worthwhile to look at a second source of location input. Android devices can also get their location from the cell towers of the mobile network. This is a very coarse estimate with an accuracy that can be a few hundred meters. However, the result is available almost instantly. </p>
<p>To accomodate for the differences of the two methods, I used a solution as the one shown below. First it will fetch the last known position of the GPS service, to make sure that there will be some location to use. Then it will register two LocationListeners to fetch an updated position fix. </p>
<p>The network (coarse accuracy) will deliver quick results and I will unregister this listener again when the accuracy is smaller than 1000 meters. (By the way, I was displaying distances rounded to 100 meters). Then a second listener will ask for updates from the GPS unit, and will unregister with an accuracy below 50 meters. </p>
<p>In this way I make sure that I get a position fix as quickly as possible, although with low accuracy, whereas in the meanwhile I try to get a better fix by the GPS unit. Even when the device cannot get a GPS fix, I will always be able to at least give a crude estimate on the position of the user. </p>
<p>The (stripped) code follows here.<br />
<pre class="brush: java;">
public class Main extends Activity {

	private LocationManager locationManager;
	private LocationListener listenerCoarse;
	private LocationListener listenerFine;
	
	// Holds the most up to date location. 
	private Location currentLocation;
	
	// Set to false when location services are 
	// unavailable. 
	private boolean locationAvailable = true;

		
	/** {@inheritDoc} */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.main);
		super.onCreate(savedInstanceState);
		registerLocationListeners();
		...
		...
	}

	private void registerLocationListeners() {
		locationManager = (LocationManager) 
			getSystemService(LOCATION_SERVICE);
		
		// Initialize criteria for location providers
		Criteria fine = new Criteria();
		fine.setAccuracy(Criteria.ACCURACY_FINE);
		Criteria coarse = new Criteria();
		coarse.setAccuracy(Criteria.ACCURACY_COARSE);
		
		// Get at least something from the device,
		// could be very inaccurate though
		currentLocation = locationManager.getLastKnownLocation(
			locationManager.getBestProvider(fine, true));
		
		if (listenerFine == null || listenerCoarse == null)
			createLocationListeners();
			
		// Will keep updating about every 500 ms until 
		// accuracy is about 1000 meters to get quick fix.
		locationManager.requestLocationUpdates(
			locationManager.getBestProvider(coarse, true), 
			500, 1000, listenerCoarse);
		// Will keep updating about every 500 ms until 
		// accuracy is about 50 meters to get accurate fix.
		locationManager.requestLocationUpdates(
			locationManager.getBestProvider(fine, true), 
			500, 50, listenerFine);
	}

	/**
	* 	Creates LocationListeners
	*/
	private void createLocationListeners() {
		listenerCoarse = new LocationListener() {
			public void onStatusChanged(String provider, 
				int status, Bundle extras) {
				switch(status) {
				case LocationProvider.OUT_OF_SERVICE:
				case LocationProvider.TEMPORARILY_UNAVAILABLE:
					locationAvailable = false;
					break;
				case LocationProvider.AVAILABLE:
					locationAvailable = true;
				}
			}
			public void onProviderEnabled(String provider) {
			}
			public void onProviderDisabled(String provider) {
			}
			public void onLocationChanged(Location location) {
				currentLocation = location;
				if (location.getAccuracy() &gt; 1000 &amp;&amp; 
					location.hasAccuracy())
					locationManager.removeUpdates(this);
			}
		};
		listenerFine = new LocationListener() {
			public void onStatusChanged(String provider, 
				int status, Bundle extras) {
				switch(status) {
				case LocationProvider.OUT_OF_SERVICE:
				case LocationProvider.TEMPORARILY_UNAVAILABLE:
					locationAvailable = false;
					break;
				case LocationProvider.AVAILABLE:
					locationAvailable = true;
				}
			}
			public void onProviderEnabled(String provider) {
			}
			public void onProviderDisabled(String provider) {
			}
			public void onLocationChanged(Location location) {
				currentLocation = location;
				if (location.getAccuracy() &gt; 1000 
					&amp;&amp; location.hasAccuracy())
					locationManager.removeUpdates(this);
			}
		};
	}
	
	...
	...
    
	/** {@inheritDoc} */
	@Override
	protected void onResume() {
		// Make sure that when the activity has been 
		// suspended to background, 
		// the device starts getting locations again
		registerLocationListeners();
		super.onResume();
	}
	
	...
	...
	    
	@Override
	protected void onPause() {
		// Make sure that when the activity goes to 
		// background, the device stops getting locations
		// to save battery life.
		locationManager.removeUpdates(listenerCoarse);
		locationManager.removeUpdates(listenerFine);
		super.onPause();
	}	
}
</pre></p>
<p>The activity will create and register the necessary listeners. The onPause() method will actually unregister the location listeners again to avoid that the application keeps updating its location, even when moved to the background. This will help saving battery life. On Android, you cannot really close an application (unless you kill it with an app killer application). Therefore you need to stop fetching locations yourself when it is no longer needed. </p>
<p>The onResume() method will start listening again when the activity becomes active again. This will ensure that the user gets an updated location when he has moved in the meantime. Because returning to the home screen on Android means that the application might still be running, the location could be very outdated. Therefore I added this onResume() method. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devdiscoveries.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devdiscoveries.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devdiscoveries.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devdiscoveries.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devdiscoveries.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devdiscoveries.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devdiscoveries.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devdiscoveries.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devdiscoveries.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devdiscoveries.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devdiscoveries.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devdiscoveries.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devdiscoveries.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devdiscoveries.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=46&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devdiscoveries.wordpress.com/2010/02/04/android-use-location-services/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a8596bb7cd94fa786ea5822ed087108c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdiscoveries</media:title>
		</media:content>
	</item>
		<item>
		<title>Android &#8211; Distance between two points on the Earth</title>
		<link>http://devdiscoveries.wordpress.com/2010/02/01/android-distance-between-two-points-on-the-earth/</link>
		<comments>http://devdiscoveries.wordpress.com/2010/02/01/android-distance-between-two-points-on-the-earth/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 11:18:13 +0000</pubDate>
		<dc:creator>devdiscoveries</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[distance]]></category>
		<category><![CDATA[earth]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[sphere]]></category>

		<guid isPermaLink="false">http://devdiscoveries.wordpress.com/?p=28</guid>
		<description><![CDATA[When working with geo data, it is sometimes necessary to calculate the distance between two geolocations on the surface of the Earth. This is also a problem where I came upon and I will therefore describe my findings in this post. Working in this area means that one has to brush of his trigonometry skills. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=28&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When working with geo data, it is sometimes necessary to calculate the distance between two geolocations on the surface of the Earth. This is also a problem where I came upon and I will therefore describe my findings in this post.</p>
<p>Working in this area means that one has to brush of his trigonometry skills. But luckily there are some good resources on the web, that explain the theory perfectly. The formula you need is the haversine formula, which gets its name from the use of the haversine function:<br />
<img src='http://s0.wp.com/latex.php?latex=haversin%28%5CTheta%29+%3D+sin%5E2%28%5CTheta+%2F+2%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='haversin(&#92;Theta) = sin^2(&#92;Theta / 2)' title='haversin(&#92;Theta) = sin^2(&#92;Theta / 2)' class='latex' />.</p>
<p>The haversine formula is:</p>
<p><img src='http://s0.wp.com/latex.php?latex=R+%3D+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='R = ' title='R = ' class='latex' /> earth&#8217;s radius (mean radius = 6367.45 km)</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5CDelta+lat+%3D+lat_2+-+lat_1+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Delta lat = lat_2 - lat_1 ' title='&#92;Delta lat = lat_2 - lat_1 ' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=%5CDelta+long+%3D+long_2+-+long_1+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Delta long = long_2 - long_1 ' title='&#92;Delta long = long_2 - long_1 ' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=a+%3D+sin%5E2%28%5CDelta+lat+%2F+2%29+%2B+cos%28lat_1%29cos%28lat_2%29sin%5E2%28%5CDelta+long+%2F+2%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a = sin^2(&#92;Delta lat / 2) + cos(lat_1)cos(lat_2)sin^2(&#92;Delta long / 2) ' title='a = sin^2(&#92;Delta lat / 2) + cos(lat_1)cos(lat_2)sin^2(&#92;Delta long / 2) ' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=c+%3D+2+atan2%28%5Csqrt%7Ba%7D%2C+%5Csqrt%7B%281-a%29%7D%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='c = 2 atan2(&#92;sqrt{a}, &#92;sqrt{(1-a)}) ' title='c = 2 atan2(&#92;sqrt{a}, &#92;sqrt{(1-a)}) ' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=d+%3D+Rc+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d = Rc ' title='d = Rc ' class='latex' /></p>
<p>Here the distance <img src='http://s0.wp.com/latex.php?latex=d&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d' title='d' class='latex' /> in kilometers will be calculated based on the latitudes and longitudes of the two points on the earth, expressed in radians. To convert from degrees to radians, simply multiply the value in degrees by <img src='http://s0.wp.com/latex.php?latex=%5Cpi+%2F+180&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;pi / 180' title='&#92;pi / 180' class='latex' />. The <img src='http://s0.wp.com/latex.php?latex=atan2%28%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='atan2()' title='atan2()' class='latex' /> function is a function implemented in many computer languages and is a <a title="variation" href="http://en.wikipedia.org/wiki/Atan2" target="_blank">variation</a> on the arctangent function.</p>
<p>The error of this formula in calculating distances is about 0.1% and mostly due to the fact that the Earth is not a perfect sphere (see the resources below for a more in-depth discussion). Also numerical rounding errors can occur, but this is mainly an issue when the two locations are very nearly antipodal (on opposite sites of the Earth), which is generally not something you will use very often.</p>
<p>But enough now of the theoretics, I will show how to put this to a practical use. The code to calculate the distance between two points can be expressed in Java code as:</p>
<p><pre class="brush: java;">
double EARTH_RADIUS = 6367.45;

double latitude;
double longitude;

double lat2;
double lon2;

double deltalat = lat2 - latitude;
double deltalon = lon2 - longitude;

double a = Math.sin(deltalat / 2) * Math.sin(deltalat / 2) + Math.cos(latitude) * Math.cos(lat2) * Math.sin(deltalon / 2) * Math.sin(deltalon / 2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
double distance = EARTH_RADIUS*c;
</pre></p>
<p>One thing you need to make sure, is that the latitude and longitude are expressed in radians (see above).<br />
Put this code into a method and you are done.</p>
<p>This post is based on a few web resources, that will give a bit more information on distance calculations. There is a nice <a title="haversine formula" href="http://en.wikipedia.org/wiki/Haversine_formula" target="_blank">wikipedia</a> article on the Haversine formula. <a title="Great circle distance between 2 points" href="http://www.movable-type.co.uk/scripts/gis-faq-5.1.html" target="_blank">Here</a> and <a title="Calculate distance, bearing and more between 2 points" href="http://www.movable-type.co.uk/scripts/latlong.html" target="_blank">here</a> you can find a bit more information on calculating distances on a sphere. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devdiscoveries.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devdiscoveries.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devdiscoveries.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devdiscoveries.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devdiscoveries.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devdiscoveries.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devdiscoveries.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devdiscoveries.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devdiscoveries.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devdiscoveries.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devdiscoveries.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devdiscoveries.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devdiscoveries.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devdiscoveries.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=28&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devdiscoveries.wordpress.com/2010/02/01/android-distance-between-two-points-on-the-earth/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a8596bb7cd94fa786ea5822ed087108c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdiscoveries</media:title>
		</media:content>
	</item>
		<item>
		<title>Mobile Strategy</title>
		<link>http://devdiscoveries.wordpress.com/2009/12/21/mobile-strategy/</link>
		<comments>http://devdiscoveries.wordpress.com/2009/12/21/mobile-strategy/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 10:59:06 +0000</pubDate>
		<dc:creator>devdiscoveries</dc:creator>
				<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://devdiscoveries.wordpress.com/2009/12/21/mobile-strategy/</guid>
		<description><![CDATA[Nowadays more and more companies try to provide services via mobile media to their customers. One of the questions there is: &#8220;What strategy should we pursue to serve our customers in the best way possible and in the meantime be best prepared for new developments on the mobile platform?More practically, the question quickly becomes a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=23&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Nowadays more and more companies try to provide services via mobile media to their customers. One of the questions there is: &#8220;What strategy should we pursue to serve our customers in the best way possible and in the meantime be best prepared for new developments on the mobile platform?More practically, the question quickly becomes a choice between native apps and portable cross platform solutions. This is the specific question that I would like to discuss a bit.</p>
<p>Native apps are applications that are developed for a specific platform. They will only run on that platform, but will have the possibility to use all the platforms specific functionalities. Let&#8217;s look as an example to the iPhone platform. Apps can be designed and developed specifically for the iPhone. The user experience of these apps is very good. Transitions between pages are smooth and the layout is generally compliant with the Apple standards. However, nothing of the development effort can be reused for other platforms. Apps like these are nowadays generally available via so-called &#8216;App Stores&#8217;, where users can download or buy applications.</p>
<p>Cross platform solutions are solutions that try to mend the reusability problem. Solutions are a mobile website of a solution as widgets (I have <a href="http://devdiscoveries.wordpress.com/2009/12/17/widgets-the-future-of-mobile-apps/" target="_blank">written</a> about those earlier). These solutions will be usable across multiple platforms, without extra or with minimum development effort. Other cross platform solutions try to bridge the two possibilities, by giving the developer a way to design an application and then bundle this for multiple platforms in different applications that can be sold in the respective app stores. The primary example of this is <a href="http://phonegap.com/" target="_blank">PhoneGap</a>.</p>
<p>So, what are the benefits of the native apps over the cross platform solutions and vice versa? Generally speaking, one can say that native apps best utilize the specific functions of the device and integrate natively with the OS. However, to maintain native apps for multiple platforms is quite expensive and laborious. It requires sufficient technical skills on every platform as well. I do development for iPhone and Android, and can therefore say from experience that maintenance of multiple apps can be quite a pain. Especially since one also need to support multiple versions of each platform (like iPhone OS 2.x and 3.x and Android 1.5, 1.6 and 2). It is clear that cross platform solutions are much cheaper and better maintainable (although it is probably still necessary to test on a lot of different devices).</p>
<p>Let us now revisit the question what businesses should do when starting out in the mobile market. I think that for very small companies a cross platform solution is best, since native development is too expensive. However, for larger companies I think that it is best too target one or two major native platforms as well. The users of those devices are used to high quality applications and will not easily accept medium quality apps. Development for one or two widespread platforms (that are, based on current insights, future proof as well) will not be too expensive, since a lot can be done with one or two good developers and will result in best user experience. It is best to chose platforms where users are used to high standards.</p>
<p>On a side note, I have heard some people doubting the future proofness of the App Store, and more specifically of the iPhone. I think that for the coming years Apple will still gain <a href="http://brainstormtech.blogs.fortune.cnn.com/2009/12/16/morgan-stanley-drinks-apple-kool-aid/" target="_blank">more and more market share</a> with the iPhone and thereby with the App Store. I think that iPhone users will not care very much about mobile websites (since mobile Safari is quite good) and also not about widgets (since there are more then 100.000 apps in the store). On the contrary, they are expecting an app for everything in the store. I think it is wise to target the biggest app stores, until the future will tell us more about how the mobile landscape is about to evolve.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devdiscoveries.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devdiscoveries.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devdiscoveries.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devdiscoveries.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devdiscoveries.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devdiscoveries.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devdiscoveries.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devdiscoveries.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devdiscoveries.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devdiscoveries.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devdiscoveries.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devdiscoveries.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devdiscoveries.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devdiscoveries.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=23&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devdiscoveries.wordpress.com/2009/12/21/mobile-strategy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a8596bb7cd94fa786ea5822ed087108c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdiscoveries</media:title>
		</media:content>
	</item>
		<item>
		<title>Android &#8211; How to create a border with rounded edges</title>
		<link>http://devdiscoveries.wordpress.com/2009/12/18/android-how-to-create-a-border-with-rounded-edges/</link>
		<comments>http://devdiscoveries.wordpress.com/2009/12/18/android-how-to-create-a-border-with-rounded-edges/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 12:49:31 +0000</pubDate>
		<dc:creator>devdiscoveries</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[layout]]></category>

		<guid isPermaLink="false">http://devdiscoveries.wordpress.com/?p=17</guid>
		<description><![CDATA[One of the issues during Android development I&#8217;ve run against is that I needed to create a screen surrounded by a border with rounded edges. I will post my solution here. First you will need a background drawable. Create the file screen_background.xml in your drawables directory and put in the following content. Now use this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=17&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the issues during Android development I&#8217;ve run against is that I needed to create a screen surrounded by a border with rounded edges. I will post my solution here.</p>
<p>First you will need a background drawable. Create the file screen_background.xml in your drawables directory and put in the following content.</p>
<p><pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
android:shape=&quot;rectangle&quot; android:padding=&quot;10dp&quot;&gt;
	&lt;solid android:color=&quot;#FFFFFF&quot;/&gt;
    &lt;corners android:bottomRightRadius=&quot;30dp&quot; android:bottomLeftRadius=&quot;30dp&quot;
android:topLeftRadius=&quot;30dp&quot; android:topRightRadius=&quot;30dp&quot;/&gt;
&lt;/shape&gt;
</pre></p>
<p>Now use this background in your layout file. First create a LinearLayout and set the background color to be the color of the border. Then use your newly created background in a subview. Apply paddings to adjust the thickness of the border. Here is a basic example.</p>
<p><pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout android:id=&quot;@+id/LinearLayout01&quot;
	android:layout_width=&quot;fill_parent&quot;
	android:layout_height=&quot;fill_parent&quot;
	android:background=&quot;#0000FF&quot;
	android:padding=&quot;10dp&quot;
	xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
	&lt;RelativeLayout android:id=&quot;@+id/RelativeLayout01&quot;
			android:layout_width=&quot;fill_parent&quot;
			android:layout_height=&quot;fill_parent&quot;
			android:padding=&quot;10dp&quot;
			android:background=&quot;@drawable/screen_background&quot;&gt;
	&lt;/RelativeLayout&gt;
&lt;/LinearLayout&gt;
</pre></p>
<p>This example will result in a white screen with a blue border and rounded edges of the white area. Good luck.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devdiscoveries.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devdiscoveries.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devdiscoveries.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devdiscoveries.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devdiscoveries.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devdiscoveries.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devdiscoveries.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devdiscoveries.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devdiscoveries.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devdiscoveries.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devdiscoveries.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devdiscoveries.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devdiscoveries.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devdiscoveries.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devdiscoveries.wordpress.com&amp;blog=10997391&amp;post=17&amp;subd=devdiscoveries&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devdiscoveries.wordpress.com/2009/12/18/android-how-to-create-a-border-with-rounded-edges/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a8596bb7cd94fa786ea5822ed087108c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdiscoveries</media:title>
		</media:content>
	</item>
	</channel>
</rss>
