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 [...]
Author Archive > Pau Sanchez
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 [...]
How to get user-agent in Google App Engine using Python
User-Agent tells which is the client application that is making the request. It tells if it’s a browser (and information which browser it is), if it’s a robot (for example a Google/Yahoo/Bing spider), … In theory the string is present in all HTTP headers, no matter which client is doing the request, but it might [...]
Max URL (or GET) length in Google App Engine
I’ve done some tests in order to evaluate what is the maximum length of a URL that the different browsers can handle, and I ended up with a restriction on the server-side. According to the tests I’ve been doing, the maximum length of a URL in Google App Engine is 2048 characters. So, if you [...]
GeoIP in Google App Engine
It is surprising to me that Google does not offer any service or method in Google App Engine to get the geographic location from a IP. This is something they have in tons of products, and offering this will be something really simple to do for them. I don’t see why they are not offering [...]
Python and utf-8: force_unicode
Character encoding is the worst thing ever invented. Hopefully somebody invented Unicode and UTF-8 and UTF-32. For me, UTF-8 is, and should be, the standard for saving and sending text strings all over the world. Programming languages (even Python) should only support UTF-8 as input, be it from console, from a file, or from a [...]
mansofk: the super mega ultra lightweight js framework
I needed a javascript framework that was able to change the CSS of the elements, that was able to do AJAX requests, able to load external JS and CSS dynamically, able to add or change HTML on the fly, able to handle events, able to do animations and able to avoid collisions with other frameworks [...]
Running Google App Engine in Ubuntu 10.4 Lucid Lynx
It is not new, it always happens the same to me. After I update my computer to the latest version of Ubuntu (in this case version 10.4) I always have to spend a couple of days reconfiguring things or reinstalling packages. The thing is that right now I am developing an application using Google App [...]
Ubuntu 10.4: How to place the window close button on the right again
Ubuntu 10.4 is live. I’ve been using Ubuntu for around 4 to 5 years, and I am a pretty happy user. From my point of view, the big problem I found on this release (which I just installed 5 minutes ago) is that they changed the window buttons from the right to the left side [...]
http_build_query implemented in Python
I implemented a function in Python that mimics http_build_query function. ## # Mimics the behaviour of http_build_query PHP function # This method can be useful for sending data to flash applications ################################################## def http_build_query(params, topkey = ”): from urllib import quote if len(params) == 0: return "" result = "" # is [...]


Español