Speed Development, or how I learned to love the App (Part 1)

(The finished app can be purchased on the Android Marketplace)

Let me set the scene first: It’s mid-evening, I’m in my home office working on my next major app but nothing seems to be clicking. I’m trying to get a fairly simple feature to work, but it’s not. Even the logs and debugging list isn’t giving me much of a clue. The heat of two computers, a laptop and a server in a small-ish room compounds my frustrations further.

Then I give up. I close Eclipse and play some Team Fortress 2 to unwind.

Sometimes when I’m coding something that takes a lot of my time, something that seems like it’s going to take forever for a one-man effort, it’s disheartening. It happened with My Shopper, an app I spent months pouring my efforts into, but ultimately didn’t sell well. I’ve got high hopes for this current project, but it still feels like it’s too easy to get completely lost. At times like those you just want to do something different, start fresh.

So that’s what I did.

Inspired by the second episode of this year’s Apprentice and fuelled by tea, I decided to set myself a challenge – come up with an idea for an application and bring it to the Android Marketplace by the morning.

The Idea

As it was 11pm, and I effectively had up to 9 hours to get this app complete, I had to think of an idea that was small but practical and whose scope was unlikely to spiral out of control. I also had to find an idea that, while not completely unique, was not likely to be crowded out by an established or superior app. Something that was likely to be used in a real-life situation.

After jotting down some ideas and comparing those ideas to existing apps on the marketplace, I opted to make a Lottery Number generator. The structure of the program would be simple – a random number generator picking numbers within the rules of each game. The rules of the chosen game would then be fed into the generator, meaning the app could be expanded for other non-UK lotteries in the future.

The simplicity of the program structure meant I could make a bare-bones demo of the app within a couple of hours, getting the functionality done and frozen before giving serious thought to the look and feel.

The Realisation

At this point I had a realisation, one of the reasons I was becoming bogged down in my major project – I had spent too much time on the User Interface, how the app was going to look, but not to the features and how it was going to work. What I thought were simple features were spiralling. I was having a hard time keeping these new features under control because I didn’t have a map of what features were required, and ultimately didn’t know how to implement them. Essentially, without the map, I was lost.

Whether it was the coding or the coffee, things were starting to look a lot clearer both in this challenge, and my coding techniques.

Posted in Android, Development, Tutorial | Tagged , , , | 2 Comments

Android Unit Testing

Just a quick one as I’ve not been feeling too well this week. I’ve been having one or two issues getting Unit Testing up and running on my Android application, but found this blog post to be very helpful on the matter:

http://codetrips.blogspot.com/2010/06/unit-testing-android-activity.html

Posted in Uncategorized | Tagged , , | Leave a comment

Burning and rebuilding bridges

… of the network kind, of course ;)

This past weekend I decided to take the plunge and start virtualising some of the many things my home server does, such as printing via CUPS, hosting my dev sites and documentation, backing up all computers in the flat and so on. I managed to get 2 Debian Lenny VMs up and running with this tutorial, and all seemed good and well with the world. Well, apart from one thing.

It seemed that the new VMs I had created were unable to see the outside world, and likewise could also not be pinged. The one existing VM used as a Jabber server, however, was working perfectly fine.

This was an immensely frustrating problem, which consumed pretty much all of my weekend with no luck. However, after over 4 days of searching with little luck (and many edits to this post), I finally found a network setup that worked for me. In /etc/xen/xend-config.sxp, I only enabled (network-script network-dummy) and (vif-script vif-bridge), while my /etc/network/interfaces is set up as:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto br0
iface br0 inet static
        address 192.168.1.x
        gateway 192.168.1.1
        network 192.168.1.0
        netmask 255.255.255.0
        bridge_ports eth0
        bridge_stp on
        bridge_maxwait 0

And each virtual guest having this bridge specified in the networking section of its respective config file:

vif         = [ 'ip=192.168.1.x, bridge=br0' ]
Posted in Linux, Networking, Virtualisation, Xen | Leave a comment

My name is JSON, Part 1

So here it is, my first post. And while I may have been slightly distracted by the rise of our robotic overlords, it didn’t take me that long to think of a starter for 10. As a mobile and web developer there are always certain things that may not seem important at first, but start to take a greater importance when you realise just how useful it can be, even for mundane things like encapsulating data for easy transfer.

So I’m beginning with Javascript Object Notation, or JSON for short. JSON is one of the most widely-used methods of holding data in a structured format, XML being its main rival. This was a topic originally thrust onto me during a University project in 2010, and while seeming daunting at the time turned out to be fairly straightforward. Before I explain how this data can be handled in PHP and Java, let’s take a look at some JSON-encoded data.

So what does JSON look like? Something like this:

{
    "forename" : "Michael",
    "surname" : "Dodd",
    "age" : 23,
    "breaks" : [34, 66, 12, 35, 22, 73, 94, 147],
    "match" : {
        "frames_won" : 5,
        "frames_lost" : 3
    }
}

This example is my performance in a snooker match (I wish!). Similar to PHP, this data structure can be seen as an array with named keys. Each key can contain:

  • A simple value such as a string or integer.
  • An array of simple values, denoted by square brackets [ ].
  • A child JSON object, denoted by curly braces { }.

With the ability to structure data in such a fashion, it is easy to map the data in a JSON object to the data structure in your application. One point to note when creating these structures, however, is to make sure that the final entry in each object does not have a comma at the end of it as this may cause problems with some parsers.

In the next few posts, I will explain how JSON data can be used with PHP and Java (with an Android flavour), but for now check out some of the many potential uses of JSON data with the Guardian Open Platform API.

Posted in Javascript, PHP, Tutorial, Web | 1 Comment

Welcome

Welcome to my personal website. On it you will find a collection of projects and products I have created, as well as details of my skills and experience in my CV. I also intend to use this blog as a place to discuss various topics and tips from the world of web development and Android development.

So, thanks for visiting, and stick around for more in the future.

Michael

Posted in Announcements | 1 Comment