Bobbie Smulders

Micro-virtualization

During a recent cleaning of my workstation’s operating system, I noticed that I had quite a few background applications running. These applications ranged from Apache, MySQL, PHP, GlassFish to some downloading applications. All of these applications are running all the time and clutter the file-system, the workstations’s performance and the launch-daemons. So what did I do about it?

I created a couple of small virtual machines. One to host Apache with MySQL and PHP, one to host my build-server, one to host my downloading applications. When I want to do some web-development, all I have to do is start one of the virtual machines and the server is fully functioning in about 10 seconds.

So what are the advantages of such a system?

  • Portability: I can easily copy these virtual machines to any of my workstations or servers
  • Seperation of responsiblity: Each virtual machine has its own purpose
  • Safety: I can return to a snapshot when I want to undo a certain change
  • Storage: It is very easy to move the application storage to a different location
  • Development: Extremely easy to use DTAP by cloning virtual machines

The only disadvantage is the fact that a virtualized server will use more resources compared to a background process, but I can easily turn off virtual servers when I don’t need them. With my usage, the virtual servers are a clear winner.

I want to give a few pointers on how I configured my system:

Read the rest of this entry »

Using the TomTom Live Traffic API

As of late, I’ve been commuting to work on a very congested part of the dutch highway network. I’ve been using the free online TomTom Live Traffic to see if there are jams on the motorways, major roads or secondary roads. To date, it is by far the best traffic measurement tool I stumbled upon. It updates every two minutes, also works inside cities and has the most accurate information.

I would have loved to use the traffic information for other purposes, like a nice widget or to gather statistical information, but the API appears to be accessible to large corporations only. So it’s time to pull out Firebug!

Read the rest of this entry »

Computer vision optimization when using Java

A while back, I wrote a blogpost about using computer vision techniques to play an automated game of pong. This was accomplished by scanning the screen for a white pixel and moving the mouse to this position.

In that particular blogpost, I didn’t really go deep into the optimization that can be done when using Java for computer vision. So this time, I’d like to try some techniques and benchmark them to find out how to shorten the execution time.

The benchmark is prepared as follows:

  • An image is loaded from disk
  • The benchmark timer starts
  • The image is converted to grayscale one hundred times
  • The benchmark timer stops
  • The image is written back to disk to manually verify the results

For each benchmark, a couple of variables are prepared:

  • imageO containing the original image as a BufferedImage object
  • imageN containing a blank target image as a BufferedImage object

Lets try some techniques, starting with a worst-case scenario:

Read the rest of this entry »

I’m an engineer!

I recently graduated from the University of Applied Science Utrecht with a Bachelor of ICT in Computer Engineering.

During the program, I specialized in Mobile Server-based Systems and I was enrolled in the minor Interactive Media Products

During my graduation internship of five months, I’ve developed a PhoneGap (callback/cordova) based mobile app using Sencha Touch to create GUI and application logic. For the server side, I used the Windows Communication Framework to provide a RESTfully API to an existing application.

Due to the NDA I can’t describe the details of this project, but I can tell I got a 9 (out of 10) for my graduation project.

So…. I’m an engineer!

New project: CaptureTheData!

I’ve recently started a project on GitHub called ‘CaptureTheData!’. The project is about using cheap and readily available sensors like GPS receivers, Wiimotes or cellphones to create a cheap vehicle data logger. This data can be viewed/analyzed in an interactive web-application using a customizable dashboard.

The following video demonstrates the features of the web-application:

Visit the project page on GitHub to read more about the project:
http://github.com/bsmulders/CaptureTheData

On a personal note, this project has been really great on improving my programming skills. Since I’ve started this project, I’ve learned a lot about:

  • Git, creating a repo, submitting proper commits, file diff
  • GitHub, setting up a repo, managing a project
  • GPL, how to use licenses on a project, how to obey the GPL license when including external libraries
  • MarkDown, creating files using MarkDown syntax
  • PHP, building a REST web service
  • C, setting up a project with a proper directory structure, using libraries
  • Make, creating a makefile using dependencies and including libraries
  • Shell scripting, create a shell-script to automate shell commands, using variables
  • Ext JS 4, creating a proper MVC application using models, stores, views and controllers. Using charts. Using external libraries
  • Firebug, how to use the Firefox plugin to analyze JavaScript, intercept HTTP requests, dig into data structures, parse JSON
  • SQLite 3, managing SQLite databases, indices, optimization of queries. Using them in C and PHP with libraries
  • Eclipse, using the JavaScript Development Tools, PHP Development Tools and C Development tools

I already had a lot of knowledge on interfacing with GPS receivers (using NMEA), cellphones (using the Hayes command set) and WiiMotes (using WiiRemoteJ) and have used this on various projects in the past. Applying this knowledge on one large project was very satisfying.

 

Remote Phone Control

After reading an article on Hack a Day about a machine that automatically pushes cellphone buttons, I set myself the challenge to create a more efficient way to tackle this problem.

My starting point would be the same: Have a camera monitor the phone’s screen, and a computer to control the phone’s keypad.

The difference I wanted to make was sending the key-presses using an RS232 or Bluetooth serial connection. This would eliminate the need for external hardware pressing the buttons, or the need for altering the cellphone by hot-wiring the buttons. This was a very simple task, all I needed was the AT Commands Online Reference. The phone I used (Sony Ericsson T610) supports the AT+CKPD command (Control Keypad), thus giving me the power to emulate the entire keypad over a serial connection.

The second difference would be on the graphical user interface. At first I thought it would be best to control the phone using the PC’s keyboard, but whilst developing I found out it would be better to be able to click the phone’s actual buttons using your mouse. I rewrote the key-press part, so when a mouse-click on the video-stream is registered, it translates the mouseX and mouseY to a certain button on the phone, and sends the corresponding key-press using the Bluetooth connection.

The end result: A live video-stream of the phone on your computer and being able to use your mouse to click the phone’s buttons within this stream. A demonstration:

Download source code (for Processing)

Note: The original cellphone button pusher also is an amazing piece of art. I get why the over-enginereerd method is chosen, and it is quite astonishing how it all worked out. This article is purely to demonstrate how it can done in a simpler way.

OSIRIS Email script

As it’s still not possible to receive an email when new grades are published on OSIRIS, I wrote a script that periodically retrieves my grades. When a change in my grade-list occurs, I automatically get an email with a list of my last fifteen grades.

I am using this script with full satisfaction for some time now, which is why I’m publishing it.

Download OSIRIS Email script v0.1

Notes:

  • A (web)server with PHP and cron is required
  • Use at your own risk
  • Read the comments in each file

31-05-2011 update: The latest OSIRIS upgrade breaks compatibility with this script. You’ll have to modify the source code in order to get it to work again. I might look into this myself.

19-02-2012 update: OSIRIS has implemented email functionality in the latest release. I will no longer support this script.

Minor “Interactive Media Products”

I’ve recently enrolled in the minor “Interacive Media Products”, which is taught by the Mediatechnology department.

Some YouTube clips I’ve created that have some affiliation with my minor:

Read the rest of this entry »

Automated game of Doeo using Java Robot class

Now that pong is fully automated, it is time to optimize.

First I switched to the game Doeo. The goal of the game is to move your mouse as fast over Doeos as possible. A fun game to use as an example for automation.

I also made a small performance enhancement (10 to 15 percent) by not using getRGB () from BufferdImage, but reading directly from an array. It does take some time to get everything into an integer array, but if that’s done, the for-loop is a lot faster.

Demo video:

The optimized code:

Read the rest of this entry »

Automated game of pong using Java Robot class

Using the Java Robot class, I have written a small utility that plays an automated game of pong against the computer.

It constantly monitors the left side of the game, and when a ball enters the field, it moves the mouse cursor to the position of the ball.

Demo video:

This is a simple introduction to image-recognition and mouse-movement in Java. Feel free to use the code, optimize or improve.

Usage of the RobotPong object::

  • Create an object using the coordinate of the part of the screen that needs to be monitored.
  • Start the object using the start() method, this will start the thread containing the object.
  • It is possible to run multiple threads, each playing their own game of pong.

For the game itself, go to

http://www.megafungames.com/games/flash_pong/

The code:

Read the rest of this entry »