2011/10/28

Gitのインストール

CentOS環境で、Gitをインストール。

yumでもいいんですが、最新のソースではコマンドの更新なんかも進んでいるので、 ソースからコンパイル。

■ソースコード
http://git-scm.com/から
git-1.7.7.1.tar.gz (10/28時点最新)

■インストール
cd /usr/local/src/
wget http://git-core.googlecode.com/files/git-1.7.7.1.tar.gz
tar xvzf git-1.7.1.tar.gz 
cd git-1.7.7.1
make prefix=/usr
make prefix=/usr install

git --version
git version 1.7.7.1

2011/10/25

SVN 再帰的追加を回避

新規に追加したいディレクトリ以下に既にファイルが存在するが、 ディレクトリのみ追加するオプション。
-non-recursive
$ svn add --non-recursive newdir
A         newdir

2011/09/28

リバースプロキシ経由のアクセス元IPを取得

リバースプロキシを利用すると、クライアントのアクセスIPアドレス(REMOTE_ADDR)がReverse ProxyサーバのIPアドレスになってしまう。

■クライアントのIPアドレスをそのまま取得する方法。

モジュール「mod_extract_forwarded」の追加

1,yumで一発(EPELは追加されてる前提)
yum install mod_extract_forwarded

2,confファイル修正
proxyサーバのIPアドレスを指定

/etc/httpd/conf.d/mod_extract_forwarded.conf
=======================

MEFaccept 192.168.1.1

=======================

3,Apache再起動
service httpd restart

2011/05/25

rails rakeタスク

■rake -T
タスクの確認

rake about # List versions of all Rails frameworks and the environment
rake db:create # Create the database from config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config)
rake db:drop # Drops the database for the current Rails.env (use db:drop:all to drop all databases)
rake db:fixtures:load # Load fixtures into the current environment's database.
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
rake db:migrate:status # Display status of migrations
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n).
rake db:schema:dump # Create a db/schema.rb file that can be portably used against any DB supported by AR
rake db:schema:load # Load a schema.rb file into the database
rake db:seed # Load the seed data from db/seeds.rb
rake db:setup # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first)
rake db:structure:dump # Dump the database structure to an SQL file
rake db:version # Retrieves the current schema version number
rake doc:app # Generate docs for the app -- also availble doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-template.rb, TITLE="Custom Title")
rake log:clear # Truncates all *.log files in log/ to zero bytes
rake middleware # Prints out your Rack middleware stack
rake notes # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template # Applies the template supplied by LOCATION=/path/to/template
rake rails:update # Update both configs and public/javascripts from Rails (or use just update:javascripts or update:configs)
rake routes # Print out all defined routes in match order, with names.
rake secret # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions).
rake stats # Report code statistics (KLOCs, etc) from the application
rake test # Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profile, test:plugins)
rake test:recent # Run tests for recenttest:prepare / Test recent changes
rake test:uncommitted # Run tests for uncommittedtest:prepare / Test changes since last checkin (only Subversion and Git)
rake time:zones:all # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6
rake tmp:clear # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)
rake tmp:create # Creates tmp directories for sessions, cache, sockets, and pids




■rake db:abort_if_pending_migrations
適用されてないマイグレーションを確認

■rake db:version
現在適用されているマイグレーションバージョンを確認

■rake db:create
データベースを作成
- database.yml に定義した内容
- オプション RAILS_ENV
-- rake db:create RAILS_ENV=production

■rake db:create:all
すべてのデータベースを作成
- database.yml に定義した内容

■rake db:drop
データベースの削除

■rake db:drop:all
すべてのデータベースの削除

■rake db:migrate
マイグレーションファイルに定義した内容を適用
- オプション VERSION
-- rake db:migrate VERSION=20110524125234

■rake db:migrate:up
■rake db:migrate:down
- バージョンを指定してマイグレーションを適用
-- オプション VERSION 必須
-- rake db:migrate:up VERSION=20110524125234
-- up
--- マイグレーションファイルに定義した up の内容
-- down
--- マイグレーションファイルに定義した down の内容

■rake db:migrate:redo
指定STEP数だけマイグレーションを再実行
- オプション STEP
-- rake db:migrate:redo STEP=2

■rake db:migrate:reset
drop、create、migrate 全て実行

■rake db:reset
schema.rb に定義された実行内容を復元

■rake db:rollback
DBの状態をバージョンを指定して復元
- オプション STEP
-- rake db:rollback STEP=3

2011/04/08

android 開発環境 for mac

Eclipseのインストール



■eclipceのインストール
eclipseから、
Eclipse IDE for Java Developersをダウンロードする。
(私の環境だと64bit版)
解凍したものを、適宜好きなフォルダに移動。
私はアプリケーションフォルダ /Applications/eclipse に配置。

■日本語化
1、Pleiadesをダウンロード。
今回は安定版1.3.2を利用する。
2、ダウンロードしたファイルを解凍し、その中の
・features/jp.sourceforge.mergedoc.pleiades
・plugins/jp.sourceforge.mergedoc.pleiades
を、それぞれ、
/Applications/eclipse/features
/Applications/eclipse/plugins
に移動する。
3、eclipceを保存したフォルダで、「eclipce」の「パッケージの内容を表示」選択。
(「eclipce」上でセカンダリータップ(右クリックを同じ))
/Applications/eclipse/Contents/MacOS/eclipse.ini を開き、最後に以下の追記する。
-javaagent:../../../plugins/jp.sourceforge.mergedoc.pleiades/pleiades.jar

4、eclipceを起動して、日本語されたことを確認する。

2011/01/08

Google Chromeで画面キャプチャ

■導入するエクステンション
Webpage screenshot


1,Webpage screenshotにアクセスし、「Install」をクリック




2,ポップアップウィンドウで「インストール」をクリック。



インストールは以上。