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!)