-->

4 posts categorized "ONO SENDAI SOFTWARE"

2007年5 月21日 (月)

i-AppLeRemote地味にバージョンアップ

ども、シン石丸です。

i-AppLeRemoteのほう、地味にバージョンアップしました。

お使いの方は更新してください。

見た目はなんら変わりませんが、赤外線送信部分に、同じデータを複数回送るバグがあり、1回ボタンを押したら、2,3回動いてしまうバグがあったので修正しました。

最新版は、gamma版となっております。

2007年1 月21日 (日)

【アルカディア】Webページのサムネール生成コード

トグサです。
ケイスがつくっている面白すぎるアルカディアですが、
サムネール生成サーバが動いているサーバは、
MacMini上のParallelsで動いているUbuntuなので、重い&偶に落ちます。
まぁそれは仕方無いのですが、問題は、その度に私の前(MacMiniがある)に来ては、
「また落ちた!重い!もー!全画面からもどせねー!」と叫んで行く事です!

毎日これでは、またシリコン鉱床に埋もれかねないので、
もうちょっと安定し、さらに簡易キャッシュ機能をもたせたサムネール生成サーバを30分くらいでつくりました。

Windowsマシン+CrenaHtml2jpgApache2PHPです。

すべて普通にインストールして、このPHPスクリプトを置きます。

<?php
$crena_exe_path = "C:\\ht_cgi\\crena\\CrenaHtml2jpg.exe";
$crena_image_quarity = 85;
$crena_timeout_sec = 15;
$cache_timeout_sec = 60 * 5;
$image_data_path = "C:\\ht_cgi\\img\\";

function safe_cmd_sanitize_string( $_str )
{
    return strtr( $_str, "\\>\"&<| \0", "________" );
}

function conv_intval( $_str, $_min, $_max, $_err_default )
{
    $val = intval( isset($_GET[$_str]) ? $_GET[$_str] : "0" );
    return ($val < $_min || $_max < $val) ? $_err_default : $val;
}

$cache_str = "";
$cache_str .= "_" . ( $url = safe_cmd_sanitize_string( $_GET['url'] ) );
$cache_str .= "_" . ( $width   = conv_intval( 'width', 32, 1280, 640 ) );
$cache_str .= "_" . ( $height  = conv_intval( 'height', 24, 1024, 480 ) );
$cache_str .= "_" . ( $dwidth  = conv_intval( 'dwidth', 32, 1280, 1024 ) );
$cache_str .= "_" . ( $dheight = conv_intval( 'dheight', 24, 1024, 768 ) );

$file_name = $image_data_path . md5( $cache_str ) . ".jpg";
if( !file_exists( $file_name ) || $cache_timeout_sec < (time() - filemtime( $file_name )) )
    system( "$crena_exe_path -o\"{$file_name}\" -fjpeg -w{$dwidth}x{$dheight} -s{$width}x{$height} -q$crena_image_quarity -t$crena_timeout_sec -u$url" );

header("Content-type: image/jpeg");
readfile( file_exists( $file_name ) ? $file_name : "{$image_data_path}na.jpg" );

?>

後は、こいつを、
http://localhost:8088/index.php?url=http%3A%2F%2Fwww.hogehogex.jp%2F&width=640&height=480
みたいにして呼べばOK。

CrenaHtml2jpgが外部呼出しを前提につくってあるので、楽につくれました。ありがたいですね。どうやら、あちら側でも盛んにつかわれてるようです。

あとは、PHPの設定を、他の余計なコードが実行されないように設定したほうがいいですね。

【アルカディア】ネットの海を表現してみました

ケイスです。
土曜日といってもやらなきゃいけないことが沢山あるのですが、なかなか進まないため、現実逃避でトグサと二人していろいろやってしまいました。

今回は3D表示に挑戦。
もちろんJavaScriptのみでチャレンジです。

こんな感じのクラスを作って

var system3D = new function(){
this.display = new Object();
this.display.width = 1024;
this.display.height=1024;
this.display.center_x = 512;
this.display.center_y=428;
this.display.zoom = 10;
this.elements = new Array();
this.add = function(el){
this.elements.push(el);
};
this.draw = function(){
for(var i=0;i this.elements[i].display();
};

this.camera = new Object();
this.camera.x = 0;
this.camera.y = 0;
this.camera.z = 0;
this.camera.apply = function(){
this.draw();
};
};

//3Dイメージクラスのコンストラクタ
function Image3D(){
this.x=0;
this.y=0;
this.z="";
this.w=600;
this.hw=300;
this.h=600;
this.hh=300;
this.img='undefined';
this.load = function(el,url){
this.img = document.createElement("img");
this.img.style.position = "absolute";
this.img.src = url;
el.appendChild(this.img);
system3D.add(this);
};
this.display = function(){
if(this.z- system3D.camera.z > 0 ){
var mag = system3D.display.zoom / (this.z - system3D.camera.z);
this.img.style.left = ( this.x-this.hw- system3D.camera.x ) * mag
+ system3D.display.center_x ;
this.img.style.top = ( this.y-this.hh - system3D.camera.y ) * mag
+ system3D.display.center_y;
this.img.style.width = this.w * mag ;
this.img.style.height = this.w * mag ;
this.img.style.zIndex = 1000000-this.z;
this.img.style.display = "block";

}else{
this.z += 300;
this.img.style.zIndex = 1000000-this.z;
}
};
};

こんな風に使います

var testImg = new Image3D();
testImg.load($('placeholder'),'http://hogehoge');
testImg.x = 100;
testImg.y = 0;
testImg.z = 10+i*2;
testImg.display();

こんなにシンプルでもちゃんと動作するのがJavaScriptの面白いところです。
まさに富豪的プログラミング

WindowsマシンのPentiumD 2GHzでテストしたらサクサク動きました。
まだFirefoxとSafariでしか動かないんですけどね。

今回はお遊びということで、実用性を無視してサイトを3D空間上にちりばめて、"ネットの海"を航海しているというイメージにしてみました。背景とかモロ宇宙だし。これはLeopardに搭載される"タイムマシン"機能へのオマージュです。

さて、このあとどうするか
僕もいろいろアイデアがあるのですが、なにか面白いことを思いついたらどしどしメール下さい
近々「インターネット探索」をテーマに番組を作る予定です

2006年12 月14日 (木)

AppleRemoteクローン携帯アプリ「i-AppLeRemote(アイーアップルリモート)」β版公開

Iappleremote

電脳空間カウボーイズの新たなコンピュータロデオ!

MACユーザー必見の便利な、iアプリ。

「i-AppLeRemote」を、皆さんにお届けします。

こいつはですね、MAC付属の、AppleRemoteと、だいたい同じ機能をもったiアプリでして、つまり、DoCoMoの携帯電話が、AppleRemoteとして、機能するようになります。

これさえあれば、AppleRemoteを持ち歩かなくても、DoCoMoの携帯電話の人はOK!

P1030168

右のAppleRemoteと、i-AppLeRemoteを起動したSH901iC。

P1030167

こいつを、MacBookにむけて、キーを押すとあら不思議!

Front Rowが起動します。

DoJa 3.0(505i、506i、900i)以降の端末ならば、おそらく動くと思います。

現状、901、902でしか動作確認していませんが。

ダウンロードは、次のQRコード、またはURLから。

Qrcode

http://onosendai.jp/i-AppLeRemote/Download.html

一部、AppleRemoteの機能には、対応していませんが、それはまたのちほど。

- 操作方法 -

上キー:AppleRemoteの+に対応

下キー:AppleRemoteの-に対応

SELECTキー:AppleRemoteの再生に対応

右キー:AppleRemoteの早送りキーに対応

左キー:AppleRemoteの巻き戻しキーに対応

0-9,#,*キー:AppleRemoteのMENUキーに対応

関連書籍-Kindle

iTunesStoreで評価する

フォトアルバム

他のサービス

Twitter
powered by TypePad
登録年月 2005年10月