Alojamiento autónomo de servicios / aplicaciones

Este repositorio de Github incluye una lista bastante extensa de recursos para ofrecer / disfrutar de servicios / aplicaciones, que pueden ser auto-alojadas. Menos Amazon S3 y mas hosting propio, mas ahora que una RaspberryPi ofrece la potencia suficiente, ya no hay excusa 🙂

https://github.com/awesome-selfhosted/awesome-selfhosted

Escrito en Ubuntu|Ubuntu n idatzia|Posted in Ubuntu | Deja un comentario|Idatzi zure iritzia|Leave a comment

Sandi Metz, great post

sandimetzlogoA great post from Sandi, regarding wrong abstraction when coding: http://www.sandimetz.com/blog/2016/1/20/the-wrong-abstraction. I’ve seen myself in such a situation a lot of times, so time to change things! 🙂

Escrito en Programación, Ruby|Programación, Ruby n idatzia|Posted in Programación, Ruby | Tagged , | Deja un comentario|Idatzi zure iritzia|Leave a comment

New project published

Ruby code repository at Bitbucket.orgI have recently published a small project at Bitbucket, called “view_reports”. This small project allows people to connect to a database and get a tiny report of a table from that database. The main key is that uses Yubikey [1] [2] for two-factor authentication (a Yubikey and a PIN). Other than that is a very simple application now (and I want to keep it like so). I have used Sequel, Sinatra as main components. Comments are very welcome 🙂

Cheers 🙂

Escrito en Programación, Ruby, Software, Software Libre|Programación, Ruby, Software, Software Libre n idatzia|Posted in Programación, Ruby, Software, Software Libre | Tagged , , , , | Deja un comentario|Idatzi zure iritzia|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 🙂

Escrito en Programación|Programación n idatzia|Posted in Programación | Tagged , , , , , , , | Deja un comentario|Idatzi zure iritzia|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
end

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.

Escrito en Programación|Programación n idatzia|Posted in Programación | Tagged , , | Deja un comentario|Idatzi zure iritzia|Leave a comment