Search Erlang-related information

Posted by stoyan

Started Google Co-op powered Erlang-related Search Engine . Enjoy

Update 09-Feb-2007: Also some tinyurl for the search machine

MapReduce for Ruby: Ridiculously Easy Distributed Programming

Posted by stoyan

Google’s MapReduce is now available for Ruby (via gem install starfish ). MapReduce is the technique used by Google to do monstrous distributed programming over 30 terabyte files.

Here is the basic code that will get you up and running with MapReduce in Starfish .
    # item.rb
    ActiveRecord::Base.establish_connection(
      :adapter  => "mysql",
      :host     => "localhost",
      :username => "root",
      :password => "",
      :database => "some_database" 
    )

    class Item < ActiveRecord::Base; end

    server do |map_reduce|
      map_reduce.type = Item
    end

    client do |item|
      logger.info item.id
    end
Now just run:
    starfish item.rb
and Starfish takes care of the rest. The code above does the following:
  • The server grabs all the items via: Item.find(:all)
  • Each of the clients grab an item from the collection
  • When there are no more items to be grabbed, everything shuts down

Just add REST (and it’s come by default with the Edge Rails) and you’ll have your own S3 or GDrive for free ;)

ActiveMailer sending via GMail

Posted by stoyan

On the previous Kansai Rails Conference in Asiyagawa somebody asked me about using GMail (smtp+ssl or tls) with Rails ActiveMailer. Didn’t find solution until now but ‘dza-dza-dzaaaaaaan’ (hahaha i’m not so smart, all credits going to entombedvirus ):

Send email with ActionMailer through TLS only SMTP server

So for Debian (Ubuntu):

Install msmtp (light SMTP client with support for server profiles)

$ sudo apt-get install msmtp

Create/edit ~/.msmtprc

account gmail
host smtp.gmail.com
auth on
user <your_account>@gmail.com
password <your_password>
tls on
tls_starttls on
from <your_account>@gmail.com
maildomain gmail.com
account default : gmail

Stop msmtp complaining about permissions

$ chmod 600 ~/.msmtprc

Add on the bottom of yourrailsapp/config/environment.rb (and comment another ActionMailer::Base.delivery_method settings if exists)

ActionMailer::Base.delivery_method = :msmtp

module ActionMailer
  class Base
    def perform_delivery_msmtp(mail)
      IO.popen("/usr/bin/msmtp -t -C /<path_to>/.msmtprc -a gmail --", "w") do
 |sm|
        sm.puts(mail.encoded.gsub(/\r/, ''))
        sm.flush
      end
    end
  end
end

Do not forget to fix the exact path to your .msmtprc in the source above.

Google Notebook

Posted by stoyan

Google announced their new toy – Google Notebook . There are already several reviews for it on the net. People complaining about missing tagging etc. GNotebook come with Firefox extension. Pretty cool. And there is already Python Google Notebook API . Hm, where is the Ruby one? ;)

And another happy news from Google – hosted domains already have calendars!

Gmail for your domain

Posted by stoyan

Gmail for your domain just rocks! After 1 or 2 weeks of waiting you can have the latest on the web 2.0 email market for your own domain (personal or the company one). I already have my Gmail-based family webmail ;) Still moving the whole stuff from the @gmail accounts is in front…Hope there is some tool for easy transfer between accounts – emails, labels, filters etc.