Speed cameras on motorways should be replaced with Safe distance cameras.

instead of having speed cameras set up to catch people “speeding” there should be cameras on the motorways to catch people not using safe distances, as cars driving too close to each other is more dangerous than going faster than 70mph (too fast is still a problem, and 70 mph is only too fast if you are too close)

So what I propose is to have a strip of motorway with cameras every mile or so that count up to 4 seconds with a display that the drivers can see (maybe 4 bars). if you pass the camera under the 4th bar then you will get a fine.

When a driver passes the camera the display for the car behind is reset to 0 and it counts up.

The main benefit is that this will work as traffic shaping in all traffic conditions, it will work at night when goin 120mph (warning of a previous driver infront of them) or at 20 mph in highly congested traffic (forcing smoother driving, and less stop and go)

Posted in Uncategorized

Bresenham’s algorythm in javascript

With the advent of HTML5 and canvas, old game programming techniques are going to be unearthed and taken out of retirement, one such technique is called bresenhams algorythm.

Bresenham’s algorythm is a line drawing algorythm, basically it is more or less what lineTo does in html5 canvas. So why would want to use that when the browser does that for you?

Well the basic reason is that in games you have to have an internal representation of what the screen is doing, for example comparing two lines to see if they intersect; now with bresenham’s algorythm you compare two arrays for matching elements. and you can test whether a point is inside a box or a circle, or any shape that you can distinguish the shape of using maths.

    function bresenham(x1,y1,x2,y2){

            // Initalize the math
            dx = x2 - x1;
            sx = (dx < 0) ? -1 : 1;
            dy = y2 - y1;
            sy = (dy < 0) ? -1 : 1;
            m = dy / dx;
            b = y1 - (m * x1);

               y = Math.round((m * x1) + b);
               x1 += (sx * 1);
            return pts;

The code above is an enhancement from this blog post

for a demo the actual code is making the green line. not the rest which is part of a future javascript game engine.

Posted in Uncategorized

Do Microsoft even have usability testers?

Have a look at this!!

It’s the age old and never changed (for good) “open with” menu.

Before Windows 7 it was even more anoying as, “choose a default program” was “let me attempt to look on the internet for 1 second to see if there’s an editor for this then tell you that I don’t know how to open it”

As you can see from my image i’ve put little suggestions, like replacing “choose a default program” with “choose a program”.

So here there should be three things they could do, “Recent apps that have opened this extention” and a tick icon for the default application to use. and if the application isn’t in the list then let me try and use an app from my program files.

Windows is riddled with anoyances left in from the old days that have never been tweaked correctly, yet they insist in changing the network settings pages but when you do want to changed something that matters you than have to delve into the old options that haven’t changed.

They should have just had a look at xp and gone through each screen and given it a 10% improvement, rather than a radical change to the interface that confuses people. smaller improvement to a system that the client knows how to use already are more welcome than radical changes, and it is generally a smooth transition in between products.

Posted in Uncategorized

Mass updates in rails console

I found this neat little trick in the console to mass update database information.

Just a one liner.

Company.find_all_by_user_id(nil).each do |c| c.user_id=1;c.save() end

If you have a shorter snippet I would like to hear from you.


Company.update_all("user_id"=1, "user_id=nil")
Posted in Uncategorized