Este es un saludo a toda la gente que nunca saludo, a las personas que
nunca saludaré y a los que no he saludado.
A aquella gente que me encuentro en el bus, cada día, y casi ni nos
miramos. A los que estan en la puerta del edificio, lloviendo y
pasando frío, y compartimos un cigarro de silencio. A quién lleva un
libro en la mano que he leído y me gustó, y podría pasar horas
hablando de él. Pero no nos decimos nada.
A un telefono que acabo de descolgar, y me he quedado mudo para que no
me vendieran enciclopedias ("hola buenas tardes" - han dicho). A los
que tengo al lado en un concierto de Mamá Ladilla.
A los que hacen guasas de Top Secret y Mucachada Nui en la mesa de al
lado en un bar.
A los visitantes silenciosos del blog,
Personalmente necesito empezar a decir "hola", porque por lo general,
el día a día me lleva al asco más absoluto. Mientras digo "hola", no
me estoy cagando en, ni arrepintiendo de, ni pensando si, ni
conspirando contra.
Hola.
Ala, aquí el temazo del dia. Estranged.
miércoles, 3 de marzo de 2010
sábado, 27 de febrero de 2010
Mastermind in scheme. Now with GUI!!

plt scheme has a wide collection of libraries, some bundled with the basic package, and some which have to be installed through PLaneT.
GUI library is from the first group, so if you have plt-scheme already installed (not mzshceme alone, but the complete suite, with drscheme and so) you already have everything you need.
WARNING: It seems there's some programming course in NY with an assignment related to writing a mastermind. If it's your case, please, do not use my code blindly. I'm a novice scheme programmer, and probaly, my code is not very idiomatic. Anyway, have fun.
I've been using the mastermind game as a toy project to learn scheme for the last month. And now, it even has a little GUI. I also have a solver in 5 tries (in the worst case) but I haven't embedded it yet in the GUI.
The process of writing GUIs using plt-scheme is easier than I thought. It's great to write little things (we could say it makes easy things really easy). I don't know how difficult it'd be to write a more complex GUI, for example, I haven't found any grid component. Only comboboxes, radiobuttons, buttons and text-fields.
The good part is that it's really easy to assemble these compoonents in layouts, panels, frames, and so. It's also really easy adding menus to windows.
Here follows a little code that lets you play mastermind, fully coded in scheme.
Btw, This is (more or less) what I used last wednesday at flibug meeting to show an example of GUIs in plt. I really enjoyed the meeting: Learning, sharing, having fun, and beers :) .There's some more info about the last flibug meeting in my last post.
viernes, 26 de febrero de 2010
lisperlang
This has been a frenetic week. It seems that flibug and Perl Mongers meet at the same week every month.
But first things first.
Monday: Erlang.
I attended to the first class of an introductory erlang course. For the moment, we only looked at erlang syntax (btw, it sucks), and some points of functional programming. Pattern matching, tail recursion, consing, lists, and some erlang's BIFs to manage lists (we have neither while nor for). I'll expand a bit more on erlang on a future post.
Wednesday: Flibug.
A small and familiar meeting. Thomas H. Marc-André L., Andrew B., Andy W and me. As always, we talked about what we are hacking on lately and did some lightning talks.
Thursday: Breakout && Barcelona Perl Mongers.
After $work, I went to borneo bar, the place where this month's Breakout was held. Some chitchat while having lunch with other smalltalkers, then some hacking, and at 20:00, we had a PerlMongers meeting.
You see... pretty busy week, isn't it? Well, in fact, at $work I've been busy too, reading about evolving graphs in genetic algorithms. I've done some literature fetching on GA parallelization.
Conclusion
My brain's gonna explode in 5, 4, 3, 2,.... Ah no, I'm just in coma.
Meta
Btw, when writing this post, I've started a new tiny tool which I called LinkAdder, that's just intended to add some common html links I insert over and over on my posts. Its repo is here. It's a very simple translator for now, but I have some ideas for it.
But first things first.
Monday: Erlang.
I attended to the first class of an introductory erlang course. For the moment, we only looked at erlang syntax (btw, it sucks), and some points of functional programming. Pattern matching, tail recursion, consing, lists, and some erlang's BIFs to manage lists (we have neither while nor for). I'll expand a bit more on erlang on a future post.
Wednesday: Flibug.
A small and familiar meeting. Thomas H. Marc-André L., Andrew B., Andy W and me. As always, we talked about what we are hacking on lately and did some lightning talks.
- I did my first lightning talk, about making GUIs using plt-scheme. A bit simple for the general level of flibug talks, but well, I think it's a good way to start doing talks. And probably, Thomas will do a talk next month on an alternative way to write GUIs in scheme. I'll post about it in a future post.
- Andrew B. talked about an app he did some time ago in OCaml to apply morphologic filters to images. Pretty interesting but I couldn't understand the details. All in all, I think I got a good overview and I got 'the message': "functional pays off more times than we think".
- Wingo showed us some interesting parts of guile code. Mostly the evaluator, and he explained us the multilevel scheme compiler/interpreter (c -> scheme -> scheme). He also showed us the guile-gtk bindings.
Thursday: Breakout && Barcelona Perl Mongers.
After $work, I went to borneo bar, the place where this month's Breakout was held. Some chitchat while having lunch with other smalltalkers, then some hacking, and at 20:00, we had a PerlMongers meeting.
- Alexm brought some round tuits for us. He explained some of his experiences at last FOSDEM.
- Esteve did a talk about FluidDB implementation and it's intended usage. Pretty cool stuff, and little by little, I think I start to understand the amplitude of the concept.
- Fxn ended the session with a talk on his Net::FluidDB module, and the difficulties he had to coerce floats,ints and booleans between fluiddb and Perl. He talked about some Perl internals I didn't know. And he's a great speaker, so it's always a pleasure to hear.
- It was probably the most crowded PM meeting I've been to. It was a really great meeting.
You see... pretty busy week, isn't it? Well, in fact, at $work I've been busy too, reading about evolving graphs in genetic algorithms. I've done some literature fetching on GA parallelization.
Conclusion
My brain's gonna explode in 5, 4, 3, 2,.... Ah no, I'm just in coma.
Meta
Btw, when writing this post, I've started a new tiny tool which I called LinkAdder, that's just intended to add some common html links I insert over and over on my posts. Its repo is here. It's a very simple translator for now, but I have some ideas for it.
viernes, 19 de febrero de 2010
Roboshop 0.01
This is an addendum to my last post on web scraping with perl and HTML::TreeBuilder. I've named the script Roboshop.Ok, I've rewritten the roboshop script. Now it's shorter, and more reliable (as reliable as a webscrapper can be)
So If you want code(you got it) (yeah, I know it sounds better with "if you want blog, you got it", but there's little chance I can make this pun, and AC/DC is cool anyway).
The site seems to send different html pages depending on some (unknown to me) variables.
So I analyzed the two variants. At present version (alpha 0.01) it just outputs an array with prices, but I'm in the process of making it cooler, and send me mails when it finds some interesting thing in the INTERNETZ.
Here you can see the use for HTML::Element look_down with chained calls to get the desired node. Apart from cpan, there's more info here.
I'm thinking about writing a WWW::Search subclass too. We'll see...
Btw, I don't understand why perl isn't syntax-highlighted when embedded in the blog. If you have any pointers, I'd be very happy to hear a way to solve that. Sorry for the inconvenience.
See ya in the next post.
Thanks for the shopped Artwork go to nabax. =)
jueves, 18 de febrero de 2010
Mi último sueño
De pequeño escribía historias imposibles y las acababa diciendo que el personaje se despertaba. Estaba bien la impunidad que daba el sueño, y la invencibilidad de la que disponías.
De mayor a veces me pasan cosas que al despertarme recuerdo, y hubiera preferido estarlas soñando. Pero no. Hay pruebas reales.
Entonces me doy la vuelta e intento volver a dormir, para soñar con la noche anterior, y mandar la historia entera al mundo de Morfeo. Pero ya no me duermo.
De mayor a veces me pasan cosas que al despertarme recuerdo, y hubiera preferido estarlas soñando. Pero no. Hay pruebas reales.
Entonces me doy la vuelta e intento volver a dormir, para soñar con la noche anterior, y mandar la historia entera al mundo de Morfeo. Pero ya no me duermo.
lunes, 15 de febrero de 2010
robots go shopping!

One way to go shopping is spending long afternoons walking among crowds. I imagine it can be less boring than I think but anyway... I've written a little perl program that finds cheap books for me, and mail me if there's any good oportunity. This makes shopping more fun for sure. :)
I've used HTML::TreeBuilder to parse the html. Yo'll have to take a look at HTML::Element too.
The site I'm parsing has changed three times since I started writing this script (2 weeks ago), so it will get outdated very soon, but well...
HTML::TreeBuilder can treat any given html as a Tree (huh, really? ¬¬ ) and lets you navigate through it in multiple ways. A very intuitive way to traverse a tree looking for some tag is using look_down. it accepts an even number of arguments, the first being an attribute name, and the next being the content you want to match.
For example here's a stupid code that extracts some tables from an html.
my $tb = HTML::TreeBuilder->new();The steps are really easy and this lib gives you the power to write web spiders fairly easy. If you're more fond of python, you can use beautiful soup (which has a smalltalk port too).
$tb->parse('file.html');
my $root = $tree->root;
my @res = $tb->look_down('_tag', 'table', 'class' , 'result');
say $_->as_text for (@res);
As the code is pure unstable crap, I'm not going to upload it for the moment...
OFF-TOPIC PS for last Saturday hardparty-ers: I'm still alive, well and kicking. Thanks, sorry, and good luck!
viernes, 12 de febrero de 2010
Suscribirse a:
Entradas (Atom)