Me suena este portátil

librebootx200Hoy me entero de que el portátil que utilizo para trabajar (con el que estoy encantado por cierto) está avalado por la FSF. Leyendo la noticia en veo además que la configuración avanzada es muy similar a la que tengo yo: 8GBs de RAM, disco SSD, etc.

Este línea de portátiles (la X y también la T) de Lenovo son muy agradables de uso, robustos, troteros y con prestaciones mas que suficientes para un uso habitual. Yo he conseguido localizarlos a través de varios proveedores, ya que se suelen retirar de empresas que los tenian en renting y demás.
Además, Lenovo (al menos las series X y T) están enfocadas al uso profesional y disponen de multitud de elementos para complementar el propio portátil, además de manuales de uso y reparación que denotan bien a las claras para que se han construido: para ser reparados, y no para ser tirados a la basura ante el menor problema, como sucede con otros fabricantes o modelos.

Si te encuentras uno por la calle, no lo desprecies porque sea negro y cuadradote, al contrario: dale cariño y verás como el también te cuida :D


Posted in Ubuntu | Leave a comment

Query SQLite looking for boolean records

rubyToday I have needed to ask an SQLite DB to get some records with a field set to true, and all my first attempts to do it have been failed. Finally I have achieved it, and I would like to share this little achievement :)

NOT working:

Model.find(:all, :conditions => 'field = true')

NOT working:

Model.find(:all, :conditions => 'field = "true"')

NOT working:

Model.find(:all, :conditions => 'field = 1')

NOT working:

Model.find(:all, :conditions => 'field = "1"')

and finally working:

Model.find(:all, :conditions => 'field = "t"')

The solution has consisted on looking at DB level, which is the real data stored on it. Cheers :)

Posted in Programación | Tagged , , , , , , , | Leave a comment

Dinamyc callbacks on Rails, is it possible?

Today I have tried to do this: let any application application, and among all the tables to storage the data of your model estructure, there is one called “Configuration”. As you can suspect, this table will storage some configuration options for your application. For some configuration options you need to execute certain code, and here is what I’ve tried:

class Configuration < ActiveRecord::Base
# These next lines are related to Hobo gem, and are just 
# an expression to define the model (you can imagine what they do for sure)
  fields do
    name :string
    value :string
    callback :boolean, default => false
    callback_name :string

after_update self.callback_name.to_sym, :if => self.callback?
... here comes the definition of each callback ...

For some reason this is not allowed. I think this is a nice solution to hook configuration options within code, but it doesn’t seem to work :/

If any of you get something like this working, please let me know, I will own a beer (no alcohol obviously :)

Cheers, Ibon.

Posted in Programación | Tagged , , | Leave a comment

Capybara screenshot on ancient Rails 2.3.X projects

Recently I’ve been playing with some tests on an old Rails Project. In terms of actual Computer Science Mesure Units or CSMUs, this is quite old (remember that one CSMU is the time used by a user to change his/hers iPhone :)

Some failures on the test forced me to look up for some solutions and Capybara-screenshot was one of the elected ones, instead of being playing around with messages on the log file. The sad side of recent versions of this gem is that it seemed not to play well with Rails 2.3 infrastructure. There is a Rails 2.3 compatible version but some of the usual methods of Capybara-screenshot were not working well.

What I have founded is this recipe running for me: install capybara-screenshot 0.3.14, then require it on your spec_helper.rb file. When your test fails the screenshot is not being automatically taken (at least in my case), but you can use it manually, before the offending line by putting “screenshot_and_open_image” :)


Posted in Programación | Tagged , , , | Leave a comment

Si no conoces Duolingo, deberías :)

Mas vale un enlace que mil palabras :D

Para solucionar posibles problemas con el micro en Ubuntu, necesitas instalar (para Gnome):

sudo apt-get install adobe-flash-properties-gtk

o (para KDE):

sudo apt-get install adobe-flash-properties-kde

y luego lanzar Adobe Flash Properties o (en un terminal):


Salud ;)

Posted in Formación, Ubuntu | Tagged | Leave a comment