あすなろブログとのダブルポストです。
―――

http://googlecustomsearch.blogspot.com/2008/04/searching-for-creative-commons-licensed.html

先日、FlickrのCCライセンスが付与されている写真の使い方を書きましたが、今度は自分のコンテンンツにCCライセンスを付与する方法をご紹介します。

どのライセンスで公開するかを決める

CCにはいくつかのライセンスラベルがあります。
http://creativecommons.org/licenses/
http://www.hyuki.com/trans/cc-licenses.html

HTML内にCCライセンスを表記する

HTMLdoc内にCCライセンスを表記する方法はいくつかある:

  1. <rdf:RDF>タグをHEADまたはBODY内に記述する
  2. <meta name="DC.rights" content=uri of cc license>タグを記述
  3. <a rel="license" href=uri of cc license>タグを記述
    4.<rdf:RDF>タグをコメント内に記述する

上記のどれかを満たしていれば付与したとみなされるようです。
ページでは実際にCCライセンスを付与しているサイト:http://joshua.smcvt.edu/linearalgebra/をサンプルとして紹介しています。上記の3と4の方法両方を実践。

3の方法(サイトの該当部を抜粋):

   1  <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>

4の方法(サイトの該当部を抜粋):

   1  <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
   2  	<Work rdf:about="">
   3  		<license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" />
   4  	<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
   5  	</Work>
   6  	<License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> -->

posted by Png satoko on Sun 11 May 2008 at 08:12

EC2onRailsでpostfixを使ってaliasesを設定する方法のメモです。

まずはaliasesの定義ファイルの場所ですが、/etc/aliasesにあります。 これを開くと

   1  postmaster:  root

というようなエイリアスのリストがあるので、これを編集します。 あて先が複数ある場合はコンマで区切ります。 "@"や":"などの記号を含む場合は二重引用符で囲みます。

あて先に指定できる項目は以下の通り。

  • ユーザ名 or メールアドレス 所定のあて先に転送されます。
  • PATH 指定のファイルに追記されます。
  • | command 指定したコマンドが実行され、標準入力に渡されます。

他にもありますが、詳細は下記のSee Alsoを参考にしてください。

編集し終わったら、DBを更新するために以下のコマンドを実行します。

   1  # postalias /etc/aliases

以上で完了。

See Also

posted by Png genki on Fri 9 May 2008 at 16:56

現状etchのgit-coreバイナリーpackageの最新は1.4.4系です。ただ1.5系ではコマンド体系が変わっているのでソースから入れることにしました。
→DebianでGitバイナリーpackageインストールについてはここ

git-coreパッケージを探す

http://packages.debian.org/search?searchon=names&keywords=git-core
http://packages.debian.org/lenny/git-core
現状ではlenny(testing:次期stable)のgit-coreが一番良さそうですね:1.5系。

/usr/local/srcにパッケージをダウンロード、解凍、インストール

   1  # wget http://ftp.de.debian.org/debian/pool/main/g/git-core/git-core_1.5.5.1.orig.tar.gz
   2  # tar -xvf git-core_1.5.5.1.orig.tar.gz
   3  # cd git-1.5.5.1
   4  # ./configure
   5  # make
   6  # make install
   7  # git --version
   8  git version 1.5.5.1

おまけ

gitの最新バージョンを入手してみます
via http://git.or.cz/#download

   1  $ git clone git://git.kernel.org/pub/scm/git/git.git
   2  Initialized empty Git repository in /home/hibi/git/.git/
   3  remote: Counting objects: 71595, done.
   4  remote: Compressing objects: 100% (21567/21567), done.
   5  remote: Total 71595 (delta 51380), reused 68247 (delta 48660)
   6  Receiving objects: 100% (71595/71595), 15.33 MiB | 1428 KiB/s, done.
   7  Resolving deltas: 100% (51380/51380), done.
ちゃんとclone出来ました。

posted by Png satoko on Thu 8 May 2008 at 05:36

Amazonからrpmパッケージを持ってきてインストールするメモ。

   1  # cd /usr/src
   2  # wget http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.noarch.rpm
   3  # alien --to-deb ec2-ami-tools.noarch.rpm
   4  # dpkg -i ec2-ami-tools_1.3-20042_all.deb

でOK。/usr/lib/site_ruby/の下に当該ファイル群がインストールされています。

See Also

posted by Png genki on Wed 7 May 2008 at 17:32

EC2onRails は、EC2上でRailsアプリケーションを走らせる環境として提供されている AMIイメージと管理用スクリプト群です。 これを使うと、非常に簡単にRailsアプリケーションをEC2上で動かす 環境を用意することが出来ます。 基本的にCapistranoのタスクとして実装されていて、

   1  % cap deploy

するだけで、開発環境からEC2上にデプロイが完了します。

EC2onRailsは非常に便利でありがたいのですが、 基本的に1アプリケーション1インスタンスの構成でデプロイされるように なっているので、ちょっとしたサンプルアプリケーションや、 内々に評価中のアルファ版のサービスなどを気軽にデプロイするのには、 コスト面が気になるところです。

ということで、1インスタンスで複数アプリケーションをデプロイするために 施した修正のメモを以下に書いておきます。

  • EC2onRailsの各種設定ファイルのデプロイ先を/mnt/app/から /mnt/app/<app_name>に変更
  • /etc/init.d/mongrel の中身を修正し、第二引数でアプリケーション名を 受け取るようにする。
    • 受け取ったアプリケーション名を元に、/mnt/app/<app_name>/currentにcdして、config/mongrel_cluster.ymlを参照してmongrel_rails cluster::restart するようにする。
  • /etc/apache2/conf.d/の中身をapp.proxy_frontend.confとcharset以外削除。
  • /etc/apache2/sites-enabled/の中身を削除し、アプリケーションごとのVirtualHostの設定を記述したファイルを<app_name>という名前で作成する。
       1  ServerSignature Off
       2  <VirtualHost *:80>
       3  ServerName blog.s21g.com
       4  
       5  <Directory />
       6  (---略---)
       7  </Directory>
       8  
       9  DocumentRoot /mnt/app/blog/current/public
      10  
      11  <Directory "/mnt/app/blog/current/public">
      12  (---略---)
      13  </Directory>
      14  
      15  <Proxy balancer://mongrel_cluster>
      16    BalancerMember http://127.0.0.1:8000
      17    BalancerMember http://127.0.0.1:8001
      18  </Proxy>
      19  (---以下略---)
    
  • アプリケーションごとに80n* のようなポート番号を割り当てるとか。

大体こんな感じで複数アプリ対応化できた気がします。 何か漏れがあるのを思い出したら追記します。

See Also

posted by Png genki on Wed 7 May 2008 at 15:25 with 2 comments

Rubyでは、Dateのインスタンスをinspectすると、以下のような馴染みのない数値が出力されます。

   1  Date.today.inspect
   2  => "#<Date: 4909185/2,0,2299161>"

これはDateクラスが日付の内部表現としてRationalを利用しているためですが、inspectしたときにこの表現が出てきても、日付がわからないので困りますね。 そこで、以下のようにDate#inspectを定義してあげると、 人間に優しい表現になります。

   1  class Date
   2    def inspect
   3      strftime '#<Date: %x>'
   4    end
   5  end
   6  
   7  >> Date.today
   8  => #<Date: 05/06/08>

これならDateが何日なのかわかりやすいですね。

strftime%xはロケールによって出力が変わるので、 お使いのPCの環境によっては、上記のような出力にならない事もあります。

See Also

posted by Png genki on Tue 6 May 2008 at 11:44

C++のノリで以下のように宣言しても、Rubyのクラスメソッドはprivateにはなりません。

   1  class Foo
   2  private
   3    def self.bar
   4    end
   5  end
   6  
   7  Foo.bar #=> 呼べる

Rubyでクラスメソッドをprivateにするためには、以下のように private_class_methodを利用します。

   1  class Foo
   2    def self.bar
   3    end
   4  
   5    private_class_method :bar
   6  end
   7  
   8  Foo.bar # => NoMethodError: private method `bar' called for Foo:Class

private_class_methodの宣言は、メソッド定義より後ろにある必要があります。

posted by Png genki on Mon 5 May 2008 at 04:44 with 2 comments

The language is the first tool and is the last shackle.

Or rather, every useful tool easily becomes a shackle. The more useful tool is the stronger shackle. The language is the most useful tool for us mankinds, whether programming languages or natural languages.

posted by Png takiuchi on Sun 4 May 2008 at 11:44

ここここで書いたSchwartzさんですが、Git@goole techtalkの資料公開をリクエストしてみました。
次の日の朝には返信が帰ってきて、「1年ほど前のやつだしちょっと話している内容とはちょっと違うけど大体同じだと思う。」ということで教えていただきました!yay!

CCで公開されています(商用はNG)。すばらしい。

SchwartzさんのGit資料

http://www.ourmedia.org/node/276036
http://www.archive.org/download/Introduction_to_git/Git.pdf 資料直リン

Schwartzさんの他の資料へのリンク

http://ourmedia.org/node/225170 Perl Best Practices
http://ourmedia.org/node/372391 Perl Web Testing
http://ourmedia.org/node/373784 Podcasting Primer

資料で気に入ったところ

18ページくらいまでしか見れてないです。後半mergeとかbranchとか出てきてさらに面白さがupしています。

  • working treeのtopには".git"ファイルがある(サブディレクトリにはない!)
  • コピペ編集でも同じ内容なら同じものと検出(fileのSHA1が同じならということだと思います)
  • git coreはimport/export with CVS, import/export with SVNもOK
  • git coreはCVSサーバーも同梱
  • "git-MUMBLE-FOO bar"は"git MUMBLE-FOO bar"と書ける
posted by Png satoko on Sun 4 May 2008 at 07:28
3rd Sat

EC2に移行中

現在このブログシステムをEC2に移行する作業を行っております。

しばらくの間、アクセスしにくい状態が発生する可能性がありますが、 よろしくお願いいたします。

追記

移行が完了しました。今後ともよろしくお願いいたします。

posted by Png genki on Sat 3 May 2008 at 04:15 with 1 comment