Category > manso trick

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

, , , , ,

MansoTrick: Convert 24h time string to 12h AM/PM format (Python)

Manso trick to convert from 24h time format to 12h (AM/PM) time format in Python def ampmformat (hhmmss): “”” This method converts time in 24h format to 12h format Example: “00:32” is “12:32 AM” “13:33” is “01:33 PM” “”” ampm = hhmmss.split (“:”) if (len(ampm) == 0) or (len(ampm) > 3): return hhmmss # is […]

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: simple strip HTML tags using Python

The idea is to make a simple function that strips all HTML tags on a given string. I know the following code might not seem the best code in the world, but keep in mind that I’m just looking for a simple function that does the job. def stripHTMLTags (html): """ Strip HTML tags from […]

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

, , ,