Toda regla tiene una excepción? – La paradoja de la excepción

La paradoja de la excepción:

Si toda regla tiene una excepción, entonces, la excepción a la regla “toda regla tiene una excepción” sería una regla sin excepciones. Por lo tanto, no toda regla tiene una excepción.

Posted in es, funny, geek | Leave a comment

UnicodeEncodeError on Django uploaded files

This has been an error that’s been bugging me for months. For some reason in production settings only in the production server only, whenever a user uploaded a files with a non ascii filename, I’d get this error

UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 54: ordinal not in range(128)

And I was unable to reproduce.

Looking at the last line of the trace, it would be os.stat that would break, and none of my code would be involved, nor the database driver so it seems to be a file system issue.

The system’s locale:

LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=

After a lot of wandering around, I ended up on Django’s documentation in the Apache Additional tweaking section, even though my application is running under fastCGI. and I foudn this:

export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'

It turns out that LC_ALL does not have a value. I added those two lines to my fcgi launching script, and problem solved!

Posted in django, en, programacion, Python, tech, web | Leave a comment

Disqus coments UI

I really like Disqus comments service. But I wish they had a simple UI alternative, as I don’t want to show that much text/options in my screen.

This is what it looks like by default:

I would hide the “suscribe”, “RSS”, “Trackback” options, into a “advanced” (or something more explicit) section that is collapsed by default. The comment sorting does nothing for me and I wish I could choose to remove that option. Same with “Communiti box” and remove the duplicate “login” link and Discus logo that works as a Login menu, leaving only one.

Here’s what I’d like:

Proposed simpler Disqus screen

Posted in es, geek, web | Tagged | 3 Comments

CSS3 gradients in Webkit

I’m just writing this to record a shorthand answer to a doubt I had.

Old format Webkit gradients only support percentage color stops

Recently, Webkit added support for standards CSS3 gradients, so your syntax will be the same for different engines (with different prefixes of course).

This means that you can now set various color stops at different pixels instead of % of the container.

background-image: -moz-linear-gradient(top, rgba(0,0,0,0.5) 0, rgba(255,255,255,0) 80px);
background-image: -webkit-linear-gradient(top, rgba(0,0,0,0.5) 0, rgba(255,255,255,0) 80px);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgba(0,0,0,0.5)), color-stop(80px rgba(255,255,255,0))); /* BREAKS */
background-image: -o-linear-gradient(top, rgba(0,0,0,0.5) 0, rgba(255,255,255,0) 80px);
background-image: linear-gradient(top, rgba(0,0,0,0.5) 0, rgba(255,255,255,0) 80px);


gradients test

Posted in css, en, html, programacion, web | Tagged | Leave a comment

Mogrify using too much memory

I wanted to shrink pictures a folder with thousands of files. They were unnecessarily huge. So I made a script to resize them.

Imagemagick’s mogrify takes all the RAM it can in the system to handle huge files, making the system unusable. Luckily it has a -limit option so it behaves. Use it like this

mogrify -limit memory 32 -limit map 32 -thumbnail 12801280 -quality 70 filename.ext
Posted in en, geek, linux, programacion, tech | Tagged | Leave a comment

Sobre mousepads

Este es un tema que siempre me ha interesado y por el que me he preocupado bastante. El mercado ofrece mucha variedad y siempre me ha gustado poder compararlos.

Hoy tuve la oportunidad de comprar dos de los modelos disponibles en RadioShack

  • Teraware Mouse pad
  • HandStands Mouse mat

El pad Teraware es de un gebe que parece silicona muy pegajoso por lo que se adhiere muy bien a la mayoría de superficias, sea vidrio, madera, melamine, etc.

El mousepad de HandStands es de un formato mas tradicional los que vienen con una fina malla de tela sobre una espuma plástica, no se adhiere a la mesa tan bien como el Teraware pero lo hace suficientemente bien para no ser un problema.

Yo siempre tuve preferencia por los pads con superficie de malla a diferencia de los que tienen superficie plástica que muchas veces son sólo decorativos, su principal problema siendo que su superficie dura y rugada hace que se acumule fácilmente la suciedad y se traslada al mouse incrementando rápidamente la fricción.

La desventaja principal de los pads de tela es que absorben el sudor de las manos y pueden quedar húmedos lo que los hace muy desagradables de compartir además que en el tiempo puede llevar a temas más desagradables.

Teraware Mousepad

Teraware Mousepad TeraWare Mousepad Teraware Mousepad

En el video se puede ver que hay demasiada fricción con este mousepad, lo que lo uso inutilizable. El gebe es tan pegajoso que el mouse se queda pegado y cuesta mucho arrastrarlo, además la porosidad de la superficie es muy irregular para mi mouse laser lo que hace que hayan pequeños saltos, inaceptable.

HandStands Mousemat

HandStands mousepad HandStands Mousepad HandStands Mousepad

Se puede ver acá como desliza el mouse con más facilidad, así que me quedo con este.

En el interín que estuve sin mousepad, acudí al papel bond, es muy bueno, muy barato y ayuda a limpar el mouse.

Posted in Forgot to categorize | Leave a comment

Búsqueda en Google de “PPK”

Resultados en Google de PPK

Si buscas por Pedro Pablo Kuczynski si encuentras resultados correctos :P

Posted in Forgot to categorize | 1 Comment

Cosas nuevas en Firefox 4


Hoy salió a la luz Firefox 4 y trae muchas cosas nuevas, entre las más importantes:

* Soporte HTML5
* Motor Javascript más rápido
* Firefox Sync
* Tab panorama
* Nuevo look
* Complementos y temas que no necesitan reiniciar
* Mejores herramientas de desarrollow, Consola web
* Mejoras en el manejo de tabs, awesomebar, tabs de aplicaciones.

Posted in es, firefox, geek | Leave a comment

Magenta CSS

When setting a background color always set a foreground color

I like to use a white over black GTK theme in Linux, it looks like this:

GTK Darklooks

Which can be a problem when websites are not styled properly by setting only either a background or foreground color making the controls unusable under certain system configurations:

To prevent that, I just made Magenta CSS. It is a CSS framework that will turn all elements’ background and foreground color to magenta so you can see when you forgot to style something.

To use it, simply add magenta.css before your site’s main CSS, it can be either before or after your reset.css.

Magenta sample page


I know that there’s only a very small set of cases when using braindead css patterns results in unusable controls. The specific case being Firefox, Webkit browsers automatically set input’s default background to white. But I use Firefox and I set inverted colors in my system. That’s whey I had to come up with this ;) .

Posted in css, en, geek, html | Tagged , | 1 Comment

Happy PI day!

PI from Wikipedia

I’ve got to learn my decimals again, shame on me!

Posted in en, geek, math | Leave a comment