木曜日, 12月 24, 2009

postgresサーバーに認証するようにする

PostgreSQL のセキュリティ(Apache + PHP + PostgreSQL 実験室)

/data/pg_hba.conf で
local      all                                          md5
host all 127.0.0.1 255.255.255.255 md5


> psql test
でログインして
alter user postgres with password 'xxxx'
でパスワードを変更する。

Dual on various Database Systems

Where is my dual?
■表不要→MySQL, PostgreSQL, MS SQL Server
□表必要→Oracle(DUAL), InterBase/Firebird(RDB$DATABASE), IBM DB2(SYSIBM.SYSDUMMY1)

menu and MIME in GNOME

GNOME 2.14 Desktop System Administration Guide

Customizing Menus

The MIME Database

Hidden Directories

月曜日, 12月 21, 2009

Chamap

Chamap

Format FAT32 on Linux

LinuxにおけるFAT32フォーマットの方法

FAT32を表す領域タイプとして0x0B(FAT32)、0x0C(FAT32 (LBA))がある。これらの使い分けは以下の通り。

0x0B (FAT32)
パーティションの終了シリンダが1023、ディスクの先頭から8GBまでの領域にパーティションが収まる場合に利用してもよい。
0x0C (FAT32 (LBA))
LBA対応版。パーティションが終了シリンダが1023を超える場合にこちらを利用する。

実際にmkfsコマンドを利用してフォーマットする。

$ sudo mkfs.vfat -v -c -F 32 /dev/sde1

後はまったりとフォーマットが完了するまで待つだけです。

オプションの解説
-v
詳細な進捗を表示
-c
不良ブロックの精査を行う
-F 32
FAT32形式でのフォーマットの指定。-FだとFAT(16)となる。

LinuxでUSBメモリ等の中のvfat/ntfsのラベル付け方法

mlabel -i /dev/hoge ::NEWLABEL

日曜日, 12月 20, 2009

10 things you can do when Windows XP won't boot

10 things you can do when Windows XP won't boot


起動しないエラーと修復方法
  • fixmbr - ブートストラップローダを修復する
  • fixboot - NT-IPLが壊れている

金曜日, 12月 18, 2009

grldrファイルの説明

使うファイルとその説明

grldr grub4dos のプログラム本体
       grub の stage2 に相当

grldr.mbr grldr を ロードするブートストラップ
grub の stage1(MBR) と stage1_5 をくっつけたもの。
これだけで FAT/FAT32 , NTFS, EXT2/EXT3 に対応

menu.lst 設定ファイル (MSDOS 形式 CR+LF OK)

default 状態を保存するためのファイル。
状態を保存しなければ必要なし

Google MAPS API に登録する

Google MAPS API に登録する

送信できるジオコード リクエスト数の制限

木曜日, 12月 17, 2009

Converting a Relative Path to an Absolute Path in Bash

Converting a Relative Path to an Absolute Path in Bash

if [[ ! $d =~ /^\/.*/ ]]; then d=$PWD/$d; fi;

if the directory exists, then
echo "Absolute path: `cd $1; pwd`"
-- or --
readlink -f ../bar

How to install ubuntu9.04 dual boot with Windows XP using grub4dos

How to install ubuntu9.04 dual boot with Windows XP
Install Ubuntu 8.04 from Hard Disk
title Install Ubuntu
root (hd0,4)
kernel /vmlinuz boot=casper iso-scan/filename=/ubuntu-8.04.1-desktop-i386.iso
initrd /initrd.gz


Installing Fedora from the hard drive (without a boot CD).


Let Grub to load before XP boot menu
▲.rename ntldr (the XP loader) as ntldrxp and grldr (Grub loader) as ntldr
▲.create an entry in menu.lst to load XP
title Microsoft Windows XP SP2 Pro (Find and Load)
find --set-root /ntldrxp
chainloader /ntldrxp


Grub4dosでのCDイメージの起動
title Windows PE 2.0 (from /recovery.iso)
find --set-root /recovery.iso
map /recovery.iso (0xff) || map --mem /recovery.iso (0xff)
map --hook
chainloader (0xff)


Grub4dos Guide


Boot Fedora 12

In menu.lst, add
title Fedora Live
kernel (hd0,0)/boot/vmlinuz0 root=/dev/sda1 rootfstype=ntfs ro quiet liveimg rhgb
initrd=(hd0,0)/boot/initrd0.img

水曜日, 12月 16, 2009

月曜日, 12月 14, 2009

Split Window in Vim

How do I open and edit multiple files under VIM text editor running under Ubuntu Linux / UNIX operating systems to improve my productivity?

My vi/vim cheatsheet

Vim documentation: windows


Open two windows
$ vim -o file1.txt resume.txt Start vim as follows to open two windows,split horizontally
$ vim -O /etc/passwd /etc/hosts The -O option allows to open two windows, split vertically
^W-sSplit current window in two horizontally
^W-vSplit current window in two vertically
^W-nOpen new empty window horizontally
:newOpen new empty window horizontally
:spOpen new empty window horizontally
:vspOpen new empty window vertically
:new /etc/hosts.denyOpen exiting file in a new windows horizontally
:sp /etc/hosts.denyOpen exiting file in a new windows horizontally
:vsp /etc/hosts.denyOpen exiting file in a new windows vertically
Switch from Horizontal split to Vertical split
^W-L Switch from horizontal to vertical split,
putting the current buffer on the right side of the vertical split.
^W-H Put it on the left
^W-Jbottom
^W-Ktop
Moving between windows
Key combination Action
^W-h move to the window on the left
^W-j move to the window below
^W-k move to the window above
^W-l move to the window on the right
^W-t move to the TOP window
^W-b move to the BOTTOM window
Close windows
^W-^Q Close the current windows
[ESC]-:qQuit current window
Resize Window
[ESC] - 5 - ^W - +Increase windows size by 5
[ESC] - 5 - W - -Decrease windows size by 5
Save and quit all windows
:wqall Save all changes in all windows and quite
:qall! Quits Vim and throws away all changes

Makefileディレクトリ

As make reads various makefiles, including any obtained from the MAKEFILES variable, the command line, the default files, or from include directives, their names will be automatically appended to the MAKEFILE_LIST variable. They are added right before make begins to parse them.

Using the ?= construct will keep variable from being redefined if it is already set.

金曜日, 12月 11, 2009

Debugging Tomcat

Debugging Tomcat
Debug in Tomcat 6 plus using NetBeans 6.5
Remote debugging with Tomcat and Netbeans
NetBeans Remote Debugging
Debugging Servlets using Netbeans
Eclipse 3.3 and NetBeans 6.0 compared !
Developing JSPs and Servlets with Netbeans



  1. How do I configure Tomcat to support remote debugging?
  2. How do I remotely debug Tomcat using Eclipse?
  3. How do I remotely debug Tomcat using NetBeans?
  4. How do I change the monitoring interval for modified resources and application reloading?

Start postgresql database server

You can now start the database server using:

/usr/bin/postgres -D /var/lib/pgsql/data
or
/usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start

サービスで起動の時:

service postgresql initdb <- 初回だけ service postgresql start


PostgreSQLサーバーに接続
  1. postgresユーザーでログイン
    # su - postgres
    ログインした後:
    $ psql -lで初期作成したデータベースを確認できる
  2. 「createuser」コマンド で、ユーザ(ロール)を作成する
     createuser myuser
  3. postgresユーザーからmyuserアカウントに戻って、データベースを作成する
     createdb mydb
  4. 「psql」コマンド で、作成したデータベースに接続する
     psql mydb

木曜日, 12月 10, 2009

Linuxドライバに変数を渡すのにうってつけの方法

ドライバに変数を渡すのにうってつけの方法

  • ioctl
  • /dev/以下のファイルに対してread/write(例:/dev/dvb)
  • /procファイルシステム
  • /sysfsファイルシステム
  • モジュール起動時のオプション
  • これら以外にも、block-driverやnetlink、configfsを使うなどの案もありました。

vimに表示したファイルのエンコーディング変更

Reload a garbled text with correct encoding on Vim
:e ++enc=utf-8

火曜日, 12月 08, 2009

FoxyProxy

FoxyProxy

tor+foxyproxy

佛跳墙

.mozilla/firefox/ggc9qb7w.default/extensions/VMwareVMRC@vmware.com/plugins/np-vmware-vmrc-2.5.0-122581.soアクセスの許可

chcon -t textrel_shlib_t '/home/ccc/.mozilla/firefox/ggc9qb7w.default/extensions/VMwareVMRC@vmware.com/plugins/np-vmware-vmrc-2.5.0-122581.so'
semanage fcontext -a -t textrel_shlib_t '/home/ccc/.mozilla/firefox/ggc9qb7w.default/extensions/VMwareVMRC@vmware.com/plugins/np-vmware-vmrc-2.5.0-122581.so'


或いは

setsebool -P allow_execmod 1  

月曜日, 12月 07, 2009

How to use OpenSSL

How to use OpenSSL

Check:
$ openssl verify -verbose -purpose smimesign /Library/Ruby/Gems/1.8/gems/httpclient-2.1.5/lib/httpclient/cacert.p7s

What Is My IP Address?

What Is My IP Address?

水曜日, 12月 02, 2009

Using Top More Efficiently

Using Top More Efficiently

MySQL Select Into File - Outfile

MySQL Select Into File - Outfile

SSH Tunneling

SSH Tunneling

ssh -f user@personal-server.com -L 2000:personal-server.com:25 -N


ssh -f -L 3000:talk.google.com:5222 home -N


Windows 用ターミナルエミュレータ
TeraTermPuttyPoderosa

Linux
ssh-gui


Souptonuts

月曜日, 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) を生成する

月曜日, 10月 26, 2009

Aptana Studio 1.5 Plugin and Aptana RadRails

Aptana Studio 1.5 Plugin
Installing via Aptana or Eclipse

Aptana RadRails
Aptana RadRails is the leading IDE for Ruby and Rails development.

水曜日, 10月 21, 2009

Googleの新機能が多すぎて、把握できません

Googleの新機能が多すぎて、把握できません

内容:

"e サイドウィキを使って役立つ情報を投"
- Google サイドウィキGoogle サイドウィキで表示

Ruby on Railsのセットアップ(Windows編)

Ruby on Railsのセットアップ(Windows編)(時間が掛かりたくない場合)

■自力でMSWin32版のRoRをセットアップするのは、次の手順で行います。
  1. Rubyのインストール
  2. readline.dll, zlib.dll, libeay32.dll, ssleay32.dll「OpenSSL-0.9.8e for windows (Win32 version)を使う必要がある」の用意
  3. rubygemsインストール
    C:\ruby-x.x.x> ruby setup.rb
  4. rubyでrailsのインストール
    C:\ruby-x.x.x>gem install rails --include-dependencies
  5. その他のgemのインストール
    C:\ruby-x.x.x> gem install uuid
    C:\ruby-x.x.x> gem install reliable-msg
    C:\ruby-x.x.x> gem install ap4r
    C:\ruby-x.x.x> gem install gettext
    C:\ruby-x.x.x> gem install vpim
    C:\ruby-x.x.x> gem install mocha
    C:\ruby-x.x.x> gem install json
    C:\ruby-x.x.x> gem install mongrel
    C:\ruby-x.x.x> gem install fastercsv
    C:\ruby-x.x.x> gem install fastthread
    C:\ruby-x.x.x> gem install httpclient
    C:\ruby-x.x.x> gem install nokogiri
    C:\ruby-x.x.x> gem install soap4r
    「gem install fastthread」がインストールできない場合、ここのstill can't install mswin32 mongrel_service or fastthreadを参照しながら、fastthread-1.0.1-i386-mswin32.gemをダウンロードして、「gem install fastthread-1.0.1-i386-mswin32.gem」でエラーなく実行できます。


■Windows下のMinGWのインストール
  1. MinGWとMSYSのダウンロードとインストール
  2. rubyのコンパイル
    $ ./configure --prefix=/
    $ make
    $ DESTDIR=/c/test/rubymingw make install

  3. rubygemsのインストール
    C:\ruby-x.x.x> ruby setup.rb
  4. railsのインストール
    gem install rails --include-dependencies

複数のコンピュータで一組のキーボードとマウスを共有する「Synergy」

複数のコンピュータで一組のキーボードとマウスを共有するSynergy

How Do I Enable Remote Access To MySQL Database Server?

How Do I Enable Remote Access To MySQL Database Server?
MySQL リモート接続を許可する

Rails Cookie Detection

Rails Cookie Detection
JavaScript Cookie Object using Prototype

木曜日, 10月 15, 2009

技術情報 From ロボット開発工学

技術情報 From ロボット開発工学
Linuxでロボット制御、ハードウエア操作
ユニバーサルインターフェイスボード
技術ネタ
USB-シリアル変換ネタ(ロボット学会誌関連)
ロボコン向けH8周辺回路集

Crackerjack Project

Crackerjack Project

IPA、Linuxカーネルの互換性情報を提供

qt4-qtconfig does not save font settings

qt4-qtconfig does not save font settings The problem appears with Gtk+ theme, if you change to another theme (e.g cleanlooks) it'll disappear.

The reason is Qt does not recognize all font styles

Gentoo Users

Gentoo Users Find Gentoo users near you
See also 看看哪位Gentoo User离自己最近

prototype.js

  1. Prototype JavaScript framework: Easy Ajax and DOM manipulation for dynamic web applications
  2. prototype.js逆引きサンプル集
  3. Developer Notes for prototype.js covers version 1.5.0
  4. JavaScriptライブラリの先駆け「prototype」を勉強しなおすサイト20
    See also:JavaScriptライブラリ「jQuery」関連サイト34jQuery 311 プラグイン and 644 + JavaScript ライブラリ サンプル


Ajax 最適化 Tips - Prototype.js のパフォーマンス

水曜日, 10月 14, 2009

qtconfig-qt4

qtconfig-qt4 is included in the package of qt-x11-4.5.2-3.fc11.i586

There also includes a file called qdbusviewer , it maybe be used to view something about dbus.

蓝魔发布MID新品W7

蓝魔发布MID新品W7

SmartQ

See:なにこれ欲しい

火曜日, 10月 13, 2009

Examining the Ruby Call Stack

Examining the Ruby Call Stack
caller.each {|c| puts c}

Monit's FAQ

FAQ

Monit is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.

Real-world configuration examples From Monit Wiki

月曜日, 10月 12, 2009

xdotool - fake keyboard/mouse input

xdotool - fake keyboard/mouse input
This tool lets you programatically (or manually) simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11's XTEST extension and other Xlib functions.


Examples:
Opening a new tab in an existing GNOME terminal window and gterm.sh

X Windows関連のツール
  • xdotool
    例:xdotool getactivewindow
  • wmctrl
  • xwininfo
  • xlsclients - list client applications running on a display
  • xprop
    例:xprop -root _NET_ACTIVE_WINDOW
  • xdpyinfo

金曜日, 10月 09, 2009

SWATの設定ファイル

SWATの設定ファイル

/etc/xinetd.d/swatがSWATの設定ファイルです。

SWATは、接続要求があったときにxinetd経由で起動します。そのため、設定変更後その内容を有効にするには、xinetdを再起動します。
# /etc/init.d/xinetd restart

火曜日, 10月 06, 2009

RubyEditing

RubyEditing

Rails Searchable API Doc





Some Articles about Ruby on Rails by Bruce Tate

Linuxにおけるネットワークプリンタの設定

印刷の設定ファイル

例)ネットワーク上の LP-M5600 を lpm5600 の名前で登録する場合

lpm5600:\
:sd=/var/spool/lpd/lpm5600:\
:if=/usr/bin/lpm5600_lprwrapper.sh:\
:mx#0:\
:sh:\
:rm=192.168.xxx.xxx:\
:rp=lp:


lp 出力デバイスファイル名。例えば/dev/lp0とか。ネットワークプリンタなので特に指定しない。
rp プリンタに渡す引数。プリンタの名前でググッてみると、それなりに探せるようだ。
rm ホスト名(IPアドレス)/etc/hostsに載せとけば好きにかける。
sd スプールディレクトリ。複数のプリンタで同一ディレクトリを指定すると、
  混ざって混乱しちゃうみたい。どっちに出力されるかはタイミング次第となるようだ。
lf エラーログファイル
mx 最大ファイルサイズ。mx#0は無制限という意味のようだ。


  

月曜日, 10月 05, 2009

mysqldumpでバックアップ&復元

mysqldumpでバックアップ&復元

バックアップ:
  • $ mysqldump -u root -x --all-databases > dump.sql //すべてSQLにしてテキスト形式に保存
  • $ mysqldump -u root データベース名 > dump.sql //特定のデータベースのみのバックアップ

復元:
  • $ mysql -u root -p < dump.sql
  • $ mysql -u root データベース名 < dump.sql


Copy MySQL database from one server to another remote server
  • mysqldump -u user1 -h server1 -ppassword1 db_name | mysql -u root2 -h server2 -ppassword2 db_name


mysqlのダンプファイルって特定のテーブルのみのダンプファイル
mysqldump --opt -c --where="xxx = 'yyy'" --no-create-info -u root -pmanager database table > data.sql

Remote login to a mysql server

From remote system or your desktop type the command:
$ mysql -u webadmin –h 65.55.55.2 –p
Where:

  • -u webadmin: webadmin is MySQL username
  • -h IP or hostname: 65.55.55.2 is MySQL server IP address or hostname (FQDN)
  • -p : Prompt for password


How Do I Enable Remote Access To MySQL Database Server?

水曜日, 9月 30, 2009

SVN Usage

To checkout the source simply type:
svn co https://jnode.svn.sourceforge.net/svnroot/jnode/trunk/ foo

which creates a new directory called foo (Mind the space between "trunk/" and "foo"!) . In this directory all stuff of the repository in /jnode/trunk will be copied to foo/ on your local computer.
See more, please refer to SVN Usage

Version Control with Subversion, a free book about Subversion

火曜日, 7月 07, 2009

法律の尊厳

7月5日発生した新疆ウゥグル自治区ウルムチの暴動は国外のメディアによって、伝えられましたが、本質的に暴力犯罪のことを人権問題にすりかえられ、中国批判になろうという欧米、日本のメディアの下心は丸々見えになってしまいました。

暴動の背景にある中国の少数民族に対する人権問題などで、国際社会の批判も高まりつつあり、サミットでも取り上げられるのは確実な情勢だった。

ジャーナリズムがなんだろう、ジャーナリストとしての使命がなんだろうという基本の人格問題として、自問自答にしていただきたい。巧みの言葉ででっち上げるのは紛れもなく人間失格です。

中国の少数民族政策は世界中に最も優れた政策で、全地球中に、別の民族を受け入れ、VIPとして扱う民族が漢民族しかないと言い切れます。人権、民主、自由を叫び続けるアメリカ、ヨーロッパの歴史は、別民族の大虐殺しかありません。

どんな自由の国でも、どんな綺麗な民主でも、その前提として、法律を守ることです。7月5日に暴動を参加したウゥグル族の暴徒を厳罰することは平和の中国民族大家庭を幸せに、嘘で生活する外国ジャーナリストを墓場へ導く唯一の対処方法です。

土曜日, 7月 04, 2009

ld --verbose

ld --verbose



See Also:
How to embed binary data in an ELF file
ELF Binary Optimization for size
The Linker Script at The Basic Kernel

Embed Glade files in executable


  • Gtk#

    Just bundle glade files as resources (using the -resource: option in the compiler) and change constructor call or use the Glade.XML.FromAssembly () method to create Glade.XML ui.
    See also A google search application using Gtk#

  • Gtk+(Embedding Binary Blobs With GCC)
    1. Excerpt From Embedding Binary Blobs With GCC
      $ echo Hello, World > foo.txt
      $ ld -r -b binary -o foo.o foo.txt
      $ objdump -x foo.o

      test.c
      #include <stdio.h>
      extern char _binary_foo_txt_start[];

      int main (void) {
      puts (_binary_foo_txt_start);
      return 0;
      }



      $ gcc -o test test.c foo.o
      $ ./test
      Hello, World!

      Change the string itself in the .data section, which is read/write, to be read-only data in the .rodata section so that it isn't copied for every instance of the application.
      $ objcopy --rename-section .data=.rodata,alloc,load,readonly,data,contents foo.o foo.o
      $ objdump -h foo.o

    2. You might find GNU as's .incbin directive more useful for this purpose - you can control the symbol name, section, and add a NUL terminator. You do have to write little wrapper .s files though. For example
      $ echo hello world > demo.txt
      $ cat > demo.s
      .section ".rodata"
      .globl demo
      .type demo, @object
      demo:
      .incbin "demo.txt"
      .byte 0
      .size demo, .-demo
      ^D
      $ as demo.s -o demo.o
      $ nm demo.o
      00000000 R demo
      $ strings demo.o
      hello world


  • wxWidget(xml-based resource system overview)


For More, See:
Add icons to ELF files
How do I add an icon to a mingw-gcc compiled executable?
  1. create a .rc file that looks id ICON "path/to/my.ico"
  2. windres my.rc -O coff -o my.res
  3. g++ -o my_app obj1.o obj2.o my.res

金曜日, 7月 03, 2009

Creating a GUI using PyGTK and Glade

Creating a GUI using PyGTK and Glade


The First Step:
#!/usr/bin/env python

import sys
try:
    import pygtk
    pygtk.require("2.0")
except:
    pass
try:
    import gtk
    import gtk.glade
except:
    sys.exit(1)


The Full Sample(Glade Object File:Libglade)
#!/usr/bin/env python

import sys
try:
    import pygtk
    pygtk.require("2.0")
except:
    pass
try:
    import gtk
    import gtk.glade
except:
    sys.exit(1)

class HellowWorldGTK:
    """This is an Hello World GTK application"""

    def __init__(self):
        
        #Set the Glade file
        self.gladefile = "pyhelloworld.glade"  
        self.wTree = gtk.glade.XML(self.gladefile)
        
        #Create our dictionay and connect it
        dic = { "on_btnHelloWorld_clicked" : self.btnHelloWorld_clicked,
            "on_MainWindow_destroy" : gtk.main_quit }
        self.wTree.signal_autoconnect(dic)

    def btnHelloWorld_clicked(self, widget):
        print "Hello World!"


if __name__ == "__main__":
    hwg = HellowWorldGTK()
    gtk.main()


The Full Sample(Glade Object File:GtkBuilder)
#!/usr/bin/env python

import pygtk
import gtk
pygtk.require("2.0")

class GUI(object):
    def __init__(self):
        builder = gtk.Builder()
        builder.add_from_file("GUI.xml")
        builder.connect_signals(self)
        self.window1 = builder.get_object("window1")
        self.window1.show()

    def on_window1_destroy(self,widget,data=None):
        gtk.main_quit()

    def on_button1_clicked(self,widget,data=None):
        gtk.main_quit()  

if __name__ == "__main__":
    app = GUI()
    gtk.main()


More Simple Sample(test003.py)
#!/usr/bin/env python

import sys
try:
    import pygtk
    pygtk.require("2.0")
except:
    pass
try:
    import gtk
    #Libglade
    #import gtk.glade
except:
    sys.exit(1)

class TestMain:
    """This is an Hello World GTK application"""

    def __init__(self):
        
        #Set the Glade file
        self.gladefile = "test003.glade"
        self.glade = gtk.Builder()
        self.wTree = self.glade.add_from_file(self.gladefile)

        #Create our dictionay and connect it
        #dic = { "on_btnHelloWorld_clicked" : self.btnHelloWorld_clicked,
        #    "on_windowMaindow_destroy" : gtk.main_quit }
        #1.Libglade Auto Connect
        #self.wTree.signal_autoconnect(dic)
        #2.GktBuilder Auto Connect
        #glader.connect_signals(dic)

        #Main Window
        self.windowMain = self.glade.get_object("windowMain")
        self.windowMain.connect("destroy", self.on_windowMain_destroy)
        self.windowMain.show()

        #GktImage
        self.imageMain = self.glade.get_object("imageMain")
        self.imageMain.set_from_file("airplane.jpg")
        #MenuItem Activate
        self.menuitemQuit = self.glade.get_object("imagemenuitemQuit")
        self.menuitemQuit.connect("activate", self.on_windowMain_destroy)

    def on_windowMain_destroy(self, widget, data=None):
        gtk.main_quit()

    def btnHelloWorld_clicked(self, widget, data=None):
        print "Hello World!"

if __name__ == "__main__":
    hwg = TestMain()
    gtk.main()


And the test003.glade file
<?xml version="1.0"?>
<interface>
  <requires lib="gtk+" version="2.16"/>
  <!-- interface-naming-policy project-wide -->
  <object class="GtkWindow" id="windowMain">
    <child>
      <object class="GtkVBox" id="vboxMain">
        <property name="visible">True</property>
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkMenuBar" id="menubarMain">
            <property name="visible">True</property>
            <child>
              <object class="GtkMenuItem" id="menuitemFile">
                <property name="visible">True</property>
                <property name="label" translatable="yes">&#x30D5;&#x30A1;&#x30A4;&#x30EB;(_F)</property>
                <property name="use_underline">True</property>
                <child type="submenu">
                  <object class="GtkMenu" id="menuFile">
                    <property name="visible">True</property>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitemNew">
                        <property name="label">gtk-new</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitemOpen">
                        <property name="label">gtk-open</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitemSave">
                        <property name="label">gtk-save</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitemSaveAs">
                        <property name="label">gtk-save-as</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
                        <property name="visible">True</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitemQuit">
                        <property name="label">gtk-quit</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>
            <child>
              <object class="GtkMenuItem" id="menuitem2">
                <property name="visible">True</property>
                <property name="label" translatable="yes">&#x7DE8;&#x96C6;(_E)</property>
                <property name="use_underline">True</property>
                <child type="submenu">
                  <object class="GtkMenu" id="menu2">
                    <property name="visible">True</property>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitem6">
                        <property name="label">gtk-cut</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitem7">
                        <property name="label">gtk-copy</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitem8">
                        <property name="label">gtk-paste</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitem9">
                        <property name="label">gtk-delete</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>
            <child>
              <object class="GtkMenuItem" id="menuitem3">
                <property name="visible">True</property>
                <property name="label" translatable="yes">&#x8868;&#x793A;(_V)</property>
                <property name="use_underline">True</property>
              </object>
            </child>
            <child>
              <object class="GtkMenuItem" id="menuitem4">
                <property name="visible">True</property>
                <property name="label" translatable="yes">&#x30D8;&#x30EB;&#x30D7;(_H)</property>
                <property name="use_underline">True</property>
                <child type="submenu">
                  <object class="GtkMenu" id="menu3">
                    <property name="visible">True</property>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitem10">
                        <property name="label">gtk-about</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkImage" id="imageMain">
            <property name="visible">True</property>
            <property name="stock">gtk-missing-image</property>
          </object>
          <packing>
            <property name="position">1</property>
          </packing>
        </child>
        <child>
          <object class="GtkStatusbar" id="statusbarMain">
            <property name="visible">True</property>
            <property name="spacing">2</property>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="position">2</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>