Tag Archive > truco manso

Manso Hack: Speedup Google App Engine SDK SQLite Database

I was trying to initialize a local database using the Google App Engine SDK, and I was going crazy. –use_sqlite parameter was not even solving my problem. Inserts on the database were really slow, like 10 per second. A nightmare. OK, ok, it is an SDK, it emulates the server… it is intended to be […]

Continue reading

, , , , ,

Manso Trick: Easy way to generate random hex string in Python

Generate a random string in hexadecimal is one of those things that you always have to do, from time to time. As far as I know, the easiest way to do this in python is to import uuid module and run the following code: uuid.uuid4().hex With the call above we have 32 hexadecimal characters string […]

Continue reading

,

Manso Trick: Getting the latitude/longitude from an address

For a project soon to be born (I hope), I’ve been doing a quick research for a way to obtain the latitude and longitude from a geographical address. For example, to determine the latitude/longitude from a totally random address like “Emerson Street, Palo Alto, California”  BTW, Hi Mariano! Thanks for the stay in USA last […]

Continue reading

, , , , ,

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 […]

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 […]

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 […]

Continue reading

, ,