Archive for the ‘備忘録’ Category

phpでコーディング規約に沿っているかチェックするPHP_CodeSniffer(javaでいうcheckstyle的な)

phpでコーディング規約に沿っているかチェックする
http://pear.php.net/manual/ja/package.php.php-codesniffer.usage.php
インストール
pear install PHP_CodeSniffer
Zendのコーディング規約でチェックする
phpcs –standard=Zend users_controller.php
[出力結果]
FILE: /home/hogehoge/public_html/app/controllers/users_controller.php
——————————————————————————–
FOUND 20 ERROR(S) AFFECTING 21 LINE(S)
——————————————————————————–
10 | ERROR | Opening brace of a class must be on the line after the
| | definition
19 | ERROR | Opening brace should be on a new line
24 | ERROR [...]

Posted by ニセレブ on 9 月 7th, 2010 under php, 備忘録 Tags: , , , , , ,  •  No Comments

railsで日付の妥当性チェック

よく忘れるのでメモしておく。
http://github.com/nickstenning/validates_date_time
insatall

./script/plugin install git://gith [...]

Posted by ニセレブ on 5 月 18th, 2010 under ruby, 備忘録 Tags: , , , , , , ,  •  3 Comments

railsのログのフォーマットをカスタマイズ

Rails 2.3.5でログのフォーマットを変更したら予想以上に面倒だった件について。
他にもいろんな方法が有るみたいなんだけどrailsのバージョンにって対応方法が違うらしい。
このコードをconfig/initial [...]

Posted by ニセレブ on 2 月 16th, 2010 under ruby, ソフトウェア, 備忘録 Tags: , , , , , , , , , , ,  •  4 Comments

ubuntu linux で起動時にスクリプトを実行する

ubuntu linux で起動時にスクリプトを実行する
1. /etc/init.d に起動するスクリプトを設置する。
skeleton というのがあるのでそれをコピッて作るといい。
と、知らなくてmysqlの起動スク [...]

Posted by ニセレブ on 9 月 9th, 2009 under linux, 備忘録 Tags: , , , , ,  •  No Comments

hyper estraierとrailsを組み合わせてrailsから全文検索

hyper estraierとrailsを組み合わせてrailsから全文検索を利用する。
参考にした記事は
Railsの全文
検索は、Hyper Estraierとsearch_doプラグインで超簡単 - 医者を志す妻を [...]

Posted by ニセレブ on 8 月 1st, 2009 under ruby, 備忘録 Tags: , , , , , , ,  •  No Comments

android開発用のADT(eclipse plugin)のインストール

いろんなサイトに以下のURLよりインストールすると書いてあるのだが
リポジトリが存在しないらしくエラーになる。
ブラウザでたたいても404だし。
https://dl-ssl.google.com/android/ecl [...]

Posted by ニセレブ on 7 月 26th, 2009 under java, 備忘録 Tags: , , , , , , ,  •  No Comments

ubuntu linux にandroid SDKをインストール

このあたりからsdkをダウンロードしてインストール。
http://developer.android.com/intl/ja/sdk/1.5_r3/index.html
tools をパスに追加してパスを通す。
*起動
emulator
速攻でエラー!

hogehoge@ireul:/opt/android-sdk/tools$ ./emulator
emulator: ERROR: You did not provide the name of an Android Virtual Device
with the ‘-avd <name>’ option. Read -help-avd for more information.

If you *really* want to *NOT* run an AVD, consider using ‘-data <file>’
to specify a data partition image file (I hope you know what you’re doing).

ふむふむavdというのを指定するらしい
*avdを作成

android create avd –name android1.5 –target 3

オプションのメモ
–target 1 [...]

Posted by ニセレブ on 7 月 21st, 2009 under java, 備忘録, 日記 Tags: , , , , , , ,  •  No Comments

ActionMailerのメールをgmailのsmtpサーバを使って送信

ぐぐったらいろいろでたのですが、一点だけ注意することがある。
lib/smtp_tls.rb に以下のコードを保存する。

require "openssl"
require "net/smtp"

Net::SMTP.class_eval do
private
def do_start(helodomain, user, secret, authtype)
raise IOError, ‘SMTP session already started’ if @started
check_auth_args user, secret if user or secret

sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
@socket = Net::InternetMessageIO.new(sock)
@socket.read_timeout = [...]

Posted by ニセレブ on 7 月 18th, 2009 under ruby, 日記 Tags: , , , , ,  •  No Comments

Thinkpad X41とubuntu 8.04でマルチモニタできた

昨日はこれにハマって3時間ぐらいつぶれた。
勢いでubuntu linuxにしたのですが大体のことは先人が残してくれた備忘録を元
に解決できます。
しかしやはりwindows や mac みたいに完成されたOSではないのでやりたいこと
がなかなかできない事があったりと、
高スキルな人かドMじゃないとデスクトップOSにlinuxは難しいと思う今日この頃。
bubbkisさんのwebサイトを参考にしたらできました。

# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by failsafeDexconf, using
# values from the debconf database and some overrides to use vesa mode.
#
# You should use dexconf or another such tool for creating a “real” xorg.conf
# For example:
# sudo dpkg-reconfigure -phigh xserver-xorg
Section “InputDevice”
Identifier “Generic Keyboard”
Driver “kbd”
Option “XkbRules” “xorg”
Option “XkbModel” “us101″
Option “XkbLayout” “us”
EndSection

Section [...]

Posted by ニセレブ on 7 月 14th, 2009 under linux, 備忘録 Tags: , , , , , , ,  •  No Comments

rubyのloggerの設定をメモ

ruby の logger につてのメモ
いちいち調べて面倒なので自分でよくつかう logger 設定についてメモ

require ‘logger’

# ローテーション

# 日次ローテーション
logger = [...]

Posted by ニセレブ on 7 月 12th, 2009 under ruby Tags: , , , ,  •  No Comments