I’m looking to make an app for my phone that allows me to record my mood each day and plot the data on a graph.

I don’t know Java very well, so I am learning it on the way. I am trying hard not to be impatient; I am tempted to cram as much information into my skull as possible and, in doing so, cause a great deal of frustration.

The first hurdle that I needed to overcome was learning how to save information within J2ME. The standard way of saving anything is to use the Record Management Store API, which, I have read, is exceedingly difficult to use for anything beyond the simplest examples. To this end, others have released their own libraries to make saving data less of a pain.

The solution which I have settled upon is Floggy. In their own words, Floggy is “a free object persistence framework for J2ME/MIDP applications”. Sounds great. Despite their claim that Floggy makes record storage much simpler, I still found using it confusing, though it could have been worse with RMS alone.

I searched Google for a simple example midlet to demonstrate the use of Floggy. (The official examples, a ‘barbecue calculator’ and hospital app, are too complicated for me to grasp.) This site has a short, simple example that saves two items: a name and an age variable. However, it didn’t show me how to load back the data! There isn’t much point to storing it when you can’t get it back.

I modified the example and put in a ‘load file’ command. It works! I’m ecstatic. Here it is:

ExampleFloggy.java

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import net.sourceforge.floggy.persistence.*;

public class ExampleFloggy extends MIDlet implements CommandListener {

    private TextField tfield;

    private Display display;
    private Form form;
    private TextField tfieldN;

    private Command savecmd;
    private Command loadcmd;
    private Command exitcmd;


    public ExampleFloggy() {
        tfield = new TextField("name:", "", 15, TextField.ANY);
        tfieldN = new TextField("age:", "0", 15, TextField.NUMERIC);

        savecmd = new Command("save", "save file", Command.SCREEN, 0);
        loadcmd = new Command("load", "load file", Command.ITEM, 0);
        exitcmd = new Command("exit","exit",Command.EXIT,0);

        form = new Form("Floggy example.");
        form.append(tfield);
        form.append(tfieldN);
        form.addCommand(savecmd);
        form.addCommand(loadcmd);
        form.addCommand(exitcmd);
        form.setCommandListener(this);
    }

    protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
        notifyDestroyed();
    }

    protected void pauseApp() {
    }

    protected void startApp() throws MIDletStateChangeException {
        display = Display.getDisplay(this);
        display.setCurrent(form);
    }

    public void commandAction(Command cmd, Displayable arg1) {
        if (cmd == savecmd) {
            Date dateOut = new Date(tfield.getString(), Integer.parseInt(tfieldN.getString()));
            int id;
            try {
                id = PersistableManager.getInstance().save(dateOut);
                Date dateIn =  new Date();
                PersistableManager.getInstance().load(dateIn, id);
                form.append(dateIn.toString());
            } catch (FloggyException e) {
                e.printStackTrace();
            }

        } else if (cmd==exitcmd){
            try {
                destroyApp(true);
            } catch (MIDletStateChangeException e) {
                e.printStackTrace();
            }
        } else if (cmd==loadcmd) {
            try {
                ObjectSet set = PersistableManager.getInstance().find(Date.class, null, null);
                Date dateIn = new Date();
                set.get(0, dateIn);
                tfield.setString(dateIn.getName());
                tfieldN.setString(Integer.toString(dateIn.getAge()));
            } catch (FloggyException e) {
                e.printStackTrace();
            }
        }
    }

}

Date.java (save in the same folder as ExampleFloggy.java)


import net.sourceforge.floggy.persistence.Persistable;

public class Date implements Persistable {

    private String name;
    private int age;
    private transient int num;

    public Date() {
    }

    public Date(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String toString() {
        return "";
    }

    public String getName() {
        return this.name;
    }

    public int getAge() {
        return this.age;
    }

}


I’ve had this phone for a while now, so I figured I should write a review on it.

The Nokia 6760 Slide isn’t too popular if your only source of information are the reviews on it. See here, here, here and here. My impression is that the reviews are more negative than positive about the phone. What irks me more are people who whether they realize or not, are comparing this lower-end phone to its more expensive cousins. Someone actually suggested to get a N900 instead of this phone… which is as sensible as telling a person to buy a BMW when they want a Hyundai.

The reviews mention most of the things I don’t like about the phone already. Probably its biggest downside is a lack of WiFi. If I knew I would spend so much time on this new phone, I might have considered getting one with WiFi so I can use the internet from my wireless router at home. It limits the phone quite a bit: in the end, it really does boil down to a mobile phone if there’s no internet. I haven’t enabled internet access on my plan yet, but I will want to soon, simply because it’s awesome being able to surf the internet on your mobile. 😀

A point that the reviews haven’t mentioned is that the covers on the USB port and the slot where you put in the power cable to recharge the phone (argh, bad terminology) are difficult to prise open. This is one of the reasons why I really want to connect the phone to the laptop through Bluetooth, so I can avoid having to open the cover every time I want to connect it.

The looseness of the sliding portion of the phone is a concern, because it does feel like it could be ripped off if you tried hard enough.

After using this phone for a while, I turned off the predictive text setting since it was so easy typing in words in full with the QWERTY keyboard. It’s not the same as typing on a keyboard on a desktop or laptop, though, since you use your thumbs to type instead of all your fingers. The keys are too firm for your smaller fingers to press, not to mention it would be very cramped to put both your hands on it.

Nokia 6760 Slide

The main attraction of the 6760 Slide for me is its design and keyboard. I like how it’s asymmetrical due to the groove on its side. The design of other Nokia phones tend to look chunky and pedestrian. (The E-series springs to mind.)

Another point that only becomes apparent with continuous use of the phone is that the keyboard configuration does not interact well with J2ME applications. I downloaded a few games to play, which assume that the keys the phone uses are the number keys. This would be okay on a normal phone, but on the Nokia 6760 Slide, the number keys are accessed by holding down the function keys on the bottom left and pressing the number-marked keys. So, to use these apps you have to hold down the function key while pressing the number keys, otherwise it will recognise the key as an alphabet instead of a number.

I also like the size of the phone. It fits just nicely in my pocket. I don’t know how I would get along with other, larger models. A long time ago, when I had a Nokia 3310, I justified its considerable weight by saying that if it were lighter I would not notice if it dropped out of my pocket. I now know that you don’t need the phone to weigh as much as a brick to notice it dropping out, because the 6760 Slide has fallen out of my pocket a few times and I’ve noticed it. And yes, it is much lighter than the 3310.

Oh dear, it’s getting very late over here. This isn’t much of a review, when I read it back to myself. But I hope it gives someone out there a little more information to help them decide what new phone to buy among the myriad options out there.


I’m in the process of transferring my settings over to the new laptop, which has Windows 7. I use Nokia PC Suite a fair bit, so I installed it today. I encountered my first disappointment with Windows 7 when I wanted to connect my phone to the laptop through Bluetooth.

PC Suite kept scanning for devices but could not find any. The laptop uses Microsoft Bluetooth Stack which was supported by PC Suite. I clicked on the Bluetooth icon and selected “Show Bluetooth Devices” — also nothing. The new laptop could not even find and connect to the old laptop. Even more worrying was the Settings option from the Bluetooth icon on the taskbar not working, and the absence of Bluetooth from the Control Panel.

Frustrated, I Googled for solutions. I came across a forum post with an unexpected answer:

I stumbled upon this thread and while reading i found the solution to my own problem.

Windows xp pro sp2, bluetooth icon not showing up in control panel and im having poor performance with BT devices.

I tried control panel -> administrative tools -> computer management

expand the services and applications(by using the + symbol) then click on “services”

in the list to the right side, find bluetooth support services and double click on that.

Ensure that the service is both set to automatic and started.

Hopefully this helps someone!

best wishes.

j.

WHYYYY?!??!?! This is asinine. When I see the Bluetooth icon on the taskbar, I expect that Bluetooth services are enabled. (I’m not even sure what I’m referring to by ‘service’.) The meagre information provided by the help system in Windows 7 did not mention this at all. I do not know why anyone would want the Bluetooth icon to be visible and not be able to use it.

There’s still no Bluetooth in the control panel, unfortunately. I’m pretty sure it should be there as an option, but whatever. The laptop detects and connects to my phone without issue now.


I’m installing the S60 SDK for Symbian and it is annoying me.

When I click on the download link, it asks me to join Forum Nokia. I do not remember doing this the first time I downloaded the SDK; a quick search of my email inbox reveals I have no account confirmation emails from them. This must mean it is a relatively new change they’ve implemented, and I don’t see much point in it. The registration form has spaces for address, city, postcode, phone numbers… but I am so turned off with Nokia I won’t bother giving anything. It’s not like they need it for anything, do they? Or perhaps this is how Nokia plans to induce bonding amongst developers to an Apple-like fervor.

If I really liked the community that much I would make an account to post on the forums. Nobody likes being forced.


Playing games

26Dec09

I’ve been satisfying my gaming thirst by indulging in a little Icewind Dale 2.

Yes, it’s not a recent game. I played Baldur’s Gate a few years ago, loved it, and decided to try something similar. As it turned out, they also share the same game engine, along with a number of other RPG games of a similar DnD breed.

Icewind Dale 2

Two half-orcs in Kuldahar, standing next to Iselore

The fundamental difference between Icewind Dale and Baldur’s Gate is that Icewind Dale expects you to create your entire party at the start. Baldur’s Gate only allows you to make one character — which is you — and then you have to find your own party members throughout the game.

I was hoping ID would follow the BG model, but then again, they are supposed to be different games. After playing ID for a while I began to appreciate the fun of creating whatever kind of party you want to face the scenarios in the game. For one thing, the game has to make allowances for different kinds of parties, which means that an NPC could treat you differently according to race, intelligence, charisma, talking skills, etc. Also, I welcomed the far less dangerous traps in Icewind Dale as compared to Baldur’s Gate, where nearly every one towards the end of the game was a one-hit kill. In Icewind Dale they are just annoyances.

Icewind Dale 2

Preparing to fight the Guardian, a very tough boss

‘course, this isn’t really supposed to be a review. I think it’s a bit late for that! The quality of the gameplay has not deteriorated with age. It’s still plenty of fun, unless you choose to concentrate on the quality of graphics in a game at the expense of other factors.

(I got Dragon Age as a Christmas present. I have not tried it yet. Looks awesome!)


First off: happy holidays to all. 🙂

Blog Stats is an enticing page to visit when your favourite sites have exhausted their interesting content. Unfortunately, I think it breeds an inappropriate amount of attention to how many people visit a blog. One could spend a lot of time picking out which posts get the most views and feeling coerced to write something more… applicable to the rest of the population.

Nonetheless, this little exercise in sounding out a voice in a well full of other voices probably deserves a smidgeon more substance.

A problem I’ve noticed with myself, that’s been growing ever since I left high school (which was not all too long ago) is that I’ve become very impatient. Not just impatient as in someone who thinks the bus is always late, although I’ve not been taking the bus as much these days due to that reason. No, this impatience is much worse — it’s on a very long term scale. I think of wonderful things I would like to do. There’s a mountain-load of them. The problem is that I often spend a large sum of energy in executing them, only to give up on it very shortly after, like say, after a few days, and then I find something else and I pick up on it.

The whole process is draining. To put it bluntly, I seem to be throwing away my efforts as soon as I have made any headway in them. Take, for example, a version of the Robots game I made in Mobile Processing. I made a large amount of progress within a few hours of a night, and I couldn’t sleep through to the next day on account of being so excited about all the things I wanted to do with Processing. And then I lost interest after that; it seemed that I did so much imagining and brainstorming that I didn’t have the energy to pick up on the ideas I had.

And it is so disappointing how I find flaws in my project ideas so quickly. The flaw can be almost anything — the project might be too easy or too hard or just plain redundant. A mere pebble added to a pile of refuse code that makes no difference at all. I have an idea for a novel I’ve been building in my head since 2005, and I haven’t been able to make significant headway in writing it down, except for a few scraps here and there that are more like notes than actual story.

Oh, sorry. I think this has degenerated into another one of those discussions that probably no one will ever read! I’ve done exactly what I set out not to do. Instead of something that adds to the swelling corpus of knowledge out there, it’s just a sad rant from a guy with ideas who can’t make them work.

Hrm. The scheme of things, the number of people reading this doesn’t matter. I just think it’s important that I’ve recognised this habit of mine. The next step is to do something about it.


A lot has happened between now and the previous year. My interest in programming died when uni started, though it has been rekindled after buying a new mobile phone. My old Nokia 1100 finally gave up; its battery wavered in status between full and empty despite lengthy sessions of charging.

I now have a Nokia 6760 Slide. What a clumsy name. Why didn’t they just call it Nokia 6760 or Nokia Slide. I suppose whatever marketing executive who decided on the name thought that just having the name was too dehumanizing for a device so intimately connected with our daily lives. Still, tacking on “Slide” doesn’t make it any more cool than the other 182387 models that Nokia releases. Reification is dangerous.

What set off my interest again was the possibility of programming for the phone. Before buying the new phone I had a very old-fashioned view of what a mobile phone did: it called people, and nothing else. These days mobile phones seem to do everything except your tax return. (There’s probably someone writing a tax return app for Iphone as I type this.)

There are a number of ways of programming on the phone. It’s a Nokia phone, and it runs the Symbian operating system, Version 3 Feature Pack 2 to be totally exact. Two main resources are Forum Nokia and the developer section of the Symbian website. For this make of phone, the choices are C++, Python, Java, Flash Lite and web widgets. The only two that I have looked at in detail is Python S60 (PyS60) and Java ME (Micro Edition).

My interest began in Python because I had previous experience with it. I could remember a lot of Python despite not having used it in months. I was very excited when I was playing around with it; I made a significant amount of progress on the L Game program which I tried to write last year. I gave up when I realised how time-consuming and laborious it would be to manually rotate every square that makes up each counter in the L game. There’s got to be an easier way to do this, I said.

My initial excitement with Symbian faded when I came to realise that the world’s most popular operating system, operating on a phone made by the world’s most popular mobile phone manufacturer, was not very friendly with developers, especially amateur hacks like me. The Symbian OS itself seems to receive a large measure of hatred for being complex. Programming in Python for the S60 edition of Symbian might be fun, but I’m a bit disappointed seeing that few apps are written in it. This is probably due to a variety of reasons, such as the limitations of Python S60 API and hassles with packaging .sis files.

Now I’m experimenting with Java ME, also known as J2ME. It’s Java on your phone, except it’s missing some classes from standard Java. Plenty of apps seem to be written in it, mostly games. Java ME has less capabilities than Python S60, but it has the benefit of being able to run on many more phones, not just by Nokia. If your phone is relatively new, say 1-2 years, it likely has Java on it. While you won’t be able to access GPS through Java, it has its own advantages, such as a class specifically designed for games.

I actually did not know Java before encountering this. I’m learning Java because of it, which is quite nice. 🙂 (The reason for learning, not Java I mean. Java is horrible and mean and bullies me with its muscly curly braces and sneaky semi-colons.) And now I am experimenting with Processing and Mobile Processing. I have a lot of good things to say about those two projects, far more than can be contained by a single blog post. So that’s all for now, hehe.