May 11, 2012

Apple WWDC 2012 - Here we go! :)

I have been fortunate enough to get a ticket to the Apple WWDC 2012 conference. It brings back a whole lot of memories. Last time I visited San Francisco and Moscone Center, I was a full time Java developer. That time it was JavaOne, when Sun still was existing. Now I am a full time iPhone application developer, although I sometime do some Android development. It is around 2 years since I decided to give iPhone development a try. I have not yet regretted it. See you at Apple WWDC!

Is there anyone else attending Apple WWDC?

Nov 17, 2010

Öredev 2010 - Some Thoughts

Öredev 2010 is over and it is time for me write some words about the conference. What I like about the conference is that has an interesting mix of tracks; Java, .NET, Agile, Web Development etc. It is always nice to broaden your views. New this year was the Xtra(ck). The Xtra(ck) contained sessions that had nothing to with software development, or at least very far from it. For example there was a session called "Understand Hypnosis". These session was definitely a way to broaden your mind. I liked the "Photographic Composition and Creativity" and the photo walk both with Amy Archer. Thanks for the tips during the photo walk!

Also new for this year was the Öredev puzzle application. The application was designed around the concept of being social. Each participant got a puzzle code within the application. By sharing your code you got a piece of the puzzle. As a bonus you got the contact information for the person whose code you entered. Each person to finish the puzzle got an Öredev t-shirt and was participating to win some great prizes. The application was available for Blackberry, Android, Windows Phone 7 and iPhone. The application also contained the schedule and speaker bios. A real nice application. Next year I hope to see an improved version. For example, integrating your own schedule would be great.

And here are some photos from the conference. Enjoy!

Öredev 2010 - Get Real


Speaker Dinner at Malmö City Hall


Developers Competing

Hard to Choose the Righr Track?

Even Doll showing of Some Nice Xcode Tricks

Coffe Lounge

Jack Nutting about Making Money in Appstore

John Seddon


Marcus Zarra on Core Graphics

The Audience
Library by Night

And that is the wrap. See you next year!

Oct 25, 2010

Network Programming Tips for Mobile Developers (iPhone, Android, Java ME etc)

Among the most important things to master for a mobile application developer is network programming. Every mobile application I have developed has involved some kind of network communication. During the year I have learned a thing or two. Read on to get some tips & trick from me.

Quite often the server is developed alongside the client. This means that you as a client developer have to wait for those awfully slow server programmers. Not every server programmer is slow, but most likely you have to wait for some server functionality. In situations like these, it is handy to roll your own server. But as a client developer, you do not want to spend an massive amount of time to setup a server. In fact, if it takes longer than a couple of minutes most client developers give up. What you need is a server that is very quick and easy to setup. Also it needs to be simple, yet powerful. Many server programmers would recommend you setting up a Tomcat server. The advantage of using a Tomcat server is that it is very versatile. But I do not really like Tomcat. It is to advanced for me. Another solution is to use a Jetty server. This is simpler to setup than Tomcat, but yet rather powerful. It could be executed from Maven. As such is is convenient to use for automated tests. Maven takes cares most of the work, including starting and stopping your Jetty server. But there is a new and rising star, the Sinatra server. The Sinatra server is actually a Ruby library. You use Ruby to program the behavior of your server.   

A simple “Hello World” implementation for Sinatra looks like the one below (from the Sinatra Book).

require 'rubygems'
require 'sinatra'

get '/' do
  "Hello world, it's #{Time.now} at the server!"
end

The file is saved as a file with .rb extension, in our example we save it as “hello.rb”. Then you start your server as simple as this:

ruby hello.rb

You get a nice line saying that Sinatra has taken the stage and that your server uses port 4567. This could of course be changed, if you want to mimic another server without changing your code. It is very easy to extend your server functionality. Ruby is easy to learn and powerful for making your own server without any big hazzle. Take a look at the “Sinatra Book” if you want to master Sinatra.

Another common scenario is that you need to figure out what happens when you make a certain URL request, for example if you do a REST request. Before even writing a single of code, you could use the cURL command line tool. Its available on most platforms, like Unix, Linux, Mac OS, Windows etc. For a matter of discussion, let us assume that you want to check that you programmed your Sinatra web server correctly. Then you the following command:

curl http://127.0.0.1:4567/

The response should look like this:

Hello world, it's Mon Oct 25 20:44:19 +0200 2010 at the server!

So now you know how to implement your own simple server, as well as how to debug your server request using curl. But wait, there is even more tricks I want to share with you. I hope that you feel like reading a little bit more.

I think that XML is a rather misused technologies around. It is used for many things, ranging from describing your builds (Ant, Maven, etc) to describing serialized objects traveling through cyberspace (SOAP, REST etc). When SOAP was introduced, one main argument for XML is that it human readable. What? Have you ever seen a SOAP request that is human readable? If you are about to send and/or receive objects there are much more suitable technologies than XML. Especially when making a mobile client, where XML parsing could take to much time and memory, it is important to understand that there are good alternatives. One good old technology is ASN.1, that is hugely underestimated. It was designed for communicating data between different architectures and CPUs. It is fast even on a 8-bit CPU. The biggest drawback is that it is not widely supported and it requires an ASN.1 compiler. However you could implement your own ASN.1 encoder/decoder quite easy. Another solution that is easier to use, but building on the same principles as ASN.1 is the Hessian protocol. It is a binary web service protocol. The specification is originally designed by Caucho, who did the Resin web server. The specification is open and implemented in many languages, including .NET, Flash, Ruby, Python, Objective-C etc. I have primarily used it for Java ME, where only a subset is implemented. If you use it in Java ME, I would recommend considering using it to store object data in the record store. But now it is more relevant for me to use it on Android or iPhone. The Objective-C variant for iPhone is called HessianKit. It is open source and released under Apache 2.0 license. Thus it is not a viral open source license, which I think is great. I will not describe how to use it, since there already is a good article on the subject “HessianKit Released”. I hope that you will consider using Hessian if you are in the position to decide what web service protocol to use. If you feel the urge to use XML for your web services, you could use Burlap which is the XML version of Hessian. The communication is as simple as it could get using XML.

Another useful tool is a network analyzer. This is good for finding out what happens between the client and server. For example, if you want to take a look at the headers are many times auto generated. I have used Wireshark with great success. It would not say it is easy to use, but when you need to use it is priceless.

These are the tools that I think I use the most for network programming. What are your best tools when doing network programming?

Oct 8, 2010

Synchronizing iPhone 4 with Google without iTunes

Today I received a brand new iPhone 4. Life was joyful. However it gave me some frustrating moments before I could use it for real. Here is the true story what happened when I got my iPhone 4.

I had prepared the migration by backing up my contacts from my HTC Hero. The HTC had no way to export contacts to a SIM card, but only to SD card. Strangely enough it was possible to import contacts from a SIM card. Anyway I did not consider this to be a big problem, since exporting to the SD card should work fine.The contacts was saved as a VCF file. This was easily imported by double-clicking on the file. When this was done, all the google contacts was on my Mac Book. After I started and initialized the iPhone, it was connected via a USB cable to the Mac Book. Consequently iTunes was started with a wizard. One of the steps was the sync setup. By default all contacts was to be synced. Perfect! This was exactly what I wanted. A couple of more steps and I pressed the “Sync”-button.

After a short while something really odd happened. A warning message saying that no synchronization of contacts was not possible, since the phone was not connected. What! The phone was connected. Not good! I discovered a button labeled “Restore”. The help text explained that this should be used when in trouble. I felt like being in trouble and hit the restore button. The process was really fast, but enough time to get some tea. Then the same procedure once more. Still the same problem. Next try; search the Internet. I found out that I was not alone with this problem. I tried out all of the different solutions explained in the forum. Do not know how many times I cleared the sync settings, restarted the phone, re-booted the computer and all other kinds of tricks. The Apple support pages did not contain any other suggestions than found in the forum. Now I was really frustrated. I should not be that complicated to get your contacts into your new phone. Time to get a break. Get your brain to think in a different way. Reset the brain. Get some food.

Several hours later it was time to try a new approach. I googled “Sync iPhone Google”. I found an article called “Google Sync: Set Up Your Apple Device for Google Sync“. It seemed to be exactly what I was looking for. The article explained how to use add an account in the iPhone to synchronize mail, contacts and calendar. In fact it was a Microsoft Exchange account. It took me less than 5 minutes to have mail, contacts and the calendar in sync.

The final solution was much simpler than copying contacts via the computer. The intent was to only transfer the contacts and then set up a mail account on the phone. Now I get an all-in-one solution,  with mail, contacts and calendar synchronization. Now my life is joyful again.

Oct 4, 2010

The Öredev Developer Conference 2010

Each year since its inception, I have attended the Öredev developer conference. What makes it special is that it is a combined conference, with not only Java. This year it is especially important for me, since I can learn about both Android and iPhone development.

I will attend this year. Will you?

Do not forget to register at the Öredev site.

Sep 26, 2010

Microlog4Android V1.0 Released

Finally! After many months of struggling with Microlog4Android, the first official release is here. The core is the original Microlog code, but it is re-written to take full use Java SE features. For example, no Vectors are used. This means that the logging is faster than it was in Java ME. One important addition is the support for SLF4J. This should make it easy to migrate if necessary. This might also be an addition to future versions of Microlog. This way it should be easy to share code between Java ME and Android. The most important appenders are there as well.

Please download it from here. As always, any feedback and comments are welcome.

Sep 24, 2010

My World is Changing; Android & iPhone Development

I have been working with Android development for quite a while now. So I decided to do something quite different; iPhone development.

It is like groping in the dark. After many years with Java and garbage collection, it feels a little awkward to manage your memory by yourself. The first encounter with garbage collection in Java was really awesome. After a couple of years as a Java developer, you realized that the garbage collector is not the answer to all of your memory problems. But still, you are not forced to think about memory management on a daily basis. All of a sudden you need to think about memory management on a more regular basis.

Eclipse has been the main tool in my Java toolbox for many years now. One might argue that IntelliJ or NetBeans is a better tool, but I have used Eclipse. Switching from Eclipse to Xcode is not easy. I miss the fabulous re-factoring support in Eclipse. There are many other small issues, but I am slowly and constantly learning new keyboard shortcuts in Xcode. I guess that I could be a better Xcoder in a while. The interface builder in Xcode is an invaluable tool. It is very easy to get nice looking iPhone UIs. It is very nice not having to worry about getting your XML files right. Making a good looking UI on Android can be frustrating and cumbersome. Of course you can get nice UIs on Android, but I find it easier to create one on iPhone.

Last but not least, the markets are a little bit different. Android market is open. Appstore is a little bit more closed. There is no quality control when submitting to Android market. As a consequence there is a lot of really bad Android applications. It is hard to find what you are searching for on Android market. The search seems to be case sensitive. Not good. Usually I install applications that is recommended somewhere. In most cases, there is a QR code available that I scan with the Android barcode reader. Really nifty application that makes installation on Android simple. The applications in Appstore is controlled by Apple and it seems that they are of better quality than Android applications. It must be pointed out that there are many high quality Android applications, but they are harder to find. As a developer in Sweden it is not possible to get paid for your Android applications, but you can get paid for your iPhone apps. When will this problem be solved?

Another thing that seems to be missing in the iPhone world is open source projects. The Java and Android world is full of open source. However there seems to be good hope for the iPhone world. I found this this list of open source applications for iPhone.

Of course there are many more differences. These are the most apparent differences from my perspective. At the end of the day I am a mobile software developer. Switching to iPhone gives me a new perspective of my world. I think that is a good thing.