Nokia 6120

Posted by David N. Welton Thu, 23 Oct 2008 14:01:00 GMT

I finally got around to getting myself a new mobile phone, as it looks like the Android phones may take a while to arrive here in Europe, unlocked, and my old phone was fading.

I ended up selecting a Nokia 6120 in order to get something that runs Symbian, which has a decent amount of apps above and beyond the Java ME stuff.

So far, I'm fairly happy with the phone. Here are some notes:

  • It's small and light. Nice!

  • It runs Java ME (J2ME) applications surprisingly slowly. I'm non-plussed by this. And no, it's not just Hecl, even ShopList, which is quite simple and small (~ 6K), takes several seconds to start up. This is not appreciably faster than on my cheap phone from several years ago.

  • My old, cruddy phone was able to recharge (slowly) via USB. This one doesn't, as far as I can tell.

  • I bought it from Amazon.de, and the bozos who were the 'real' sellers sold me a phone intended for the polish market, meaning the dictionary languages installed are all eastern European - no Italian, which I need. Not the phone's fault though, and I guess it's probably possible to replace that stuff.

  • The camera has some weird issues where it leaves streaks. I realize that it's only a phone camera, but it ought to be able to do better. Here's an image from my recent trip to Oslo, by way of example:

Oslo Fjord

  • Creating videos wors pretty well though.

  • Playing video is just a bit jerky - it mostly keeps up, but not 100% of the time, when you lose a few frames.

  • Nokia ought to do a better job making sure that it's integrated with Linux (Ubuntu in my case). That said, things work quite well, by and large, and I was able to get things done with relatively little fiddling.

  • The amount of progress over a few years is very impressive. This phone completely blows my old phone out of the water. Sure, it's a bit pricier, but it's way more capable.

All in all, I'm happy with it, but I think that my next phone will be some kind of Android-based device, as that system is way more hackable than Java ME, and the people developing it seem to 'get it' a bit more.

That said, I'm glad I got it - I needed something modern to play with Hecl on, and hopefully I will be able to work on using some of the fancier bits of the phone from Hecl.

Oh, and by the way, I'm always on the lookout for phones to try Hecl with - even if they're old and worn out, the only thing that matters is that they are able to run Java ME applications. Contact me for shipping information:-)

3 comments |

Making Applets Suck Less

Posted by David N. Welton Tue, 07 Oct 2008 06:07:00 GMT

With all the effort being poured into Javascript lately, it's pretty evident that that's the way forward. However, there are still some neat things you can do with applets that you can't do with Javascript. For instance, I use the microemulator applet to let people play with a simulated phone on the Hecl web site.

Unfortunately, the user experience hasn't that good. While playing around with the code for that site, Firefox crashed a number of times, and I've heard other browsers have trouble as well. No fun.

So it is with some satisfaction that I found this:

https://jdk6.dev.java.net/plugin2/

It's an updated Java plugin that seems to work much, much better than the old one. Unfortunately it doesn't appear as if it will be in the new Ubuntu, as it was released recently, but I'm quite happy to have something a bit more stable to develop with.

You can download that version of the Java SDK or JRE here:

http://download.java.net/jdk6/

It's good to see this effort, even if it may be a bit late.

6 comments |

Hecl Syntax: A Survey

Posted by David N. Welton Tue, 12 Aug 2008 11:59:00 GMT

[ Taken and modified from a post to the hecl-devel mailing list ]

I've been talking with a company about a consulting job regarding a programming language for mobile apps. Sounds familiar, right?

There is, however, a bit of discussion regarding the syntax - my contact at said company maintains that Hecl's syntax is unfamiliar to many programmers, and I think on the face of it, I'd have to agree. Of course, Hecl's syntax is like it is because when I started the project, being very small was a necessity, and a very simple syntax facilitated that goal nicely. Additionally, the syntax allows for extreme flexibility, letting you create new control commands, and "DSL's" (domain specific languages) easily. Also, sticking with small/simple means that the interpreter and parser can both reside on the phone, instead of doing some kind of solution where the development/host computer compiles the scripting language to byte code, and the interpreter on the phone runs the byte code. That sort of strategy has some advantages, but has disadvantages too: if you don't have an on-board parser, you don't get "eval".


A quick Hecl syntax refresher:

In Hecl, everything is a command, seperated by spaces, and grouped with {}:

if { ... } { ... }

Is a command that takes two arguments. It evaluates the first one, and if it's true, evaluates the second one. This is different from languages like C, Python or Ruby, where 'if' is part of the language. For those unfamiliar with languages like Lisp, where this looks strangest is probably in conditions or other expressions:

if { = $foo 10 } { puts "foo is ten" }

Or

set foo [+ [* $bar 10] [- $beebop $doowah]]

Which is certainly a different take on things than most 'mainstream' languages. That radical simplification is, however, one of the ways that I used to save space in the interpreter.


Personally, I'm pretty happy with how Hecl looks, but I am sensitive to the 'marketing' argument: popularity helps, and this isn't the first time I've heard complaints about Hecl looking "funny" to people.

What do you think?

A) "I like Hecl just the way it is and wouldn't want to change it!"

B) "Hecl is quite useful, but I just want a mobile scripting language, the syntax doesn't matter much."

C) "I think the syntax is ugly, but I use it because I need an interpreter."

Also related:

1) "I don't care too much about code size. My current apps target N kb as an acceptable size."

2) "Small is really important. The smaller the better."

And:

I) "I don't care about eval, or being able to run human readable code on the phone."

II) "I really like the fact that you can download or even write code directly on the phone."

And finally:

X) "I don't care about midp1.0"

Y) "The fact that Hecl runs on midp1.0/cldc1.0 is important to me."

Now, I am not going to run off and change Hecl! Code that currently runs ought to continue to run, modulo some tweaks here and there, api changes, and the normal stuff. If I do something 'new', it would probably be a clean break (although of course code that could be reused would be), and will be in addition to Hecl, rather than instead of Hecl, because I would be working on the 'new' language as a day job. I do that with Hecl too, but not all the time, as I often have consulting/contracting work.

1 comment |

New Hecl Release

Posted by David N. Welton Thu, 31 Jul 2008 02:37:00 GMT

I've added a new Hecl release to the sourceforge site:

http://sourceforge.net/project/showfiles.php?group_id=122383

Although, as always, you're probably better off checking it out of subversion. We mainly do releases in order to focus on polishing things up just a bit, and as a way to promote Hecl by creating a reasonably stable release.

Some of the things that we've got working pretty well for this release include:

  • Google Android support.

  • Java reflection/integration - call Java directly from Hecl.

  • And of course a lot of numerous other little tweaks and fixes that crop up over time.

no comments |

An impressive amount of resources

Posted by David N. Welton Fri, 30 May 2008 11:53:00 GMT

In the TechCrunch coverage of Google IO, I was impressed by this:

Not every team has the resources Google does to build for every platform. Google is betting on browser over time for mobile devices; it will be the entry point for many applications.

But today, the only browsers capable for supporting mobile apps include iPhone and few others. So Google is developing Android, which includes world class Webkit browser.

Here at the world headquarters of DedaSys LLC (which for the time being happens to be "in front of David's computer, wherever that is"), we too have some suspicions about the browser becoming the platform of choice for mobile phones, although there is a big if:

When will the carriers make always on, cheap internet connections widespread?

Until that happens, client side apps will still probably dominate for many things. And of course for applications requiring hardware access, some kind of local program will be necessary as well for the foreseeable future. (And of course, Hecl is a good choice "for the time being", too!)

Coming back to the phrase cited above, what blows me away about it is the sheer amount of time and money that they're investing in something that "over time", they're not really betting on, in the sense that they just want browsers everywhere? Jumping into a market with a new "OS", toolkit, etc... just to spread a platform with a decent browser?

Wow. That is a company with a lot of spare change. Most people and companies in business are doing the best they can to stretch out their dollars or euros as best they can. I guess it really takes a behemoth to pour so much in the way of engineering talent and financial resources into something that's in some ways a bump in the road in terms of their long term vision. Or maybe I'm just reading too much into one phrase?

1 comment |

Neat Hecl app from newcomer

Posted by David N. Welton Fri, 16 May 2008 08:47:00 GMT

This is a cool little application, and a helpful tutorial for people trying Hecl for the first time. Since I know the system so intimately, people doing these kinds of pages are always a helpful reality check, pointing out where people new to the language hit stumbling blocks, and providing a guide for people who haven't "been there and done that":

http://lauri.ojansivu.googlepages.com/heclcommandlineapp

Thanks Lauri!

1 comment |

Hypothetical Hecl

Posted by David N. Welton Sun, 04 May 2008 01:54:00 GMT

I did some 'playing' with Hecl the other day, to see what it might look like if implemented in a slightly different way, and I thought I'd share what I was thinking about. Keep in mind that

  1. I haven't thought this through completely:-)

  2. It's not something I'm going to just rush out and do in the near future. It's definitely a Hecl 2.0 sort of idea.

My notion was to make use of the ClassCommand feature to have at least simple types be hooked directly to the relevant Java types, and dealt with through methods, rather than commands. For instance:

$i + 10

instead of

+ $i 10

Where $i is, in the first case, a Java Integer, rather than a Hecl type.

What it would be doing internally is something like this:

  1. $i is recognized as the object to act on.

  2. It's an Integer, so the corresponding ClassCommand is looked up and executed with + and 10 as arguments.

  3. The classcommand for Integer has a + method that accepts an argument, in this case, 10, which is added to the value of $i, and returned as a new Integer.

Without a "real" (where real also means bloated, memory and space hungry) parser, Hecl is never going to have a C-like syntax - you still wouldn't be able to do foo = 1 + 2 + 3 - but this just might make a significant amount of people more comfortable with Hecl, which would be a good thing. You could do something like this:

set i 1

while { $i < 1000000 } {
    set i [$i + 1]
}

instead of

set i 1

while { < $i 1000000 } {
    set i [+ $i 1]
}

I actually built a really simple HeclInteger class that implements < and + as methods to Integer ObjectThings, in order to test out this idea, and it seems to run about as fast as the regular Hecl version.

I welcome any thoughts or comments on the idea.

no comments |

XML handling for Hecl

Posted by David N. Welton Thu, 24 Apr 2008 11:35:00 GMT

We received an interesting contribution to Hecl recently: Martin Mainusch put together a Hecl interface to kxml, and also sent in some demo code that fetches and parses weather forecast information. I thought it was pretty cool:

Hecl Weather Forecast

Note that it's not compiled into the default build, so you have to change a property from 0 to 1 and recompile, and...being new there might be some issues, but still, it's nice to have that to let people play around with simple "web service" type things that use XML. Of course, another strategy might be to have a 'proxy' server that fetches the actual XML, and returns a tagged Hecl list so that Hecl can parse it directly, but that requires a server and has more overhead.

no comments |

Hecl Jacta Est

Posted by David N. Welton Mon, 14 Apr 2008 07:35:00 GMT

I don't know if androids dream of electric sheep, but I've certainly been losing a lot of sleep over Google's Android, and am glad that the Android Developer Challenge is winding up, as I've been doing all Android, all the time for the past month or so.

I have greatly enjoyed working with Android, as it's much more capable than Java ME. It's still very much a work in progress, and only time will tell if Google and their partners are able to best current mobile programming systems... or if the web will simply obviate the whole thing, as it's doing in many other areas. Win or lose, I will continue to support Android as a platform that Hecl runs on, but in the meantime, I hope to go back and look at some less future-oriented code and get back to some Java ME work. More on that soon...

In any case, here's hoping that the contest judges see the value in bringing a scripting language to mobile phones! I also hope to see actual hardware soon, as I'm really looking forward to getting my own Android phone.

6 comments |

Mass customization of Android applications

Posted by David N. Welton Tue, 11 Mar 2008 14:57:00 GMT

As I mentioned in an earlier article, one of the goals for the Android port of Hecl is to make it as easy as it is to create Java ME applications:

  1. Write the script.
  2. Wrap it up and send it to the phone.

No "compiling" (well, none that's obvious or explicitly asked of the user, at least, as we'll see) or fiddling with build files or writing new Java classes or any of that.

We're still not there yet 100%, but I did managed to hack together a system that, from an original Hecl.apk, creates a new application that can be installed on the emulator. This is tricky, because Android looks at the uniqueness of the package and class utilized for the application, meaning you can't just rename Hecl.apk to Foo.apk and install it as a separate app. The emulator will overwrite your old copy of Hecl.

Here's what we go through to make this work. Be forewarned - big, ugly hacks that are not for the faint of heart follow. The command line isn't exactly beautiful either, but it beats all the individual steps that it replaces, as we'll see.

java -jar /home/davidw/workshop/hecl/jars/AndroidBuilder.jar -android \
    /opt/android-sdk_m5-rc15_linux-x86/ -class Example -label "Hecl Example" \
    -package my.example -permissions ACCESS_LOCATION,ACCESS_GPS
  1. The first thing that needs to be done is to replace the AndroidManifest.xml that is contained within our "template" application, that resides in Hecl.apk, a copy of which is contained within the AndroidBuilder jar file. Since the compiled version of the xml file is a binary format that hasn't been reverse engineered or documented yet, the best way to do this was to simply:
  2. Write out a new AndroidManifest.xml in our temporary work directory that uses our provided package name, label and class.
  3. Using the aapt command in the SDK, create a new, empty apk file, specifying the newly created xml file as the manifest file to use.
  4. Now we can extract the compiled version of the xml file, for later use.
  5. At this point, we extract a version of Hecl.jar contained within AndroidBuilder.jar to the temp directory.
  6. Now we need to generate some Java classes that correspond to the new package and class names that we've passed to AndroidBuilder. Ideally, I would have done this with some tools to write the byte code out directly, since the classes are so simple: all they do is subclass the Hecl and SubHecl classes so that methods fall through to those.
  7. But instead, I just write out the .java code and compile it.
  8. The two new classes get stashed inside the copy of Hecl.jar that we're working with.
  9. We now use the dx command to compile the entire jar into the classes.dex file that Android uses.
  10. Since Hecl.apk is just a zip file, we can replace the AndroidManifest.xml file and classes.dex file with the new files we have created.
  11. At this point, we rename the whole works, and move it out of the temporary working directory to the current directory.

Phew! That's a lot of ugly work. It's obvious that a lot of this should and could be handled in a less "brute force" way, but for now it gets the job done. The only thing left to do is replace the Hecl script, which is very easy:

zip -r Example.apk res/raw/script.hcl

This makes it possible to whip out new Android Hecl scripts without carrying around a lot of project infrastructure - all you really need is AndroidBuilder.jar and your script.

Naturally, all of this is very much a work in progress, so it may not work as advertised, and, given the mess that we go through, bugs are likely as well. Do report them if you find any, and have fun! In the future, it will be necessary to make it so that it's possible to add resources to the apk file with zip, and have them be available to Hecl applications, which was actually the focus of the previous article.

1 comment |

Older posts: 1 2 3