TaskFlow – Simple GTD app for Nokia N900

Ever since I switched from Nokia E71 to Nokia N900 I started to miss my Mobile Task Manager app which was really handy Getting Things Done tool on the Java ME capable Symbian device.

Now that Qt people from Nokia released a preview of the Qt Web Runtime for N900 I was able to create a new simple task manager tool for my new phone in matter of hours. I like both KISS princible and GTD organizational method so I made the app as simple as possible: There are only four “folders” for tasks – Next, Someday, Archive and Shop. I tend to store my active tasks on the Next folder. Tasks that doesn’t have high priority go into Someday folder. Old tasks or tasks that are low priority go into Archive. Just because I used the Mobile Task Manager as a shopping list too I made a separate folder for listing the groceries.

TaskFlow - Simple GTD app for Nokia N900

On the technical side I was now able to use HTML5 client-side storage to persist the tasks. I wrote another blog post on that subject just to show how easy it is.

UI was easy to do and now I also took advantage of both portrait and landscape view modes. In landscape mode the toolbar is on the right side of the screen so that there are as much vertical space as possible for the tasks and in the portrait mode the toolbar is in the bottom so it is pretty easy to use with one hand for example when collecting items from shopping list.

You can download the widget here: TaskFlow.wgt

Posted in Software, Web Runtime | Tagged , , , , , | Leave a comment

Storing Objects to HTML5 Client-side Storage

Here is a handy tip on how to store your JavaScript objects into HTML5 client-side storage which is basically a simple key/value hashtable. You can easily store objects into a storage in JSON format.

W3C Development with TextMate and Chrome

Code that I’m using for storing the “Task” objects in my GTD app:

var jsonTasks = JSON.stringify( tasks );
localStorage.tasks = jsonTasks;

That’s it. That is quite easy and can’t really think of many languages where you can persist objects with only few lines of code.

Code that I’m using for retrieving objects from storage:

tasks = JSON.parse( localStorage.tasks );

I hope you find this helpful. It works great on Qt Web Runtime running on my Nokia N900.

Posted in Tips and Tricks, Web Runtime | Tagged , , , | Leave a comment

TwimGo Teaser – Maemo/MeeGo Twitter Client

What if your Twitter client would look like this? I’ve seen that only few iPhone apps take advantage of portrait view. I made it so that you can see more tweet details in the portrait view and even apply some actions like retweet or reply.

What do you think? Would you use a client like this? What features or user experience you’d like to see in the app?

TwimGo in landscape mode (selected tweet details shown on right). Sorry about the twisted Finnish date format :)

TwimGo in landscape mode

TwimGo in portrait mode – clear timeline view:

TwimGo in portrait mode

I have to say that I like it a lot :)

Posted in Software | Tagged , , , , , , | 5 Comments

Labyrinth Game with W3C Widget, Accelerometer API and Nokia N900

I’ve been crafting the W3C Widgets for Qt Web Runtime (WRT) from the day Qt guys released the version for my Nokia N900. I haven’t been so productive on any other platform.

This time I crafted a small game of Labyrinth. The idea of game should be pretty familiar to everyone. You’ll need to guide the metal ball to goal by tilting the game board. I made it so that on each level there is one hole more compared to previous level. Levels are created randomly.

My Labyrinth game for Nokia N900

On the technical side it was easy to use device sensor in JavaScript to track the tilt angles:

// Ball's acceleration
var ballAccX = 0.0;
var ballAccY = 0.0;

// Initialize sensors
wrtSensors = nokia.device.load("sensors");
wrtSensors.startChannel(callback, "AccelerometerAxis", errorCallback);

// Callback function for sensors
// The 2.5 is a magic number that felt good :)
function callback(data) {
	ballAccX = parseFloat(data.axisX) / 2.5;
	ballAccY = parseFloat(data.axisY) / 2.5;
} 

function errorCallback(err) {
}

The animation and simple ball physics are done in JavaScript timer:

// Initialize timer to be run on every 50ms
animate = setInterval("animateBall()", 50);

// Timer function contains most of game logic like
// checking if ball have reached the goal or hole.
// Ball movement and physics are also calculated here
function animateBall() {
	if(gameover==false && goal==false) {
		ballVelX = ballVelX - ballAccX;
		ballX = ballX + ballVelX;
		ballVelY = ballVelY - ballAccY;
		ballY = ballY + ballVelY;	

		checkLimits();
		checkGoal();		

		// Move the ball DIV
		$("#ball").css("left", ballX);
		$("#ball").css("top", ballY);
	} else {
		if(goal) {
			$("#gameover").text("Creating next level!");
			$("#gameover").show();
			clearInterval(animate);
			level++;
			setTimeout("reset()", 1500);
		} else {
			$("#gameover").text("GAME OVER!");
			$("#gameover").show();
			level = 1;
			clearInterval(animate);
		}
	}
}

Here is a small video of what it looks like in action on my Nokia N900:

There are still few known issues in the game:

  • It can create a level where goal is unreachable.
  • Another issue I’m having with the game is that I haven’t found out how the backlight could be forced to stay on. I wrote a question on Qt Web Runtime forum but haven’t received any answers. If you know how to do it, please respond to my thread.
  • It would be nice to have fullscreen mode in games like this. If you know how to create fullscreen widget, please respond to this thread in Qt Forum.

Finally, if you’d like to try it out yourself you can download the widget (ChromeBall.wgt) here.

Posted in Games, Qt, Software Development, Tips and Tricks, Web Runtime | Tagged , , , , , , | 2 Comments

Check Screen Orientation with jQuery in W3C Widget

Here is a small tip for your W3C Widget on how you can identify when screen orientation have changed.

Screen rotation tutorial

It’s simple to use additional JavaScript libraries in widgets so it makes sense to use something like jQuery in your widgets. You can do so by downloading the latest jQuery library from their site and adding that to your ZIP file as separate js file.

With jQuery you can add an event handler for the screen resize event. In the event you can easily check the window dimensions and with those you can define the screen orientation. This makes it easy to change the overall UI to match the landscape and portrait views. Like in some apps you may want to have your toolbar in left side in landscape view and on the bottom when on portrait view.

Here is the code how this can be done with jQuery:

<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Rotation Test</title>
  <link type="text/css" href="css/style.css" rel="stylesheet"></style>
  <script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
  <script type="text/javascript">

  $(window).resize( function(){
    var height = $(window).height();
    var width = $(window).width();

    if(width>height) {
      // Landscape
      $("#mode").text("LANDSCAPE");
    } else {
      // Portrait
      $("#mode").text("PORTRAIT");
    }

   });
  </script>
 </head>
 <body>
   <div id="mode">LANDSCAPE</div>
 </body>
</html>

You can download the whole widget here: Rotate.wgt

Here is a sample how widget works in action on Nokia N900:

Posted in Tips and Tricks, Web Runtime | Tagged , , , , | 1 Comment