martes, 28 de junio de 2011

Volvi a programar en mi "spare time": web_alert

Proyecto: web_alert
Objetivos: Divertirme, aprender y, en una de esas, sale algo útil.
Lenguajes: Python, obvio!

Queriendo meterme un poco con python+web, empecé un proyectito al que nombré "web_alert".

Primero lo armé versión consola y "on demand", luego la idea es que sea una especie de servicio web.

Qué haría? Fácil, toma como input urls que el usuario suministra y tags de interés que el usuario suministra, por ejemplo:

urls: http://barrapunto.com, http://www.lanacion.com.ar
tags: panchos, celulares, perros

La aplicación 'mira' esas urls, y genera como output links relacionados con los tags que le pasas como input y, te lo presenta donde vos le digas, por ejemplo:

mail, twitter, facebook.

Sirve? No se, pero que me voy a divertir, seguro. =)

P.D: Previews y el código en google, coming soon...

EDITADO: Este post estaba en planeta python y desapareció, jua! =)

jueves, 16 de junio de 2011

Advide from an old programmer

Advice From An Old Programmer

You have finished this book and have decided to continue with programming. Maybe it will be a career for you, or maybe it will be a hobby. You will need some advice to make sure you continue on the right path, and get the most enjoyment out of your newly chosen hobby.
I have been programming for a very long time. So long that it is incredibly boring to me. At the time that I wrote this book I knew about 20 programming languages and could learn new ones in about a day to a week depending on how weird they were. Eventually though this just became boring and couldn't hold my interest.
What I discovered after this journey of learning is that the languages did not matter, it's what you do with them. Actually, I always knew that, but I'd get distracted by the languages and forget it periodically. Now I never forget it, and neither should you.
Which programming language you learn and use does not matter. Do not get sucked into the religion surrounding programing languages as that will only blind you to their true purpose of being your tool for doing interesting things.
Programming as an intellectual activity is the only art form that allows you to create interactive art. You can create projects that other people can play with, and you can talk to them indirectly. No other art form is quite this interactive. Movies flow to the audience in one direction. Paintings do not move. Code goes both ways.
Programming as a profession is only moderately interesting. It can be a good job, but if you want to make about the same money and be happier, you could actually just go run a fast food joint. You are much better off using code as your secret weapon in another profession.
People who can code in the world of technology companies are a dime a dozen and get no respect. People who can code in biology, medicine, government, sociology, physics, history, and mathematics are respected and can do amazing things to advance those disciplines.
Of course, all of this advice is pointless. If you liked learning to write software with this book, you should try to use it to improve your life any way you can. Go out and explore this weird wonderful new intellectual pursuit that barely anyone in the last 50 years has been able to explore. Might as well enjoy it while you can.
Finally, I will say that learning to create software changes you and makes you different. Not better or worse, just different. You may find that people treat you harshly because you can create software, maybe using words like "nerd". Maybe you will find that because you can dissect their logic that they hate arguing with you. You may even find that simply knowing how a computer works makes you annoying and weird to them.
To this I have one just piece of advice: they can go to hell. The world needs more weird people who know how things work and who love to figure it all out. When they treat you like this, just remember that this is your journey, not theirs. Being different is not a crime, and people who tell you it is are just jealous that you have picked up a skill they never in their wildest dreams could acquire.
You can code. They cannot. That is pretty damn cool.

Fuente

miércoles, 1 de junio de 2011

El programador pesimista

Esto es algo que, si bien suena obvio, parece que no lo es porque, una y otra vez me encuentro con gente del "ambiente" que parece ignorarlo o, por lo menos, lo pasa por alto.

Todo el mundo Muchos programamos como si el mundo fuera de colores y los duendes con sombreros divertidos bailaran a nuestro alrededor.
Es decir, como si todo fuera a salir bien.

Y es por programar de esta forma, optimista que, uno se sobresalta y se rompe la cabeza cuando algo sale mal[0].

    posible duendes divertidos

  es sarcasmo Marge

El programador pesimista

Lo que propongo (o más bien, resalto porque estoy seguro de que esto no se me ocurrió a mi) es, programemos como si todo fuera a fallar.

Si lo que estoy escribiendo se rompe, cómo evito datos incongruentes? como le doy la posibilidad al usuario de arreglarlo él mismo? o cancelarlo? o volver a hacerlo?

Cómo escribo el código/comentarios de manera que, si falla o se rompe pueda arreglarlo fácil sin tener que volver a pensar todo de nuevo?

Cómo escribo ese mismo código para que, si hay un problema y lo tiene que arreglar un compañero (porque yo no estoy) lo pueda hacer sin problemas y entienda todo como si fuera yo?

Es decir, pensar en el peor escenario posible y, anticiparse con medias preventivas que, en el momento son hasta triviales, pero nos pueden ahorrar horas.

Posibles programadores pesimistas:




Framework web minimo

Estaba buscando algún framework web, chiquito y sencillo. Quería tirar código y que salga andando algo, fácil, sin instalar mucho ni configurar.
Se me ocurrió preguntar en la lista de python argentina[0].
Al instante, muchas respuestas y, una de ellas me nombraba web.py (que lo conocía) y otro más[1], que es el motivo de este post:


Muy zarpado. Lo primero que me cautivó:

"Bottle does not depend on any external libraries. You can just download bottle.py into your project directory and start coding."

Un solo archivo! Lo importo y, habemus web. Eso es lo que quería!

Luego, el hello world:

from bottle import route, run

@route('/hello')
def hello():
    return "Hello World!"

 
Cada vez se ponía mejor. Sintaxis clara y, una linda manera de resolver la relación url-código: Decoradores.

Creó que me enamoré =)
 


[0] PyAr
[1] Bottle