Tag Archives: Apps

Golf scorecard for your Smartphone

Do you need to use your smartphone as a golf scorecard, try my Golf scorecard for Smartphones app. It is free and gratis.

For the user
Any smartphone should work (iPhone, Android, Symbian, WP). Please let me know if you have problems with a particular model. All data is stored locally on the phone, and you do not need to be online to use the scorecard (but you need to be online when loading it, as it is a web application). Data is preferably stored in cookies, but if you do not allow cookies it will try to fallback to local storage (which has not been 100% stable for me).

For curious developers
This application is built 100% using DHTMLX Touch framework and JavaScript. The style/layout is 100% default DHTMLX Touch – no CSS editing from my side. Also, no other JavaScript libraries (such as jQuery) has been used.

Simple JavaScript for old school programmer

Obviously JavaScript is a very relevant language in 2013. I have to admit I am an old school programmer. I know how to write command line programs, GUI programs, and CGI-style web pages (get/post-refresh-style). It is not that JavaScript and Dynamic HTML (as it was called years ago, when XHTML was thought to be the future) are very new technologies, but to an old school programmer it is a bit different from what I am used to. Many things are confusing about JavaScript… for example:

1. It does not really resemble other script languages a lot, and it does not really resemble Java either (less so than C or C#).

2. There are many examples on the web about how to fix cool stuff on web pages with JavaScript, but where to start if you want to understand the language itself and feel comfortable with it?

3. The “script” in the name could imply that it would be simple, perhaps a subset of Java. Wrong. It is not simple and is in many ways more powerful than Java.

4. Where to start if you want to do JavaScript without necessarily creating a web page at the same time?

5. Browser incompabilities and JQuery (and more) – how to know I learn JavaScript, not just some features of JQuery?

Anyway, I decided to do some practical programming with JavaScript, in the most simple way. I wrote simple static web applications with no server side functionality, and as little and simple HTML as possible. Just like simple command line or GUI programs with no I/O, that still do useful stuff. And, to make my applications a little bit more real and relevant, I had mobile targets in mind.

A simple calculator
My first app was a simple calculator. It uses very standard HTML, and JQuery. It is simply too painful to not use JQuery when it is needed. All I wrote is in index.html, just view source. The fascinating thing for an old school programmer is the way (global) variables work:

  1. In old web programming, any kind of state had to be maintained by passing parameters to the reloaded page – it really feels defiant that everything is still there after the user clicked a button.
  2. In old school programming, global variables were embarrassing, but here, just go on like we have not learnt anything since the BASIC era.

From this simple application I learnt how to use JavaScript at all and to use JQuery.

A link list
My second application is a simple list of links. Think bookmarks, but the oldest ones are on top, so you don’t end up wasting your time checking the same blogg twice the same afternoon. With this application I learnt to use cookies (via third party library written by Scott Hamper) to make a persistant list of bookmarks. I also learnt to manipulate HTML through JavaScript. Obviously the HTML design is a little too simple to be appealing, and I can imagine many improvements. But the result is still useful. Again, everything is in the index.html file.

A speed-distance-time calculator
Have you ever tried to calculate how long time it would take to travel 54km in 15m/s. Well, it is not hard math. Anyway, I wrote a little application, especially designed for mobile units with touch screens (but it works well on a computer too). I think my Human-computer-interaction teachers would cry if they saw it, but it works and I think it is a little cool. On the implementation:

  1. Everything is in index.html, again
  2. Uses the DHTMLX Touch framework
  3. Not a single HTML element within <body>, just the JavaScript code

I have tried it on iPhone and Symbian (as well as computers). I hope it works on Android too.

This application has very little to do with web programming, and is essentially a pure JavaScript application (using a library, of course). I think this is a fascinating way of delivering end user programs in the future.

Conclusions
Getting started with JavaScript is very simple (you just need a text editor and a web browser – I have been using Firefox and its standard functions for debugging JavaScript – very old school).

I think it was useful to avoid getting stuck in the normal challenges of Web (back end server, data, content) and focus on building a more traditional application.

I believe my applications (and similar applications) can serve as a base for more advanced JavaScript experimentation. Inevitable, to create something really useful, I need to look more into:

  1. Simple Server side, for persisting/sharing data
  2. Local storage (thinking HTML5)

I can appreciate JavaScript for its very straight forward syntax: you do not waste many bytes when you write JavaScript code.

Without being a LISP expert, I find similarities with LISP. I find myself having as many curly brackets in JavaScript as I had parenthesis in LISP – that might not be a good thing. But there is also no difference between compile time and runtime in the sense that all functions are created as your code is executed, and that functions are just data passed to the function keyword. If you are smart (?) you can write programs that rewrite themselves, kind of, I think 😉

I would say JavaScript is one of the worst possible programming language for beginners. It incorporates all advanced programming concepts imaginable, without making a deal about it at all. Shooting yourself in the foot is very easy, as is being confused by runtime errors. But, perhaps I am just old school – maybe JavaScript is very natural if you are not burdened with prejudice about that programming languages should work like PASCAL, just better.