Tag Archive > manso trick

Manso Trick: Pad a number with leading zeroes in javascript

I was missing a simple and elegant method for padding a number with leading zeroes in javascript.
A typical example of leading zeroes is when you want to show the current time and you want the time to be formatted like hh:mm. There is no problem when it’s 12:40, but when is five minutes past one, [...]

Continue reading

, , ,

Manso Trick: Detect the Operating System in PHP

There could be a lot of reasons to detect the OS in PHP, and I’m pretty aware that these reasons could open a discussion by themselves. Anyway, it could be useful to do some tweaks or optimizations, to run one commands or anothers, or simply  it can be useful as additional information for webmasters, developers [...]

Continue reading

, , ,

Manso Trick: Updating the order of a row in a table

This time, the article is not about javascript or PHP, but SQL. The idea of this article is to review different methods for updating the order of a row in a table (trying to touch only the row we want to change, keeping intact the rest of rows).
To start with a simple example, let’s say [...]

Continue reading

, , , , ,

Manso trick: how to force the browser to reload an image

It is not difficult to find yourself programming a beautiful AJAX web page and realizing you have to reload an image, because it has been changed in the server.
As you use AJAX  in your web site,  it is not desirable to make the user reload the page for just viewing an update image (not cool [...]

Continue reading

, ,