Thinking on hiring me?

Please read

Fernando Guillén

a Freelance Web Developer

cabecera decorativa

software development as an artistic expression

Archive for the ‘Ruby on Rails’ Category

Sábado, Marzo 5th, 2011

Coding in Berlin

Ruby Room

Today I have comeback from a five months isolation bubble of coding, partnership and teamwork in Berlin.

When I talked by phone with Markus for first time I didn’t expect how wonderful and grateful was gonna be to become the new member of his team.

I just was looking for a position that allow me to work among an small developer team and I found an excited startup very concerned in find the most talented people, I have spent half of a year surrounded by 60 very interesting and friendly people from more than 22 nationalities.

The multidisciplinary team

One thing SponsorPay has confirmed to me has been that it isn’t possible to success in an Internet entrepreneurship if you only focus in technology. From the 60 people of the Berlin SponsorPay’s team only 7 of us are programmers. The big weight of the business is carried by people attending the needs of our customers and users, people thinking in new business ideas, people measuring what is working and what isn’t, people talking to other people about us, …

Of course every of these departments depends in one way or another in our small techie team, as well as we depend in the plugs to work, is a very common mistake to don’t think even in the existence and the necessity of this people as much as the programmers.

You are very wrong if your think behind a successful website there is just code.


This last five months have been stressful and rewarding very just in the perfect balance. I feel like I have been doing anything else but work but in the same time I feel full and not empty.

In any case my stress feeling has never been produced because an slavery schedule or my bosses pushing me, all the opposite, the schedule is based in objectives and not in hours sitting down on the chair, an the objectives for every sprint are decide by all of us with especial respect for the development team previsions.

Technically the projects we are carrying are not specially complicated, the hard part is that every thing is in continuos movement and everyone in the team has to know and to understand what the others are doing.

We have become in a git warriors.

Another hard side of our technology is that it has to deal with a high work load, with an average of 150 requests/second and maximum peaks of 400 requests/second, we have to move any feet very carefully.

The Ruby table

So this is the situation: we are 7 people dancing together in a very dense and moody multiple choreography carrying cups in our hands under an storm trying to not any drop to touch the floor.

This is why they need good dancers and this is why they can be proud of the dance group the already have.

The European Style

Another thing I have felt in my professional experience in this wonderful city is the respect for the talent.

SponsorPay is a company with less than two years wich has already raised more than 10€ Millions of venture capitals.. And of course is not the only startup based in technology business that is protected this way by investors.

What is this money for? To build a good team, talented professionals. They know to obtain this costs money, they know they need it and they know that to choose a regular worked instead a good professional is never profitable.

Why isn’t this happen in Spain? Because there are not experienced business people carrying startups, so all the startups are carried by, possibly, enthusiastic people who is risking his own money to become an idea in a reality, but, sorry I say this, this is not enough. One of SponsorPay’s cofounders, and actual CEO, left his job as CEO of Telefónica Deutschland to push up an small company that was fighting in a very risky and futuristic business model.

When have you seen this in Spain? Do you imagine this guy taking the decision to change his very comfortable, and profitable, chair to put all his expertise and, even most important, all his contacts to drive a tiny and unknown company of uncertain future born in the hands of a twenty-something entrepreneur?

The summary of these last paragraphs is something that is becoming in a ‘meme’ lately: If you are a good professional and you want to find people that appreciates and respects your value run away from Spain.

So, what have I come back to Spain?, you will be wondering… because this and this. Besides, they have offered me the possibility to telecommute :).


But over all and the most important thing I have build in this Berlin experience has been a few really good new friends.

Domingo, Marzo 14th, 2010

Arduino: Phixter Visits, blinking a led each time your website receives a visit

 Arduino I’m in

PhixterVisits is a way to convert an user visit on your web site into a blinking led on your desktop.

I have received for my birthday present one of the most awesome presents a geek can received: an Arduino Workshop Kit.

The first experiment I did was, of course, a Hello World, and after that I build something I was feeling like doing for long time: blink a led when someone visits my website.

This is very useless thing, I know and I don’t care, I just think that when something happens on the web and it become in something real on my table this is kind of magic.

On the beginning was a very simple experiment and withing an afternoon I build an small Sinatra project that received requests with a numerical parameter, the Sinatra webapp sent a signal to an script on my computer through a socket, and my computer finally sent this numerical value to the Arduino that knew with led to blink on depending the value.

This was awesome, I could to hidden an ‘img’ html element on my website asking for an image that in fact was a request to the Sinatra webapp and then the rest worked by it self.

Finally I wanted to play a competition with my girlfriend, she has a very most popular website than mine is, and then I was thinking to do all this stuff much easier to configure so this is because PhixterVisits born.

PhixterVisits is composed for three layers:

Arduino Sketch and Circuit

This is the most simple layer. It is a simple Arduino sketch that opens a Serial connection with your computer waiting for numerical values from 1 to 11, on depending the value received the Arduino will send a signal to one of its digital output connections.

The circuit is also very simple as you can see on the ‘How to Install It’ section.

Local Server

The local server is also very simple but I’ve complicated it becoming what was a simple console script on a wxRuby desktop application so you can configure it and test it visually.

Web Service

Is a Rails application where you can register your self and configure what I call ‘Phixters’. The Phixters are composed by an ‘URL:Port’ address what is your local computer public ip and the port where the Local Server is listening. You configure a value for each Phixter. And finally you can copy a very small piece of html code that you have to paste on whatever place of your website you want.

This piece of html code is the one that hides the Web Service request on an image so when your user visitors are watching an image a signal was sent to the Web Service.

How To Install It

I suppose you have a few experience with Arduino, at less you have obtained to operate the ‘Hello World’ with Arduino.

The Arduino Layer

Download the Arduino Sketch and upload it to your Arduino controller.

Build the circuit as show in this draw.

Phixter Visits Arduino Sketch

On this draw and on all my tests there are only 6 leds but you can fill all the digital outputs with leds and they suppose to work. Put atention that the digital outputs 0 and 1 are not being used, that is because on the circuit there is printed ‘RX’ and ‘TX’ on this out puts and I didn’t want any serial communication interference (I really don’t know if this interference was going to happened).

For test it you can open the ‘Serial Monitor’ of your Arduino app and send numerical values like ‘1′ or ‘2′ or ‘6′, the corresponding leds should blink for while.

Local Server

Download the ‘Local Server’ wxRuby desktop application.

You must to have Ruby installed on your computer and also the ‘wxruby’ gem:

$ sudo gem install wxruby

Go to the directory you have uncompressed the ‘Phixter Visits Local Server’ app and run on console:

$ ruby wx_tcp_server.rb

Yo should see something like on this picture:

Phixter Visits Local Server off

You have to know the name of the USB port of your Arduino and replace the text box named ‘Arduino Serial Port’ with yours one.

Select a port where you want the Local Server listens, for example ‘20000′.

Push ‘listen’.

You should see something like this bellow:

Phixter Visits Local Server

If you want to test it you can push ’stop’ and play with the ‘Send test value’ buttons. If you click on these buttons a corresponding led should blink.

Press ‘listen’ again and let the Local Server listening.

The Web Service

Go to PhixterVisits, register your self and create a Phixter for your web site like this:

Phixter Visits Web Service create Phixter

On URL:Port you have to put the public IP of your computer (or whatever computer your Local Server is listing), the Port is the port you have said to Local Server to listen.

Look that I’m using the ‘’ service so I don’t have to take care of my non-static public IP.

You can create any number of Phixters you want, one of them could be for a different website, just take care you are using the correct ‘code’ of each one.

Very important also is that I’m not going to talk about how to configure the NAT of my home router. This is diferent on each router and is the same theory of ‘opening the ports’ for your emule. Although I’m not talking of this step, this step is very important and the Web Service won’t can talk with your Local Server if this is not well configured.

You can check the communication from your Phixter on the Web Server to your Local Server on your desktop computer by pushing the button ‘check’ as you see bellow:

Phixter Visits Web Service go to check

This will send a signal to the URL:Port configured on this Phixter sending the value indicated, if everything is connected and working a led will blink on your Arduino circuit and a Ok message will appear on the Web Server page.

The HTML code on your Web Site

Still on the Phixter Visits Web Site, go to the ‘code’ of your Phixter:

Phixter Visits Web Service go to code

Copy the code on the textarea:

Phixter Visits Web Service Phixter’s code

And paste it on some place on your web site, be intelligent here and don’t put it on a place that an image is not going to be loaded.

From now on each time your website is loaded this image will want to be loaded and a request will arrive to the Web Service which will send a signal to your Local Server which will send a signal to your Arduino which will make the corresponding led to blink.

What is next

The game now is to connect to the Arduino not leds but DC motors so when a signal arrive the motor will work for a while and then stop until the next signal arrive. The motor will move some kind of figure like a horse or something then the race can start.

Phixter Visits Horse Race

Also will be great not to depend on a computer to communicate with the Web Service, using a ethernet interface directly connected to Arduino could be great.

The Code

All the code of this project, even the the Phixter Visits Web Service is available on the Phixter Visits Github Repository.


Play with this code and instructions on your own risk, I’m a very beginner on all of this Arduino stuff and some problems could happen to your loved kit.


You can do whatever you want with the code, attributions will be grateful.

Creative Commons License

Phixter Visits by Fernando Guillen is licensed under a Creative Commons Attribution 3.0 Unported License.

Domingo, Septiembre 27th, 2009

Conferencia Rails 2009, just around the corner

 Conferencia Rail 2008

Another year, another conference, the conference that opened my eyes to the amazing word of Ruby, there on 2007, is just tuning the last details.

Conferencia Rails 2009, this year bigger, more impressive, with new venue, bigger organization team, more energy, and asking to the english spoken community  to meet us with talks.

This year I am not being to much helpful on the organization team, I know they are not missing me: a big and strong bunch of people is helping this year with new energy and ideas. I am on the register application support one more year. You can check the code and help sending patches here on the ConfRor2009 github repository.

As more news arrive to me about the Conferencia Rails 2009 more sad I feel, this is because this year I will not can assists to the event, I will be on New York on an weird adventure.

The Call for Papers is almost closed. Be hurry and propose your talk to Conferencia Rails 2009 on the registration app.

Domingo, Septiembre 13th, 2009

Coding on New York City

Coding on NYC

It’s done, I’ll be traveling with my angel to New York City next October. It won’t be a very short visit: 3 months. All the Autumn on New York.

I’m very excited, very stressed and very nervous, I know not one of this sensations is a pleasure sensation, but this is my way, I am a guy that likes to feel at home, and NYC is definitely not my home. But I know at the moment I’ll know where the bakery is and a good place to take a relaxing coffee I’ll start to feel at home.

This is a very great experience, a personal one, but I’ll like to turn it on an important professional experience too.

I don’t want to make telecommuting on NYC, I don’t want to work at home. I can to keep working for my actual clients on the same way I am doing it here on my house at Mallorca (Spain), but I need something different, I want to work close to other coders, I want to work close to New Yorker coders.

I have spoken with the managers of one of my most important actual projects, and the development team I am deeper working with: LaCoctelera, I exposed my concerns and they are absolutely agree with me, I have to take this opportunity, I will stop coding and committing for this project for a while, and on my return we will see if I am still helpful for them.

So now I have time, but I don’t have any idea if my skills will be desirable there on USA.

What I’m looking for is kind of simple: a Ruby on Rails project, with a development team of at least three persons, with hi coding level, comfortable office space, where a ten agile fingers and a bright mind could be helpful.

The money is not a problem, I’m chasing the experience and the knowledge I could acquire, so if your budget is not weight but your team is amazing I would be proud to work on it. The contract isn’t a problem either, as a Freelance I own my own software company, so this’ll be not a employment contract but a international companies relationship.

But if I can’t access to any kind of refundable job I am also opened to volunteer work.

If you know or are part of something like what I am looking for, please don’t hesitate to contact me.

Viernes, Agosto 28th, 2009

The Rails Rumble Experience

Software development is a box of wonderful surprises and the community I have found around Ruby on Rails is the most passionate I have never met.

The last crazy geek stuff I have been involved in was the RailsRumble. A contest where small web development teams have to show what they are able to build in only 48 hours. Of course the web framework to use is Ruby on Rails, which other can you use to implement something almost finished in only this bunch of hours?

The experience, besides being a technology challenge, is a very enriching personal experience

Our group was formed by Raimond Garcia, Felipe Talavera, Carlos Matallín and me.

RailsRumble Mallorca Team

Within a few days of cross mailing conversation we had an approximate idea of what we were gonna build. The 3 developers get together at my house in Mallorca, our designer and front developer, Carlos Matallín, could not enjoy physically the experience with us, but was on continuous contact through mail, skype and video conference.

The previous night was the discussion time.. a few cups of coffee and a lot of pen and paper, our idea was incredibly simple and could become something incredibly helpful, but it was full of small details and possible solutions that should be decided before work started.

Functional Paper Doc2am, Day D -2, Hour H -48, the time of the first commit, just a very concise file and go to sleep.

When I waked up in the morning my partner Felipe had already the server standing up and our most important tool working: the mail digester.

The day was very pleasing, not any pressure stressed us, our code was responding our expectations incredibly well, Raimond was concentrated on the integration test layer of our application, Carlos was sending us very correct designs time at a time, Felipe working here and there knowing all the stack of the application and me focusing on the mail parser. Time at a time we reset our bodies with a very cold dip up on our small swimming-pool.

At the end of the first day our application was working. Not on any casuistic worked well, but it was working.

The second and last day supposed to be only to correct details and test any problematic casuistics, I don’t know if it was for overconfidence or because the problems to resolve were too hard to resolve but the last commit was exactly at 2am on Sunday, that means Hour H on Day D.

The supposed objective of the RailsRumble is to convince the expert judges that our application developed on 48 hours is above the rest of them.. Our project was judged as the #57 of more than 200 applications. Not available to pass to the next level: the public vote. That suppose to mean that we failed. Nothing further from the truth. We built something very transgressor, very innovative and also very simple, we were congratulated for one of the most known Ruby on Rail gurus: Obie Fernandez, we enjoyed ourself a wonderful geek weekend and we have decided to improve the code and to expose it to the community to see if it becomes as helpful as we think.

And over all we were full up of new inspiration and energized passion towards our profession.

What was that we were working this weekend? … :), the new mailing bot to help your mailing list with informal votes: I’ll talk more concise about it on future post.

Miércoles, Abril 15th, 2009

Satanizando Java

(Esto lo tenía por ahí desde hace tiempo… )

Últimamente está muy de moda eso de satanizar los grandes lenguajes corporativos en pro de los lenguajes de juguete.

Llevo 5 años trabajando con Java y sabéis qué os digo: que me uno a ellos, vine aquí para divertirme y creo que para eso se necesitan juguetes.

Lunes, Abril 6th, 2009

Ruby on Rails, Scotland on Rails 2009

Un fin de semana en Edimburgo rodeado de amantes, curiosos y rock-stars de Ruby on Rails, además de un montón de colegas de profesión y pasión, no me lo podía perder: Scotland on Rails.

Gueto español en SoR 2009

El fin de semana comenzó el jueves con un curso de un montón de horas de lo que se esperaba fuera un acercamiento a RoR y se convirtió en curso avanzado de Ruby a base de demostraciones malabaristas de lo que con este lenguaje se puede hacer.

Allí estábamos Raul, Flype, Ray y yo mismo con la cabeza apunto de explotar. Todo el día en una especie de destripamiento de carnicero de las entrañas de Ruby.

Acabé con agujetas de tener la boca abierta.. bueno espera que la cierre para escribir estas otras 2 líneas. Nos acaban de mostrar una especie de trigers o callbacs que se disparan cada vez que incluyes un módulo o incluso cada vez que declaras un método de una clase. Pueden funcionar como filtros también.

OMG.. ahora nos acaban de mostrar una clase que inspecciona Ruby en sí mismo: ObjectSpace.

Todos los ejercicios que vimos están en un proyecto de github:

Los posteriores días transcurrieron entre interesantísimas charlas, otras no tanto, alguna otra en la que no me enteré de nada, chistes, gueto español, cenas, desayunos, paseos, cervezas.. una delicia vaya.

Unas de las partes de la conferencia con menos expectativas pero que resultó ser super interesante fueron las Lightning Talks. En ellas se hablaron de unas cuantas idas de olla, de varios generadores de back y de una gran premier: la presentación de RedCar, un editor TexMate-style para Linux desarrollado por un chaval que no aparentaba ni 20 años.

Los posteriores días post-conferencia fueron aún más dulces, acompañado de un ángel fui a visitar a un amigo en Glasgow que nos llevó de paseo por las highlands.

… Feliz de mi profesión.

PD: por cierto, terminé la conferencia siendo premiado en el sorteo de 250 libras en libros de O’Reilly :) .. que repartí gustoso con mis compañeros de gueto por mi imposibilidad de leérmelos todos antes de que se quedasen anticuados.

Jueves, Febrero 5th, 2009

Ruby on Rails, Agujero de seguridad en mi API xml

En uno de los pet-projects en los que ando he intentado construir todo un poco académicamente rollo RESTfull (o casi full :) ) y tal.

Pero lo que nos acomete ahora es que he intentado soportar en todas las acciones de controlador en formato .xml.. ¿para qué?.. pues no sé.. pero ahí que lo he dejado.. sin testear ni nada, por si acaso.

Resulta que el otro día me levanté inquieto por la mañana con el pensamiento de que las si se hacía una petición a una acción con el formato .xml la respuesta que le iba a llegar al cliente no me iba a gustar nada.. pero luego se me pasaba y me olvidaba.

Bueno pues la acabo de hacer, acabo de hacer la petición con el formato .xml y, confirmando mis miedos, la respuesta no me ha gustado nada. (no clckes.. no te va a funcionar :))

<activated-at type="datetime">2009-02-02T01:01:22+01:00</activated-at>
<activation-code nil="true"></activation-code>
<company-name>Mi company</company-name>
<created-at type="datetime">2009-02-02T01:01:10+01:00</created-at>
<id type="integer">103</id>
<name>Fernando Guillen</name>
<personal-web-name>mi web</personal-web-name>
<public-profile type="boolean">true</public-profile>
<remember-token nil="true">
<remember-token-expires-at type="datetime" nil="true">
Vaya texto guapo que pongo aquí:
Con varias líneas
y alert("hola");
<updated-at type="datetime">2009-02-04T18:52:21+01:00</updated-at>

En la respuesta están todos los datos del usuario 103.. ¡todos! hasta la password, aunque está cifrada.. y ¡¡el email!!.. y si hacemos:

Entonces es cuando casi me desmayo..

Alguien podría descargarse toda la base de datos de mi aplicación a base de peticiones .xml o usando ActiveResource.. ¿qué hago ahora?…

  • …¿Eliminar por completo el soporte .xml?
  • …¿Crear vistas .xml para sólo devolver los atributos públicos?
  • …¿Alguna manera de decirle al modelo o al controlador qué atributos quieres que aparezcan en el formato .xml?

Antes de liarme a postear de manera alarmista en éste mi blog, sin solución alguna que ofrecer, comenté estas inquietudes en la sagrada lista ror-es y aparecieron el señor Blat y Pablo Formoso al rescate con un buen par de links y sugerencias:

Estos dos links te enseñan a pasarle parámetros a las invocaciones del método .to_xml de tus modelos de tal modo que puedes poner en tus controladores cosas como esta:

format.xml  { render :xml => user.to_xml( :except => [:email, :crypted_password] ) }

Y así empecé pero no me acabó de convencer pues tengo miedo de olvidarme algún controlador y decido pasar la seguridad al modelo y sobrescribir el método .to_xml de la clase User. Pero los métodos para hacer esto que se sugieren por ahí son un poco tediosas con llamadas a Builder::XmlMarkup y vamos.. un rollo. Lo suyo sería trasladar la facilidad del :except y el :only a la sobrescritura del .to_xml y en los comentarios de este post tenemos una solución bien ingeniosa:

  alias_method :ar_to_xml, :to_xml
  def to_xml(options = {})
    default_except = [
    options[:except] = (options[:except] ? options[:except] + default_except : default_except)
    self.ar_to_xml( options )

Sobre todo fíjate en el truqui del alias_method para seguir permitiendo llamadas al comportamiento original del to_xml.

Si sigues los comentarios del hilo que te he indicado verás que las propuestas continúan hasta formar un solución polivalente que bien se puede convertir en un buen parche para Rails.

Domingo, Febrero 1st, 2009

Ruby on Rails, Paperclip y validaciones de dimensiones

Me he picado una extensión de Paperclip para porveer de validaciones de dimensiones para las imágenes adjuntas aquí la comparto contigo por si te resulta útil.

No he hecho un parche para Paperclip pues eso supone un gran esfuerzo en tests y demás y eso tendrá que esperar un poco.

Lo he organizado todo para que copies y pegues el código en un fichero en /lib y lo requieras desde el environment.rb con eso debería valer pero úsalo bajo tu entera responsabilidad :)

La extensión provee de dos nuevos validates:

  • validates_attachment_width
  • validates_attachment_height

Que se pueden usar con toda la convinación de opciones que el nativo ‘validates_attachment_size‘.

Por ejemplo:

validates_attachment_width :photo, :greater_than => 576, :less_than => 1000
validates_attachment_height :photo, :greater_than => 150, :less_than => 300
validates_attachment_width :photo, :in => 576..1000
validates_attachment_height :photo, :in => 150..300, :message => "file height must be between :min and :max pixels."

Tenemos por ejemplo la validación del ancho:

    def validates_attachment_width name, options = {}
      min     = options[:greater_than] || (options[:in] && options[:in].first) || 0
      max     = options[:less_than]    || (options[:in] && options[:in].last)  || (1.0/0)
      range   = (min..max)
      message = options[:message] || "file width must be between :min and :max pixels."
      attachment_definitions[name][:validations][:width] = lambda do |attachment, instance|
        if attachment.file? && !range.include?( Geometry.from_file(attachment.queued_for_write[:original]).width.to_i )
          message.gsub(/:min/, min.to_s).gsub(/:max/, max.to_s)

El código completo lo tienes aquí:  paperclip_validations_extended.rb.

Un ejemplo de tests y usos lo tienes aquí: paperclip_validations_extended_test.rb.

A mi me está funcionando.. y a tí?

Domingo, Enero 18th, 2009

Ruby on Rails, Passenger… ¡alucinantemente simpático!

Estoy instalando Passenger (aka mod_rails) en el servidor de staging porque es lo que está ahora de moda para poner aplicaciones Rails en producción y la verdad que empiezo a entender porque.

La instalación es super sencilla, se instala como una gema:

$ sudo gem install passenger

Que en realidad lo que instala es el instalador en sí, que se encarga de buscar tu apache, compilar los módulos, buscar posibles dependencias que falten, decirte como arreglar estas dependencias y finalmente explicarte como activar el módulo y como configurar el apache para activar tu primera aplicación rails.

Osea que más que un instalador es un tutorial super amigable y fácil de seguir.

Una vez todo instalado y configurado mi primer virtual host apuntando a mi aplicación Rails intento acceder a ella y salta un error, pero no es un error de esos feos, de casque total que no sabes lo que es y tienes que empezar a navegar por los logs para detectarlo, no.. el error aparece en forma de página web dispensada por el propio Passenger que te explica amable y elegantemente que no tienes Rails 2.2.2 instalado y el comando que debes ejecutar para arreglarlo.. super simpático.

Instalado rails 2.2.2 me salta otro error, debidamente capturado otra vez por el módulo y con varias explicaciones, posibles causas y consejos para resolverlo.. en este caso me falta el database.yml.. normal que no funcione.. pero lo increíble es lo majo que está siendo conmigo Passenger.

Arreglado esto intentamos volver a acceder a la aplicación.. pum! nuevo error, falta una gema.. no pasa nada Passenger también me sugiere “A required library may not installed. Please install all libraries that this application requires.”.

Error de acceso a BD, ups! Passenger no me ha dado feedback de esto, una simple pantalla blanca con un poco sutil “500 Internal Server Error“. Ha habido que acudir a los logs para detectar la causa.. un punto menos Passenger :)

Toma otro 500 en frío, no había corrido las migraciones, ya lo sabía, era para ver como se portaba Passenger, parece ser que una vez arrancada la aplicación ya deja de capturar los errores, una pena, con lo bonitos que los muestra.

La balanza se inclina muy favorablemente y estoy encantado con Passenger.

a Freelance Web Developer is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

Creative Commons License
Fernando Guillen's blog by Fernando Guillen is licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License.