<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Codigo Manso</title>
	<atom:link href="http://www.codigomanso.com/en/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codigomanso.com</link>
	<description>Programación, informática y tecnología</description>
	<lastBuildDate>Fri, 30 Jul 2010 17:19:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Manso Trick: Pad a number with leading zeroes in javascript</title>
		<link>http://www.codigomanso.com/en/2010/07/simple-javascript-formatting-zero-padding/</link>
		<comments>http://www.codigomanso.com/en/2010/07/simple-javascript-formatting-zero-padding/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 17:08:33 +0000</pubDate>
		<dc:creator>Pau Sanchez</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[formatting]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[padding]]></category>
		<category><![CDATA[truco manso]]></category>

		<guid isPermaLink="false">http://www.codigomanso.com/es/?p=907</guid>
		<description><![CDATA[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&#8217;s 12:40, but when is five minutes past one, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I was missing a simple and elegant method for padding a number with leading zeroes in javascript.</p>
<p style="text-align: justify;">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&#8217;s 12:40, but when is five minutes past one, you get 1:5, which is not what you would expect. You want it formatted like 01:05. The same happens with dates and in several other situations.</p>
<p style="text-align: justify;">Yesterday I found the best solution I&#8217;ve seen for this problem. Before that, let&#8217;s see possible solutions.</p>
<p style="text-align: justify;">Usually, needing only one zero, I would do something like:</p>
<pre><code>h = (h &lt; 10) ? ("0" + h) : h;</code></pre>
<p style="text-align: justify;">This is not bad at all, but is not elegant. The problem is, what if we want it to be formatted with 3 digits? Then, using the same schema, we can end up with something like:</p>
<pre><code>h = (h &lt; 100) ? ( (h &gt;= 10) ? ("0" + h) : ("00" + h) ) : h;</code></pre>
<p style="text-align: justify;">Man, this is ugly and unreadable!! Maybe it will improve with an if/else, but it will be bad anyway. Probably if you need to do something like that, you will create a function that will handle this problem and then, you will call that function saying you want h padded with 3 zeros. But there is another solution that does not require you to use or create such a funciton&#8230;</p>
<p style="text-align: justify;">Have a look for two digit and three digit:</p>
<pre><code>("0" + h).slice (-2);  // devolverá "01" si h=1; "12" si h=12
("00" + h).slice (-3); // "001" si h=1; "012" si h=12;"123" si h = 123</code></pre>
<p style="text-align: justify;">I don&#8217;t know what are you thinking after seeing this solution, but I got flashed when I saw it. Just amazing!</p>
<p style="text-align: justify;">Let&#8217;s explain what&#8217;s going on. The code above only concatenates the &#8220;00&#8243; with the number we want to format (e.g: &#8220;00&#8243; + 12 = &#8220;0012&#8243;) and then, we get the last three digits using the <b>slice</b> string function (that&#8217;s why you have a -3). Guess what? The last three characters are &#8220;012&#8243; which is the string we want.</p>
<p style="text-align: justify;">Of course this solution is not only limited to leading zeroes, you can use it with leading spaces, or whatever character you want.</p>
<p>Sources:</p>
<ul>
<li><a href="http://gugod.org/2007/09/padding-zero-in-javascript.html">Padding zero in Javascript</a></li>
<li><a href="http://dev.enekoalonso.com/2010/07/20/little-tricks-string-padding-in-javascript/">Little tricks: string padding in Javascript</a> of Eneko Alonso blog (originally seen here)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.codigomanso.com/en/2010/07/simple-javascript-formatting-zero-padding/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to get user-agent in Google App Engine using Python</title>
		<link>http://www.codigomanso.com/en/2010/07/how-to-get-user-agent-in-google-app-engine-with-python/</link>
		<comments>http://www.codigomanso.com/en/2010/07/how-to-get-user-agent-in-google-app-engine-with-python/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 17:23:18 +0000</pubDate>
		<dc:creator>Pau Sanchez</dc:creator>
				<category><![CDATA[Programacion]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[user-anget]]></category>

		<guid isPermaLink="false">http://www.codigomanso.com/es/?p=902</guid>
		<description><![CDATA[User-Agent tells which is the client application that is making the request. It tells if it&#8217;s a browser (and information which browser it is), if it&#8217;s a robot (for example a Google/Yahoo/Bing spider), &#8230;  In theory the string is present in all HTTP headers, no matter which client is doing the request, but it might [...]]]></description>
			<content:encoded><![CDATA[<p>User-Agent tells which is the client application that is making the request. It tells if it&#8217;s a browser (and information which browser it is), if it&#8217;s a robot (for example a Google/Yahoo/Bing spider), &#8230;  In theory the string is present in all HTTP headers, no matter which client is doing the request, but it might be ommited.</p>
<p>For knowing which is the browser the user is using, you should get the &#8220;User-Agent&#8221; string. For getting this string when programming in Python under Google App Engine you just have to include following line inside any  &#8220;get&#8221; or &#8220;post&#8221;  method which inherits from <em>webapp.RequestHandler</em>:</p>
<p><strong>self.request.headers['User-Agent']</strong></p>
<p>Another useful thing is to know the IP of the client who is making the request. This is even easier to do:</p>
<p><strong>self.request.remote_addr</strong></p>
<p>The IP can be used <a href="http://www.codigomanso.com/es/2010/05/geoip-en-google-app-engine/"> to localize geographically (commonly geolocalize)</a> to the one making the request.<strong><br />
</strong></p>
<p>Related links:</p>
<ul>
<li><a href="http://www.codigomanso.com/es/2010/05/geoip-en-google-app-engine/#content">Geolocalization in Google App Engine</a></li>
<li><a href="http://code.google.com/appengine/docs/python/tools/webapp/requestclass.html">Google  App Engine &gt; Python &gt; The Request Class</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.codigomanso.com/en/2010/07/how-to-get-user-agent-in-google-app-engine-with-python/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Max URL (or GET) length in Google App Engine</title>
		<link>http://www.codigomanso.com/en/2010/06/longitud-maxima-de-una-url-o-get-en-google-app-engine/</link>
		<comments>http://www.codigomanso.com/en/2010/06/longitud-maxima-de-una-url-o-get-en-google-app-engine/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 08:37:40 +0000</pubDate>
		<dc:creator>Pau Sanchez</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[gae]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://www.codigomanso.com/es/?p=894</guid>
		<description><![CDATA[I&#8217;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&#8217;ve been doing, the maximum length of a URL in Google App  Engine is 2048 characters.
So, if you are [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;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.</p>
<p>According to the tests I&#8217;ve been doing, the maximum length of a URL in Google App  Engine is 2048 characters.</p>
<p>So, if you are going to do a GET request on Google App Engine, make sure that the both the address and the data you are sending are less than 2048 bytes long.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codigomanso.com/en/2010/06/longitud-maxima-de-una-url-o-get-en-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GeoIP in Google App Engine</title>
		<link>http://www.codigomanso.com/en/2010/05/geoip-en-google-app-engine/</link>
		<comments>http://www.codigomanso.com/en/2010/05/geoip-en-google-app-engine/#comments</comments>
		<pubDate>Sat, 29 May 2010 07:34:45 +0000</pubDate>
		<dc:creator>Pau Sanchez</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[geoip]]></category>

		<guid isPermaLink="false">http://www.codigomanso.com/es/?p=885</guid>
		<description><![CDATA[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&#8217;t see why they are not offering [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">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&#8217;t see why they are not offering this to GAE developers (they offer a solution in the client side, if you want to use their javascript, <a href="http://code.google.com/apis/ajax/documentation/#ClientLocation" target="_blank">google.loader.ClientLocation</a>)</p>
<p style="text-align: justify;">Fortunately, this problem has two easy solutions.</p>
<h5 style="text-align: justify;">Solution 1: do a request to another server</h5>
<p style="text-align: justify;">You can do an HTTP  request to <a href="http://geoip.wtanaka.com/">http://geoip.wtanaka.com/</a> and this server will return the country code:</p>
<p style="text-align: justify;">For example, to know the country of the ip 72.14.235.121 you will only have to do a request to  <a href="http://geoip.wtanaka.com/cc/72.14.235.121"><code>http://geoip.wtanaka.com/cc/72.14.235.121</code></a></p>
<p style="text-align: justify;">If you want to know how to do this kind of requests, take a look to  <a href="http://code.google.com/p/geo-ip-location/wiki/GoogleAppEngine">http://code.google.com/p/geo-ip-location/wiki/GoogleAppEngine</a></p>
<h5 style="text-align: justify;">Solution 2: implement it in your own server</h5>
<p style="text-align: justify;">This is the solution I like the most. You just download the latest version of  <a rel="nofollow" href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz">GeoIP.dat</a> and you use it with the  <a href="http://python-geoip.googlecode.com/svn/trunk/pygeoip.py">pygeoip.py</a> library.</p>
<p style="text-align: justify;">Using it is as easy as:</p>
<pre><code>def getCountryByIP (remote_addr):
  GEOIP = pygeoip.Database('GeoIP.dat')
  info = GEOIP.lookup(remote_addr)
  return info.country</code></pre>
<p style="text-align: justify;">Please note that using the function I defined before will not be the best practice for this library. This library has been though to  load everything into memory, so they speed-up lookups. Each time <strong>pygeoip.Database</strong> is called, the GeoIP.dat file is loaded into memory, and as you might think, you only to do that once, otherwise it makes no sense.</p>
<p style="text-align: justify;">On the other hand, for the application I am developing, I only wanted to do one lookup, so it made no sense to load this file in memory. It just won&#8217;t speed up anything, and will load 1MB into memory.</p>
<p style="text-align: justify;">My solution has been to update this library to allow two modes of operations. The first mode behaves the same way the original library, it loads everything to memory and it will work better if you are going to do hundreds of lookups. The second mode is access to disk for each lookup. This mode will work better if you are only going to do  a few lookups.</p>
<p style="text-align: justify;">Here you have <a href="http://www.codigomanso.com/archives/python/pygeoip/pygeoip.txt">pygeoip.py</a> with the changes I&#8217;ve made. For convenience, you can use <strong>disk_lookup</strong>:</p>
<p><code>pygeoip.disk_lookup (remote_addr)</code></p>
<p style="text-align: justify;">This function works faster and consumes less resources but you have to use it when you want to do only a couple of lookups.</p>
<p style="text-align: justify;">I want to congratulate David Wilson, the author of this library, because it has been really  easy to implement all the changes and improvements (of course I&#8217;ve sent him an e-mail with the changes, but now is up to him to include them or not).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codigomanso.com/en/2010/05/geoip-en-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Python and utf-8: force_unicode</title>
		<link>http://www.codigomanso.com/en/2010/05/una-de-python-force_unicode/</link>
		<comments>http://www.codigomanso.com/en/2010/05/una-de-python-force_unicode/#comments</comments>
		<pubDate>Thu, 20 May 2010 19:15:16 +0000</pubDate>
		<dc:creator>Pau Sanchez</dc:creator>
				<category><![CDATA[Programacion]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[character encoding]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[force_unicode]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://www.codigomanso.com/es/?p=880</guid>
		<description><![CDATA[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 socket. I [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Character encoding is the worst thing ever invented. Hopefully somebody invented Unicode and UTF-8 and UTF-32.</p>
<p style="text-align: justify;">For me, UTF-8 is, and should be, the standard for saving and sending text strings all over the world.</p>
<p style="text-align: justify;">Programming languages (even Python) should only support UTF-8 as input, be it from console, from a file, or from a socket. I think I&#8217;m going to stop here, because each time I think on how languages support the different encodings I get sick.</p>
<p style="text-align: justify;">The point is that I think Python support of character encodings is not very good. Why? It is not smart enough to workaround simple concatenations, it throws exceptions constantly. I cannot have a good programming experience dealing with strings in Python.</p>
<p style="text-align: justify;">Probably I&#8217;m missing something about python, but I used to do str.decode(&#8216;utf-8&#8242;, &#8216;ignore&#8217;) where str is the string to be converted to UTF-8, but even using that sometimes I still got exceptions.</p>
<p style="text-align: justify;">Today, looking for a solution again, I found force_unicode on django framework. After doing some tests, it seems that it works awesome.</p>
<p style="text-align: justify;">I just wanted to share the code (slightly modified):</p>
<pre><code>def force_unicode(s, encoding='utf-8', errors='ignore'):
    """
    Returns a unicode object representing 's'. Treats bytestrings using the
    'encoding' codec.
    """
    import codecs
    if s is None:
      return ''

    try:
        if not isinstance(s, basestring,):
            if hasattr(s, '__unicode__'):
                s = unicode(s)
            else:
                try:
                    s = unicode(str(s), encoding, errors)
                except UnicodeEncodeError:
                    if not isinstance(s, Exception):
                        raise
                    # If we get to here, the caller has passed in an Exception
                    # subclass populated with non-ASCII data without special
                    # handling to display as a string. We need to handle this
                    # without raising a further exception. We do an
                    # approximation to what the Exception's standard str()
                    # output should be.
                    s = ' '.join([force_unicode(arg, encoding, errors) for arg in s])
        elif not isinstance(s, unicode):
            # Note: We use .decode() here, instead of unicode(s, encoding,
            # errors), so that if s is a SafeString, it ends up being a
            # SafeUnicode at the end.
            s = s.decode(encoding, errors)
    except UnicodeDecodeError, e:
        if not isinstance(s, Exception):
            raise UnicodeDecodeError (s, *e.args)
        else:
            # If we get to here, the caller has passed in an Exception
            # subclass populated with non-ASCII bytestring data without a
            # working unicode method. Try to handle this without raising a
            # further exception by individually forcing the exception args
            # to unicode.
            s = ' '.join([force_unicode(arg, encoding, errors) for arg in s])
    return s</code></pre>
<p>I am sure that if you have trouble dealing with strings in Python, as I was, you will appreciate and use this code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codigomanso.com/en/2010/05/una-de-python-force_unicode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mansofk: the super mega ultra lightweight js framework</title>
		<link>http://www.codigomanso.com/en/2010/05/mansofk-el-super-mega-ultra-lightweight-js-framework/</link>
		<comments>http://www.codigomanso.com/en/2010/05/mansofk-el-super-mega-ultra-lightweight-js-framework/#comments</comments>
		<pubDate>Tue, 04 May 2010 19:01:40 +0000</pubDate>
		<dc:creator>Pau Sanchez</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programacion]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[mooTools]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[js framework]]></category>
		<category><![CDATA[lightweight]]></category>
		<category><![CDATA[mansofk]]></category>

		<guid isPermaLink="false">http://www.codigomanso.com/es/?p=869</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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 or with other versions of himself, and, on top, I wanted a framework that was ultra lightweight and I wanted something that worked on IE6+, FF, Safari, Chrome and Opera.</p>
<p>After being tired of looking for this, I finally decided to do it myself, and honoring the blog I called it<strong> manso framework</strong>, <strong>mansofk</strong> for firends.</p>
<p>I got all that functionality in just 1.5 KB!!</p>
<p>The main features are:</p>
<ul>
<li>Easy to rename the framework to avoid collissions (with other frameworks or other versions of mansofk)</li>
<li>Chaining support</li>
<li>Dynamic load of external elements
<ul>
<li>Supports loading external CSS files upon request</li>
<li>Supports loading external JS files upon request</li>
</ul>
</li>
<li>Simple DOM manipulations
<ul>
<li>Select elements by ID</li>
<li>Add new HTML on an element</li>
<li>Replace the HTML of an element</li>
</ul>
</li>
<li>Support CSS manipulations
<ul>
<li>Get the current property of an element</li>
<li>Change the property of an element</li>
<li>Change several properties at once</li>
</ul>
</li>
<li>Simple CSS animations
<ul>
<li>Supports several attributes at once</li>
<li>Several parameters, supports changing the duration or the frames per second</li>
<li>You can choose the linear function and the cubic function</li>
</ul>
</li>
<li>Event support
<ul>
<li>bind</li>
<li>unbind</li>
</ul>
</li>
<li>AJAX calls
<ul>
<li>Using GET and POST</li>
<li>Support parsing XML data</li>
<li>Supports parsing JSON data</li>
<li>Supports getting plain text</li>
</ul>
</li>
<li>Super lightweight
<ul>
<li>3.3 KB minified</li>
<li>1.5 KB gzipped!</li>
</ul>
</li>
</ul>
<p style="text-align: justify;">You are all free to use this framework for whatever you want, but don&#8217;t blame at me if it fails (although bugs are welcome).</p>
<p style="text-align: justify;">Following you have the minified version using <a href="http://closure-compiler.appspot.com/home" target="_blank">Google   Closure Compiler</a> and the development version:</p>
<ul style="text-align: justify;">
<li><a href="http://www.codigomanso.com/archives/mansofk/mansofk-1.0.min.js" target="_self">mansofk-1.0.min.js</a> (3.3 KB for using in production, gzipped is just 1.5KB)</li>
<li><a href="http://www.codigomanso.com/archives/mansofk/mansofk-1.0.js" target="_self">mansofk-1.0.js</a> (11KB for using during development)</li>
</ul>
<p style="text-align: justify;">So&#8230;  that&#8217;s it!  I think it would be great to give you a demo, but right now I&#8217;m out of time, so I leave it for another day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codigomanso.com/en/2010/05/mansofk-el-super-mega-ultra-lightweight-js-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Running Google App Engine in Ubuntu 10.4 Lucid Lynx</title>
		<link>http://www.codigomanso.com/en/2010/05/google-app-engine-en-ubuntu-10-4-lucid-lynx/</link>
		<comments>http://www.codigomanso.com/en/2010/05/google-app-engine-en-ubuntu-10-4-lucid-lynx/#comments</comments>
		<pubDate>Mon, 03 May 2010 17:06:55 +0000</pubDate>
		<dc:creator>Pau Sanchez</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[gae]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.codigomanso.com/es/?p=863</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">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  <a href="http://www.codigomanso.com/es/2010/04/ubuntu-10-4-poner-el-boton-de-cerrar-la-ventana-a-la-derecha/" target="_self">reconfiguring things</a> or reinstalling packages.</p>
<p style="text-align: justify;">The thing is that right now I am developing an application using <a href="http://code.google.com/appengine/">Google App Engine</a> (GAE  for friends), and for not having problems when deploying the next version, it is recommended to use Python 2.5 when developing.</p>
<p style="text-align: justify;">As you might have guessed in the title, Canonical have removed the Python2.5 package from the latest Ubuntu Lucid release, so I cannot run the local  Google App Engine web server.</p>
<p style="text-align: justify;">Lucky me, after searching for a while on <a href="http://www.launchpad.net">launchpad.net</a> I&#8217;ve found a solution. There is a person that has created  <a href="https://launchpad.net/~fkrull/+archive/deadsnakes">python2.4 and python2.5 packages</a> for Ubuntu Lucid Lynx.</p>
<p style="text-align: justify;">The only think you should do is add the following two lines at the end of your   /etc/apt/sources.list</p>
<pre id="sources-list-entries">deb <a href="http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu">http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu</a> lucid main
deb-src <a href="http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu">http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu</a> lucid main</pre>
<p style="text-align: justify;">And finally run:</p>
<pre>
$ sudo apt-get update
$ sudo apt-get install python2.5
</pre>
<p style="text-align: justify;">And that&#8217;s it, you can now run GoogleAppEngine.</p>
<p>Interesting links:</p>
<ul>
<li><a href="https://launchpad.net/~fkrull/+archive/deadsnakes">Old Python  versions in Launchpad</a> (you can check on this website the packages and how to install them)</li>
<li><a href="http://www.python.org/download/releases/2.5.5/">Python 2.5.5  release page</a></li>
<li><a href="http://code.google.com/appengine/">Google App Engine</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.codigomanso.com/en/2010/05/google-app-engine-en-ubuntu-10-4-lucid-lynx/feed/</wfw:commentRss>
		<slash:comments>159</slash:comments>
		</item>
		<item>
		<title>Ubuntu 10.4: How to place the window close button on the right again</title>
		<link>http://www.codigomanso.com/en/2010/04/ubuntu-10-4-poner-el-boton-de-cerrar-la-ventana-a-la-derecha/</link>
		<comments>http://www.codigomanso.com/en/2010/04/ubuntu-10-4-poner-el-boton-de-cerrar-la-ventana-a-la-derecha/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 11:16:07 +0000</pubDate>
		<dc:creator>Pau Sanchez</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.codigomanso.com/es/?p=860</guid>
		<description><![CDATA[Ubuntu  10.4 is live. I&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ubuntu.com/">Ubuntu  10.4</a> is live. I&#8217;ve been using Ubuntu for around 4 to 5 years, and I am a pretty happy user.</p>
<p>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 of the window. I think 95% of the users are used to the buttons on the right side, and I don&#8217;t see the point on moving them to the left.</p>
<p>Anyway, I don&#8217;t like it, so I searched around, and I&#8217;ve found a quick and easy solution.</p>
<p>Press Alt+F2, then type <strong>gconf-editor</strong> and press enter. That&#8217;s for opening the configuration editor.</p>
<p>Once on this editor, in the item tree at the left, you have to look for this path  <strong>app -&gt; metacity -&gt; general</strong> and you doubleclick on the field named  <strong>button_layout</strong>.</p>
<p>Then, you have only to change the value field and put this:</p>
<p><strong>menu:minimize,maximize,close</strong></p>
<p>You save the changes, and voila!! all the windows reconfigured again!</p>
<p>Now all the windows show the minimize, maximize and close buttons on the right again <img src='http://www.codigomanso.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.codigomanso.com/en/2010/04/ubuntu-10-4-poner-el-boton-de-cerrar-la-ventana-a-la-derecha/feed/</wfw:commentRss>
		<slash:comments>71</slash:comments>
		</item>
		<item>
		<title>http_build_query implemented in Python</title>
		<link>http://www.codigomanso.com/en/2010/04/http_build_query-para-python/</link>
		<comments>http://www.codigomanso.com/en/2010/04/http_build_query-para-python/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 21:00:04 +0000</pubDate>
		<dc:creator>Pau Sanchez</dc:creator>
				<category><![CDATA[Programacion]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[http_build_query]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.codigomanso.com/es/?p=854</guid>
		<description><![CDATA[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 a [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I implemented a function in Python that mimics http_build_query function.</p>
<pre><code>##
# 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 a dictionary?
  if type (params) is dict:
    for key in params.keys():
      newkey = quote (key)
      if topkey != '':
        newkey = topkey + quote('[' + key + ']')

      if type(params[key]) is dict:
        result += http_build_query (params[key], newkey)

      elif type(params[key]) is list:
        i = 0
        for val in params[key]:
          result += newkey + quote('[' + str(i) + ']') + "=" + quote(str(val)) + "&amp;"
          i = i + 1

      # boolean should have special treatment as well
      elif type(params[key]) is bool:
        result += newkey + "=" + quote (str(int(params[key]))) + "&amp;"

      # assume string (integers and floats work well)
      else:
        result += newkey + "=" + quote (str(params[key])) + "&amp;"

  # remove the last '&amp;'
  if (result) and (topkey == '') and (result[-1] == '&amp;'):
    result = result[:-1]

  return result</code></pre>
<p>If you find the code useful, feel free to use it in any kind of software product, be it commercial or not <img src='http://www.codigomanso.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.codigomanso.com/en/2010/04/http_build_query-para-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Manso Trick: Detect the Operating System in PHP</title>
		<link>http://www.codigomanso.com/en/2010/04/truco-manso-detectar-el-sistema-operativo-en-php/</link>
		<comments>http://www.codigomanso.com/en/2010/04/truco-manso-detectar-el-sistema-operativo-en-php/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 09:36:39 +0000</pubDate>
		<dc:creator>Pau Sanchez</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programacion]]></category>
		<category><![CDATA[truco manso]]></category>
		<category><![CDATA[sistema operativo]]></category>
		<category><![CDATA[so]]></category>

		<guid isPermaLink="false">http://www.codigomanso.com/es/?p=779</guid>
		<description><![CDATA[There could be a lot of reasons to detect the OS in PHP, and I&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">There could be a lot of reasons to detect the OS in PHP, and I&#8217;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 or operations department.</p>
<p style="text-align: justify;">Anyway, we are all grown ups, so you know what you are doing. Now, imagine you need to know this. There are several ways (the more creative you are, the more ways you will find). The first way, and most simple and complete, is by using the <a href=" http://php.net/manual/en/function.php-uname.php" target="_blank"><em>php_uname</em></a> function. The php_uname is similar to the unix command uname, and with this function we can know the  operating system, the version of the OS, the release number, the host name, and the hardware architecture  (i386, amd64, &#8230;). It has all that you need <img src='http://www.codigomanso.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p style="text-align: justify;">On the other hand, if you don&#8217;t want to use this pretty command, you can directly use the PHP_OS constant, which only includes the operating system name, but in most cases will be enough (it is equivalent to call <em><strong>php_uname(&#8217;s&#8217;)</strong></em>).</p>
<p style="text-align: justify;">Now you can try these two examples:</p>
<pre><code>echo php_uname() . "\n";
echo PHP_OS . "\n";</code></pre>
<p style="text-align: justify;">The funny thing is that probably you would never need to know the OS, so you can skip the whole post <img src='http://www.codigomanso.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.codigomanso.com/en/2010/04/truco-manso-detectar-el-sistema-operativo-en-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
