jueves, 31 de marzo de 2011
Finalmente!
martes, 29 de marzo de 2011
I went to Pycamp 2011
I'm not a geek anymore.
I were, once: staying up late coding a feature, learning obscure programming languages, coding AI for trivial tasks. But I don't do that stuff anymore: I work office hours, I write little code outside my job, I'm even taking a course for BA in Sociology. I still read about technology and learn new stuff, but no more than any other one that loves its profession.
That's why, when a friend asked me if I wanted to go to PyCamp, I hesitated. I consider myself a Python newbie: I used it last year on my job and a few personal projects, but I'm conscious of how much I have to learn. I thought I didn't match the profile, that I wasn't so great. Just prejudice.
In the end, I said yes. I didn't know what we were going to do, except that it involved the snake's language. And I only knew one person. But the city convinced me: they say La Falda is beautiful this time of the year. :)
The first thing we did when we arrived was introduce ourselves. I confessed that I wasn't part of the Python group in Argentina and that I didn't even read the distribution list. A few laughed, and from that moment I was one of them. After all the introductions, I found out what I came to do: there were 20 projects, they asked me which of them interested me enough to contribute to them, and they left me to my own volition. There was a little project called peewee that captured my attention: we had to add support for MySQL (seemed easy enough), and Nassty, one of the two people on the PyCamp I knew, was there. So, I sited and started to code. Bah, I sited and saw leet coders set up a coding environment. In the end, I managed to contribute some code and gave a few suggestions here and there.
I finished early, so I talked with the rest of the crew and killed time in general. Everyone was cool, and they knew a lot. Around seven, I took a few juggling clubs someone brought and learned to juggle :D. That was a good sign: we were going to do geek stuff, but not *just* geek stuff.
The rest of the days were the same: contribute to a project for a while, and have a good time. One of the leet people that were there gave us a crash course in Twisted, and I programmed a chat server that censored you if you used the list of words you can't say on TV (George Carlin XD ). After that, I helped Ditto with the translation of Lalita's documentation to English (I did, like, 25% of the work), then I wanted to help with the i18n effort of pilas's API, but I had no idea what they were talking about. Instead, I took pyanola. They needed a GUI in pilas, but my lack of knowledge got the best of me again. I was lucky that San had a lot of patience. :)
I said I did other things besides programming. First, I went to the night clubs of the city, which were conveniently close to the hotel, with two other fellas. Unfortunately, most of the girls there had between 16 and 18 years old, so I felt I could be their uncle. What else I did: crash course on juggling, a guided tour through the Eden Hotel (a lot of Nazi history on those walls, really weird). the Eden Avenue (nice place), table-football minitournament, ArmageTRON minitournament, and a long list of et ceteras.
It was a cool weekend. Nueces, the guy that organized everything, did a pretty good job, he even found a bus for us poor lads that couldn't travel to our city because of the bus drivers' strike. There were a few people that weren't Python-savvy just like me, and they made us feel like one of the community. I'm satisfied with the people of pyar, so in the end, I joined the distribution list.
And this is how the road trip ends. FIN :P
P.S.: This is the English version of the previous post.
Fui al PyCamp 2011
Ya no soy geek.
Lo fui alguna vez: pasar de largo codificando alguna funcionalidad, aprendí lenguajes de programación raros, hice un programa que use inteligencia artificial para tareas triviales. Pero ya no hago esas cosas: trabajo en horarios de oficina, escribo muy poco código fuera del horario de trabajo, y en mi tiempo libre hago una materia de sociología en la facu. Sigo leyendo sobre tecnología y aprendiendo cosas nuevas, pero lo hago como cualquier persona que ama su profesión.
Por eso, cuando me preguntaron si quería ir al PyCamp, al principio lo dudé. Por un lado, porque me considero un newbie: usé Python el año pasado en el laburo y para algunos proyectos personales, pero soy consciente de lo poco que sé. Pensé también que ya no daba con el perfil, que no era tan grosso. Prejuicios.
Al final, dije que sí, de caradura. No tenía mucha idea de qué íbamos a hacer, salvo que tenía que ver con el lenguaje de la serpiente. Y sabía que no iba a conocer más que a una persona. Pero me convenció que se hiciese en La Falda, es una linda ciudad. :)
Lo primero que hicimos cuando llegamos, fue presentarnos todos. Ahí aclaré que no pertenecía a pyar y que nunca había entrado a la lista. Hubo risas, y a partir de ahí ya era uno más del montón. Después de las presentaciones, me entero a qué vine: habían 20 proyectos, me preguntaron en cuáles me interesaba colaborar, y después me dejaron a mi propia volición. Había un proyecto chiquito: era dar soporte de MySQL a un ORM (parecía accesible), y estaba metido Nassty, una de las dos únicas personas que conocía del evento. Sin más, me senté a codear. Bah, me senté a ver como los grossos seteaban el entorno de trabajo. Al final, me di maña para contribuir en la parte de SQL propias de MySQL, y sugerencias aquí y allá.
Como terminé temprano, me la pasé charlando con el resto de la gente y pasando el rato hasta la hora de la cena. Todos muy buena onda, y muy picantes. De hecho, alrededor de las 7, me puse a aprender a hacer malabares con unas clavas que había traido uno de los flacos :D . Fue un gesto alentador: si bien nos juntábamos a programar y hacer geek stuff, no significaba que era lo único que fuésemos a hacer.
El resto de los días transcurrió del mismo modo: contribuir a un proyecto de a ratos, y pasarla bien. Uno de los grossos del lugar nos dio un minicurso de Twisted, y programé un chat que te censuraba la lista de malas palabras de George Carlin, le siguió traducir con Ditto la documentación de Lalita al inglés (hice un 25% del laburo), después quise colaborar con i18n para la API de pilas, pero era super claro que no sabía de qué estaban hablando. En vez de eso, me puse con pyanola, donde, una vez más, mi carestía de conocimientos quedó en evidencia. Menos mal que San me tuvo mucha paciencia. :)
Dije que hicimos otras cosas aparte de programar. Para empezar, salímos a la zona de boliches (quedaba cerca :D ) con dos guasos, pero la mayoría de las mujeres de ahí tenían entre 16 y 18. ¡Así no se puede! Lo único que logramos fue llenar de olor a humo la remera de PyCon Atlanta. Otras cosas: curso de malabares y clavas, excursión al hotel Edén (con clases de física y química inolvidables), patear la avenida Edén (muy lindo lugar), torneito de metegol, torneito de Tron, y otros etcéteras.
Al final, fue un buen finde. Nueces, el que organizó todo, hizo un trabajo muy copado, hasta nos consiguió una Traffic que nos llevó ida y vuelta (los colectivos estaban de paro). Había un par como yo, que no eran picantes en Python, y a todos nos trataron como uno más de la comunidad. Quedé satisfecho con la gente de pyar, así que me terminé uniendo a la lista.
Así termina este road trip. FIN :P
miércoles, 23 de febrero de 2011
Remote screen using X
This is just too awesome to keep it for myself. I had an installation bundle for a Business Rules Engine, and it wouldn't allow to be installed using a console: it required a GUI. Pretty weird arrangement, since this would be deployed on a server, where graphical user interfaces are the exception, not the norm. Thanks to a friend, I got myself to use X for the first time.
IMPORTANT DISCLAIMER: DO NOT USE THESE INSTRUCTIONS ON AN INSECURE ENVIRONMENT! This was a quick-and-dirty approach because I needed it so.
On the server:
You'll need Xvfb and x11vnc. Xvfb will set a screen for the server, and x11vnc will allow it to be accessed through the network. Run these in order (if you are like me, you'll open three sessions, one for Xvfb, another for x11vnc, and the last one for the export and xterm, although this one is included just as an example):
- Xvfb :0 -screen 0 1024x768x16 &
- x11vnc -display :0 &
- export DISPLAY=:0.0
- xterm &
On the client:
You'll need a vnc viewer, I used vncviewer :P . Run it like this (remember to change "server-hostname" for the hostname or IP of the server):
- vncviewer server-hostname:0
And that's it! Using these instructions, I runned the installer, a Java desktop application, and everything went smoothly.
I like to close my posts with a quote, and here it is, from Emanuel Goldstein a.k.a. Cereal Killer, and it's exactly how I felt when I saw that xterm appear remotely:
I kinda feel like God!
martes, 1 de febrero de 2011
Littler twitter...
After this, I should have put the matter to rest, but it was too late. My mind was starting to brew a few ideas, and was thirsty of information. :D
Let's begin with some APIs: I downloaded these packages using easy_install %NAME --user (no pesky sudo here):
- http://cheeseshop.python.org/pypi/simplejson
- http://code.google.com/p/httplib2/
- http://github.com/simplegeo/python-oauth2
After, that, I installed python-twitter and I had all the source code and libraries needed to do a little exploration. But there's a catch (as usual): you must register your application and get your tokens in order to access some twits. Ah, well... I named my app "yate", "Yet Another Twitter Environment" and Spanish for "yatch". It needs a home page even if it's a client program... OK, GitHub to the rescue!
After that, you'll have your four vanilla-secret tokens. I just hardcoded them and downloaded my twits. You have a limit of 200 twits per request, so if you are a frequent twitterer you may have to work some magic out. Fortunately, I'm quite lazy so I only had 180 or so. Here's the code:
#!/usr/bin/python
import twitter
CONSUMER_KEY =
CONSUMER_SECRET =
OAUTH_TOKEN =
OAUTH_TOKEN_SECRET =
if __name__ == "__main__":
api = twitter.Api(consumer_key = CONSUMER_KEY,
consumer_secret = CONSUMER_SECRET,
access_token_key = OAUTH_TOKEN,
access_token_secret = OAUTH_TOKEN_SECRET)
my_user = api.GetUser("one_twit_wonder")
statuses = api.GetUserTimeline(screen_name="one_twit_wonder", count=200)
with open("out.txt", "w+") as f:
f.writelines([s.created_at for s in statuses])
This thing downloaded the creation date of all my twits. I had to format everything because I forgot to add line separators (yay for me). And then, it hit me: the timestamp format of twitter was quite ugly. If you want to convert it to something more palatable, do this:
import datetime
twit_dt_f = '%a %b %d %H:%M:%S +0000 %Y\n'
out_f = '%m/%d/%y\n'
with open("out.txt", "r") as i:
with open("clean_out.txt", "w+") as j:
for d_str in i.readlines():
j.write(datetime.datetime.strptime(d_str, twit_dt_f).strftime(reg_f))
Yeah, it's ugly, but it does the trick. You can replace out_f with a format of your choice. I choose that because our next step is... OpenOffice.org Calc. There are better ways to do this for sure, but I was tired. I pasted all the timestamps and worked with Calc the best I could. I would have liked that feature from Business Intelligence suites that converts dates into numbers, but I didn't have it, so I approximated it. I was 10 days short in the end, but it worked neatly.
Check out this graph:
You'll notice a few twits the first days: I was testing the Twitter API before it dropped basic authentication (ah, simple days...). I got bored and put the account to rest (after all, I didn't name it one_twit_wonder for nothing). A full year after that, my sister created her account, and started nagging me about how I didn't twit. I had gwibber on my Ubuntu box and publishing an update was one click away, so I started using it, mostly for syndication and sharing, just like Google Reader. Since that fateful day, I averaged a little bit less than an update per day. Klout tells me that eventually I'll post like crazy and turn into a conversationalist. Given my current apathy regarding Twitter and Facebook, I'll say Challenge Accepted. :)