Android – Introduction to Parallel Computing

Handling asynchronously is a ‘must’ for all mobile applications when executing any long time operation. For example, in Android, when a network operation is going to be called, it has to be executed on other thread (not UI thread). If the developers try to run a network operation on UI thread, Android OS will force the app to stop with an exception of android.os.NetworkOnMainThreadException. As usual, the developers will put long time operation in a AsyncTask (or a Thread) and let it run. I also introduced this class in many Android posts before. However I have only one AsyncTask running at a time in all of examples. A reader asked me if I can create a list of AsyncTask and execute them at the same time. Something likes Parallel Computing? The answer is ‘Yes, of course’. We can do that in Android. Therefore, in this post, I would like to show how I simulate a multi-threading case with AsyncTask and some experimental cases for comparison between native Java and Android Java in Parallel Computing

Continue reading

Introduction to Mercurial and Bitbucket

In my recent posts, I hosted source code in Bitbucket. Bitbucket is a free code decentralized version control system (DVCS) hosting site for Git and Mercurial. In comparison to GitHub, Bitbucket allows us to host unlimited private repository for free – GitHub not. In Bitbucket, we can also integrate with other great Atlassian products for managing our development with a hosted wiki and issue tracker. Because I will host my code there in future as well as moving slowly all available .zip code files from my site to Bitbucket, I would like to write a short instruction so that you know how to check out or download the code. However I won’t go into details how Mercurial works and how great the products of Atlassian are. The topic of this blog post is very limited only in source code download section, no commit and everything else.

Continue reading

Android – How to consume an Azure Mobile Services?

Publishing core data through web service is always a work-intensive progress because we have to build up a web server, define service interface, make data access layer and implement user management. It has never been easy and always requires advanced knowledge. The resources of developers have to be distributed not only for client but also for server. Therefore the cost gets more. Moreover because of strong growth in market of smartphone and table running on different operating systems, the developers are put into a challenge to make a universal web service which can be easily consumed in all platforms. In my previous posts, such as How to call ASP.Net Web API service from Android? or Android – Media player and ASP.NET Web Api, we are able to build up a universal REST web service which can be consumed in all platforms supporting HTTP protocols.

Continue reading

Android – Introduction to AndroidAnnotations, Maven in Intellij IDEA

I think, as developers, all of us want to write less code but still keep the code structure clean and clear as possible. When I develop app in Android, I always miss MVVM (WPF in Visual Studio) where I can bind control to event easily. Android makes me ‘bored’ when I have to look up each control with findViewById() and then initialize them so that I can use them later. Even though that the problem with findViewById() can be solved with Roboguice, but I still have to write the code for registering event such as click, long click,… It’s really boring and I want to have less code for that task. I need something ‘clean and clear’. Therefore in this post, I would like to introduce AndroidAnnotations, a framework for helping us keeping our code thin and healthy.

Continue reading

Android – Basic testing with unit test, android test and roboguice, robolectric, mockito

Bugs are always the most annoyed things for developer. It’s a dream (which never comes true) that a software runs without any problem at client’s site. There are always some points that developers have to improve after deployment. The more time developers invest for testing, the better the software is and the less annoyance developers have. I made many examples of Android development which are small apps and illustrate how a point of interest works. As a demo, I didn’t care too much about if there is a bug in app code because it isn’t a complete application. However if we want to make something that can be sold to customers, we have to be sure that our software should be reliable as it could be. Therefore in this post I would like to discuss some simple basic tests in Android development. We will learn how to write a logical unit test with JUnit, an integration unit test with test classes from Android and some advanced test cases with Roboguice, Robolectric and Mockito.

Continue reading

Sqlite with Entity Framework Code First and Migration

Last month I’ve a chance to develop an app using Sqlite and Entity Framework Code First. Before I started with this project, I thought everything will be easy because Sqlite and Entity Framework are both popular framework. Maybe I just need to install some nuget packages and it will work like a charm. But… yes, there is always a ‘but’ later, it’s just not so easy. Especially when I usually work with NHibernate than Entity Framework. The installation doesn’t complete his job when configuring the .config file (or maybe it just happens for me or does the author do it with intentionally?) and the Migration for Sqlite Entity Framework Code First is not supported (please correct me if I’m wrong). There are, of course, commercial products for Sqlite Migration but I prefer an open source framework or something free :). So in this post I would like to write down the steps required when starting a project for Sqlite Entity Framework Code First and how I make my own simple Migration engine.

Continue reading

C# – Lotus NotesSQL Driver install, configure and connect to server through ODBC

Lotus Notes and Lotus Domino are the client and server of a collaborative client-server software platform from IBM. The ecosystem provides business collaboration functionality, including email, calendars, to do lists, contacts management, discussion forums, file sharing, instant messaging, blogs, and user directories. Like other business applications, Lotus system conducts a database system behind to manage all data objects for sharing data between internal applications. To make the system itself more friendly to 3rd applications, Lotus also provides a driver – Lotus NotesSQL – so that 3rd applications can query data from Domino server. With Lotus NotesSQL, users and application developers can integrate Domino data with their applications through ODBC. IT professionals can enable their existing ODBC-enabled applications to access data stored in a Domino database. It allows ODBC-enabled data reporting tools, database tools, and application development tools to read, report, and update information that is stored in Domino databases (NSF files).

Continue reading

Android – Sqlite database with ContentProvider and LoaderManager

If you follow my previous posts, you may already know that we discussed how to make an application with database in Android before in Android, Dependency Injection (IOC) with roboguice and MVVM (Model-View-ViewModel) pattern. Although the main topic in that article relates to Dependency Injection but we had also a working example which fully supports all CRUD actions for Sqlite database. However, in practice, it shouldn’t work like that because the synchronous read/write actions will block the user interface and your apps will freeze. When your database grows over time, the query time gets longer and you app will completely freeze during the query get executed. Therefore, in this post, I would like to make a sample for illustrating how a database application can work in asynchronous mode.

Continue reading

Simplicity is the ultimate sophistication – Leonardo da Vinci