Archive

Posts Tagged ‘Programming’

My First Android Application

September 15, 2011 1 comment

I was hesitant to learn android development because of time. Last week, a requirement kicked in that needed an android front-end. Target platform was android 2.2.  This is my feel of android development after six days of using android SDK. Actually I had also never used an android phone, so I was amazed how cool android OS  is.I should say mobile development should have been easier like how android development is from the beginning. I have developed in QT, and J2ME, but both dont match up to android development with ease. The great UI controls that come out of the box, the eclipse integrated plugin, the ability to reuse most of the standard java code, its all great.

I did consult the SDK documentation and the hello tutorials during the development. They where of great help. The application pulls the data from a .NET WCF JSON Rest based service. I used the Google Gson for the serialization and de-serialization of json to object types.  On the WCF service I decorated by operation contracts with WebGet and WebInvoke depending on whether am making GET or POST requests. To reuse the forms based authentication, the http connection service takes care of  managing the cookies mainly the forms based authentication cookie to receive and send it on requests.

Coding in android though seams easier than QT or j2me, I got some beating for not reading the documentation. Some of the beating I got:-

  • Embedding more than one root view in the scroll viewer was just throwing exception. I was quite big headed on googling for a solution on this one, because I just couldn’t expect it was the cause.
  • The table layout. This I had to abandon and choose another approach. I needed to replicate a telerik like silverlight gridview with a details view on each row. Was t0o ambitous about it, but abandoned it. Got headaches about the table row layout parameters and scrollview.
  • Adding an activity to the manifest file. Was always forgetting about this step and that led me to debugging. And pretty much I would remember (f***) when the exception is raised from the line where I start the Activity.
  • A point I got so frustrated with exceptions from setting content view. The exceptions just could’t make sense. I don’t know what I f.*up, but when I change layouts, or add new layouts. I tend to get exceptions when setting activity view. It just couldn’t make sense why. so I went to the bin folder and did the mighty SHIFT-DELETE-RETURN. Damn. all references to resources in R.java couldn’t be recognized any more. I was quick to think may be its a build order, so I moved gen above src folder, build project and back. Some magic happened, no more errors even when setting the content view. I still don’t know why for now. But this seems to be the solution I do for now when I get exceptions when setting content view. It seems to work. Till when I become a sniper at android, I will overlook this.

Damn! Hooking my configuration service to android preferences activity has been the easiest way of managing preferences on a mobile app have seen.

Lastly for now. The way resources are managed in android development, I can’t find an execuse for the laziness of harding cording strings in code files. Its damn fast, easy. Android is great. Android development platform is very great. Now I just feel cheated because I was missing a lot for a long time. I must boostrap my N900 with Nitdroid.

Android development is the way mobile development should have been like from the beginning.

Advertisements
Categories: Programming Tags: , ,

2011 Searchable Uganda Voters List

February 19, 2011 Leave a comment

I had scrapped a voters list a few months back. I realized its out of date. The new voters list available at the Electoral Commission website has voter id’s but it doesn’t offer search. I had to harvest a fresh list. You can search the voter’s list at http://reg.kutokea.com for the following information:- Read more…

Editing Excel Sheets using Microsoft.Office.Interop.Excel in C#

I found my self repetitively entering data into an excel sheet and needed to automate it using C#.

First add a reference of Microsoft.Office.Interop.Excel to your project.

To open a work book


using Microsoft.Office.Interop.Excel;
...
...
var m_TemplateFileName = "/path/to/excel/file/to/edit.xls";
var m_InputWorkSheetName = "input";
var application = new ApplicationClass();
var workBook = application.Workbooks.Open(m_TemplateFileName);
...
...

Read more…

Categories: Programming Tags: , ,

Uganda Dot Net User Group meeting for 26th Febuary 2010

Friday 26th Feburay 2010 was my first Uganda Dot Net User Group meeting.

The topic of discussion for the day was NHibernate ORM framework presented by J Marcus (Assistant IT Manager bank of Baroda).

Am not an expert of NHibernate, so it was time not wasted to listen and see how NHibernate can be applied in .Net applications. I use a combination of spring and Hibernate in the java applications I do develop, so I know the hustles of hibernate. Like having to create the mapping files and classes that map to database objects manually. Good enough NetBeans 6.8 comes with a reverse engineering plugin that removes the hustles of having to update and create the mapping classes. Read more…