memo.xight.org

2006-04 / 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
最近 日分 / 今月の一覧

2006-04-24 Mon

Visual Studio 2005 Express Edition 無償公開期間が無期限に

- Reference
Visual Studio 2005 Express Edition
http://www.microsoft.com/japan/msdn/vstudio/express/
窓の杜 - 「Visual Studio 2005 Express Edition」日本語正式版の一般向け無償公開開始
http://www.forest.impress.co.jp/article/2005/12/16/visualstudioex.html
窓の杜 - 「Visual Studio 2005 Express Edition」の無償提供期間が1年から無期限へ変更
http://www.forest.impress.co.jp/article/2006/04/20/visualstudioex.html

カテゴリ: [Memo]

2006-04-20 Thu

リンクをマウスオーバーでサムネイルをポップアップ

- Source

function linkthumb(){
	var nophoto = 'http://img.simpleapi.net/img/nophoto.gif';
	var img = document.createElement('img');
	img.src = nophoto;
	img.onmouseout = function(){
		img.src=nophoto;
		img.style.display='none';
	};
	img.style.position = 'absolute';
	img.style.cursor   = 'pointer';
	img.style.display  = 'none';
	document.body.appendChild(img);
	var d = document.getElementsByTagName('div');
	for (var j = 0 ; j < d.length ; j++){
		if (d[j].className != 'body') continue;
		var a = d[j].getElementsByTagName('a');
		for (var i = 0 ; i < a.length ; i++){
			if (!a[i].href.match(/^http:/)) continue;
			if (a[i].href.match("^http://www\.example\.org/path/to/dir/")) continue;
			a[i].onmouseover=function(e){
				var link  = this.href;
				var thumb = 'http://img.simpleapi.net/small/'+link;
				img.onmouseover=function(){
					img.src=thumb;
					img.style.display='block';
				};
				img.onclick = function(){
					location.href=link;
				};
				if(document.all){
					img.style.left = document.documentElement.scrollLeft + event.x + "px";
					img.style.top  = document.documentElement.scrollTop  + event.y + "px";
				}else{
					img.style.left = e.pageX + "px";
					img.style.top  = e.pageY + "px";
				}
				img.src = thumb;
				img.style.display = 'block';
			};
			a[i].onmouseout = img.onmouseout;
		}
	}
}
if(window.addEventListener){
	window.addEventListener('load',linkthumb,false);
} else if(window.attachEvent){
	window.attachEvent('onload',linkthumb);
} else {
	window.onload=linkthumb;
}


以下の部分を適宜書き換えることで,自分のサイトはポップアップさせないように設定可能.
if(a[i].href.match("^http://www\.example\.org/path/to/dir/")) continue;


- Reference
Simple API - ウェブサイト・サムネイル化ツール
http://img.simpleapi.net/
- via
halchan's diary
http://www.halchan.org/diary/

カテゴリ: [JavaScript]

Smarty + HTML_QuickForm で 簡単フォーム生成

- HTML_QuickFormのインストール

# pear install HTML_Common HTML_QuickForm


- Sample (index.php)
HTML_QuickForm利用の手引きより

<?php
// ページを作成するのに使うライブラリの読み込み
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
require_once 'smarty/libs/Smarty.class.php';
 
// Formの作成
$form = new HTML_QuickForm('secondForm');
$form->setDefaults(array(
	'name' => 'Namahage'
));
 
$form->addElement('header','second','QuickForm second example');
$form->addElement('text','name','Enter your name:', array('size' => 50, 'maxlength' => 255));
$form->addElement('submit','submit','Send');
$form->addElement('reset','reset','Reset');
$form->addRule('name','Please enter your name','required',null,'client');
 
if ($form->validate()) {
	// Formが正しかったらfreezeする
	$form->freeze();
}
 
// Smartyの設定
$smarty = new Smarty;
$smarty->template_dir = "./templates";
$smarty->compile_dir = "./templates_c";
$smarty->cache_dir = "./cache";
 
// Render関連の設定
$renderer =& new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->accept($renderer);
$smarty->assign('form',$renderer->toArray());
 
// 表示
$smarty->display('index.tpl');
?>


- Sample (templates/index.tpl)
HTML_QuickForm利用の手引きより
{* Smarty *}
<html>
	<head>
		{$form.javascript}
	</head>
	<body>
		<form {$form.attributes}>
			{$form.hidden}
			<h1>{$form.header.second}</h1>
			{$form.name.label}: {$form.name.error}{$form.name.html}<br>
			{$form.reset.html}
			{$form.submit.html}
		</form>
	</body>
</html>


- Reference
PEAR初心者ガイド - HTML_QuickForm入門
http://www.planewave.org/translations/quickform/html_quickform.html
HTML_QuickForm利用の手引き
http://www.is.titech.ac.jp/~yanagis0/kei/quickform.html

Smarty : Template Engine
http://smarty.php.net/


HTML_QuickForm

カテゴリ: [PHP]

locale を UTF-8 にする

- /etc/locale.gen

ja_JP.EUC-JP EUC-JP
ja_JP.UTF-8 UTF-8



- locale 生成

# locale-gen


- .zshrc など

export LANG=ja_JP.UTF-8

カテゴリ: [Linux]

PHPでExcelを読み書きする

- Reference
IBM dW : オープンソース : PHPでExcelデータを読み書きする
http://www-06.ibm.com/jp/developerworks/opensource/051104/j_os-phpexcel.shtml?ca=drs-
minfish.jp/blog: PHPでExcelファイルの入出力
http://www.minfish.jp/blog/archives/2006/01/phpexcel.html

Spreadsheet_Excel_Writer

PHP Classes - Class: Spreadsheet_WriteExcel
http://psbweb.mirrors.phpclasses.org/browse.html/package/767.html

カテゴリ: [PHP]

2006-04-18 Tue

Bloginfluence

- 計算式

[(blog+posts+web links) + (bloglines subs * 2)] * 1+(Pagerank/10)


- Reference
Bloginfluence - Rate your influence in the blogosphere - SEO tool
http://www.bloginfluence.net/en/
- via
http://www.hyuki.com/t/200604.html#i20060418083210

カテゴリ: [Web Tool]

everystockphoto.com - Creative Common ライセンスの画像集

- Reference
everystockphoto.com - your source for free photos
http://www.everystockphoto.com/

カテゴリ: [Memo]

Niceform できれいなフォーム生成

- source

<script language="javascript" type="text/javascript"
src="niceforms.js"></script>
<style type="text/css" media="screen">@import
url(niceforms-default.css);</style>

- Reference
badboy.media.design :: articles :: Niceforms
http://www.badboy.ro/articles/2005-07-23/
- via
phpspot開発日誌 - Niceformでエレガントなフォーム生成
http://phpspot.org/blog/archives/2006/04/niceform.html

カテゴリ: [PHP]
内部リンク: [2006-06-19-16]

ime.nuからアクセスがあった際の調査方法

- Reference
地獄変00 - ime.nuからアクセスが! そんなときは…
http://blog.livedoor.jp/jigokuhen00/archives/6271017.html
2ちゃんねる検索
http://find.2ch.net/
はてな - ime.nuとは
http://d.hatena.ne.jp/keyword/ime.nu
はてな - ime.stとは
http://d.hatena.ne.jp/keyword/ime.st

カテゴリ: [2ch]

PHP で DOM を使って HTML を出力

- 準備

# aptitude install php4-domxml


- PHPをソースから入れている場合
php.iniを編集

extension_dir = "/usr/lib/php4/20020429"



- sample

// 文章を生成する
$doc = domxml_new_doc("1.0");
 
$root = $doc->create_element("html");  // ルートとなる要素生成 (<html>タグ)
$root->set_attribute('lang','ja');     // <html>タグに lang 属性を追加
$root = $doc->append_child($root);
 
// <head>タグ生成
$head = $doc->create_element("head");
$head = $root->append_child($head);
 
// <title>タグ生成
$title = $doc->create_element("title");
$title = $head->append_child($title);
 
// <title>タグの中にテキスト挿入
$text = $doc->create_text_node("This is the title");
$text = $title->append_child($text);
 
// HTMLを出力
echo $doc->html_dump_mem();


- output (インデント付与)
<html lang="ja">
  <head>
    <title>This is the title</title>
  </head>
</html>


- 応用例
都道府県の一覧の<select>タグを出力
function generateSelectHtml($items,$id,$default){
	$doc = domxml_new_doc("1.0");
	$root = $doc->create_element('select');
	$root->set_attribute('name',$id);
	$root->set_attribute('id',$id);
	$root= $doc->append_child($root);
	
	// 初期表示のテキストが設定されていたとき
	if (!empty($default)){
		$option = $doc->create_element('option');
		$option->set_attribute('value','');
		
		if(empty($_SESSION[$id])){
			$option->set_attribute('selected','selected');
		}
		
		/* Add text node */
		$text = $doc->create_text_node($default);
		$option->append_child($text);
		
		$root->append_child($option);
	}
 
	foreach($items as $i){
		$option = $doc->create_element('option');
		$option->set_attribute('value',$i);
		
		if ($_SESSION[$id] == $i){
			$option->set_attribute('selected','selected');
		}
		
		/* Add text node */
		$text = $doc->create_text_node($i);
		$option->append_child($text);
		
		$root->append_child($option);
	}
	return $doc->html_dump_mem();
}
 
function generatePrefSelectHtml(){
	$default = '都道府県を選択してください。';
	$items = array(
	'北海道',
	'青森県',
	'岩手県',
	'宮城県',
	'秋田県',
	'山形県',
	'福島県',
	'茨城県',
	'栃木県',
	'群馬県',
	'埼玉県',
	'千葉県',
	'東京都',
	'神奈川県',
	'新潟県',
	'富山県',
	'石川県',
	'福井県',
	'山梨県',
	'長野県',
	'岐阜県',
	'静岡県',
	'愛知県',
	'三重県',
	'滋賀県',
	'京都府',
	'大阪府',
	'兵庫県',
	'奈良県',
	'和歌山県',
	'鳥取県',
	'島根県',
	'岡山県',
	'広島県',
	'山口県',
	'徳島県',
	'香川県',
	'愛媛県',
	'高知県',
	'福岡県',
	'佐賀県',
	'長崎県',
	'熊本県',
	'大分県',
	'宮崎県',
	'鹿児島県',
	'沖縄県',
	);
	return generateSelectHtml($items,'pref',$default);
}


- usage
<?= generatePrefSelectHtml() ?>


- Reference
PHP: DomDocument->html_dump_mem - Manual
http://jp.php.net/manual/ja/function.domdocument-html-dump-mem.php

カテゴリ: [PHP]

2006-04-17 Mon

Windows Script Decoder - Windows Script Encoder ファイルをデコード

Windows Script Encoder[2006-04-17-12]でエンコードされたスクリプトをデコードするソフトウェア
- Reference
Windows Script Decoder
http://www.virtualconspiracy.com/?page=scrdec/intro
- via
MOONGIFT - Windows Script Decoder
http://fw.moongift.jp/intro/i-1539.html
MOONGIFT - Windows Script Decoder レビュー
http://fw.moongift.jp/review/i-1545.html

カテゴリ: [Windows][Software]

Windows Script Encoder - VBScript,JScriptを難読化

- Summary
スクリプトエンコーダは,スクリプト設計者のためのシンプルなコマンド ライン ツール.
作成したスクリプトをエンコードし,Web ホストや Web クライアントによりスクリプトのソースが表示されたり変更されないように保護できる.
コードがユーザーの目に触れるのを防ぐことが目的.
コードが解読されるのを防ぐことを目的としているものではない.

- usage

screnc [/s] [/f] [/xl] [/l defLanguage] [/e defExtension] inputfile outputfile

/? ヘルプ
/s サイレントモード
/f 入力ファイルを出力ファイルで強制上書き
/xf .ASP ファイルの先頭に @language ディレクティブが追加されないようにする.
デフォルトでは .ASP ファイルに対して @language ディレクティブが追加される.

- ファイル名が変わる
使用前 使用後
example.vbs eample.vbe
example.js eample.jse

- HTMLへの埋め込み (Internet Explorer限定)
<script language="JScript.Encode" src="example.jse"></script>


- Reference
Windows Script Encoder
http://www.microsoft.com/downloads/details.aspx?FamilyID=2976ee94-bec5-4314-84fd-8d7ec891c1c5&DisplayLang=ja
Microsoft ダウンロードセンター検索: Windows Script Encoder
http://www.microsoft.com/downloads/results.aspx?freetext=Windows%20Script%20Encoder&displaylang=ja

MSDN - スクリプト エンコーダの概要
http://msdn.microsoft.com/library/ja/script56/html/seconscriptencoderoverview.asp
MSDN - スクリプト エンコーダを使用する
http://msdn.microsoft.com/library/ja/script56/html/seusingscriptencoder.asp
MSDN - スクリプト エンコーダの構文
http://msdn.microsoft.com/library/ja/script56/html/seconscriptencodersyntax.asp

- via
MOONGIFT - Windows Script Encoder
http://fw.moongift.jp/intro/i-1538.html
MOONGIFT - Windows Script Encoder レビュー
http://fw.moongift.jp/review/i-1541.html

カテゴリ: [Software]
内部リンク: [2006-04-17-13]

RPGツクール for Mobile

- Summary
iアプリ対応RPGを制作できるRPGツクールが無償公開.

- 動作環境
o Java 2 SDK
o iαppli Development Kit for DoJa-3.5

- Reference
ツクールweb - RPGツクール for Mobile
http://www.enterbrain.co.jp/tkool/mobile_rpg/
- via
窓の杜 - エンターブレイン、iアプリ対応RPGを制作できる“RPGツクール”を無償公開
http://www.forest.impress.co.jp/article/2006/04/17/rpgtkoolmobile.html

カテゴリ: [Game]

Debian Sarge で PHP5.0

- /etc/apt/sources.listに以下を追加

deb http://people.debian.org/~dexter php5 sarge


- インストール

# aptitude update
# aptitude install php5
# aptitude install php5-mysql php5-gd

- Reference
[debian-users:43746] Re: php5 の 対応
http://lists.debian.or.jp/debian-users/200506/msg00077.html

カテゴリ: [Debian][PHP]

Eye Tracking - 視線でユーザビリティテスト

- 動画デモ
http://www.etre.com/usability/eyetracking/showme/
- Reference
Eye Tracking - Etre
http://www.etre.com/usability/eyetracking/
- via
秋元@サイボウズ研究所プログラマーBlog: 究極のユーザビリティテスト Eye Tracking
http://labs.cybozu.co.jp/blog/akky/archives/2006/04/post_104.html

Apache2 API Document

- Reference
Apache2 Documentation
http://www.m-takagi.org/docs/apache/api/packages.html
- via
オレンジニュース - 2006-04-13
http://secure.ddo.jp/~kaku/tdiary/20060413.html#p07

カテゴリ: [Apache2]

Google Calendar

- Reference
Welcome to Google Calendar
http://calendar.google.com/
- via
Going My Way: イベントの追加などが手軽にできるGoogle Calendarリリース
http://kengo.preston-net.com/archives/002540.shtml
オレンジニュース - 2006-04-13
http://secure.ddo.jp/~kaku/tdiary/20060413.html#p15

カテゴリ: [Google]

ハッカージャパンブログ

- Reference
ハッカージャパンブログ
http://hackerjapan.blog55.fc2.com/
- via
オレンジニュース - 2006-04-13
http://secure.ddo.jp/~kaku/tdiary/20060413.html#p09

カテゴリ: [Memo]

Zend Framework Manual

- Reference
Zend Framework: Manual
http://framework.zend.com/manual/ja/

ゼンド・ジャパン株式会社 技術情報コンテンツ - その他/Zend Framework
http://www.zend.co.jp/tech/?%A4%BD%A4%CE%C2%BE%2FZend%20Framework

カテゴリ: [PHP]

CSSレイアウト サンプル集

- Reference
Layout Gala: a collection of 40 CSS layouts based on the same markup and ready for download!
http://blog.html.it/layoutgala/

カテゴリ: [CSS]

Google Maps API 2 を用いた 東京メトロ・都営地下鉄路線図

- Reference
Unofficial Tokyo Metro Map / 東京メトロ・都営地下鉄路線図 / Google Maps API 2
http://japonyol.net/editor/ajax.html

カテゴリ: [Google Maps]

FirefoxやThunderbirdのメモリ消費量を劇的に減らす方法

- Summary
Firefox ならば about:config を開く.
Thunderbirdならば [ツール] - [オプション...] - [詳細]タブ - [設定エディタ]ボタンから設定.

真偽値 config.trim_on_minimize を作成し, true に設定する.
その後, Firefoxを再起動.

最小化時にメモリを開放するようになる.

- Reference
GIGAZINE - FirefoxやThunderbirdのメモリ消費量を劇的に減らす方法
http://gigazine.net/?news/comments/20060415_firefoxthunderbird/

カテゴリ: [Firefox][Thunderbird]
Referrer (Inside): [2005-12-14-7]

2006-04-16 Sun

ファイナルファンタジーIII Nintendo DS版をチェック

- Summary
Wikipediaを見る限り,Wi-Fiコネクションに対応するとの事.
要チェック!

- Reference
ファイナルファンタジー III: ゲーム
Wikipedia - ニンテンドーWi-Fiコネクション

ファミ通.com - 完全リメイク版『ファイナルファンタジーIII』はニンテンドーDSで発売決定!
http://www.famitsu.com/game/news/2005/10/05/103,1128507368,44284,0,0.html
FINAL FANTASY IV ADVANCE
http://www.square-enix.co.jp/ff4a/

カテゴリ: [Game]

2006-04-13 Thu

初代Googleのアルゴリズム解説

- Summary
PRはページランク.
PR(A)はAというページのページランク.
Tn はページAへのリンク数.
C(A)はAから外へのリンク数.

dは定数で,ここでは0.85とする.
行き止まりのページや,類似したページ郡を考慮するために用いる.



ページランク以外のアルゴリズム要素
1. 地理的情報
IPアドレスで地域をまとめる.
地域が近いページ間は同じ言語圏である可能性が高い.
日本から検索した場合,IPアドレスから日本と推測されたページのランクを情報させておく.

2. ビジュアル要素
文字のサイズ,文字の位置がページの上の方にあれば高評価.

3. キャッシュ
クロール時のページランクが検索結果と乖離しないよう,
クロール時のページをキャッシュしておくことで,
クロール時のページランクを得たページを閲覧することが可能.

- Reference
Stanford University - The Anatomy of a Search Engine
http://infolab.stanford.edu/~backrub/google.html

Google! (初代Google)
http://web.archive.org/web/19981202230410/http://www.google.com/

- via
GIGAZINE - 初代Googleのアルゴリズム解説
http://gigazine.net/index.php?/news/comments/20060411_google/

カテゴリ: [Google]

2006-04-12 Wed

XOOPS Protector

- Summary
以下の攻撃を防ぐためのXOOPS モジュール.

  - DoS
  - 悪意あるクローラー (メール収集ボットなど)
  - SQL Injection
  - XSS (一部のパターンのみ)
  - システムグローバル変数汚染
  - セッションハイジャック
  - ヌルバイト攻撃
  - ディレクトリ遡り指定
  - いくつかの危険なCSRF (XOOPS 2.0.9.2以下に存在するもの)

- mainfile.php の変更

define('XOOPS_GROUP_ADMIN', '1');
define('XOOPS_GROUP_USERS', '2');
define('XOOPS_GROUP_ANONYMOUS', '3');
 
include( XOOPS_ROOT_PATH . '/modules/protector/include/precheck.inc.php' );
if (!isset($xoopsOption['nocommon'])) {
    include XOOPS_ROOT_PATH."/include/common.php";
}
include( XOOPS_ROOT_PATH . '/modules/protector/include/postcheck.inc.php');


- Reference
XOOPS Cube公式サイト - モジュール/ハック - XOOPS Protector
http://jp.xoops.org/modules/mydownloads/singlefile.php?cid=6&lid=131

カテゴリ: [XOOPS]

SP+メーカー - アップデートを適用したブート可能なISOイメージ作成ソフト

- Summary

Windows 2000/XP/Server 2003 に Service Pack やその後にリリースされたアップデートを適用させた
ブート可能なISOイメージを作成するGUIベースのソフト

- Reference
A.K Office - オリジナル作品 - ソフトウェア - SP+メーカーの説明
http://www.ak-office.jp/original/soft/winsppm.html
Vector - SP+メーカー
http://www.vector.co.jp/soft/winnt/util/se332861.html

カテゴリ: [Windows][Software]