ある単語Xが出てくる場所の前後5行以内に別な単語Yが出現する場所を探したい。

たまにはそんなこともありますね。

-A -B -C オプションが実装されている Rak やgrepを使えば簡単。

   1  % rak X -C 5 | rak Y

-A nは後方n行、-B nは前方n行、-C nは前後n行を 含めて表示するので、それをパイプして前後の文脈の 中からさらに検索してあげればOK。

posted by Png genki on Fri 21 Dec 2007 at 13:07

一時動かなくなっていた restful_open_id_authenticationプラグイン ですが、 ひとまず手元の環境で動く状態になったので、こちらに置いておきます。

http://svn.s21g.com/public/rails/plugins/restful_open_id_authentication_redux/

ruby-openid-2.0.1 のexamplesのコードが非常に参考になりました。

プラグイン中のmigrationジェネレータは、何も無い状態から DBを作るためのマイグレーションになっています。

すでにrestful_open_id_authenticationプラグインを 使っている状態からアップグレードする場合は、下記 [2]に掲載したmigrationコードをご利用ください。

Enter at your own risk!

See Also

  1. restful_open_id_authenticationプラグインの更新に着手
  2. rescful_open_id_authenticationプラグインの更新#2
posted by Png genki on Fri 21 Dec 2007 at 08:09

restful_open_id_authenticationプラグイン でOpenIDストアに使用していたDBを ruby-openid 2.0に移行させるためのマイグレーション。 ruby-openid 2.0のexamplesから抜粋。

   1  # Use this migration to upgrade the old 1.1 ActiveRecord store schema
   2  # to the new 2.0 schema.
   3  class UpgradeOpenIdStore < ActiveRecord::Migration
   4    def self.up
   5      drop_table "open_id_settings"
   6      drop_table "open_id_nonces"
   7      create_table "open_id_nonces", :force => true do |t|
   8        t.column :server_url, :string, :null => false
   9        t.column :timestamp, :integer, :null => false
  10        t.column :salt, :string, :null => false
  11      end
  12    end
  13  
  14    def self.down
  15      drop_table "open_id_nonces"
  16      create_table "open_id_nonces", :force => true do |t|
  17        t.column "nonce", :string
  18        t.column "created", :integer
  19      end
  20  
  21      create_table "open_id_settings", :force => true do |t|
  22        t.column "setting", :string
  23        t.column "value", :binary
  24      end
  25    end
  26  end

ちなみにオリジナルのプラグインが生成したマイグレーションコードはこちら。

   1      create_table :open_id_associations, :force => true do |t|
   2        t.column :server_url,   :binary
   3        t.column :handle,       :string
   4        t.column :secret,       :binary
   5        t.column :issued,       :integer
   6        t.column :lifetime,     :integer
   7        t.column :assoc_type,   :string
   8      end
   9  
  10      create_table :open_id_nonces, :force => true do |t|
  11        t.column :nonce,        :string
  12        t.column :created,      :integer
  13      end
  14  
  15      create_table :open_id_settings, :force => true do |t|
  16        t.column :setting,      :string
  17        t.column :value,        :binary
  18      end

open_id_settingsは不要になって、open_id_nouncesの 内容が変わります。

posted by Png genki on Fri 21 Dec 2007 at 06:40

昨日RubyGemsを1.0.0にアップデートしたところ、 require_gemが使えなくなってしまったため、 内部でrequire_gemを使っているGemが使えなくなりました。

かなり前から移行措置が取られていたため、 使えなくなったGemはほとんど無かったのですが、 一個だけ、ruby-openidの1.x.x系列が使えなくなっていました。

その結果、愛用していた restful_open_id_authenticationプラグインが 動かなくなってしまいました。 結構いろんなプロダクトで使っていたので影響大です。

ruby-openidの2.x.x系列は、require_gemを使わないようなコードに なっているのですが、インターフェイスが大分変わっているため、 すんなりとアップグレードが出来ない感じですね。

しかし、アップグレードしないわけにもいかないので、 restful_open_id_authenticationプラグインの ruby-openid 2.x.x系対応に着手します。

すでに同じ問題に取り組んでいる方がいらっしゃいましたら、 喜んでご協力いたしますのでご連絡いただけるとありがたいです。

連絡先

posted by Png genki on Fri 21 Dec 2007 at 06:23
Contents
grepやRakで2つ以上のキーワードの共起を検索する方法
restful_open_id_authentication_redux
restful_open_id_authenticationプラグインの更新#2
restful_open_id_authenticationプラグインの更新に着手
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
瀧内元気: おお、チェックしてみます。thx! '11-12
overisland: Reeder for iPhone もこの UI を実装していますね。 '11-12
瀧内元気: その情報は見たのですが、以下のサイトによると、現在はまた必要になってるっぽいんですよね。 ... '11-12
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ