さくらインターネットのVPSにDebian Squeezeをインストールする。

デフォルトのCentOSでネットワークの設定を記録しておく。

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# cat /etc/resolv.conf

installerをダウンロードする。

# mkdir /boot/new
# cd /boot/new
# wget ftp://ftp.jp.debian.org/pub/Linux/Debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz
# wget ftp://ftp.jp.debian.org/pub/Linux/Debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux

grubからinstallerを起動できるようにする。

# /boot/grub/grub.conf:
(...)
title new squeeze amd64
        root (hd0,0)
        kernel /new/linux ro root=LABEL=/ console=tty0 console=ttyS0,115200n8r
        initrd /new/initrd.gz

rebootしたらgrubのmenuでinstallerが選べるのでインストールする。

参照:タイトルは明日考えます: さくらのVPSでシリアルコンソールからDebianインストール

Gmailのロックを外す方法。

Gmailでは短期間に何度もログインしたりするとアカウントにロックがかかるらしい。下記の方法でロックを解除できる。

クライアントでユーザー名とパスワードが受け入れられません - Gmail ヘルプ

[PASSWORD]:535-5.7.1 Username and Password not accepted. Learn more at
[PASSWORD]:535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257

MUAのログには上記のように出るが、Railsのエラーでは1行目しか出ないのでロックがかかっていることに気付くのが難しい・・・。

RailsでGmailを使ってメールを送る。(Google Appsも可)

# config/environments/development.rb:
(...)
  config.action_mailer.smtp_settings = {
    :address              => 'smtp.gmail.com',
    :port                 => 587,
    :domain               => 'example.com',
    :user_name            => 'foo@example.com',
    :password             => 'password',
    :authentication       => 'plain',
    :enable_starttls_auto => true
  }
(...)

下記を設定しないとエラーを表示してくれないところに注意する。

config.action_mailer.raise_delivery_errors = true

Send email with Rails by using Gmail. (Google Apps too)

If the following are not set, the error is not displayed.

Generators Slim - Issues - plataformatec/devise - GitHub

I'm exec this generate for slim, but the code created is erb...

$ rails g devise:views usuarios -e slim
  create  app/views/usuarios
  create  app/views/usuarios/confirmations/new.html.erb
  create  app/views/usuarios/mailer/confirmation_instructions.html.erb
  create  app/views/usuarios/mailer/reset_password_instructions.html.erb
  create  app/views/usuarios/mailer/unlock_instructions.html.erb
  create  app/views/usuarios/passwords/edit.html.erb
  create  app/views/usuarios/passwords/new.html.erb
  create  app/views/usuarios/registrations/edit.html.erb
  create  app/views/usuarios/registrations/new.html.erb
  create  app/views/usuarios/sessions/new.html.erb
  create  app/views/usuarios/shared/_links.erb
  create  app/views/usuarios/unlocks/new.html.erb

josevalim February 11, 2011 | link

You need devise master to do that.

READMEに書いてあるけど、deviseでhaml or slim(-eオプション)使いたかったら1.1.7じゃ駄目でmaster使えとのこと。1.2rcが正式になったら使えるようになるかも。

Lokkathon #2が開催されました。

場所はFJORDのオフィス。参加者は@komagata, @machida, @kyanny, @junya, @mochizの5人。

努めてモクモクと作業。とてもはかどったし、皆さんとも話せてとても楽しかったです。

僕はGithubのIssuesを整理したり、Pull Requestを処理したり、バグを潰したりしていました。@machidaさんはデザイン系のIssueをやってくれました。@kyannyさんはAWS Elastic BeanstalkでLokkaを動かそうという作業。@mochizさんは会社のブログをLokkaにしようという作業。そして@junyaさんはLokkaにrspec2によるテストの環境をコミットしてくれました。

何か発表する勉強会や交流する懇親会もいいけどひたすらコードを書くHackathonも良いですね。皆さんのお陰で色んな方位に一気にLokkaの作業が進んだ気がします。ありがとうございました。

ゆるい会なので月1ぐらいでやっていきたいなと思います。

$ sudo -s
# bash < <( curl -L http://bit.ly/rvm-install-system-wide )
# rvm install 1.8.7

Terminal — less — 80×24

RubyでのUUIDのversion 1の使い方。

gem install uuid
>> require 'rubygems'
=> true
>> require 'uuid'
=> true
>> UUID.new
=> MAC: 58:55:ca:f3:26:47  Sequence: 9499
>> UUID.new.generate
=> "bc66c930-22f1-012e-251b-5855caf32647"
>> UUID.new.generate :compact
=> "be64e03022f1012e251b5855caf32647"

:compactはハイフンを取ってくれる。


How to use UUID Version 1 in Ruby.

:compact option omits the hyphens.

Lokkathon #2 - Lokka

日時:02月27日 10:00 - 19:00
参加費:無料
開催場所:FJORD, LLC
東京都渋谷区本町1−36−11 ドエルヤマト203

Lokkaの本体、テーマ、プラグインをもくもくと開発するイベントです。

最低でも@komagataはいて作業しています。

遅刻早退自由です。

飲み物食べ物持ち込み自由です。

# Gemfile:
gem 'devise'
% bundle
% rails g devise:install
% rails g devise:views
% rails g devise user
% rails g controller home index
% rake db:migrate
# config/environments/development.rb:
Foo::Application.configure do
  # ...
  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
end
# config/routes.rb:
Foo::Application.routes.draw do
  root :to => 'home#index'
  # ...
end
# app/views/layouts/application.html.erb:  
<p><%= link_to 'Sign in', [:new, :user_session]  %></p>                                                                                                               
<p><%= link_to 'Sign up', [:new, :user_registration]  %></p>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %>
% curl https://github.com/svenfuchs/rails-i18n/raw/master/rails/locale/ja.yml -o config/locales/ja.yml
% curl https://gist.github.com/raw/833169/54d19c523f6a608e732d4e9a6606a6d6cbec7f8e/devise.ja.yml -o config/locales/devise.ja.yml