最近、 NeverBlock の周辺の動きが面白い。

What is it all about?

NeverBlock is a Ruby library that allows developers to write non-blocking, concurrent code in a transparent manner. Meaning that you will keep coding in your traditional ways while you get the benefit of non-blocking IO operations.

LL futureの講演者控え室で、まつもとさん、高橋さんから、 その辺の話を伺う機会がありましたが、 NeverBlockはRuby-1.9普及の引き金になるかもしれない。 なぜなら、NeverBlockはRuby-1.9のFiberに依存したライブラリで、 Ruby-1.9が無いと利用できないからだ。

Building the Never Blocking Rails, Making Rails 12X Faster

They told you it can't be done, they told you it has no scale. They told you lies!

What if you suddenly had the ability to serve mutliple concurrent requests in a single Rails instance? What if you had the ability to multiplex IO operations from a single Rails instance?

No more what ifs. It has been done.

NeverBlockを使うとRailsが12倍速くなるらしい。

MySQLPlus: A Non-Blocking MySQL Driver for Ruby 1.8 and 1.9

MySQLPlus is billed as a new general purpose MySQL driver that supports "threaded access and async operations"

NeverBlockを使うために作られたMySQL用の新しいドライバらしい。

See Also

posted by Png genki on Thu 4 Sep 2008 at 09:32

I made an Ubiquity command in order to enable us to get images of mathematical equations from anywhere at anytime. It uses the Formula , which is the service for making images of mathematical formulae.

You can also get a preview of your input in real time, like this.

formula_u.png

INSTALL

The command is able to be installed from here.

NOTE1: You need the Ubiquity , an extension of the Firefox, to use ubiquity commands.

NOTE2: This command requires BASIC authentication via SSL at the first time in order to prevent SPAM posts. When you get the dialog box of the authentication, please enter your name and password which were used when you left a comment at the Formula. It means that you must leave at least one comment to the Formula for being authorized.

posted by Png takiuchi on Thu 4 Sep 2008 at 04:50

Formula を使って、Ubiquityから数式を投稿するUbiquityコマンドを作ってみました。 こんな感じに、Previewも実装しています。

formula_u.png

これを使えば、いつでもどこからでも、数式を投稿することができます。 コマンドを実行すると、Formula上の数式ページにジャンプするので、 埋め込みようタグを使ってブログに投稿することも簡単にできます。

インストール

formula用Ubiquityコマンドは、以下のページからインストールできます。

配布には拙作の Gist Ubiquitifier を使っています。

ご注意

スパムプログラムからの投稿などを避けるために、 SSL+Basic認証による認証をかけています。

本コマンドを最初に実行する時に、Basic認証のダイアログが出ます。 Basic認証に使うユーザ名とパスワードは、 Formula上でコメントをする時に使ったものをご利用ください。 Formula上に1つでもコメントがあれば、本コマンドが利用可能になります。

posted by Png genki on Thu 4 Sep 2008 at 02:54

prawnto(プラウント?)使ってみました。まだ課題があるのですが、現時点でのメモです。

http://cracklabs.com/prawnto
http://cracklabs.com/prawnto/demos:デモ一覧
http://github.com/thorny-sun/prawnto/tree/master
git://github.com/thorny-sun/prawnto.git

生成したPDF

以前の記事をPDFにしてみました。
生成されたPDF:test.pdf

pluginのインストール

prawnライブラリを使っているので、ますprawnをインストール。その後prawnto pluginインストール。

   1  sudo gem install prawn
   2  ./script/plugin install    git://github.com/thorny-sun/prawnto.git

(日本語表示用に)IPAフォントをダウンロード

下記からダウンロードして解凍、ttfファイルをアクセス可能なところにコピーします。
http://ossipedia.ipa.go.jp/ipafont/

配置するとしたら下記でしょうか。

  • #{RAILS_ROOT}/vendor/fonts
  • #{RAILS_ROOT}/vendor/font_ttf
  • /usr/share/fonts/
  • /usr/local/share/fonts/)

Rails controller, view

まずはController
page_layoutは:portrailt(縦)か:landscape(横)のどちらかです。

   1  #controller
   2      respond_to do |format|
   3        format.html { render :action => 'show' }
   4        format.pdf {
   5          prawnto :prawn => {
   6            :page_layout => :portrait, #
   7            :page_size => "A4",
   8            :left_margin => 36,
   9            :right_margin => 24,
  10            :top_margin => 24,
  11            :bottom_margin => 24},
  12          :inline => true
  13        }
  14      end

そしてview(show.pdf.prawnという形式のファイル)

   1  #show.pdf.prawn
   2  pdf.font "#{RAILS_ROOT}/public/ipag.ttf"
   3  pdf.text @article.title, :size => 36
   4  pdf.text @article.body
   5  pdf.text "This page has very wide left and right margins, causing a squeeze. " * 10
   6  pdf.text "これはテストです。" * 20
   7  pdf.font "Times-Roman"
   8  pdf.text "abcdefghijklmnopqrstu"* 20, :wrap => :character
   9  pdf.text "http://thebogles.com/blog/2007/10/how-to-add-google-adsense-for-mobile-to-your-ruby-on-rails-site/"

現時点での課題

  • URLや日本語の文章など空白がない文字列?だと折り返されない
    => demoで紹介されている:wrap => :characterオプションが0.1.2だとなさそう?
  • レイアウト枠のpdfを重ねたりする機能はない?(発見できず)
posted by Png satoko on Wed 3 Sep 2008 at 23:28 with 2 comments
Contents
NeverBlockの周辺の動き
The Ubiquity Meets Mathematical Formulae
Ubiquityから数式を投稿するコマンドを作りました
Rails:prawn & prawntoで日本語のPDF生成
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
KingofSmack: Here also good reads for this mobile applicatio... '14-5
Spencer: You don't have to re-compile it, this version w... '14-4
staiano: Any chance we can get a recompile for 10.9? '14-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ