Saturday, November 27, 2010

DebugPanel - Web 2.0 way of print_r()

DebugPanel - Web 2.0 way of print_r()

Target Audience

Novice and intermediate PHP developers who are debugging the code by inserting

print_r($var); // or
var_dump($var); // or
var_export($var);

Note: those who are using DBG, Xdebug, Zend Debugger or others, please ignore this "lame" script - it will only make you laugh.

Purpose

Most of PHP developers start debugging by inserting something like this in their code and seeing results on the screen.

$var = call_some_obscure_function();
print '<pre>'.print_r($var, true).'</pre>';

DebugPanel also outputs the variable contents on the screen, but not directly at the place where it's called, but in a window floating over your script output with many convenience features.

Feature list

  • Collect all variable dumps in one place.
  • Highlight the syntax a little (different variable types get different background).
  • Save screen space by toggling visibility of different variables.
  • Handle multidimentional arrays with ease.
  • DebugPanel is displayed with position: absolute which is not interfering with the output of your script.
  • Drag and drop DebugPanel so it will not cover important information on your screen.
  • Never get warnings that you are trying to send HTTP headers or set cookies AFTER outputting debug information.
  • Handle objects as easy as multidimentional arrays.
  • Use the included PHP profiler to find the slowest code block in your script.
  • Use the included server statistics module to know what's going on with your server.
  • Remembers it's position after dragging, giving you pleasant debugging time!

Wednesday, November 17, 2010

Elastic Feedback

I wanted to learn the animation features of jQuery and made the elastic feedback effect.
There's just a container DIV with a ball inside. The ball is made draggable, and once released it will elastically return to it's original position. The actual JavaScript code is amazingly short (thanks to the plugins).






Wednesday, November 03, 2010

Automobile Traffic Trains

Now that Prius III (they call it Prius 2010 in US) and some other new cars has the Lane Keep Assist (Wiki), Pre Collision System (Wiki) and Dynamic Radar Cruise Control why not combining them into a Active Dynamic Traffic Follow up System which would allow the driver to snore (joking) while driving as GPS navigation will know the route, LKA will keep your car straight and DRCC will make sure you follow the car in front of you?
Many cars equipped with Active Dynamic Traffic Follow up System would be chaining to each other, switch the lanes automatically (Blind Spot Assist) and get you to your destination without your effort.

This system doesn't require a lot of investment into the highway infrastructure itself, the road remains passive. It raises the safeness of the driving a lot - no risky maneuverers, it will keep the safe distance in all circumstances and will react in a split second instead of 1.5 seconds human reaction time.
One important thing to note: there must be a loud buzzer to wake the driver (can he be called a driver still?) when approaching the highway exit ;-).
It doesn't seem like a lot of work to me, all the components exist already - they only need to be combined in a central car computer.