検索:
以降の記事を見る

This is ARAKI's daily notes.

実ノ商人ハ先モ立チ我モ立ツコトヲ思フナリ

管理/
カテゴリ/ 技術系技術系エントリの登録: 日記(全部)Feed-icon-14x14:

カテゴリ: debian の記事 [リスト] debianの登録

Debianオフィシャルデベロッパ。ar at debian.org
#1 [arduino][ubuntu] ubuntu上でemacsからArduinoを使う話

emacsからArduinoを使う話を書いたのはいいのだが,macosxでの話だったのでubuntuにつっこんだらいろいろとやることがありました.

arduinoのpageからlinux用のarduino-0012-linux.tgz をとってきて展開しただけでは使えないので,必要なjava関係とAVRのbuild環境をとってきていれる.

 apt-get install avrdude sun-java6-jre sun-java6-fonts sun-java6-plugin gcc-avr avr-libc

そしたらMakefileをcopyする.

 ~/working-dir/arduino-0012/hardware/cores/arduino/Makefile .

んでubuntuにあわせていろいろ変更.

  • シリアルデバイス位置を指定する

  • AVR関係のtoolをubuntuのを使うように指定する

  • パス修正

そのdiffをはっておく.

$ diff -u Makefile.orig Makefile
--- Makefile.orig	2009-01-01 12:44:21.000000000 +0900
+++ Makefile	2009-01-01 12:37:24.000000000 +0900
@@ -35,8 +35,10 @@
 # $Id$
 
 TARGET = $(notdir $(CURDIR))
-INSTALL_DIR = /Users/dmellis/Source/arduino/trunk/build/macosx/build/work
-PORT = /dev/tty.usb*
+## INSTALL_DIR = /Users/dmellis/Source/arduino/trunk/build/macosx/build/work
+INSTALL_DIR = $(HOME)/working-dir/arduino-0012
+PORT = /dev/ttyUSB*
 UPLOAD_RATE = 19200
 AVRDUDE_PROGRAMMER = stk500v1
 MCU = atmega168
@@ -46,7 +48,8 @@
 # Below here nothing should be changed...
 
 ARDUINO = $(INSTALL_DIR)/hardware/cores/arduino
-AVR_TOOLS_PATH = $(INSTALL_DIR)/hardware/tools/avr/bin
+## AVR_TOOLS_PATH = $(INSTALL_DIR)/hardware/tools/avr/bin
+AVR_TOOLS_PATH = /usr/bin
 SRC =  $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
 $(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
 $(ARDUINO)/wiring_pulse.c $(ARDUINO)/wiring_serial.c \
@@ -93,7 +96,7 @@
 # Programming support using avrdude. Settings and variables.
 AVRDUDE_PORT = $(PORT)
 AVRDUDE_WRITE_FLASH = -U flash:w:applet/$(TARGET).hex
-AVRDUDE_FLAGS = -V -F -C $(INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf \
+AVRDUDE_FLAGS = -V -F -C $(INSTALL_DIR)/hardware/tools/avrdude.conf \
 -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) \
 -b $(UPLOAD_RATE)

written by Ar- at Thu Jan 01 04:50:12 UTC 2009
#1 [ubuntu][db2][rails] DB2+railsアプリをUbuntu7.10から8.04(LTS)にportした

railsが1.2でUbuntuが7.10だった時代に作っていたdb2をつかったアプリをいい加減rails2.2に対応させたので忘れる前にメモ.

Ubuntu 7.108.04
rails 1.2.6 2.2.2
DB2 9.5 9.5(同じ)
gem 0.84(rubygems.debのやつ) 1.3.1
ibm_db 0.94 1.0.0

そしてActiveScaffoldも使っている.

  • とりあえずまずはubuntu8.04をいれる.いれたらdb2exeをいれる.
  • ubuntuのrubygemsでgemをがんがん入れていってもいいのだが,gemは古いのでまずupdate.gemをupdateするとrubygems.debでいれてたものは台無しになるので,まずはgemをupdateする.
 sudo gem update --system
 sudo apt-get remove rubygems
  • できたらgemでibm_dbとrailsをいれる.
sudo -s
. /home/db2inst1/sqllib/db2profile
export IBM_DB_DIR=/home/db2inst1/sqllib
export IBM_DB_LIB=/home/db2inst1/sqllib/lib32
gem install ibm_db
gem install rails -y
gem install rake -y
  • active_scaffoldをgitからとってくる.

rails2.2では1.2時代に動いてたactive_scaffoldはもう動かない.http://activescaffold.com/ をみるとやりかたが書いてある.

 git clone git://github.com/activescaffold/active_scaffold.git vendor/plugins/active_scaffold && rm -rf vendor/plugins/active_scaffold/.git

  • config/ 以下をいじる

config/environment.rbに config.action_controller.sessionを追加.

 config.action_controller.session = { :session_key => "hogecode", :secret => "

abcdefghijklmnopqrstuvwxyz...." }

rake db:migrateかますと,config/environments/development.rbがおかしいことを

指摘してくれる

$ rake db:migrate --trace
.....
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `cache_template_extensions=' for ActionView::Base:Class
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:530:in `send'

http://d.hatena.ne.jp/zariganitosh/20080621/1214110380 にある

config/environments/development.rbの「config.action_view.cache_template_extensions= false」オプションは推奨されなくなり、何の影響も与えないらしい...。削除してくださいと警告されているので、削除してしまった。(警告なので削除しなくてもサーバーは起動する。)

というかんじ.

  • DB2のcreatedbをする.

PAGESIZEが小さいとDB2におこられることがある.

==  Initial: migrating ========================================================
-- create_table("contacts", {:force=>true})
   -> 0.1195s
-- create_table("inbounds", {:force=>true})
rake aborted!
An error has occurred, this and all later migrations canceled:
ActiveRecord::StatementInvalid: [IBM][CLI Driver][DB2/LINUX] SQL0286N  A default table space could not be found with a page size of at least "8192" that authorization ID "DB2INST1" is authorized to use.  

しょうがないのでdbをつくりなおす.(db2inst1 ユーザでおこなう)

$ db2 drop db xdmsdev
$ db2 create database xdmsdev using codeset utf-8 territory us PAGESIZE 32 K

できたら

 rake db:migrate

  • rake testで試す.

が,rake test:unitsはibm_db 1.0.0では対応してないようだ.

rake aborted!
Task not supported by 'ibm_db'

とりあえずこれでokだった.donrailsの場合はCSRFを自前で対応していたり,いろいろ凝ったことをしているので大変だったが,こっちはあんがいとうまくいった.


written by Ar- at Wed Dec 03 07:31:33 UTC 2008
#1 [debian][sip] 今日はじめてDebian以外のdistroも便利だな,と思いました

仕事でもつかうマイナーなtoolであるsip-testerというパッケージ名でsippを自分がDebianにメンテナでいれています.

これは大変に便利なtoolなのですが,とある事情でUbuntuの上で今は開発をしています.そして今日になってテストすっかーという段階になりました.はて,sippあったっけか? とおもいつつ(Ubuntuをsetupしたのが遥か昔なので記憶の彼方..)タイプしてみると,sip-testerをいれやがれ,という表示が.

slで再現するとこんなわけ.

プログラム 'sl' はまだインストールされていません。  次のように入力することでインストールできます:
sudo apt-get install sl
-bash: sl: command not found

あたりまえですがubuntuがdebian派生なんだよなあ,と認識した日でした.

そろそろ安定してきたのでsip-testerもver3系にしないとな.それにしても他に誰か使っているんだろうか(w


written by Ar- at Sat Nov 29 15:11:53 UTC 2008
#1 [debian][ssh][macosx] sshd_configを設定しまくり
実は正直なんでcbcではだめなのか理解に至っていないのだが,ctrを使うようにサーバのsshd_configを設定しまくった. OpenSSH情報 - SSHプロトコルに平文を回復できる脆弱性 という記事がでてて,その中で,こんなことがかかれている.
デフォルトのCiphersの設定は以下の通りです[ssh_config(5)より].
    aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr 
以下のように ~/.ssh/config に設定することで, AESをCTRモードで用いる暗号法のみが利用されます.
Ciphers aes256-ctr,aes192-ctr,aes128-ctr
自分のssh接続が読まれないようにするならこれでいいのであるが,守るべきサーバがあるなら,そっちのsshd_configにCiphersを追記すべきだよなあとおもったので,追加.

written by Ar- at Wed Nov 19 10:44:11 UTC 2008
#1 [debian][rails][macosx] railsの実装速度をあげる方法でMac買えという話があるのだがそんな気がしない件
Speeding Up Rails Development | Ruby on Rails というところでいろんな方法が紹介されているが,そのなかでMacかえという話.
Seriously, Just Buy a Fucking Mac

Just do it. Stop making excuses. I was a Windows user for about ten years but mainly because I didn’t know any better. I now work full time on a mac, both at home and at work, and there’s not a thing you could do to make me go back to Windows.

Windows simply won’t do a lot of things that you’ll want to do. Background jobs? Not a chance. Git? oh yeah, you can use msysgit but who the fuck wants to open up a separate program just to use git? Fuck off Windows. You’re slow and you suck.

Why get a mac? Rails runs faster. You can use the best text editor around, TextMate. You can install all those gems and plugins that all say: “This won’t work on Windows”.

Think getting a mac is too expensive? Get a low spec mac mini for $599. That’s what I started using and even though it’s low spec I never had a problem with it. You can use your USB keyboard, mouse and your monitor from your Windows machine. Still think it’s too much? Have a look on Amazon… Preowned Mac Mini for $350
  • まあわからなくはないのだが,railsで開発するような人でもLinuxやBSD使うのはむずかしいのか? それなら金もかからんうえに,もっと自然に使えると思うのだが..
  • TextMateもいいけど,日本語入力に難があるような..
まあなんにせよmacも安くなってきたのはいいのか.
rubypondのsemantic_form_builderはいいかんじそうなので使ってみよう.

written by Ar- at Mon Nov 17 22:39:34 UTC 2008
#1 [debian][出張] ipswich二日目
朝からいろんな人にメールしていたら,庭の散歩に行くという誘いに乗れなかった.惜しいことをしたかも.

水曜の本番のために今日はデモをsetup.ひとつトラブルがあったけど修正はすぐ終了.まあいろいろ練習ぎみというか雑談ぎみで午後は終了.BT labの食堂のコーヒースタンドに14:13に行ったら14:15までの営業なので終了,というなかなかすごいことにでくわした.結局その場にいた人がクレームつけまくってコーヒーはのめたのだが.

そのあと15,6人でディナーへ.BT labの人がLinuxのdistributionの話をはじめたので,ubuntu, debian, RHEL, Fedoraの比較などていたら,いつしかdebianのssh問題がネタに.
ukでは退役軍人の日ではないのだが,みんなが胸につけてるワッペンはなんだと聞いたらそういうことだった.

ホテルにもどったのは22時.24時前に猛烈にねむくなったので就寝.

written by Ar- at Wed Nov 12 06:40:49 UTC 2008
#1 [debian][macosx][ssh] ssh-copy-idがmacにないの不便だなあ,と一瞬おもったのでcopyしてくる

ssh-copy-idないの不便だなあ,とつぶやいたら,yaegashi師がcopyしてくりゃ使えるよ,と教えてくれたので,確認したらシェルスクリプトだったし,早速etchからコピーしてきた.

まずはdebianからcopyしてきて

 ssh-copy-id remotehost

してみたら,remotehostの.ssh/authorized_keysに

 $ ssh-add -L

の出力であるところの

 The agent has no identities.

が追加されていた.

ちゃんと設定されるはずらしい(yaegashi師)のだがわからん.

勝手にpub keyをssh-add -Lしたりして探してくれるらしいのだが,失敗したときは.ssh/identity.pubをデフォで選ぶらしい.

自分の場合はid_rsa.pubだったのでまったくひっかからなかったようだ.

とりあえずここのあたりはよくわからないのだが

 ssh-copy-id -i .ssh/id_rsa.pub remotehost

として回避した.


この記事へのコメント: by 774 / Sun Nov 02 01:14:53 UTC 2008
cat .ssh/id_rsa.pub | ssh remotehost 'cat >> .ssh/authorized_keys' で代用できますよ。
この記事へのコメント: by araki / Sun Nov 02 07:53:43 UTC 2008
なるほど.まさに本来のrshの使い方ですな.すっかりわすれていました.どうもありがとうございます.
written by Ar- at Sat Nov 01 11:45:16 UTC 2008
#1 [misc][debian] OOo survey
参加したのはいいのだが,最後のsubmitの後が..

404 Not Found
The requested URL /user/thankyou.php was not found on this server.

written by Ar- at Wed Oct 29 23:38:58 UTC 2008
#1 [debian][devel] MonetDBをdebianに
geos-configはlibgeos-devにはいっているのでそれだけapt-getして,あとはひたすらコンパイル.
./monetdb-install.sh  --enable-sql --enable-xquery --enable-geom --prefix=/usr/local

Successfully installed MonetDB in /usr/local/bin
You can start using MonetDB/SQL by starting
 /usr/local/bin/merovingian

はて.書き込み権限とかもちゃんとチェックしているようなので sudo でやる.

monetdb_adapter_0.9.1.tar.gzもってきて中をみると,swigが必要だと気がつく.
> swig MapiLib.ruby.i
> ruby extconf.rb
> 
> make
> make install (you should typically have superuser rights for this one)
との要求が.要求どおりやってみると,
MapiLib.ruby_wrap.c:122:17: error: tcl.h:
でおこらられたので,apt-get install tcl-devして,さらにinclude行を tcl/tcl.hに修正.

written by Ar- at Thu Oct 23 00:43:56 UTC 2008
#1 [debian] cdn.debian.netインターナル第二版
というわけで,cdn.debian.netの最新状況を含めてupdateの発表を,Debian関西勉強会でやってきました.配布資料はそのうち出るだろうから,プレゼンを晒してみます.

今回はlogの解析もしてみたので結果に興味のある人はそこをよく見てほしい.
  • 2.5万アクセス/day
  • DNSのうち有効なのは約半分.(CNAMEが多いとおもわれる)
  • 利用実績をみるとクライアントのホスト,クライアントの国ともにパレートの法則が.
  • Top7は日米加韓中芬台なので,このへんの国は大陸別じゃなくて国別のミラーサーバの詳細設定を将来的には加えたい.
配布資料にない話もまあいろいろ出ましたが,中でも「現状のdebian.or.jpのサーバ,ネットワークがどうなっているのか関西にわかる人がいない」ということがわかりました.聞かれれば答えるつもりでいる人ばかりなので,整理したいですね..むしろ知りたい意欲がある人が聞きだしてまとめてほしいところです.




written by Ar- at Mon Oct 20 02:05:17 UTC 2008
カテゴリ名(記事数: カテゴリの説明) > サブカテゴリ [+]
reading categories...