2006.12.19

Category: Redhat ES(CentOS) / Tags:

iptables の 設定の保存等

redhat ES について
/ect/rc.d/init.d/iptables
の自動起動スクリプトがある場合、iptableの設定は下記の手段でやっとくと
サーバーのリブートなどの時に困らないですみます。
現在の設定ファイルの保存
/etc/rc.d/init.d/iptables save

/etc/sysconfig/iptables
のファイルに現在の設定が保存される。
このファイルを編集して
vi /etc/sysconfig/iptables
最新の情報に書き直す。
/etc/rc.d/init.d/iptables restart
で、設定を反映
/etc/rc.d/init.d/iptables status
で設定を確認。
/etc/sysconfig/iptables
でメンテナンスしておけば、リブート時にも設定が反映されて手間をとられません。

OSによって自動起動スクリプトが違うかもしれないので(反映する設定ファイルが)
/etc/rc.d/init.d/iptables
のスクリプトを一度読んで設定ファイル名や場所を確認しておくのがいいと思う。

2006.12.13

Category: JavaScript / Tags:

JavaScript と flash の連携 その2

flash player 8 以上から外部API経由で連動できるから
そちらを利用したほうがいいかも
外部APIを使用したFlashとJavaScriptの接続
http://sdc.shockwave.com/jp/devnet/flash/articles/external_interface.html
とりあえず、実験は今度してみます。

2006.12.02

Category: JavaScript / Tags:

JavaScript と flash の連携

flashとjavascriptの連携
(Flash / JavaScript Integration Kit の使い方)
FlashとHTMLをjavaScriptを介して連動します。
「JavaScript Integration Kit」
http://weblogs.macromedia.com/flashjavascript/
■ サンプルファイル━━━━━━━━━━━━━━━━━━━
http://www.itm.ne.jp/flash_test/flash_test.zip
http://www.itm.ne.jp/flash_test/index.html
に今回制作した一式(flaファイルなど)をおいています。
■ 参考━━━━━━━━━━━━━━━━━━━━━━━━
http://yoshiweb.net/blog/?itemid=106
■ 環境━━━━━━━━━━━━━━━━━━━━━━━━
 今回、flash8 Pro(試供版)でつくってます。
 動作は
 windows
  firefox 1.5.0.8
  IE 6.0
  Opera 9.0.2
 で確認しています。
■ 動作内容━━━━━━━━━━━━━━━━━━━━━━
今回の実装
イメージタグにマウスオーバーされたときに、
flashの関数を呼び出し、指定のフレームから再生する。
■ 下準備━━━━━━━━━━━━━━━━━━━━━━━━
●1.「FlashJavascriptGateway」の取得
「JavaScript Integration Kit」
http://weblogs.macromedia.com/flashjavascript/
から、
「FlashJavascriptGateway.zip」を取得します。
「Download the latest release of the Flash / JavaScript Integration Kit.」
からダウンロード
zipの中身は
—————————————-ここから

docs
license.txt
readme.html
installation
JavaScriptFlashGateway.js
JavaScriptFlashGateway.swf
source
flash
actionscript
com
macromedia
javascript
JavaScriptProxy.as
JavaScriptSerializer.as
gateway
JavaScriptFlashGateway.as
JavaScriptFlashGateway.fla
JavaScriptFlashGateway.swf
javascript
Exception.js
FlashProxy.js
FlashSerializer.js
FlashTag.js

—————————————-ここまで
となっている。
●2. 作業フォルダの作成
—————————————-ここから

flash_test
JavaScriptFlashGateway.js(JavaScript Integration Kit)
JavascriptFlashGateway.swf(JavaScript Integration Kit)
javascript2flash.fla(新規作成)
javascript2flash.swf(javascript2flash.flaから生成)
index.html(新規作成)
images
logo.gif(新規作成)
com
macromedia
javascript
JavaScriptProxy.as(JavaScript Integration Kit)
JavaScriptSerializer.as(JavaScript Integration Kit)

—————————————-ここまで
の構成でおこないます。
JavaScriptFlashGateway.js
JavascriptFlashGateway.swf
は、
「FlashJavascriptGateway/installation」 フォルダ
comフォルダ以下は
「source/flash/actionscript」フォルダ
以下になります。
最終的な公開には、
—————————————-ここから

flash_test
JavaScriptFlashGateway.js
JavascriptFlashGateway.swf
javascript2flash.swf
index.html
images
logo.gif

だけになります。
—————————————-ここまで
●3.文字コードの修正
JavaScriptProxy.as
JavaScriptSerializer.as
  がBOM付のUTF8でないと後々エラーがでるので先に変換しておきます。
–おまけ解説
「import com.macromedia.javascript.JavaScriptProxy;」で
「 ‘com.macromedia.javascript.JavaScriptProxy’ がロードされませんでした。」
のエラーが出てしまいます。
これを回避するために、unicode(BOM付)で保存してあげるとの事。
とりあえず、お手持ちのテキストエティターでUTF8に保存してあげてためしてください。
私は、「dana」でUTF8に保存しなおしてあげたら上手くいきました。

■ 実作業━━━━━━━━━━━━━━━━━━━━━━━━
●1. JavaScriptProxy.as JavaScriptSerializer.as の取り込みスクリプトを記載
「javascript2flash.fla」に
– ここから

import com.macromedia.javascript.JavaScriptProxy;
var proxy:JavaScriptProxy = new JavaScriptProxy(_root.lcId, this);

– ここまで
を記載
●2. HTML から実行する functon を作ります。
「javascript2flash.fla」に
– ここから

function viewImage(image) {
switch( image ){
case 1 :
gotoAndStop(40);
break ;
case 2 :
gotoAndStop(50);
break ;
case 3 :
gotoAndStop(60);
break;
}
}

– ここまで
のjavaScrpitからの制御を入れました。
●3.swfファイルの作成
javascript2flash.fla をパブリッシュして javascript2flash.swf
を作成
●4.index.html のJavascriptを編集
サンプルを
http://www.itm.ne.jp/flash_test/index.html
においています。そちらのソースで確認ください。
■ 注意点━━━━━━━━━━━━━━━━━━━━
今回、日本語を引数として通していません。日本語を通すと文字化けするとの
 情報があるので、スクリプトの変更が必要みたいです。
■ JavaScript Integration Kitの実装━━━━━━━━━━━━━
JavaScriptFlashGateway.js
 HTMLとFlashのつなぎのJavascriptです。
JavaScriptFlashGateway.swf
 実装として、#include “JavaScriptFlashGateway.as”だけをしているファイル
データの流れは、
1.HTML->
2.javascript(イベント等) ->
3.JavaScriptFlashGateway.js ->
4.JavaScriptFlashGateway.swf ->
5.作ったflash(swf)
の順番になります。(とおもう。。)
■ 各種マニュアル━━━━━━━━━━━━━━━━━━━━
JavaScriptFlashGateway.js とかのメソットのマニュアルは
おいおい書きます。(気が向いたら)

2006.12.01

Category: FreeBsd, Redhat ES(CentOS) / Tags:

ntp の設定

redhat系 と freebsdでおこないました。
福大のサーバーのNTPを利用するのはよしましょう。(ソースはいろんなところ)
クーロンで 「ntpdate」を設定してないか事前チェックする。
おこなってない -> そのままntpdの設定へ
おこなってる -> クーロンの設定を削除して設定へ
なお、現在の時間とサーバーの時間があまりにづれている場合は一度
[root@www root]# ntpdate ntp.xxx.xxx.xx.xx
などで、時間をあわせておく
以後は、rpm で ntpが入っている事が前提
/etc/ntp.conf
の修正

restrict default ignore
restrict 127.0.0.1
#ローカルからの問い合わせ
restrict 192.168.xxx.0 mask 255.255.255.0 nopeer nomodify notrap
#外部サーバへの許可
restrict 210.173.160.27 nomodify notrap noquery
restrict 210.173.160.57 nomodify notrap noquery
restrict 210.173.160.87 nomodify notrap noquery
#外部サーバーの指定
server ntp1.jst.mfeed.ad.jp
server ntp2.jst.mfeed.ad.jp
server ntp3.jst.mfeed.ad.jp
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
#同期ファイルの指定
driftfile /etc/ntp/drift
broadcastdelay 0.008
authenticate yes
keys /etc/ntp/keys

設定値を書き出すとこんな感じ、大事なのは、ntpサーバーを指定しているところ
server ntp1.jst.mfeed.ad.jp
の部分かな
後は、
[root@www root]# /etc/init.d/ntp start
をしてあげて起動
サービスのチェックは
[root@www root]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
LOCAL(0) LOCAL(0) 10 l 50 64 3 0.000 0.000 0.008
ntp1.jst.mfeed. fs-monntp1.mfee 2 u 44 64 3 2.093 189.550 5.384
ntp2.jst.mfeed. fs-monntp1.mfee 2 u 36 64 3 2.184 190.306 5.384
ntp3.jst.mfeed. fs-monntp1.mfee 2 u 35 64 3 3.108 190.801 6.073
としてあげてチェック
ntp3.jst.mfeed. とかの前に * や + がついてないのは同期がとれてない
しばらくすると
+ntp3.jst.mfeed. fs-monntp1.mfee 2 u 35 64 3 3.108 190.801 6.073
とかなります。
最後に、自動起動のチェック

[root@www root]# chkconfig –list | grep ntp
ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@www root]# chkconfig ntpd on
[root@www root]# chkconfig –list | grep ntp
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

で、とりあえず完了。
free bsd にて
基本的には同じ、
自動起動は
/etc/rc.conf に

[root@www /root]# vi /etc/rc.conf
# ntpd
ntpd_enable=”YES”
ntpd_program=”/usr/sbin/ntpd -c /etc/ntp.conf”
ntpd_flags=”-p /var/run/ntpd.pid”

などを書き込む