My BLOG on DIY, Hacking and notes

This includes mostly useful information for myself and my BLOG about various free time projects. Which are currently mostly hardware and electronics hacks .

Besides this I'm fully occupied with programming the final parts of MPL, extending my software generation tools such as the precompiler. And finishing my PhD thesis text which is about Creating the integrated programming environment Multi Precision Lab using source code generation tools.

First time visitors, people with comments or questions are welcome to sign my guestbook . Some of my projects in my blog hit the masses like featuring binary clock and makezine featuring my Wii-remote hack resulting in 10000 new visitors on the day they appeared in my blog. Cya and have a nice day .

ArkaPong for android the legend has just begun

Written by Walter on 11/10/2013 15:13:00.

Allright yesterday got my first android game running.
It's going to be a rewrite of the arkapong game we made in the 90's targeted at android's first, then iphone's and ipads.

Now that I started this, I'm having so much fun doing it hope my next contract involves android development again. Android sdk is a breeze if you've got a long java background like me. It's also so similar to writing regular java apps or writing c++ qt apps that's it's a breeze. By using the canvas class this game should work on androids 2.3.x -> 4.x. OpenGL might give some more features and hardware accelleration but it would not work for all the older androids as most of the earlier models don't support the 2d accelerated features I need.

Together on the team is Jasper Nuyens from linux belgium who convinced me at Ohm 2013 to just go for it as he's capable of doing the PR work and also he just went ahead and ordered and found some sample pong demo with sources to start from (it was way buggy but it had a lot of features to give us a head start like playing sounds and whatnot).

Here is a small demo of the alpha version after 3 days of develoment:

So that's pretty smooth (actually the video is less smooth than the real thing here ). Next up will be more animations and specials.

The smartphone market and stores are booming business, let's hope we can make this a winner!

Simple fragment cache and some javascript ninja code for the win!

Written by Walter on 10/09/2013 15:43:00.

Today I decided to optimize one of our most complex pages.
It was long overdue. The view rendering was now taking a whopping 9 seconds and the javascript which dynamically added tri-state selects another +7 seconds or more on a slow pc.

1. Solving the server side view render time :
Basically we have a dynamic permission checker that iterates all controllers and actions and shows an overview for each role. Turns out after some profiling, fetching the actions from routes are not expensive it's rendering +500 checkboxes that screeches our rails app to a halt. Easy 5 min. fix was using a clever fragment cache like so:

<h1>Manage permissions</h1>

<% app_controller_actions, app_controller_paths = Permission.routes_hashes %>
<% permission_cache_key = Digest::MD5.hexdigest( app_controller_actions.to_s+app_controller_paths.to_s ) %>

<%= cache "permissions_#{permission_cache_key}" do %>

... complex view code iterating all controllers and showing the action checkboxes for each login role...


What's nice about this is that it will auto invalidate the cache if the md5 of the set we use to iterate over changes. So if any new controller or action is defined we immediately create a new cached copy. Ow yes and view render time now dropped to 120ms vs the original +9000ms

2. Solving the client side (jquery javascript). We also iterated each row of checkboxes and wanted to minimize/collapse it all (this turns out to not be so slow) what did take time was determining to show a custom label in case some checkboxes we're checked. This was harder to make faster but we could solve it in another way. By (ab)using setInterval we can simulate an asynchronous process. In more modern browsers the issue will solve itself easily with javascript workers. But for now you can use the following ninja scripting:


$(".select_all").updateTriSelect(); //nice and short alas this hogs the browser and locks it untill all elements are processed


unction batchUpdateTriSelect( inputList ){
var i=0, limit = inputList.size(), busy=false;
var processor = setInterval( function(){
if( !busy ){
busy = true;

//update a single tri-select
if( i < limit ){
element = $(inputList[i]);
updateSelectAll('controller'),'role') ); //updateTriSelect of single element but unrolled to shave a few milli seconds off...

if( ++i == limit ){
clearInterval( processor ); //stop processing, our list is updated.
busy = false;

}, 1 );

The net effect is the browser is responsive straight after the pageload and is processing in the background without disturbing the user experience. woohooo!

Acetone vaping my 3d printed yoda

Written by Walter on 19/07/2013 18:01:42.

Adventures in acetone vaping. My home grown 3d printers are well callibrated and tuned.
The yoda print quality is already really good. But can we make it better?

Printed yoda on WalleBOT v2.1:

Vaping yoda in a 20 dollar rice cooker (add few tea spoons of acetone, pop in your printed part, turn on cooker and wait 2 minutes):

Here's our printed custom Yoda after acetone vaping:

Bling bling

Check out shop will be open soon you can have
the same quality 3d printer at an unbeatable price. Kit assembly takes around 8hrs for a beginner...