備忘録として。

ウインドウをいくつも開くと、タスクバーに表示されているタスクバーボタンがまとまってしまうことがある。

↓まとまっている状態のタスクバーボタン

ber2.png

まとまってしまうと、特定のウインドウを表示させたいときに手間がかかるので、タスクバーボタンをまとまらないようにする。

↓まとまっていない状態のタスクバーボタン

ber.png

方法

タスクバー上で右クリックをする。
プロパティをクリックする。
タスクバーのデザイン」にある「同様のタスクバーボタンをグループ化する」のチェックをはずして「適用」「OK]をクリックする。

posted by Png mari on Thu 21 Aug 2008 at 02:50

The PaginationScope library is a pagination library of the NamedScope era.

The difference to the last version is only a small bug fix. So you can keep using it if you don't mind.

That's all. But I shall use this opportunity to write some document for the helper method of the library.

SYNOPSIS:

   1  paginate <scope>[, <options>]

The scope is a pagination scope object. The options is a hash including several parameters as follows.

  • :newer The label string for the link to a newer page.
  • :older The label string for the link to an older page.
  • :left The number of pages which appears on the left side.
  • :right The number of pages which appears on the right side.
  • :window The width of pages which surrounds the current page.
posted by Png takiuchi on Wed 20 Aug 2008 at 02:17

Git-1.6がリリース されたようなので、手元の環境をアップデートしてみました。

   1  % su
   2  # cd /usr/local/src
   3  # wget http://kernel.org/pub/software/scm/git/git-1.6.0.tar.bz2
   4  # tar xvjf git-1.6.0.tar.bz2
   5  # cd git-1.6.0
   6  # make
   7  # rm -rf /usr/local/bin/git-*
   8  # make install
   9  # make install-doc

1.6からgit-xxxxxというサブコマンド系のコマンドが無くなったようなので、 古い実行ファイルを削除してみました。

updated by Png genki on Wed 20 Aug 2008 at 00:24

remote_functionではPost値を:withでいちいち指定する必要がある。 フィールドの数が多い場合は大変だ。

そういう場合、prototype.jsにForm.serialize('フォームのID')でフォームの値をname1=value1&name2=value2形式にしてくれる関数が便利である。

   1  <%= javascript_include_tag "prototype" %>
   2  <script language="JavaScript">
   3  function newArticle(){
   4      <%= remote_function(:url => {:action => :new},
   5                           :update => 'list',
   6                           :with => "Form.serialize('article')"
   7      ) %>
   8  }
   9  </script>
  10  

posted by Face ysakaki on Tue 19 Aug 2008 at 11:57

たとえばJavaScriptの都合などでactionがnewでもeditでもフォームタグのidが同じになって欲しいことがある。 そういう場合は:html=>{:name1=>'value1',:name2=>'value2'}でhtmlオプションを指定できる。

   1  <% remote_form_for(@article, :url => {:action => :update, :id => @article}, :update => 'list',:html=>{:id=> 'article'}) do |f| %>
   2  
   3    <%= render :partial=>f %>
   4  
   5    <p>
   6      <%= f.submit "保存" %>
   7    </p>
   8  <% end %>

posted by Face ysakaki on Tue 19 Aug 2008 at 11:53

Markdownをpreg-markdownに切り替える ついでに、 Formulaの コメントのプレビューができるようにしました。

コメント中に $x=y$ のように記述することでインライン形式で数式を記述できます。 また、

\[
f(x)=\int_0^x g(t)\,dt
\]

のように書くことで、ディスプレイスタイルで数式を含めることも出来ます。

そのうちこちらのブログでもこの記法を使えるようにする予定です。

posted by Png genki on Mon 18 Aug 2008 at 23:56

RubyでMarkdown記法というと、BlueClothが有名なのではないかと思いますが、rdiscountとrpeg_markdownという新しいライブラリが Daring Fireball氏のこちらの記事で紹介されていました。

Better Markdown Libraries for Ruby: RDiscount and rpeg-markdown

Ryan Tomayko has solved this with two new Ruby extensions that wrap extremely fast (and accurate) C libraries for Markdown: David Loren Parsons’s Discount and Jon MacFarleane’s peg-markdown.

早速 Formula で使ってみようと検証していたのですが、上述の二つのライブラリには、 エスケープの仕方でMARKDOWN記法の解釈に以下のような違いがあるようです。

   1  source = "[test](http://foo.com/?x%3Dx%2B5%2B2y)"
   2  RDiscount.new(source).to_html
   3  #=> "<p><a href=\"http://foo.com/?x%253Dx%252B5%252B2y\">test</a></p>\n"
   4  Markdown.new(source).to_html # rpeg-markdown
   5  #=> "\n\n<p><a href=\"http://foo.com/?x%3Dx%2B5%2B2y\">test</a></p>"

RDiscountの方は、エスケープ済みのQuery Stringをもう一回エスケープしてしまっているようです。

posted by Png genki on Mon 18 Aug 2008 at 23:23 with 2 comments

Rails勉強会@東京第32回 に参加してきました。 お盆の最中だったせいか、いつもの半分ぐらいの参加者でした。 そのせいか、いつもとちょっと違ったRails勉強会となりました。

  • シングルトラック
  • 3セッション
  • 自己紹介が最後

これがなかなか良かったです。 ただ、人数が多いとできない形式でしょうね。

IMG_0139.JPG

実際に行われたセッションは以下の通り。

  • YuguiさんによるRedmineの話(実質は高橋会長によるRESTトーク)
  • 大場さんによるJRubyで拡張を作る話
  • 西さんによるgitの話(入門から仕事で使えるレベルまで)

いずれもハイクオリティなセッションで面白かったです。 僕はgitの話でちょっと話をしました。 リポジトリ間で相互のpush/pullするのが出来たので満足。 それから、git-instawebやgit-guiという、 Git用のGUIツールがある事を教わりました。

posted by Png genki on Mon 18 Aug 2008 at 00:36 with 3 comments

I made a new pagination library for the NamedScope era. You can use will_paginate for ordinary case. It must be better than the young PaginationScope library. But if you want to paginate with complicated chained named_scopes, this is suitable.

Usage

At first, include the module into your model class.

   1  class Post
   2    include PaginationScope

By this, the scope named "paginate" is made.

And then, in the controller of which you want to use pagination, you can get the scope for pagination like this.

   1  class PostsController < ApplicationController
   2    def index
   3      @posts = Post.not_deleted.paginate(params[:page], 10)

Finally, the pagination links are generated by calling the view helper, like this.

   1  <%= paginate @posts %>

Have fun!

posted by Png takiuchi on Sat 16 Aug 2008 at 23:57

named_scopeによるPagination を行うためのGemを作りました。 通常はwill_paginateを利用するほうがいいと思いますが、 :joinsを含む複雑なnamed_scopeを介してpaginationを行いたい場合には、 利用すると便利かもしれません。

pagination_scope

使い方

まず、モデルクラスの中でincludeします。

   1  class Post
   2    include PaginationScope
   3  end

これによって、Postクラスにpaginateというnamed_scopeが作成されます。

続いて、Paginationを利用したいコントローラのアクションメソッド内で、

   1  class PostsController < ApplicationController
   2    def index
   3      @posts = Post.not_deleted.paginate(params[:page], 10)

のようにScopeを取得します。

続いて、Viewで以下のようにPagination用HTMLを生成します。

   1  <%= paginate @posts %>

paginateメソッドは PaginationScope によって導入されるViewヘルパーです。

posted by Png genki on Sat 16 Aug 2008 at 23:14
Contents
タスクバーボタンのまとまりを防ぐ
Shipped the PaginationScope-0.0.3
Git-1.6をインストールしてみる
Form.seriarizeでremote_functionの:withにフォームの値を設定する
remote_form_forでフォームタグのidを指定する
FormulaにコメントPreview機能をつけました
rdiscountとrpeg_markdown
Rails勉強会#32レポート
PaginationScope: The Pagination Library of the NamedScope Era
pagination_scope
Tags
Comments
瀧内元気: **See Also** * [**Moving Past BlueCloth**](ht... 8/19
瀧内元気: おお、紹介どうもありがとうございます! 8/18
瀧内元気: **追記** rpeg_markdownをインストールするにあたって、 * pkg-co... 8/18
Koichiro Ohba: 先日はお世話さまでした。 Charlesの記事もどぞ。 <a href="http://b... 8/18
瀧内元気: Dubyという言語に関する情報が得られた。 こんな感じの言語らしい。 <http://sv... 8/18
Trackbacks
Google App Engine Markdown - ウェブ検索 02:43
with_named_scope: named_scopeを古き良きwith_scope風味に利用する - Hello, world! - s21g 02:04
named_scopeによるpagination - Hello, world! - s21g 02:04
XML rails のウェブ検索結果 @search:@nifty 23:06
はてなブックマーク - toshyon bookmark / thin 20:46
Our Services
me, myself & MUJI
あなたらしい無印の使い方提案
Formula
ブログに数式を埋め込める数式コミュニティ