Thinking on hiring me?

Please read

Fernando Guillén

a Freelance Web Developer

cabecera decorativa

software development as an artistic expression

Archive for the ‘orgullo artesano’ Category

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 README.md 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: LetsDecide.us. I’ll talk more concise about it on future post.

Miércoles, Agosto 12th, 2009

OneOfZombies a brutal stupid 2D game

OneOfZombies is an experiment proyect.

Don’t come here looking for game development knowledge or very pretty Ruby code design. This is just me playing with Ruby and with Gosu.

After a few weeks working and studding on my free time I can show you this brutal stupid 2D game.

This is not a quality project, this is not a professional stuff.

I am just enjoying my self and having fun, and by the way I hope you will have fun too!.

The game is very stupid, and the code is very ugly and dirty, I just wanted to test the Gosy library, and I have not experience on game development.

It is the first time I put my self on a pure Ruby project with more of one class. I have had such an experience with Rails and still learning! and I realize that I have got no idea about Ruby.

If you want you can go to the OneOfZombies official site and try to understand what is all of this about. You can also download the Mac OSX version, or the source code, so you will can test it on your own keyboard.

Miércoles, Mayo 6th, 2009

Ruby: EuRuKo 2009, new dose of inspiration.

This weekend is the EuRuKo 2009, a very concentrate juice of Ruby programmers. 230 tickets were sold withing 3 days almost two months ago.

I am one of the big bunch of people that is on charge of the organization of this edition, I am helping on whatever is in my hand, I am very proud of have been the developer of the registration application, with the help of very big mind people. You can download and use the code on the github repository.

I also sent a design proposal for the t-shirt conquest. Of course Marze was there for putting me on my place :)

EuRuKo 2009 t-shirt proposal

Of course I’ll be there this weekend, I love to attend such events. It’s not because I like the talks, or because I learn a lot.. it’s not that. I love and need the energy that flutters there. It’s some kind of battery recharger. A new dose of inspiration. Company, Cooperation, … Pride of Craftsman.

See you there people!

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.

http://127.0.0.1:3000/people/103-fernando-guillen.xml (no clckes.. no te va a funcionar :))

<user>
<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>
<company-url>http://micompany.com</company-url>
<created-at type="datetime">2009-02-02T01:01:10+01:00</created-at>
<crypted-password>8e2434d3e574c95f4cfd0f457b20c8959ecbf04b</crypted-password>
<iail>xxxx@xxx.com</iail>
<id type="integer">103</id>
<login>fguillen</login>
<name>Fernando Guillen</name>
<password-reset-code>fcc786cd2137679f1055976989f5469607c9d663</password-reset-code>
<permalink>fernando-guillen</permalink>
<personal-web-name>mi web</personal-web-name>
<personal-web-url>http://google.es</personal-web-url>
<public-profile type="boolean">true</public-profile>
<remember-token nil="true">
<remember-token-expires-at type="datetime" nil="true">
<role>User</role>
<salt>5c26f52452d00dbd997f8c6998f5c3de1e4f53f3</salt>
−
<text>
Vaya texto guapo que pongo aquí:
 
Con varias líneas
 
y alert("hola");
</text>
<updated-at type="datetime">2009-02-04T18:52:21+01:00</updated-at>
</remember-token-expires-at>
</remember-token></user>

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

http://127.0.0.1:3000/people.xml

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 = [
      :activated_at,
      :activation_code,
      :email,
      :login,
      :password_reset_code,
      :permalink,
      :public_profile,
      :role,
      :crypted_password,
      :salt,
      :remember_token,
      :remember_token_expires_at,
      :created_at,
      :updated_at
    ]
    options[:except] = (options[:except] ? options[:except] + default_except : default_except)
    self.ar_to_xml( options )
  end

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)
        end
      end
    end

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í?

Jueves, Enero 29th, 2009

Ruby: El operador ‘~>’ y el Gem::Requirement

En un hilo de ror-es con título: ‘Problema con carga de rubygem en App rails al hacer rake db:create && rake db:migrate‘, Andrés Gutierrez se debatía con las versiones de las gemas solicitadas por un proyecto Rails que esta intentando arrancar.

La configuración del proyecto le requería tener instalada una gema y para indicarle la versión se utilizaba el operador ‘~>‘.. no el ‘==’, el ‘>’, el ‘>=’.. no, tenía el simbolito raro ese de la ñ.

En concreto la especificación de la gema requerida es tal que así:

config.gem 'mislav-will_paginate', :version => '~> 2.2.3', :lib => 'will_paginate', :source => 'http://gems.github.com'

Su duda venía de que él tenía instalada la versión 2.3.6 de la gema en concreto y no entendía porque no cumplía los requisitos.

El caso es que me piqué y al más puro ‘estilo Daniel R. Troitiño‘ ahí que fui a las tripas del código a ver que demonios hacía el operador ése..

Si miramos el fichero:

 $ mate rubygems/requirement.rb

Tenemos la lista de operadores y lo que se hace con cada uno:

 OPS = {
   "="  =>  lambda { |v, r| v == r },
   "!=" =>  lambda { |v, r| v != r },
   ">"  =>  lambda { |v, r| v > r },
   "<"  =>  lambda { |v, r| v < r },
   ">=" =>  lambda { |v, r| v >= r },
   "<=" =>  lambda { |v, r| v <= r },
   "~>" =>  lambda { |v, r| v >= r && v < r.bump }
 }

Donde ‘v‘ parece ser la versión disponible y ‘r‘ la requerida
Lo raro del operador ~> es que a la versión requerida le hace un bump
y el código de esto está en otro fichero:

 $ mate rubygems/version.rb

Aquí lo pego:

 # Return a new version object where the next to the last revision
 # number is one greater. (e.g.  5.3.1 => 5.4)
 def bump
   ints = build_array_from_version_string
   ints.pop if ints.size > 1
   ints[-1] += 1
   self.class.new(ints.join("."))
 end

Al parecer a la versión requerida en la aplicación, en este caso ‘2.2.6‘, le hace un bump y la deja en ‘2.3‘ y por lo tanto la
condición:

 '2.3.6' < '2.3'

No se cumple .. como podemos comprobar aquí:

irb>
>> req = Gem::Requirement.create("~> 2.2.3")
>> req.satisfied_by?( Gem::Version.new('2.3.6') )
=> false
>> req.satisfied_by?( Gem::Version.new('2.2.6') )
=> true
>> req.satisfied_by?( Gem::Version.new('2.1.6') )
=> false

Lo que parece que quiere el operador ~> es que la gema disponible esté
en la misma familia X.X que la gema requerida.

Hasta aquí he llegado. Si por favor conoces la documentación oficial donde se explica pásame el link para darme bien de tollejas.

Viernes, Enero 16th, 2009

Ruby on Rails: exception_logger con soporte jQuery

Estaba yo viendo el screencast éste sobre notificación de excepciones del grandísimo Ryan Bates y me puse a instalarlo, que son, calculando por lo alto, un par de minutos. Y cuando intento acceder al listado de excepciones veo que no funcionan los links ni las acciones ajax de borrar y tal… ouch¡.. resulta que está pensado para trabajar con Prototype y yo tengo todo por defecto con jQuery… así que nada, gracias al gran poder forkeador de github me puse a modificar el plugin para que soporte jQuery y aquí tenéis el resultado:

Exception_Logger_jQuery.

Instalarlo tal que así:

$ git clone git://github.com/fguillen/exception_logger_jquery.git vendor/plugins/exception_logger

Si queréis paginación hay que instalar la gema will_paginate y tocar el init.rb:

$ sudo gem install will_paginate
# init.rb
require 'will_paginate'
$PAGINATION_TYPE = 'will_paginate'
Sábado, Enero 10th, 2009

Monsters of Ruby!!!

No estaban todos los que eran ni eran todos los que estábamos pero si es cierto que se logró reunir a un buen grupo de Monstruos del Ruby.

Sábado 13 de Diciembre de 2008, 14horas, una convocatoria vía email logró reunir a rubistas de todo el estado en una sola habitación para enfrentarse a un reto por equipos.

Se trataba de enfrentarse a un fast-code de una aplicación web usando para el desarrollo de cada una de las capas herramientas que empiezan a emerger y de las que carecíamos de ningún dominio.

Nos mostraron como especificación una aplicación hecha en Rails llamada Frankenstein, para cuyo desarrollo emplearon un par de horas y otro poco para otorgarle un sugerente diseño.

Nos dividimos por equipos atendiendo a la suerta y también por sorteo se fueron repartiendo las herramientas (librerías) que cada equipo podía emplear.

A nuestro monstruoso equipo (los nosferatu) nos tocó:

Pero hubo combinaciones mucho más dolorosas.. :) que ahora no logro recordar.

Nuestro resultado lo podéis encontrar aquí: Nosferatu, pero está totalmente incompleto y dudo que logréis hacerlo funcionar sin nuestras explicaciones. El resto de  grupos y resultados los tenéis en el grupo monstersofruby de github.

A mi parecer no se puede entender lo logrado en esta reunión viendo el código generado. Lo que se ha conseguido va mucho más lejos del código, para mí ha sido una apertura de mente hacia las tecnologías que desconozco pues me da una pereza horrible enfrentarme a la primera línea de código, pero esta experiencia me ha demostrado que no es tan complicado y que hay muchas estrellas en el cielo por conocer.

Además también ha sido otra demostración más de la amigabilidad, sociabilidad, apertura y deseo de compartir que embriaga a toda esta peña entusiasmada con la programación.

Muchas gracias a todos.. ¡hasta la próxima! .. qué por cierto ya se está cociendo.

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.