2010-09-02 15:40 追記
Makefile.PL を直接書き換えなくとも,perl Makefile.PL の際のオプションとして指定できるとのご指摘をいただき,該当個所を修正しました.
(Thanks to @nekokak

はじめに

perlbrew + cpanminus(以下,cpanm) な環境を試みている今日この頃,DBIがらみで一部つまずいたので,その解決までのメモです.

環境について

現状

  • Perl-5.8.9
  • MySQL-5.0.85

これらを MacPorts 経由でインストールしています.

これから

Perl-5.8.9 に加え,さすがにそろそろ Perl-5.12 なんかも使いたいよね,ということで,perlbrew + cpanm な環境を準備しています.

エラー

cpanm DBIcpanm DBIx::Skinny などが「Successfully installed」された後に,以前の環境で動作していたアプリを動かしてみたところ,次のようなが出ました.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@ DBIx::Skinny 's Exception @@@@@
Reason  : install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /Works/Hoya/master/lib /Works/Hoya/master/extlib lib /Users/iwata/perl5/perlbrew/perls/perl-5.8.9/lib/5.8.9/darwin-2level /Users/iwata/perl5/perlbrew/perls/perl-5.8.9/lib/5.8.9 /Users/iwata/perl5/perlbrew/perls/perl-5.8.9/lib/site_perl/5.8.9/darwin-2level /Users/iwata/perl5/perlbrew/perls/perl-5.8.9/lib/site_perl/5.8.9 .) at (eval 178) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
 at lib/DBIx/Skinny.pm line 229

手動でインストール

コマンドラインで確認

先のエラーでは,DBD::mysql がない,と言われています.

% perl -MDBD::mysql -le 1
Can't locate DBD/mysql.pm in @INC (@INC contains: /Users/iwata/perl5/perlbrew/perls/perl-5.8.9/lib/5.8.9/darwin-2level /Users/iwata/perl5/perlbrew/perls/perl-5.8.9/lib/5.8.9 /Users/iwata/perl5/perlbrew/perls/p
erl-5.8.9/lib/site_perl/5.8.9/darwin-2level /Users/iwata/perl5/perlbrew/perls/perl-5.8.9/lib/site_perl/5.8.9 .).
BEGIN failed--compilation aborted.
%

確かに.

とりあえず cpanm

まずは脊髄反射的に cpanm DBD::mysql してみます.

% cpanm -v DBD::mysql
 
...
 
DBD-mysql-4.017/t/mysql.dbtest
DBD-mysql-4.017/t/mysql.mtest
DBD-mysql-4.017/TODO
Entering DBD-mysql-4.017
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.48)
Configuring DBD-mysql-4.017 ... Running Makefile.PL
Can't exec "mysql_config": No such file or directory at Makefile.PL line 82.
 
Cannot find the file 'mysql_config'! Your execution PATH doesn't seem 
not contain the path to mysql_config. Resorting to guessed values!
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
 
 
PLEASE NOTE:
 
For 'make test' to run properly, you must ensure that the 
database user 'iwata' can connect to your MySQL server 
and has the proper privileges that these tests require such 
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others. 
 
mysql> grant all privileges on test.* to 'iwata'@'localhost' identified by 's3kr1t';
 
You can also optionally set the user to run 'make test' with:
 
perl Makefile.PL --testuser=username
 
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Failed to determine directory of mysql.h. Use
 
  perl Makefile.PL --cflags=-I<dir>
 
to set this directory. For details see the INSTALL.html file,
section "C Compiler flags" or type
 
  perl Makefile.PL --help
N/A
! Configure failed for DBD-mysql-4.017. See /Users/iwata/.cpanm/build.log for details.
%
</dir>

失敗しました orz
続きを読む »

2010-08-29 07:10 追記
Emacs Lisp の記述を一部修正しました.
Thanks to @clairvy

ss-2010-08-28-10

はじめに

この数日で,Perl開発環境としてのEmacsの設定 | おいぬま日報 とか Emacsテクニックバイブル ~作業効率をカイゼンする200の技~ とか WEB+DB PRESS Vol.58 のEmacs特集とかを読んで,私のEmacs環境的にいろいろインプットできた気がするので,それらをまとめてアウトプット.

以下,新たに知った中で,個人的によく使うだろうと思った機能,以前の言及 からの設定の変更とかなどを書いていきます.

なお,.emacsの変更以外にもインストール作業等が必要なものが多々ありますが,そのあたりは省略していますのであしからず.

インプットいろいろ

ヘルプいくつか

  • <f1> kdescribe-key
  • <f1> bdescribe-bindings
  • <f1> vdescribe-variable
  • <f1> fdescribe-function

同一バッファでの反復入力の省エネ化

M-/dabbrev-expand

Emacs Lispの評価

C-x C-eeval-last-sexp

M-:eval-expression

特に前者は,.emacs 編集時,その中でも変数の値を試行錯誤する際に重宝しています.

ロードパス設定

setq 関数の引数に,設定のペアをいくつも連ねられるようなので,ちょこっと書き換え.

;; del: 2010-08-29T07:10+09:00
;(setq load-path (cons "~/.emacs.d/site-lisp/" load-path)
;      load-path (cons "~/.emacs.d/auto-install/" load-path)
;
;      load-path (cons "~/.emacs.d/site-lisp/migemo-0.40/" load-path)
;      ;load-path (cons "~/.emacs.d/site-lisp/apel-10.7/" load-path)
;      load-path (cons "~/.emacs.d/site-lisp/apel/" load-path) ; cvs で 10.8 を checkout
;      load-path (cons "~/.emacs.d/site-lisp/elscreen-1.4.6/" load-path)
;      load-path (cons "~/.emacs.d/site-lisp/wp-emacs/" load-path) ; これは使わなさげ
;      load-path (cons "~/.emacs.d/site-lisp/ac/" load-path)
;      load-path (cons "~/.emacs.d/site-lisp/twittering-mode/" load-path)
;      load-path (cons "~/.emacs.d/site-lisp/zencoding/" load-path)
;      )
 
;; ins: 2010-08-29T07:10+09:00
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(add-to-list 'load-path "~/.emacs.d/auto-install")
 
(add-to-list 'load-path "~/.emacs.d/site-lisp/migemo-0.40")
;(add-to-list 'load-path "~/.emacs.d/site-lisp/apel-10.7")
(add-to-list 'load-path "~/.emacs.d/site-lisp/apel") ; cvs で 10.8 を checkout
(add-to-list 'load-path "~/.emacs.d/site-lisp/elscreen-1.4.6")
(add-to-list 'load-path "~/.emacs.d/site-lisp/wp-emacs") ; これは使わなさげ
(add-to-list 'load-path "~/.emacs.d/site-lisp/ac")
(add-to-list 'load-path "~/.emacs.d/site-lisp/twittering-mode")
(add-to-list 'load-path "~/.emacs.d/site-lisp/zencoding")

グローバルなキーバインド

C-p 押しっぱなしによる上方向へのカーソル移動が非常にモッサリ,もしくはまったく動かないため,C-@ にも同様の役割を持たせるなど.

(global-set-key "\C-@" 'previous-line)  ; C-p 押しっぱなしだとモッサリするため
(global-set-key "\C-z" nil)             ; 最小化うざい

また,M-nM-p を「前後のバッファへの切り替え」に割り当てていましたが,auto-complete の候補選択に競合してしまうため,これらを無効に.

;; バッファ切り替えを簡単に
;(global-set-key "\M-n" 'next-buffer)
;(global-set-key "\M-p" 'previous-buffer)

カーソル点滅速度の調整

続きを読む »

IMGP3091

はじめに

先週末,2日間で3度のパンクに見舞われ,リムテープがアヤシイ,というところまではなんとなくつきとめたものの,なぜそうなるかが理解できていなかったため,いつもお世話になっている自転車屋さん サイクルショップ カワタ で,リムテープの交換とか全滅したチューブの補充とかのついでに,そのあたりの原理を尋ねてみました.

以下,私の理解を簡単な図にしてみます.

リムテープの役割

fig-2010-08-24-01

ホイールのリムには,スポークの張力を調整するための穴が空いています.チューブに高圧の空気が入っていて,かつ,ホイールとかタイヤとかに囲まれた密閉状態では,この穴が,唯一の力の逃げ場になります.この逃げようとする力が上図の A となります.しかし,逃げられてはいろいろマズイので(後述),これを抑えないと行けません.そのための力が上図の B で,その力を生むための部品が「リムテープ」となるわけです.

リムテープがない,もしくは劣化すると...

fig-2010-08-24-02

穴から逃げる力 A を抑えるための力 B がない,もしくは相対的に弱いため,チューブが穴からプクっと膨らんでしまいます.このような部分は,表面(?)が非常に弱く,裂けやすくなっているそうです(上図の C).また,穴の縁との摩擦による損傷の可能性も出てきますね(上図の D).

まとめ

チューブを交換する際には,リムテープも必ずチェックすべし!

大丈夫そうでも定期的に交換した方がよさげ!

おわりに

以上,自転車乗りのみな様には常識的なことかと思いますが,個人的にその役割とアイディア(?)にけっこう感激したので,こんなエントリを書いてみました.

amazon さん

はじめに

告知忘れてました><

明日 2010年 8月22日(日)夕方,名古屋でPerlをゆるく語る会 の第2回目がありますよ.

概要

名称
名古屋でPerlをゆるく語る会 #2
日時
2010年 8月22日(日) 17:00〜
会場
Cafe どえりゃあ
※ 前回は,お店に入って,向かって左側あたりに集まりました.
参加費
食べて飲(呑?)んだ分だけ
Twitterハッシュタグ
#yuruperl

詳しくは,ATNDの同イベントページへ.

参加表明は...

上記ページにて参加登録も行えます.興味のある方はぜひ.

その他の情報は...

Googleグループを作ったり,主催者の trinity777 さん がTwitterアカウントを作られたりしているので,そのあたりをチェックしてみてください.

おわりに

前回はゆるすぎた感が多々あったようなので,今回はもう少しPerlPerlした感じになるのかな? まぁ自分はそのまんまで行くつもりです>< この1週間泳いでいないので,泳いでから行こうかな.

あ,今回も PubHub 行きますか?w

それでは,let’s enjoy Perl’s talk!

FLOSS桜山 第40回勉強会でLTをします(しました).

以下,その資料を置いておきます.

発表資料

2010-07-24 FLOSS桜山 第40回勉強会 LT WP-Syntax LLPメガネラボ 岩田 享/issm

アジェンダ

  • 自己紹介
  • WP-自己紹介
  • WP-Syntax
  • +α
  • まとめ

自己紹介

  • 岩田 享/issm
  • LLPメガネラボ
  • とある伏見の駐車場(パーキング)

よろしくおねがいします

WP-自己紹介

  • 岩家ぶろぐ
  • http://blog.iwa-ya.net/
  • on lighttpd from 2010-01
  • テーマは自作
  • header.php
  • index.php
  • sidebar.php
  • footer.php

WP-Syntax:概要

  • WordPressプラグイン
  • ソースコードをハイライト
  • PHPライブラリ「GeSHi」を利用
    • 177種類の言語をサポート(ver.1.0.88)
    • プラグインに同梱

詳しくは...

  • http://wordpress.org/extend/plugins/wp-syntax/
  • http://qbnz.com/highlighter/

WP-Syntax:基本書式

エントリ本文で...

      <pre
      lang="{language}"
      line="{line}">
      ... ソースコード ...
      </pre>
    

これだけでハイライトしてくれる

※「ぶろぐでデモ

+α

行番号がある場合

行番号がない場合

このHTMLをごにょごにょするJavaScriptを書いてみた

  • use jQuery;

※「ぶろぐでデモ

まとめ

WP-Syntax

  • ソースコードをいい感じでハイライト
  • 設定も直感的

おまけ

  • WP-Syntax後のソースコード領域をクリックすると,コピペのための選択をするJavaScript

ご清聴ありがとうございました! Enjoy code-highlighting! powered by: http://www.dqwm.net/

1 of 7812345102030...78
直近のつぶやきを読み込みちゅう...