Category > Programming

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

, , ,

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

Continue reading

, ,

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

Continue reading

, , ,

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

Continue reading

, ,

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

Continue reading

, , , ,

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

Continue reading

, , , , , ,

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

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

, , ,

[SOLVED] Uploadify and session problems

Uploadify is a wonderful plugin for jQuery that allows you to upload several files at once,  it does the uploads transparently  using flash (take a look at the demo on this link). In fact, the great advantage I see is not to be able to upload several files at once, this can be done by […]

Continue reading

, , , ,

New web for playing Flash games

I’ve been thinking of making a games website for a while. I’ve finally decided to go ahead and do a website with Flash games. The truth is, that lately I’ve been really busy with lots of things that have nothing to do with games, but this Saturday I needed to disconnect and  work on something […]

Continue reading

, , , ,

prev posts prev posts