月曜日, 11月 30, 2009

土曜日, 11月 28, 2009

Ubuntu 9.10にSun Javaをインストールした

何か下のものが出てきた。

sun-java6-bin (6-15-1) を設定しています ...
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/ControlPanel to provide /usr/bin/ControlPanel (ControlPanel) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/java_vm to provide /usr/bin/java_vm (java_vm) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/jcontrol to provide /usr/bin/jcontrol (jcontrol) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode.

sun-java6-jre (6-15-1) を設定しています ...

sun-java6-jdk (6-15-1) を設定しています ...
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/HtmlConverter to provide /usr/bin/HtmlConverter (HtmlConverter) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/apt to provide /usr/bin/apt (apt) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jar to provide /usr/bin/jar (jar) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/java-rmi.cgi to provide /usr/bin/java-rmi.cgi (java-rmi.cgi) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/javac to provide /usr/bin/javac (javac) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/javah to provide /usr/bin/javah (javah) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/javap to provide /usr/bin/javap (javap) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jhat to provide /usr/bin/jhat (jhat) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jps to provide /usr/bin/jps (jps) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode.

木曜日, 11月 26, 2009

PacketLife.net

PacketLife.net

ウェブにぶらぶらして約半日が過ぎた途端に、(n)のサイトに辿りました。中にあちこちを見て、このサイトを詳しく紹介していたことを気付けて、これがbigなサイトだと感じました。

Windd

Windd is a free Windows utility, by Matthieu Suiche, which aims at being used as a swiss-knife to acquire the physical memory by investigators, incident responses engineers, malware analysts, system administrators and kernel developpers. Please notice ALL (32-bits + 64-bits, driver + executable) windd binaries are digitally signed to confirm they are from a trusted source.

Deleting all your .svn directories

Deleting all your .svn directories

Linux
rm -rf `find . -name .svn`

find . -name .svn -prune -exec rm -rf {} \;


Windows
for /f “tokens=* delims=” %%i in (’dir /s /b /a:d *svn’) do (
rd /s /q “%%i”
)

火曜日, 11月 24, 2009

木曜日, 11月 19, 2009

SConsって

SCons、なんだろう。

mapnikをコンパイルして、なかなか通りません。ソースから、SConsを使ってコンパイルすることすら知らなかった。なんだこれ…

ちょっとSCons

Man page of SCONS

To see the list of available options, from the root of the source distribution, run::
$ python scons/scons.py -h


Uninstall with scons
scons -c install


Using SCons with Mapnik 0.6.0

Open Source GIS

水曜日, 11月 18, 2009

Managing Hierarchical Data in MySQL

Managing Hierarchical Data in MySQL

An Introduction to Database Normalization

Securing a MySQL Server on Windows

Firefox向け同期アドオン「Weave Sync」

Firefox向け同期アドオン「Weave Sync」


Process Hackerプロセスハッカー
Process Hacker is a free and open source process viewer and memory editor with unique features such as powerful process termination and a Regex memory searcher. It can show services, processes and their threads, modules, handles and memory regions.

QGIS earns a spot on GIS software map

QGIS earns a spot on GIS software map

GISソフトウェアとしての地位を確立したQGIS

Googleマップ





Google Map Parameters

Google Maps APIのジオコーディングをHTTP経由でおこなう方法(Geocoding - Google Maps API Services - Google Code)
http://maps.google.com/maps/geo?q=地名&key=APIキー&sensor=false&output=xml&oe=utf8&gl=jp


Google Static Maps API - imgタグでGoogleマップの地図画像を貼付けるAPI
http://maps.google.com/staticmap?center=35.010517,135.759638&zoom=15&size=480x270&maptype=mobile&markers=35.010117,135.758638,reda%7C35.010417,135.759538,blueb&key=YOUR_API_KEY

土曜日, 11月 14, 2009

Connect Apache to Mongrel

From P641 Agile Web Development with Rails Third Edition, The Pragmatic Bookshelf

<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
</Proxy>

<VirtualHost *:80>
ServerName myapp.com
DocumentRoot /Library/Rails/myapplication/current/public

<Directory "/Library/Rails/myapplication/current/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

RewriteEngine On

# Check for maintenance file and redirect all requests
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]

# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ $1.html [QSA]

# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
</VirtualHost>

Configuring Mongrel

From P639 Agile Web Development with Rails Third Edition, The Pragmatic Bookshelf
# On your local computer
$ mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N 2 -c /deploy/path/current
The -p 8000 parameter specifies that the mongrel instances will start up on ports beginning with 8000 on your deployment server. The -a 127.0.0.1 parameter will set up Mongrel to listen to the localhost interface. The -N 2 parameter indicates that two instances of Mongrel will be started. And, the -c /deploy/path/current argument is where your application will be deployed to on the remote server. Note that the word current in this path is required: the /deploy/path part is the path to your application, and current is a directory that Capistrano creates inside that application structure.In the Capistrano recipes that follow, the deployment path is set to /Library/Rails followed by the name of your application. If you follow this scheme for an application named blog, the -c option in the previous example would read -c /Library/Rails/blog/current.
This command creates the file mongrel_cluster.yml in your application’s config directory. It is essential that you add this file to your version control repository.


android: 制作system.img(yaffs2) 镜像

android: 制作system.img(yaffs2) 镜像

木曜日, 11月 12, 2009

Change storage engine from InnoDB or myISAM to NDBCLUSTER

Change storage engine from InnoDB or myISAM to NDBCLUSTER
sed s/ENGINE=InnoDB/ENGINE=NDBCLUSTER/g world.sql > databaseCluster.sql

Replace ENGINE=InnoDB with TYPE=myISAM if necessary.

水曜日, 11月 11, 2009

Clearing Out Sessions in Rails

From P644 Agile Web Development with Rails Third Edition, The Pragmatic Bookshelf

Capistrano Deploys from the Repository into Production

From P640 Agile Web Development with Rails Third Edition, The Pragmatic Bookshelf
インストール
sudo gem install --include-dependencies capistrano


To add the necessary files to your project for Capistrano to do its magic, execute
the following command.
# On your local computer
$ cap --apply-to /local/project/path [applicationname]
exists config
create config/deploy.rb
exists lib/tasks
create lib/tasks/capistrano.rake


$ rake remote:code_deploy



Rails+Capistrano+Apache2.2+Mongrel_clusterのメモ

Load Balance Around Your Mongrels’ Health

See Book:Advanced Rails Recipes, The Pragmatic Bookshelf
Recipe 78 Load Balance Around Your Mongrels’ Health

Ingredients
  • The mongrel gem:
    $ gem install mongrel
  • The mongrel_cluster gem:
    $ gem install mongrel_cluster
  • A load balancer that supports periodic health checks such as HAproxy, Varnish, Squid, Pound, NetScaler, or F5 BigIP


See also Recipe 80:Monitor (and Repair) Processes with Monit

Setting Up A MySQL Cluster

Setting Up A MySQL Cluster

Building a High-Availability MySQL Cluster


MySQL Clusterには、管理ノード、データノード、SQLノードとあるのです
  • service ndb_mgmd start #管理ノード
  • service ndbd start #データノード
  • service mysqld start #SQLノード


Using semanage to allow 1186 to connect to mgm

Deploying MySQL Cluster over multiple hosts

火曜日, 11月 10, 2009

How to install MySQL into your home directory

How to install MySQL into your home directory

# First, reserve a port number by going into the WebFaction control panel and creating a new app of type "Custom App listenting on port".

MY_PORT=PUT_THE_PORT_NUMBER_HERE

mkdir -p ~/mysql/.src
cd ~/mysql/.src/
# Download and extract the Mysql source code:
wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.51b.tar.gz/from/http://mirror.services.wisc.edu/mysql/
tar xf mysql-5.0.51b.tar.gz
cd mysql-5.0.51b
./configure --prefix=$HOME/mysql
make
# Go take a 30-minute break...
make install


cat > $HOME/mysql/my.cnf << EOF
[mysqld]
port=$MY_PORT
socket=$HOME/mysql/mysql.sock
basedir=$HOME/mysql
datadir=$HOME/mysql/data

[client]
port=$MY_PORT
socket=$HOME/mysql/mysql.sock
EOF


echo export PATH=$HOME/mysql/bin:$PATH >> ~/.bash_profile
source ~/.bash_profile

mysql_install_db --basedir=$HOME/mysql --datadir=$HOME/mysql/data

# Start the MySQL Server:
cd $HOME/mysql; mysqld_safe --defaults-file=$HOME/mysql/my.cnf &

# Choose a password for root:
mysqladmin -u root password "aPasswordForRoot"


clusterのオプション指定でコンパイルする(MySQL Clusterのセットアップ
./configure –prefix=/home/mysql –with-extra-charsets=all –with-mysqld-user=mysql –enable-thread-safe-client –with-plugins=ndbcluster

gem(Rubygems)のコマンド一覧

--localコマンドで、入手したファイルを順にインストールする
gem install activesupport --local


pオプションを利用して、Proxyを通してネットワークアクセスする
gem install rails -p http://proxy:8080/


gemをダウンロードし、現在のディレクトリに置く, See Rubyのパッケージマネジメントシステムgem(Rubygems)のコマンド一覧
gem fetch
PC実機/仮想化環境ですぐに試せる「Live Android」

◇Androidイメージファイルの結合
Windows:
> COPY /B liveandroidv0.2.iso.001 +liveandroidv0.2.iso.002 liveandroidv0.2.iso

Linux家系:
$ cat liveandroidv0.2.iso.001 liveandroidv0.2.iso.002 > liveandroidv0.2.iso


◇操作キー
アイテム選択:上下左右のカーソルキー
実行/先へ進む:[Enter]キー
キャンセル/前に戻る:[ESC]キー

◇日本語表示
画面右のアプリケーションドロワーから「Settings」を開き、[Locale & text] - [Select locale] - [Japanese]

◇日本語の読み書き
adamrocker氏による「Simeji

◇コンソール画面とGUIとの切り替え
コンソール画面に切り替えるには[ALT]+[F1]キー、GUIへ戻すには[ALT]+[F7]キー

[ALT]+[F1]キーでコンソール画面 → スーパーユーザーとして利用可能
Dev Tools]を開いてから「Terminal Emulator」 → 一般ユーザーとして利用可能)

土曜日, 11月 07, 2009

Debugging Ruby and Rails

Using ruby-debug(Excerpt from P54-56, Advanced Rails, Brad Ediger, )
$ sudo gem install ruby-debug

▲To debug simple Ruby scripts, just run your scripts with rdebug rather than ruby
▲Debugging Rails with ruby-debug
  1. Require the ruby-debug library from config/environments/development.rb so that it is only loaded in the development environment:
    require 'ruby-debug'

  2. Insert a call to debugger anywhere you want to stop the application’s execution and drop into the debugger.
    class SignupController < ApplicationController
    def check_for_service
    debugger
    @query = params[:q]
    (...)

  3. Start up the Rails server. The debugger only works with WEBrick and Mongrel,
    because the running code still has access to the tty under those servers.
    Under FastCGI, the worker processes would not be able to interact with the
    console.
    $ script/server
    => Booting Mongrel (use 'script/server webrick' to force WEBrick)
    => Rails application starting on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    ** Starting Mongrel listening at 0.0.0.0:3000
    ** Starting Rails with development environment...
    ** Rails loaded.
    ** Loading any Rails specific GemPlugins
    ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
    ** Rails signals registered. HUP => reload (without restart). It might not
    work well.
    ** Mongrel available at 0.0.0.0:3000
    ** Use CTRL-C to stop.
  4. Interact with your application as needed to trigger the debugger. The request will hang in the browser, and the server console will drop into the debugger console and show the line of code it is paused on:
    app/controllers/signup_controller.rb:5 @query = params[:q]
    (rdb:1)

水曜日, 11月 04, 2009

ActiveRecord SQL in script/console

ActiveRecord SQL in script/console
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.clear_active_connections!

SVNキーワードの展開

SVNキーワードの展開

GVIMのデフォルトのフォント設定

GVIMのデフォルトのフォント設定
設定->フォントと選んで、コマンドモードになって 以下のようにやると、現在のフォントが補完される。
:set guifont=<tab>

火曜日, 11月 03, 2009

MySQL: Using a Parameter in Script

MySQLのsourceコマンドにパラメータを渡したい時のやり方:

mysql -u root -p -e "set @col_value:='%f'; source test.sql;"

日曜日, 11月 01, 2009

Railsの基本

Railsの基本操作
  • $ rails -d sqlite3 test ← プロジェクトを作る
  • $ script/generate model Book ← モデル(Page クラス)を作成する。
  • $ script/generate migration CreateBooks ← マイグレーションファイルだけ作る
    マイグレーションファイルが出来ると、 「$ rake migrate」コマンドを使ってデータベースへと反映させる
  • $ script/generate scaffold Book ← 足場 (scaffold) を生成する