La información infinita

Ayer me enteré de algo gracias a Internet que desconocía de alguien que conozco. El qué no es importante. Lo importante es que posiblemente hayamos perdido el anonimato. Buscar tu propio nombre en Internet es algo bastante común, que todo el mundo hace de vez en cuando, o eso dicen las estadísticas al menos…  ¡Si hasta puedes hacerte un perfil para que Google sepa qué enseñar cuando la gente te busca! El caso es que, si nos buscamos, o buscamos a algún amigo de la infancia, posiblemente nos salgan resultados. Y ya… Read More

Travelling salesman

One classic computation problem, the travelling salesman. Even if it’s quite simple to describe, it’s one of those hideous NP complete problems, the ones that are quite difficult to resolve, as the computation time needed grows greatly with the length of the data. On Programming Praxis they have proposed to resolve the problem using brute force, and using the closest neighbor (a simplification of the problem). I’ve created this program, in Python. The time spend on each is brutally different, specially as the number of cities grow. With more than 9 cities,… Read More

Crítica despiadada de “Todo va a cambiar” de E. Dans

Influido y presionado desde Twitter, he decidido leerme el libro “Todo va cambiar”, de Enrique Dans. Sinceramente, ha sido un suplicio, y la idea es hacer un resumen para que nadie más tenga que hacerlo… 😀 Primero, unas ideas preconcebidas. No me gusta nada Enrique Dans. Lo encuentro el paradigma del gurú de Internet que simplemente habla sin tener mucha idea, que intenta comunicar a base de repetir las mismas ideas que hacen otros, y con un sobramiento de sí mismo desmesurado. Hay un lugar para “los comunicadores”, gente que se encarga… Read More

Interesting Project Euler problem

There is one interesting problem to solve from the guys on Project Euler. I think that maybe there are some problems running a naive approach to the problem on the 2002, but right now, even a inefficient approach can give you results in not much time. I’ve made the following program in Python to measure the differences between a straight approach, and one using recursion and memoization. Looking carefully at the sequences, we realize that each time we get to a previous calculated number, we don’t have to recalculate the sequence again. So, doing… Read More

Deployment of Django project using CherryPy and Cherokee

Recently, we have deployed into a test production our latest Django project. Choosing which deployment to use it’s not easy, as there are a lot of different tools for the job, but as we expect some load on the system, we have been spending some time in getting a good deployment that will allow us to be confident on the grow of the system. After some research, we decided to use CherryPy and Cherokee. Why CherryPy? It’s pure Python, and easily integrated with Django. You can do it by yourself (it’s not very… Read More

Store standard output on a variable in Python

This is a great, hacky trick to get the standard output ( and others like standard error and standard input) in Python You can “redirect” the standard error changing the sys.stdout module with your own StringIO object. So, you can do something like Easy and very useful!   EDITED: Updated to make it work for Python 3.4