Skip to content


Enviando correo de manera asíncrona en Rails usando Workling, Workling-Mailer y RabbitMQ

Enviando correo de manera asíncrona en Rails usando Workling, Workling-Mailer y RabbitMQ (English)

El trabajar con message queues es bastante interesante, ya que podemos mandar procesos al background y que estos sean procesados de manera asíncrona, un ejemplo podría ser el envío de correos, aunque también podría servir para realizar otras tareas, por ejemplo, como el envío de mensajes sms, generación de reportes, generación de pdf’s, etc.

En esta ocasión les quiero presentar como enviar correos de manera asíncrona haciendo una aplicación sencilla haciendo uso de los puglins Workling y workling-mailer y del sistema RabbitMQ, en teoría, con esto se podría ajustar esta solución fácilmente a cualquier otro proceso que se quiera realizar de manera asíncrona.

Aplicación base

Se crea una aplicación básica con restful_authentication, y con la opción de activación.

Lo primero que hacemos es crear la aplicación en rails

rails mail_async_example -d mysql
 
rm public/index.html
 
script/plugin install git://github.com/technoweenie/restful-authentication.git
 
script/generate authenticated user sessions --include-activation

Creamos nuestra base de datos y migramos

rake db:create
 
rake db:migrate

Y hacemos unos pequeños cambios al código de la aplicación para enviar correo según las instrucciones de restful_authentication, así que agregamos lo suguiente:

config/routes.rb

map.activate 'activate/:activation_code', :controller => 'users', :action => 'activate', :activation_code => nil

config/environment.rb

config.active_record.observers = :user_observer

Con esto ya tendríamos nuestra aplicación básica la cuál podríamos probar de inmediato apuntando en el browser a http://localhost:3000/signup

Y agregando algunas cosillas extras, a app/controller/application_controller.rb agregamos la línea:

include AuthenticatedSystem

Esta misma línea que agregamos al Application controller la removemos de app/controller/sessions_controller.rb y de app/controllers/users_controller.rb

Y creamos un nuevo controlador

script/generate controller portal index

Modificamos config/routes.rb para agregar al último como página root

map.root :controller => "portal"

Por último agregamos un layout para nuestra aplicación:

app/views/layouts/application.html.erb

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <title>Contracts: <%= controller.action_name %></title>
  <%= stylesheet_link_tag 'scaffold' %>
</head>
<body>
<% if current_user %>
   <%= link_to 'Logout', logout_path %>
<% else %>
   <%= link_to 'Login', login_path %>
   <%= link_to 'Sign up', signup_path %>
<% end %>
 
<% [:error, :warning, :notice].each do |level|
    if flash[level] -%>
      <div class="flash <%= level.to_s -%>"><%= flash[level] -%></div>
  <% end -%>
<% end -%>
 
<%= yield %>
 
</body>
</html>

Instalando amqp, workling y workling_mailer

Ahora bien, antes de instalar Workling, para poder trabajar con RabbitMQ es necesario instalar la gema de amqp, esta gema requiere también de la gema de EventMachine, por lo que al instalar amqp también instalará EventMachine.

gem sources -a http://gems.github.com/
sudo gem install tmm1-amqp --no-rdoc --no-ri

Vemos nuestro listado de gemas

sudo gem list

Ahora si, a instalar workling y workling_mailer

script/plugin install git://github.com/purzelrakete/workling.git
 
script/plugin install git://github.com/langalex/workling_mailer.git

Para poder utilizar workling con RabbitMQ agregamos al final de config/environment.rb

config.after_initialize do
Workling::Remote.invoker = Workling::Remote::Invokers::EventmachineSubscriber
Workling::Remote.dispatcher = Workling::Remote::Runners::ClientRunner.new
Workling::Remote.dispatcher.client = Workling::Clients::AmqpClient.new
end

Posteriormente en app/models/user_mailer.rb añadimos

include AsynchMail

A la fecha de hoy el plugin de workling tiene un pequeño issue, para resolverlo hacemos lo siguiente en el archivo lib/workling/clients/memcache_queue_client.rb y verificar que contiene:

require 'memcache'

Al principio del archivo, si no lo tienes agrégalo.

Como el amqp corre sobre un ciclo de EventMachine es necesario correr nuestra aplicación con Thin, ya que este servidor soporta EventMachine sin ningún problema. Para instalar Thin corremos

sudo gem install thin --no-rdoc --no-ri

Instalando RabbitMQ

Checar la instalación aquí http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/

A correr todos

Nos aseguramos de que el RabbitMQ esté corriendo.

Iniciamos el cliente de workling

script/workling_client start

E iniciamos el servidor thin

thin start

Apuntamos nuestro browser a http://localhost:3000 y nos registramos con un usuario, al verificar el log de desarrollo veremos que el correo ahora es enviado después de todas las últimas operaciones registradas en el log. Podemos probar quitando la línea de include AsynchMail del UserMailer y ver lo que hace, o bien haciendo nuevo proceso que sea pesado y que se realice en background.

Referencias:

http://github.com/christospappas/workling/commit/063b9849b32e0c6140a5ecdb254357770d9bd28f
http://github.com/purzelrakete/workling/
http://github.com/langalex/workling_mailer/
http://github.com/tmm1/amqp/
http://github.com/technoweenie/restful-authentication/
http://www.rabbitmq.com
http://code.macournoyer.com/thin/
http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/

Sending mails in asynchronous way in Rails using Workling, Workling-Mailer and RabbitMQ (Español)

Working with message queues is so interesting, since we can put processes in the background in order to be processed in asynchronous way, imagine this to send several mails, or maybe for heavy tasks as sms messages, report generation, pdf generation, etc.

So, with this post I want you to show how to send mails in asynchronous way, we are going to make a small application using Workling, Workling-mailer and as message queue RabbitMQ, actually we could adjust this solution to any other problem with async process requirement.

Base application

We create a simple application with restful_authentication and activation option.

First of all we create the rails app

rails mail_async_example -d mysql
 
rm public/index.html
 
script/plugin install git://github.com/technoweenie/restful-authentication.git
 
script/generate authenticated user sessions --include-activation

Now with rake we create and migrate DB

rake db:create
 
rake db:migrate

Following the restful_authentication instructions to send mail we add this:

config/routes.rb

map.activate 'activate/:activation_code', :controller => 'users', :action => 'activate', :activation_code => nil

config/environment.rb

config.active_record.observers = :user_observer

Our base app is working now, so to test it we get the url http://localhost:3000/signup in the browser.

Add this in app/controller/application_controller.rb:

include AuthenticatedSystem

The same line added to Application controller is removed from app/controller/sessions_controller.rb and app/controllers/users_controller.rb

We create a new controller for portal index

script/generate controller portal index

And modify config/routes.rb to add portal as root

map.root :controller => "portal"

And last we create a layout for our application:

app/views/layouts/application.html.erb

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <title>Contracts: <%= controller.action_name %></title>
  <%= stylesheet_link_tag 'scaffold' %>
</head>
<body>
<% if current_user %>
   <%= link_to 'Logout', logout_path %>
<% else %>
   <%= link_to 'Login', login_path %>
   <%= link_to 'Sign up', signup_path %>
<% end %>
 
<% [:error, :warning, :notice].each do |level|
    if flash[level] -%>
      <div class="flash <%= level.to_s -%>"><%= flash[level] -%></div>
  <% end -%>
<% end -%>
 
<%= yield %>
 
</body>
</html>

Installing amqp, workling and workling_mailer

Now, before using Workling, we need RabbitMQ and amqp is needed, this gem also requires EventMachine gem, so, both gems are installed when amqp is installed.

gem sources -a http://gems.github.com/
sudo gem install tmm1-amqp --no-rdoc --no-ri

List your installed gems

sudo gem list

Now, install workling and workling_mailer

script/plugin install git://github.com/purzelrakete/workling.git
 
script/plugin install git://github.com/langalex/workling_mailer.git

Add this to config/environment.rb to allow workling to use RabbitMQ

config.after_initialize do
Workling::Remote.invoker = Workling::Remote::Invokers::EventmachineSubscriber
Workling::Remote.dispatcher = Workling::Remote::Runners::ClientRunner.new
Workling::Remote.dispatcher.client = Workling::Clients::AmqpClient.new
end

To app/models/user_mailer.rb add this

include AsynchMail

Until today I’ve seen a little issue with workling, to solve it we do the folloging in this file lib/workling/clients/memcache_queue_client.rb; verify that you have:

require 'memcache'

Add it if you don’t have it.

Amqp runs in an EventMachine cycle, so it is needed to run our app with Thin, since Thin supports EventMachine without any problem. To install Thin run

sudo gem install thin --no-rdoc --no-ri

Installing RabbitMQ

Follow the instructions here http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/

Everybody runs

Cool, naw we ensure that RabbitMQ is running.

Start workling client

script/workling_client start

And start Thin server

thin start

Point with your browser to http://localhost:3000 and sign up a new user, then verify your log and will see that email is sent and registered to the end of log after all operations. We can test removing include AsynchMail from UserMailer and see what happens, it would be great if you test some application with a heavy process working in the background.

Links:

http://github.com/christospappas/workling/commit/063b9849b32e0c6140a5ecdb254357770d9bd28f
http://github.com/purzelrakete/workling/
http://github.com/langalex/workling_mailer/
http://github.com/tmm1/amqp/
http://github.com/technoweenie/restful-authentication/
http://www.rabbitmq.com
http://code.macournoyer.com/thin/
http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/

Posted in Howto/tutorial, OpenSource, Ruby. Tagged with , , , , , , .

Instalando RabbitMQ

Instalando RabbitMQ (English)

RabbitMQ es un sistema de message queue (MQ), el cual provee comunicaciones asíncronas, es decir que el productor y consumidor no tienen la necesidad de interactuar con los mensajes al mismo tiempo, además de que es una implementación del protocolo AMQP (Advanced Message Queuing Protocol), un protocolo para mensajeo de alto rendimiento, y por último decir que RabbitMQ está desarrollado con Erlang, Erlang es un lenguaje de programación funcional.

En Ubuntu 9.04

La instalación de RabbitMQ en Ubuntu 9.04 es tan simple como correr el comando

sudo aptitude install rabbitmq-server

Y con el cual si no has instalado Erlang te mostrará que paquetes tendrá que instalar para que lo tengas también.

jcastaneyra@ubuntu:~/sources$ sudo aptitude install rabbitmq-server
[sudo] password for jcastaneyra:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
The following NEW packages will be installed:
erlang-base{a} erlang-nox{a} libltdl7{a} odbcinst1debian1{a} unixodbc{a}
The following partially installed packages will be configured:
rabbitmq-server
0 packages upgraded, 5 newly installed, 0 to remove and 8 not upgraded.
Need to get 28.6MB of archives. After unpacking 46.9MB will be used.
Do you want to continue? [Y/n/?]

Una vez instalado ya está corriendo.

En Mac leopard

La instalación es a través de los MacPorts, hay que bajar el instalador de la página www.macports.org/install.php, pero para poder compilar es necesario tener XCode instalado. Los MacPorts son instalados en /opt, por lo que hay que asegurarnos que se tengamos agregados los paths necesarios en el profile para ejecutar los comandos de MacPorts.

En mi caso en .profile (pero también puede ser el .bash_login) debe estar algo así (si no está lo agrego):

# MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
 
# MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate MANPATH variable for use with MacPorts.
export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.

Una vez que están los MacPorts hay que instalar primero erlang, así que ejecutamos

sudo port install erlang

Y esperamos un buen rato a que se instale.

Una vez instalado erlang, bajamos la última versión de RabbitMQ

mkdir /tmp/rabbitmq &amp;&amp; cd /tmp/rabbitmq
curl -O http://www.rabbitmq.com/releases/rabbitmq-server/v1.5.5/rabbitmq-server-generic-unix-1.5.5.tar.gz
tar xvzf rabbitmq-server-generic-unix-1.5.5.tar.gz
sudo mv rabbitmq_server-1.5.5/ /opt/local/lib/erlang/lib

Ahora ya lo podemos ejecutar.

sudo /opt/local/lib/erlang/lib/rabbitmq_server-1.5.5/sbin/rabbitmq-server

Recursos

http://www.rabbitmq.com
http://playtype.net/past/2008/10/9/installing_rabbitmq_on_osx/

Installing RabbitMQ (Español)

RabbitMQ is a complete and highly reliable Enterprise Messaging system, it provides asynchronous communications,  meaning that the sender and receiver of the message do not need to interact with the message queue at the same time, also it is a AMQP implementation (Advanced Message Queuing Protocol) a protocol for high performance messaging, and last RabbitMQ is developed with Erlang, a functional programming language.

In Ubuntu 9.04

RabbitMQ instalation in Ubuntu 9.04 is so simple, it is just needed to run a command

sudo aptitude install rabbitmq-server

With this also install all packages needed by rabbitmq, Erlang is installed also.

jcastaneyra@ubuntu:~/sources$ sudo aptitude install rabbitmq-server
[sudo] password for jcastaneyra:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
The following NEW packages will be installed:
erlang-base{a} erlang-nox{a} libltdl7{a} odbcinst1debian1{a} unixodbc{a}
The following partially installed packages will be configured:
rabbitmq-server
0 packages upgraded, 5 newly installed, 0 to remove and 8 not upgraded.
Need to get 28.6MB of archives. After unpacking 46.9MB will be used.
Do you want to continue? [Y/n/?]

Once the installation is finished RabbitMQ will be running.

In Mac leopard

RabbitMQ installation is done through MacPorts, you need to download the MacPorts installer from www.macports.org/install.php, also XCode is needed. MacPorts are installed in /opt, for that reason we put these paths in the .profile file (could be .bash_login), if you don’t have these paths add them to your profile file:

# MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
 
# MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate MANPATH variable for use with MacPorts.
export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.

In order to install erlang execute the following command:

sudo port install erlang

You need to wait some time, maybe several minutes :)

Once you have erlang installed, we download the last RabbitMQ version

mkdir /tmp/rabbitmq &amp;&amp; cd /tmp/rabbitmq
curl -O http://www.rabbitmq.com/releases/rabbitmq-server/v1.5.5/rabbitmq-server-generic-unix-1.5.5.tar.gz
tar xvzf rabbitmq-server-generic-unix-1.5.5.tar.gz
sudo mv rabbitmq_server-1.5.5/ /opt/local/lib/erlang/lib

Now we execute rabbitmq-server with this

sudo /opt/local/lib/erlang/lib/rabbitmq_server-1.5.5/sbin/rabbitmq-server

Links

http://www.rabbitmq.com
http://playtype.net/past/2008/10/9/installing_rabbitmq_on_osx/

Posted in Uncategorized. Tagged with , , , , .

Mostrando el branch de git en el prompt de la consola

Mostrando el branch de git en el prompt de la consola (In english below)

Tiene aproximadamente dos meses que empecé a trabajar con git, y la experiencia ha sido muy buena, bastante interesante, pero con los primeros tutoriales que empecé a ver noté que los aliases ayudan a hacer más ágil el trabajo con git, curiosamente hasta este momento no los he usado, creo que ha llegado la hora de agregarlos en mi configuración. Así que al final de mi archivo $HOME/.gitconfig agrego:

[color]
        ui = auto
[alias]
        ci = commit
        co = checkout
        st = status

Por cierto, que la parte de [color] es para mostrar con colores mis cambios cuando le doy git status, aunque ahora con estos cambios ya le podría dar git st.</p> <p>Otra cosa que noté en mis inicios con git fue que en un screencast de peepcode, en el prompt de la consola aparecía el branch en el que se encontraba trabajando, en ese entonces busqué como hacerlo pero no tuve éxito hasta ahora, entonces para lograr esto hay que agregar un archivo con funciones .bash_functions

# git-related functions in here
 
git_branch () {
  GIT_BRANCH="$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')"
  if [[ -n "$GIT_BRANCH" ]] ; then
    echo ":($GIT_BRANCH) "
  fi
}
empty_branch () {
  name="$1"
  if [[ -n "$name" ]] ; then
    echo "This will create a new empty branch in the current"
    echo -n "git repository called '${name}' ... Continue? [y/N] "
    read VERIFY
    if [[ "$VERIFY" = "Y" || "$VERIFY" = "y" ]]; then
      echo "creating branch '$name'"
      git symbolic-ref HEAD refs/heads/$name
      rm .git/index
      git clean -fdx
      echo "you should be on your new empty branch! "
      echo "add/commit files as usual! "
      echo "( your new branch will show up after you commit something to it )"
    else
      echo -n ""
    fi
  else
    echo "Creates a new empty branch in your git repository."
    echo ""
    echo "Usage: empty_branch [name_of_new_branch]"
  fi
}
 
# vim:set ft=sh:

Y dependiendo del archivo de configuración del shell que estén usando agregar en él esto:

# if .bash_functions if a file then source it
# if .bash_functions is a directory, then sourec all its files
if [ -f ~/.bash_functions ]; then
  . ~/.bash_functions
fi
if [ -d ~/.bash_functions ]; then
  for function in ~/.bash_functions/*; do . $function; done
fi
 
# bash prompt
prompt () {
  PS1="\[\e[34m\]\u\[\e[37m\]@\[\e[36m\]\h\[\e[37m\]:\[\e[31m\]\w\[\e[37m\]$(git_branch)$ "
}
PROMPT_COMMAND=prompt
export PROMPT_COMMAND

En mi caso, en leopard yo estoy usando .profile, pero podría ser .bash_rc o algún otro profile de shell. Ya para cargar la info del profile habría que ejecutar source .profile ó bien salirse de la consola y volverla a abrir para que cargue la nueva configuración.

Todavía falta mucho por aprender de git, pero creo que voy por buen camino, también he aprendido bastante de los flujos que siguen algunos equipos de trabajo ágiles, son muy interesantes.

Recursos:

Aliases
.bash_functions file from Remi
.bash_rc file from Remi
Git workflow for agile teams

Showing the git branch in the console prompt

I have working with git since started two months ago, the experience have been too good, I must say awesome, when I started to work I saw that you could use aliases with git, it is funny but since then I’ve never used aliases, so now it’s time to add them to my configuration file $HOME/.gitconfig

[color]
        ui = auto
[alias]
        ci = commit
        co = checkout
        st = status

This [color] section enable colors when I execute git status and see my changes, but now with my aliases I could write git st.</p> <p>Another nice stuff that I noticed when started to work with git and I was watching a Peepcode screencast was that in the console prompt appeared the git branch, in that moment I googled it but no results got, until now that I found how to do this; one file with the git functions is created .bash_functions

# git-related functions in here
 
git_branch () {
  GIT_BRANCH="$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')"
  if [[ -n "$GIT_BRANCH" ]] ; then
    echo ":($GIT_BRANCH) "
  fi
}
empty_branch () {
  name="$1"
  if [[ -n "$name" ]] ; then
    echo "This will create a new empty branch in the current"
    echo -n "git repository called '${name}' ... Continue? [y/N] "
    read VERIFY
    if [[ "$VERIFY" = "Y" || "$VERIFY" = "y" ]]; then
      echo "creating branch '$name'"
      git symbolic-ref HEAD refs/heads/$name
      rm .git/index
      git clean -fdx
      echo "you should be on your new empty branch! "
      echo "add/commit files as usual! "
      echo "( your new branch will show up after you commit something to it )"
    else
      echo -n ""
    fi
  else
    echo "Creates a new empty branch in your git repository."
    echo ""
    echo "Usage: empty_branch [name_of_new_branch]"
  fi
}
 
# vim:set ft=sh:

And depending which shell are you using you add this into it

# if .bash_functions if a file then source it
# if .bash_functions is a directory, then sourec all its files
if [ -f ~/.bash_functions ]; then
  . ~/.bash_functions
fi
if [ -d ~/.bash_functions ]; then
  for function in ~/.bash_functions/*; do . $function; done
fi
 
# bash prompt
prompt () {
  PS1="\[\e[34m\]\u\[\e[37m\]@\[\e[36m\]\h\[\e[37m\]:\[\e[31m\]\w\[\e[37m\]$(git_branch)$ "
}
PROMPT_COMMAND=prompt
export PROMPT_COMMAND

I’m using .profile in leopard, but could be .bash_rc. Now to load this new changes from your profile it’s need to execute source .profile or you also could close your console window and open a new one.

I’ve learned a lot until now but I still need to learn more (even english :) ), I’ve learned also from agile workflows that helps with your work.

Notes:

Aliases
.bash_functions file from Remi
.bash_rc file from Remi
Git workflow for agile teams

Another note:

This is my first try to write in english, I definitely need to learn to be more fluid in my english writing also speaking, but it’s needed to start in some place. So if this is not understandable you can give some feedback, thanks.

Posted in scripting. Tagged with , , .

Segunda reunión de MXOR

El día de ayer fue la segunda reunión de nuestro grupo de Rails MXOR, en el cuál se hablaron de diversos tópicos en general, pero como todos estamos interesados en aprender de estos tópicos llegamos a la idea de trabajar en un proyecto en donde se pueda trabajar con las cosas que nos interesan y que de esto surgan una serie de artículos los cuales puedan servirnos a nosotros como referencia y a las personas interesadas en Rails y de todo lo que está al rededor.

Sobre los tópicos que nos resultaron interesantes son:

- Instalación de Linux desde cero y con los necesario para Rails
- Version de Rails, VM’s
- Uso de Git con el proyecto
- RedMine como administrador de proyecto
- BDD
- Autenticación
- Servidores Web, App Servers
- Prototype, scriptaculous, JQuery (Edgar dice que es más ligero)
- CSS (blueprint, haml)
- Deployment
- Cache
- Plugins de consulta
- I18N

En la reunión se hizo una lluvia de ideas sobre que proyectos trabajar y sobre el proyecto que se eligió también se fueron aterrizando diversas ideas.

Problema:
Compartir historias de desarrolladores.
El contenido:
Tutoriales
Errores
Categorización de tutoriales
Categorización de Errores
Como wiki de errores
¿Compartir pasos de recetas?
Solo en español para empezar

Hasta aquí me quedé en las anotaciones ya que tuve que salir temprano, pero hay un podcast con la sesión de principio a fin. En este momento se está seleccionando un nombre para la aplicación, una vez que se haya elegido el nombre se podrá empezar a trabajar en estos tópicos, idealmente la gente involucrada en cada actividad sería la que esté interesada en aprender y no precisamente la que domine el tema. La lista de nombres al momento es:

* redcipe (3 votos)
* errecipe (1 voto)
* devrecipes (0 votos)
* devcipe (1 voto)
Por supuesto este es un proyecto open source y abierto a la comunidad interesada en Rails, buscando que a partir de esto surgan artículos e información que en un momento dado nos sea de utilidad, una especie de libro que nos sirva de guía en la realización de una aplicación. Para más información acudir a la página del grupo.

Posted in OpenSource. Tagged with , , , .

Scaling Rails

Hace un par de semanas aproximadamente buscando información de como hacer escalar aplicaciones Rails me encontré con un material bastante interesante y con información muy valiosa, y lo mejor de todo es que en screencasts, los cuales han sido publicados por Gregg Pollack de RailsEnvy con el soporte de NewRelic, sería muy bueno que les den una revisada. Los screencasts publicados hasta el momento son:

  1. Introduction
  2. Page Responsiveness
  3. Page Caching
  4. Chache Expiration
  5. New Relic RPM
  6. Advanced Page Caching
  7. Action Caching
  8. Fragment Caching
  9. Memcahed
  10. Taylor Weibley & Databases
  11. Client-side Caching
  12. Additional HTTP Caching

Posted in Ruby. Tagged with , .

Mi participación en el BarCamp 2 México

Así es, el pasado sábado hice presencia en el BarCamp 2 México con mi comunidad de México on Rails y aporté mi granito de arena con una presentación sobre como instalar Rails en Windows la cuál fue enriquecida por mis compañeros de la comunidad, cómo comunidad y equipo llevamos varias presentaciones al BarCamp, las cuáles se estarán subiendo a nuestro sitio de México On Rails, también les dejo dos reseñas, una por nuestro compañero de la comunidad @chubas donde da un resumen de todas las ponencias que dimos como grupo y la otra por @tequilavalley.

La presentación la dejo aquí:

Posted in OpenSource, Personal, Viajes. Tagged with , , , .

Como obtener una imagen ISO de un CD/DVD en Mac

Hace poco un compañerito de la comunidad de México on Rails mencionó que tener una Mac es como tener lo mejor de ambos mundos (de Windows y Linux), y he aquí el porqué, resulta que quería obtener una imagen ISO de cierto DVD para respaldarlo y posiblemente después quemarlo, y aquí les muestro al más puro estilo Unix como se puede hacer.

Primero que nada hay que insertar el CD/DVD a extraer (duh! pero alguien podría no saber :) )

Y ejecutando el siguiente comando obtenemos el status del CD/DVD a quemar:

jcastaneyra$ drutil status
Vendor   Product           Rev
OPTIARC  DVD RW AD-5630A   1CHQ
 
Type: DVD-ROM              Name: /dev/disk1
Sessions: 1                  Tracks: 1
Overwritable:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
Space Free:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
Space Used:  330:41:69         blocks:  1488144 /   3.05GB /   2.84GiB
Writability:
Book Type: DVD-ROM (v1)

Posteriormente desmontamos el CD/DVD:

jcastaneyra$ diskutil unmountDisk /dev/disk1
Unmount of all volumes on disk1 was successful

Y ahora obtenemos la imagen con la utilidad dd:

jcastaneyra$ dd if=/dev/disk1 of=vista.iso bs=2048
1488144+0 records in
1488144+0 records out
3047718912 bytes transferred in 1209.311307 secs (2520210 bytes/sec)

Después para expulsar el CD/DVD lo que se hace es volverlo a montar (jejeje, talvez puede haber otra forma, posiblemente haya un comando eject, ya no lo probé):

jcastaneyra$ diskutil mountDisk /dev/disk1
Volume(s) mounted successfully

Y por último probamos la imagen ISO:

jcastaneyra$ hdid vista.iso
/dev/disk2                                                 /Volumes/VISTA_32_BUSINESS

Y para poder quemar la imagen ISO se podría utilizar la aplicación “Utilidad de Discos”

Posted in Computers, Howto/tutorial. Tagged with , , .