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

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


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.

Thursday, October 14, 2010

FloatBox (floating effect for <div> using CSS3 box-shadow)

I've been bored at the IPC10 so I've been playing around a bit and made a hovering floating box effect in JavaScript. This thing is dynamic so the screenshot is not so useful.

The script is using jQuery and Shadow animation jQuery-plugin. I had to fix the RegExp of the plugin to accept negative shadow offsets like this:

Friday, October 08, 2010

Alien rods invasion 2010 (skyfish, solar entities)

Repost from the Get Rich Blog: There are two types of people. Those who strive and those who don’t.

There are two types of people. Those who strive and those who don’t.

You should know the normal people. They go to their work, get their salary, meet with friends, drink beer and even watch TV. They even save some money for a vacation or hobbies but don’t have a Goal (capital G). They may have a goal to get better house, car, postcards collection…, but it’s not something they think of every minute. They just live with auto-pilot turned on. I don’t mean they are bad in any way, but they are not doing what other type of people do.

The striving people are not satisfied. They eager to change their life. While most of them eager for money, some eager for peace in the world or personal spiritual development. Those people understand that watching TV is not only killing time. They understand that working for some guy is like a permitted slavery. They understand what means to be independent - you can do what you want (legally), regardless of how much money you have or what your boss thinks (they don’t have a boss) or what their neighbours think.

I’ll try to estimate the ratio between those types of people. On average a company has 1000 employees (who knows more exactly?). So there is just one striving person in a thousand. It is likely the boss of the company (if he made the company from the scratch). Sometimes there’s noone.

There are also those who are in the middle. They understand (like striving people) but are not yet on the way to their Goal.

What kind of person are you?

Repost of the GPS navigation software ideas I had in 2007


This site is about a new PDA GPS navigation system called we-go. Why having another when there are already a lot? Read on...

Disadvantages of the existing navigation software

I started working on we-go because the existing software didn’t satisfy my needs:
  • They cost money
  • Their user interface is far from being user friendly
  • They are mostly 2D even when they display it on the pseudo-3D perspective
  • The maps get rarely updated
  • No way to use bitmap maps (aerial map of the region - Google Maps) or if there is one, then the combination of vector and bitmap data on the same screen is not possible.

Key features of we-go

I think navigation software can be much better:
  • It should be free
  • Maps should be updated as frequently as possible
  • 3D view is not a cool feature; it’s a visual aid for navigation. Think of a highway intersection where there can be even more than three lanes over each other. See how it’s displayed in pseudo-3D compared to the real 3D view.
  • User interface should be skin-able to allow for customizing the user interface for each individual user. This is the most important for navigation software because it’s used during the intensive traffic and the time necessary to perform an operation should be minimized.
  • Bitmap maps like those found in Google Maps could be layered over for even greater navigation hints.
  • A desktop version of the program with all the features of the PDA version should be available (.NET can help with it) for managing the data, route pre-planning and transfer of the collected GPS data (see next topic) to the server.

Tuesday, September 21, 2010

Displaying data from myTinyTodo somewhere else

For my project bug tracking I use myTinyTodo. One day I decided that it would be nice to show my todo list to the beta users of my project. So here's a simple class which is doing the job.

Monday, September 20, 2010

Three Prius Tricks

I'm am an owner of European Prius II (2006) and want to share some tips which I find useful, but which took me some time to grasp.

  1. You can go as fast as 182 km/h on Prius if you step on the accelerator (driving at 180) and then the road starts going downhill. It takes the system several seconds to adjust to reduced necessary torque and until then it keeps accelerating as if you're going up-hill leading to 182 (I did this several times already).
    You can get 181 km/h on the plain road by stepping on the accelerator, but that's not as interesting.
  2. Don't use "B" mode to regenerate more energy (I was doing it on every traffic light for half a year because of many contradicting posts in the forums). Read this and apply brakes gently to regenerate more. Use "B" mode only when going down-hill (that's the rare case when you should follow the manual and you will do it right).
  3. If you don't like Pulse&Glide technique then at least use Glide mode to reduce the breaking force when approaching a distant red light.
  4. Navigation without GPS applies to Prius II as well! I noticed it in the underground parking and the system information screen has some kind of bearing information (displayed in degrees) which, combined with distance traveled, can replace GPS for some short distances.
  5. How to get to the system information screen in Prius II - get to the display screen and follow the instructions here (it's not on the Navigation Voice screen, at least not in Prius II).

array_merge() vs array concatenation and array_merge_recursive_overwrite()

I never seem to remember all the differences and aspects of the array_merge() function and array concatenation (not even documented thoroughly). On top there is this array_merge_recursive() which behaves like array_merge() though.

To start with I’ll say that array() + array() (called array concatenation) is in general NOT the same as array_merge(). It may behave in the same way if your arrays have all keys different. In this case you get both function and operator return the same result:

Friday, July 30, 2010

Car of the nearest future

Recently I've been driving some couple of thousands km in a couple of days (from Frankfurt to Zadar to Scalea to Frankfurt) and you might know that 37 hours driving can be very boring. It's during this long boring time I was dreaming of what my car could become in the near future.

Here are my dreams listed in no particular order. Now that own Prius II and like it, I've taken Prius III as a base (pretty advanced vehicle, BTW) and thought of some extra features.

A couple of futuristic features which make Prius III a good base candidate for “the car of the future”:
  • It has a “Lane Assist” feature keeping you in the middle of the lane.
  • It has a “Smart Key” feature allowing you to open and close the car without touching you car keys.
  • It has a “Pre Collision System” which applies brakes when you’re about to crash into something.
  • An “Intelligent Parking Assist” which can park the car in the relatively narrow space automatically.
  • “Head-Up Display” like in the Jet Fighters.

Monday, June 21, 2010

CSS3 Full-Screen Gradient Flashlight (jQuery)

Want to share a small tech-demo which simulates a moving flashlight (spotlight) over your web-site (without using Adobe Flash). The light is following mouse cursor. Uses jQuery. See the screenshot and the corresponding code:

Friday, June 18, 2010

Prius as service car in Frankfurt

I'm a fan of Prius and live in Frankfurt. Fan pictures of service-Prii (Priuses).
Location: Alte-Oper Frankfurt.

Location: Sandweg.