<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>NOTE | kazy.jp</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/" />
    <link rel="self" type="application/atom+xml" href="http://www.kazy.jp/note/atom.xml" />
    <id>tag:www.kazy.jp,2009-02-22:/note//10</id>
    <updated>2010-09-09T07:07:42Z</updated>
    <subtitle>web制作ノート</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.25</generator>

<entry>
    <title>FlashDevelopのプロジェクトにProgressionのクラスパスを通す</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2010/09/flashdevelopprogression.html" />
    <id>tag:www.kazy.jp,2010:/note//10.527</id>

    <published>2010-09-05T06:05:53Z</published>
    <updated>2010-09-09T07:07:42Z</updated>

    <summary>FlashDevelopにクラスパスを通していないと、コーディングの時、Prog...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="FLASH" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<p>FlashDevelopにクラスパスを通していないと、コーディングの時、Progressionのクラスがコード補完されません。</p><p>FlashDevelopのグローバルクラスパスにパスを通して、コーディング環境を整えます。</p><p>1. FlashDevelopの[ツール] -&gt; [グローバルクラスパスの編集]でパネルを開く。</p><p>2.追加ボタンから下記フォルダを追加する。</p><p><strong>　Windows 7</strong><br />　C:\Users\<em>ユーザー名</em>\AppData\Local\Adobe\<em>Flash CS4</em>\ja\Configuration\Progression\Libraries</p><p>以上でFlashDevelopを再起動すればコード補完されるようになります。</p>]]>
        
    </content>
</entry>

<entry>
    <title>LightBox系のJavaScriptをFLASHから動かす</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2010/06/lightboxjavascriptflash.html" />
    <id>tag:www.kazy.jp,2010:/note//10.503</id>

    <published>2010-06-21T12:53:12Z</published>
    <updated>2010-06-26T14:20:24Z</updated>

    <summary>下記サイトに書かれているように http://blog.codefidelity...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="JavaScript" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<p>下記サイトに書かれているように<br />
<a target="_blank" href="http://blog.codefidelity.com/?p=16">http://blog.codefidelity.com/?p=16</a></p>
<pre class="brush: xml;">
&lt;script type=&quot;text/javascript&quot;&gt;
	function LightboxDelegate(url,caption) {
		var objLink = document.createElement('a');
		objLink.setAttribute('href',url);
		objLink.setAttribute('rel','lightbox');
		objLink.setAttribute('title',caption);
		Lightbox.prototype.start(objLink);
	}
&lt;/script&gt;
</pre>
<p>という関数をJS側で用意し、<br />
FLASHからExternalInterfaceでアクセスすれば<br />
Lightboxを開かせることができる。</p>

<p>しかしLightboxの start(obj); のように、動作をスタートする関数やAPIが用意されていればいいが、されていなかった場合はどうすればいいか。<br />
下記のようにjQueryのtrigger関数を使って、リンクをクリックしたことにすればLightboxを作動させることができる。</p>
<pre class="brush: xml;">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	function callLightbox(url) {
 		var objLink = document.getElementById(&quot;test&quot;);
		objLink.href = url;
 		$('#test').trigger('click');
 	}
&lt;/script&gt;

&lt;a id=&quot;test&quot; href=&quot;http://google.co.jp&quot;&gt;test&lt;/a&gt;
</pre>]]>
        
    </content>
</entry>

<entry>
    <title>PHPとrsyncを使ってステージングもどき</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2010/05/phprsync.html" />
    <id>tag:www.kazy.jp,2010:/note//10.474</id>

    <published>2010-05-06T10:49:47Z</published>
    <updated>2010-06-26T14:25:50Z</updated>

    <summary>ステージング環境を簡単に作りたい時、シェルでrsyncを使えばすぐにできる。in...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="Webの運用" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<p>ステージング環境を簡単に作りたい時、シェルでrsyncを使えばすぐにできる。</p><p><strong>index.html</strong></p> <pre class="brush: xml;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;ステージングもどきテスト&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;ステージングもどきテスト&lt;/h1&gt;
&lt;a href=&quot;rsync.php&quot;&gt;アップする&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre> <p><strong>rsync.php</strong></p> <pre class="brush: xml;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;ステージングもどきテスト&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;ステージングもどきテスト&lt;/h1&gt;
&lt;?php
$output = shell_exec('rsync  -av --delete /var/www/html/virtual/test/ /var/www/html/virtual/public/');
echo &quot;&lt;pre&gt;$output&lt;/pre&gt;&quot;;
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>]]>
        
    </content>
</entry>

<entry>
    <title>JavaScriptでフリックとピンチ</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2010/04/yui.html" />
    <id>tag:www.kazy.jp,2010:/note//10.469</id>

    <published>2010-04-26T12:55:41Z</published>
    <updated>2010-10-07T09:12:11Z</updated>

    <summary>iPhoneサイトのモックアップ用にフリックとピンチのJSを作ったのでメモ。 か...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="JavaScript" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<p>iPhoneサイトのモックアップ用にフリックとピンチのJSを作ったのでメモ。<br />
かなり急いで作ったからスパゲッティになってしまった。<br />
<br />
写真を見せるギャラリーサイトを想定。<br />
フリックで別の写真へ移動し、ピンチで拡大する。<br />
<br />
※別途<a href="http://developer.yahoo.com/yui/" target="_blank">YUIライブラリ ver:3.0.0</a>が必要です <br />
<br />
<strong>JavaScript</strong></p>
<pre class="brush: js;">
document.onscroll = function(){
	if(window.pageXOffset &gt; 5)scrollTo(0,1);
}

YUI().use('anim', function(Y) {
		//アニメーションインスタンス生成
    var collectionAnim = new Y.Anim({
        node: '#collection',
        duration: 1,
        easing: Y.Easing.easeOut
    });
		//イベント登録
    var colectionLoaded = function(e) {
			//フェードイン
			collectionAnim.set('to', { opacity:1 });
			collectionAnim.run();
			
			var PHOTO_WIDTH = 320;
			var PHOTO_HEIGHT = 427;
			var PHOTO_MAX = 6;
			var SCROLL_X_MIN = - PHOTO_WIDTH * (PHOTO_MAX - 1);
			
			var startX = 0;//#collectionのタッチ時のx座標
			var nowX = 0;//#collectionのタッチ中のx座標
			var scroll = 0;//タッチの移動距離
			var target = 0;//#collectionの移動先
			var startTouch = 0;//タッチ時のタッチ位置のx座標
			var nowTouch = 0;//タッチ中のタッチ位置のx座標
			var startDis = 0;//タッチ時の2タッチ間の距離
			var nowDis = 0;//タッチ中の2タッチ間の距離
			var startPhotoWidth = 0;//タッチ時の写真幅
			var startPhotoHeight = 0;//タッチ時の写真高さ
			var touchCount = 0;//タッチ数
			var photoCount = 0;//現在表示している写真のカウント
			var collectionElement = document.getElementById(&quot;collection&quot;);
			var zoom = false;//拡大中フラグ
			var moving = false;//移動中フラグ
			
			//タッチイベントリスナー登録
			collectionElement.addEventListener('touchstart', touchHandler, false);
			collectionElement.addEventListener('touchmove', touchHandler, false);
			collectionElement.addEventListener('touchend', touchHandler, false);
			collectionElement.addEventListener('touchcancel', touchHandler, false);
			
			//タッチイベント処理
			function touchHandler(e) {
				e.preventDefault();
				
				if (e.type == &quot;touchstart&quot;) {
					document.getElementById(&quot;touchstatus&quot;).innerHTML = &quot;タッチスタート&quot;;
					//タッチ数が１の時でピンチしていない時で移動中じゃないとき
					if (e.touches.length == 1 &amp;&amp; zoom == false &amp;&amp; moving == false) {
						touchCount = 1;
						startTouch = e.touches[0].pageX;
						scroll = 0;
						startX = collectionElement.offsetLeft;
						document.getElementById(&quot;touchmove&quot;).innerHTML = &quot;startTouch:&quot; + startTouch + &quot;
startX:&quot; + startX;
					}
					//タッチ数が２（ピンチ）の時で移動中じゃないとき
					if (e.touches.length == 2 &amp;&amp; moving == false) {
						touchCount = 2;
						zoom = true;
						var touch1 = e.touches[0];
						var touch2 = e.touches[1];
						//3平方の定理で最初の距離を取得
						startDis = Math.sqrt(Math.pow((touch1.pageX - touch2.pageX), 2)+Math.pow((touch1.pageY - touch2.pageY), 2));
						var targetPhoto = document.getElementById(&quot;photo&quot;+photoCount);
						startPhotoWidth = targetPhoto.offsetWidth;
						startPhotoHeight = targetPhoto.offsetHeight;
					}
				}else if (e.type == &quot;touchmove&quot;) {
					document.getElementById(&quot;touchstatus&quot;).innerHTML = &quot;タッチ移動&quot;;
					document.getElementById(&quot;touchx&quot;).innerHTML = e.touches[0].pageX;
					document.getElementById(&quot;touchy&quot;).innerHTML = e.touches[0].pageY;
					//タッチ数が１の時でピンチしていない時で移動中じゃないとき
					if (e.touches.length == 1 &amp;&amp; zoom == false &amp;&amp; moving == false) {
						touchCount = 1;
						nowTouch = e.touches[0].pageX;
						scroll = nowTouch - startTouch;
						target = startX + scroll;
						//ステージからはみ出ないようにする
						if(target &gt; 0){
							target = 0;
						}else if(target &lt; SCROLL_X_MIN){
							target = SCROLL_X_MIN;
						}
						collectionElement.style.left = target + &quot;px&quot;;
						document.getElementById(&quot;touchmove&quot;).innerHTML = &quot;nowTouch:&quot; + nowTouch + &quot;
scroll:&quot; + scroll + &quot;
target:&quot; + target;
					}
					//タッチ数が２（ピンチ）の時で移動中じゃないとき
					if (e.touches.length == 2 &amp;&amp; moving == false) {
						touchCount = 2;
						var touch1 = e.touches[0];
						var touch2 = e.touches[1];
						//3平方の定理で現在の距離を取得
						nowDis = Math.sqrt(Math.pow((touch1.pageX - touch2.pageX), 2)+Math.pow((touch1.pageY - touch2.pageY), 2));
						//倍率
						var magnifications = nowDis / startDis;
						var targetPhoto = document.getElementById(&quot;photo&quot;+photoCount);
						if(startPhotoHeight * magnifications &gt; PHOTO_HEIGHT){
							//拡大
							targetPhoto.style.width = startPhotoWidth * magnifications + &quot;px&quot;;
							targetPhoto.style.height = startPhotoHeight * magnifications + &quot;px&quot;;
							//位置調整
							collectionElement.style.left = -(PHOTO_WIDTH * photoCount + (startPhotoWidth * magnifications - PHOTO_WIDTH) / 2) + &quot;px&quot;;
							collectionElement.style.top = -(startPhotoHeight * magnifications - PHOTO_HEIGHT) / 2 + &quot;px&quot;;
							
							zoom = true;
						}else{
							//等倍
							targetPhoto.style.width = PHOTO_WIDTH + &quot;px&quot;;
							targetPhoto.style.height = PHOTO_HEIGHT + &quot;px&quot;;
							//正常位置
							collectionElement.style.left = -PHOTO_WIDTH * photoCount + &quot;px&quot;;
							collectionElement.style.top = 0 + &quot;px&quot;;
							zoom = false;
						}
						
						document.getElementById(&quot;touchmove&quot;).innerHTML = &quot;2タッチ間の距離:&quot; + nowDis + &quot;
倍率&quot; + magnifications;
					}
				}else if (e.type == &quot;touchend&quot; || e.type == &quot;touchcancel&quot;) {
					document.getElementById(&quot;touchstatus&quot;).innerHTML = &quot;&quot;;
					//タッチ数が１の時でピンチしていない時で移動中じゃないとき
					if(touchCount == 1 &amp;&amp; zoom == false &amp;&amp; moving == false){
						if(scroll &lt; 0){
							photoCount++
							if(photoCount &gt;= PHOTO_MAX - 1){photoCount = PHOTO_MAX - 1;}
						}else{
							photoCount--
							if(photoCount &lt;= 0){photoCount = 0;}
						}
						moving = true;
						collectionAnim.set('to', { xy: [-photoCount * PHOTO_WIDTH, 0] });
						collectionAnim.run();
						collectionAnim.on('end', function(){moving = false;});
						document.getElementById(&quot;touchend&quot;).innerHTML = &quot;photoCount:&quot; + photoCount;
					}
					touchCount = 0;
				}
			}
				
    };
    Y.on('load', colectionLoaded);
		
});
</pre>
<p><strong>HTML</strong></p>
<pre class="brush: xml;">
&lt;div id=&quot;collection&quot;&gt;
 	&lt;ul&gt;
 	&lt;li class=&quot;item&quot;&gt;&lt;img id=&quot;photo0&quot; src=&quot;01.jpg&quot; width=&quot;320&quot; height=&quot;417&quot; /&gt;&lt;/li&gt;
 	&lt;li class=&quot;item&quot;&gt;&lt;img id=&quot;photo1&quot; src=&quot;02.jpg&quot; width=&quot;320&quot; height=&quot;417&quot; /&gt;&lt;/li&gt;
 	&lt;li class=&quot;item&quot;&gt;&lt;img id=&quot;photo2&quot; src=&quot;03.jpg&quot; width=&quot;320&quot; height=&quot;417&quot; /&gt;&lt;/li&gt;
 	&lt;li class=&quot;item&quot;&gt;&lt;img id=&quot;photo3&quot; src=&quot;04.jpg&quot; width=&quot;320&quot; height=&quot;417&quot; /&gt;&lt;/li&gt;
 	&lt;li class=&quot;item&quot;&gt;&lt;img id=&quot;photo4&quot; src=&quot;05.jpg&quot; width=&quot;320&quot; height=&quot;417&quot; /&gt;&lt;/li&gt;
 	&lt;li class=&quot;item&quot;&gt;&lt;img id=&quot;photo5&quot; src=&quot;06.jpg&quot; width=&quot;320&quot; height=&quot;417&quot; /&gt;&lt;/li&gt;
 	&lt;/ul&gt;
 &lt;/div&gt;&lt;!--#collection--&gt;
&lt;div id=&quot;debug&quot;&gt;
 	ステータス: &lt;span id=&quot;touchstatus&quot;&gt;&lt;/span&gt;
 	X: &lt;span id=&quot;touchx&quot;&gt;&lt;/span&gt;
 	Y: &lt;span id=&quot;touchy&quot;&gt;&lt;/span&gt;
 	&lt;span id=&quot;touchint&quot;&gt;&lt;/span&gt;
 	&lt;span id=&quot;touchmove&quot;&gt;&lt;/span&gt;
 	&lt;span id=&quot;touchend&quot;&gt;&lt;/span&gt;
 &lt;/div&gt;
</pre>
<p><strong>CSS</strong></p>
<pre class="brush: xml;">
#collection{
	opacity:0;
	width: 9999px;
	position: absolute;
}

#collection li{
	float: left;	
}

#debug{
	display: none;
	position: absolute;
	left: 0px;
	top: 0px;
	color: #FFF;
}
</pre>
<p><strong>サンプル</strong><br />
<a href="http://www.kazy.jp/note/2010/04/yui/" target="_blank">http://www.kazy.jp/note/2010/04/yui/</a></p>
<p><strong>ソース</strong><br />
<a href="http://www.kazy.jp/note/2010/04/yui/kazy_jp-note-2010-04-yui.zip" target="_blank">http://www.kazy.jp/note/2010/04/yui/kazy_jp-note-2010-04-yui.zip</a></p>
<br />
<br />]]>
        
    </content>
</entry>

<entry>
    <title>FlashDevelop Code Sunippets [ tweener ]</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2010/04/flash-develop-code-sunippets-tweener.html" />
    <id>tag:www.kazy.jp,2010:/note//10.468</id>

    <published>2010-04-26T09:51:21Z</published>
    <updated>2010-04-26T09:52:21Z</updated>

    <summary> Tweener.addTween($(EntryPoint)object$(E...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="FLASH" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<pre class="brush: as3;">
Tweener.addTween($(EntryPoint)object$(ExitPoint), {
	x:$$(x=0)
	, y:$$(y=0)
	, scaleX:$$(scaleX=1)
	, scaleY:$$(scaleY=1)
	, rotation:$$(rotation=0)
	, alpha:$$(alpha=1)
	, _blur_blurX:$$(blurX=0)
	, _blur_blurY:$$(blurY=0)
	, _blur_quality:$$(blurquality=1)
	, _color:$$(color=0xffffff)
	, delay:$$(delay=0)
	, time:$$(time=1)
	, transition:$$(transition=&quot;linear&quot;,&quot;easeInExpo&quot;,&quot;easeOutExpo&quot;) 
	, onComplete:$$(onComplete=onCompleteHandler)
})
</pre>]]>
        
    </content>
</entry>

<entry>
    <title>FlashDevelop Code Sunippets [ setter ]</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2010/04/flash-develop-code-sunippets-setter.html" />
    <id>tag:www.kazy.jp,2010:/note//10.467</id>

    <published>2010-04-26T09:49:58Z</published>
    <updated>2010-04-26T09:50:46Z</updated>

    <summary> /**  * $$(name=name)  */ public functio...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="FLASH" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<pre class="brush: as3;">
/**
 * $$(name=name)
 */
public function set $$(name)(value:$$(type=String,Number,Boolean)):void { _$$(name) = value; }
public function get $$(name)():$$(type) { return _$$(name); }
private var _$$(name):$$(type);
</pre>]]>
        
    </content>
</entry>

<entry>
    <title>FlashDevelop Code Sunippets [ for ]</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2010/04/flash-develop-code-sunippets-for.html" />
    <id>tag:www.kazy.jp,2010:/note//10.466</id>

    <published>2010-04-26T09:48:29Z</published>
    <updated>2010-04-26T09:49:17Z</updated>

    <summary> for (var $$(var=i,x,y):int = $$(min=0);...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="FLASH" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<pre class="brush: as3;">
for (var $$(var=i,x,y):int = $$(min=0); $$(var) < $$(max=n); $$(var)++) $(CSLB){
$(EntryPoint)
}
</pre>]]>
        
    </content>
</entry>

<entry>
    <title>FlashDevelop Code Sunippets [ class ]</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2010/04/flash-develop-code-sunippets-class.html" />
    <id>tag:www.kazy.jp,2010:/note//10.465</id>

    <published>2010-04-26T09:40:25Z</published>
    <updated>2010-04-26T09:43:09Z</updated>

    <summary> package { 	 	/** 	 * $$(class=class) 	 ...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="FLASH" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<pre class="brush: as3;">
package {
	
	/**
	 * $$(class=class)
	 * @author	$(DefaultUser)
	 * @version	$$(version=0.1)
	 * @since	$$(#DateTime#=yyyy/MM/dd)
	 */
	public class $$(class) $(CSLB){
		//-------------------------------------
		// CONSTANTS
		//-------------------------------------
		
		//-------------------------------------
		// PROPERTY
		//-------------------------------------
		
		//-------------------------------------
		// CONSTRUCTOR
		//-------------------------------------
		/**
		 * $$(class)
		 */
		public function $$(class)():void 
		{
			$(EntryPoint)
		}
		//-------------------------------------
		// METHODS
		//-------------------------------------
		/**
		 * _initialize
		 */
		private function _initialize():void 
		{
			
		}
		/**
		 * _finalize
		 */
		private function _finalize():void 
		{
			
		}
		//-------------------------------------
		// EVENT HANDLER
		//-------------------------------------
		
	}
}

</pre>]]>
        
    </content>
</entry>

<entry>
    <title>mixiアプリを作る</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2009/12/mixi.html" />
    <id>tag:www.kazy.jp,2009:/note//10.514</id>

    <published>2009-12-19T02:47:37Z</published>
    <updated>2010-06-28T03:07:47Z</updated>

    <summary> gadget.xml アプリの基本情報や、埋め込むHTMLを記述する     ...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="JavaScript" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<p>
<strong>gadget.xml</strong><br />
<br />
アプリの基本情報や、埋め込むHTMLを記述する<br />
</p>
<pre class="brush: xml;">

<?xml version="1.0" encoding="UTF-8"?>

<Module>
  <ModulePrefs title="クリック ゲーム">
    <Require feature="opensocial-0.8" />
    <Require feature="flash" />
  </ModulePrefs>
  <Content type="html"><![CDATA[

<div id="externalContainer"><h1>クリック ゲーム</h1></div>
<script type="text/javascript" src="http://kazy.jp/mixiApp/clickGame/js/gadget.js" charset="utf-8"></script>
<div style="width:900px; height:100px; overflow:auto; border:1px solid #CCCCCC;">
<span id="error" style="color:#F00;"></span>
<span id="trace"></span>
</div>
<a href="javascript:void(0);" onclick="removeAppData(); return false;">自分のスコアデータを削除</a>　<a href="javascript:void(0);" onclick="inviteMyFriends(); return false;">友達を招待する</a>
  ]]&gt;</Content>
</Module>

</pre>

<p>
<strong>gadget.js</strong><br />
<br />
mixiアプリのAPIへはJSでアクセスする。<br />
基本的な関数は下記の通り。
</p>

<pre class="brush: js;">

//定数
var GAME_SWF_PATH = "http://kazy.jp/mixiApp/clickGame/swf/clickGame.swf";
var GAME_PATH = "http://mixi.jp/run_appli.pl?id=11425";
var ACTIVITY_IMG_PATH = "http://kazy.jp/mixiApp/clickGame/images/activityIcon.gif"
//
var myscore = 0;
var myDisplayName;
/**
 * FLASH表示
 */
function showFlash() {
	gadgets.flash.embedFlash(
	GAME_SWF_PATH, "externalContainer", "8.0.0",
		{
			id : "externalswf",
			width : 900,
			height : 370,
			quality : 'high',
			wmode : 'transparent',
			allowScriptAccess : 'always' // swfからのaccessを許可
		}
	);
	
	//Vewerとマイミクのスコアをリクエスト
	requestScoreInfo();
	
}
/**
 * Vewerとマイミクのスコアをリクエスト.
 */
function requestScoreInfo() {

	//リクエストパラメータ
	var params = {};
	params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.HAS_APP];
	params[opensocial.DataRequest.PeopleRequestFields.MAX] = 1000;
	params[opensocial.IdSpec.Field.USER_ID] = opensocial.IdSpec.PersonId.VIEWER;
	params[opensocial.IdSpec.Field.GROUP_ID] = "FRIENDS";
	
	//リクエスト生成
	var req = opensocial.newDataRequest();
	
	//基本情報をリクエスト
	var idspec = opensocial.newIdSpec(params);
	req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER),"viewer");
	req.add(req.newFetchPeopleRequest(idspec, params),"friends");

	//スコアをリクエスト
	var scoreIdspec = opensocial.newIdSpec(params);
	req.add(req.newFetchPersonAppDataRequest("VIEWER", ["score"]),"ViewerScore");
	req.add(req.newFetchPersonAppDataRequest(scoreIdspec, ["score"]),"FriendsScore");
	
	//コールバック
	req.send(responseScoreInfo);

}

/**
 * Vewerとマイミクのスコア情報を処理.
 */
function responseScoreInfo(dataResponse) {

	if (dataResponse.hadError()) {
		//エラー処理
		document.getElementById("error").innerHTML = dataResponse.getErrorMessage();
		return;
	} else {
		//通常処理
		document.getElementById("trace").innerHTML = "Vewerとマイミクのスコア情報取得成功";
		var viewerData = dataResponse.get('viewer').getData();
		var friendsData = dataResponse.get('friends').getData();
		var viewerScore = dataResponse.get("ViewerScore").getData();
		var friendsScore = dataResponse.get("FriendsScore").getData();
		var count = 0;
		var checkFlg = false;
		
		var dataArray = new Array();
		
		//マイミク情報を配列に追加
		friendsData.each(function (person) {			
			var data = {};
			data.mixiid = person.getId()
			data.displayName = person.getDisplayName()
			data.thumbnailUrl = person.getField(opensocial.Person.Field.THUMBNAIL_URL)
			dataArray.push(data);
			count++;
		});
		
		//マイミクのスコアを配列に追加
		for (var friendsId in friendsScore) {
			var score = friendsScore[friendsId].score;
			for (var i = 0; i < count; i++) {
				//idが一致すれば代入する
				if (friendsId == dataArray[i].mixiid) {					
					dataArray[i].score = score;
				}
			}
			//配列追加完了
			checkFlg = true;
		}
		
		//friendsScoreがnullでforを逃れた場合
		if (!checkFlg) {
			//すべて0を入れる
			for (var i = 0; i < count; i++) {
				dataArray[i].score = 0;
			}
		}
		
		//nullがあれば0を入れる 
		for (var i = 0; i < count; i++) {
			if (dataArray[i].score == null) {
				dataArray[i].score = 0;
			}
		}
		
		//Viewerのスコアを抽出
		for (var viewerId in viewerScore) {
			myscore = viewerScore[viewerId].score;
		}
		
		//自分のデータを追加		
		var myData = {};
		myData.mixiid = viewerData.getId();
		myData.displayName = viewerData.getDisplayName();
		myDisplayName = viewerData.getDisplayName();
		myData.thumbnailUrl = viewerData.getField(opensocial.Person.Field.THUMBNAIL_URL);
		myData.score = myscore;
		dataArray.push(myData);
		
		//FLASHへデータを受け渡す
		thisMovie("externalswf").setData(dataArray);
		
	}
}

/**
 * スコアの更新.
 */
function updateScore(gscore) {
	//自己最高スコアよりも高ければ更新
	if (parseInt(gscore) > parseInt(myscore)) {
		document.getElementById("trace").innerHTML += "<br /><span style='color:#F00;'>自己新記録　" + gscore.toString() + "に更新";
		sendActivity( myDisplayName + "が自己新記録を"+gscore.toString()+"に伸ばしました",null);
		var max = gscore;
		myscore = gscore;//ゲームを継続した場合の対応
	} else {
		var max = myscore;
	}
	//更新リクエスト
	var req = opensocial.newDataRequest();
	req.add(req.newUpdatePersonAppDataRequest("VIEWER", "score", max));
	//送信コールバック
	req.send(function (data) {
		if (data.hadError()) {
			document.getElementById("error").innerHTML = data.getErrorMessage();
		}else{
			document.getElementById("trace").innerHTML += "<br />スコア更新成功"
		}
	});
}

/**
 * スコアデータ削除.
 */
function removeAppData() {
	var req = opensocial.newDataRequest();
	req.add(req.newRemovePersonAppDataRequest(opensocial.IdSpec.PersonId.VIEWER, ["score"]),"response");
	req.send(function (data) {
		var response = data.get("response").getData();
		if (response.hadError()) {
			document.getElementById("error").innerHTML = response.getErrorCode();
		}else{
			document.getElementById("trace").innerHTML += "<br />スコアデータ削除成功"
		}
	});
}

/**
 * FLASHコンテナへのパス.
 */
function thisMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ?window[movieName] : document[movieName];
}

/**
 * アクティビティ送信.
 */
function sendActivity(title, body) {

	var mp = {};
	mp[opensocial.MediaItem.Field.TYPE] = opensocial.MediaItem.Type.IMAGE;
	var mediaItem = opensocial.newMediaItem("image/gif", ACTIVITY_IMG_PATH, mp);
	var ap = {};
	ap[opensocial.Activity.Field.TITLE] = title;
	//ap[opensocial.Activity.Field.BODY] = body;
	ap[opensocial.Activity.Field.URL] = GAME_PATH;
	ap[opensocial.Activity.Field.MEDIA_ITEMS] = [mediaItem];

	var activity = opensocial.newActivity(ap);

	opensocial.requestCreateActivity(activity,opensocial.CreateActivityPriority.HIGH,function (response) {
	if (response.hadError()) {
		document.getElementById("error").innerHTML = response.getErrorCode();
	} else {
		document.getElementById("trace").innerHTML += "<br />アプリ更新情報へ通知成功"
	}
	});

}

/**
 * マイミク招待.
 */
function inviteMyFriends() {
	opensocial.requestShareApp("VIEWER_FRIENDS",null,function (response) {
		if (response.hadError()) {
			document.getElementById("error").innerHTML = response.getErrorCode();
		} else {
			document.getElementById("trace").innerHTML += "<br />マイミク招待パネル表示完了"
		}
	});


}

//初期関数をonLoadハンドラに登録
gadgets.util.registerOnLoadHandler(showFlash);

</pre>

<p>
あとはFLASHとExternalInterfaceでやりとりすれば、簡単なmixiアプリが完成。
</p>
<p>
実装例：<a href="http://mixi.jp/run_appli.pl?id=11425" target="_blank">CLICK GAME</a>
</p>
<p>
もちろんFLASHを使わず、HTML5やJSだけでも作ることはできる。
</p>]]>
        
    </content>
</entry>

<entry>
    <title>PHPでディレクトリ内のファイル一覧をXML出力</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2009/10/phpxml.html" />
    <id>tag:www.kazy.jp,2009:/note//10.373</id>

    <published>2009-10-16T04:43:27Z</published>
    <updated>2009-11-07T09:43:29Z</updated>

    <summary>例えば、FLASHが外部画像を読み込む場合、FLASHはディレクトリにどんなファ...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="PHP" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<p>例えば、FLASHが外部画像を読み込む場合、FLASHはディレクトリにどんなファイルがあるのか分からないので、ファイルのリストをXMLなどに持つことになるが、更新の際に画像ファイルのアップとXMLの更新が必要でめんどくさいし、ミスも起こりやすい。<br />
なので自動的にXMLを吐き出してくれるPHPを作った。</p>
<p>ソース</p>
<pre class="brush: php;">
&lt;?php
	//GETで受け取ったフォルダ名を適応
	if($_GET[&quot;dir&quot;]){
		//上位階層へのパスであればエラーにする
		if (ereg(&quot;../&quot;, $_GET[&quot;dir&quot;])){
			$erorr=&quot;セキュリティ上、上位階層は表示できません&quot;;
		}
		//ルートパスであればエラーにする
		if($_GET[&quot;dir&quot;][0] == &quot;/&quot;){
			$erorr=&quot;セキュリティ上、ルートパスは使えません&quot;;
		}
		//末尾に&quot;/&quot;がついていなければつける
		if(substr($_GET[&quot;dir&quot;], -1, 1) != &quot;/&quot;){
			$_GET[&quot;dir&quot;] = $_GET[&quot;dir&quot;] . &quot;/&quot;;
		}
		$path = $_GET[&quot;dir&quot;];
	}else{
		$path = &quot;./&quot;;
	}
	//フォルダを開く
	if ($dir = @opendir($path) ) {
		//繰り返しディレクトリ内のファイルを読む
		while(false !== ($file = readdir($dir))) {
			//is_dirは参照が狂うので、パスで指定
			$filePath = $path . $file;
			if (is_dir($filePath)){
				if($file != &quot;.&quot; &amp;&amp; $file != &quot;..&quot;){
					$dirs[] = $file;
				}
			}else{
				$files[] = $file;
			}
		}
 	}else if($erorr == false){
 		$erorr=&quot;ディレクトリを開けませんでした&quot;;
 	}
 	//以下出力部分
 	print &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot; ?&gt;\n&quot;;
?&gt;
&lt;info&gt;
&lt;?php
	if($erorr){
		print &quot;\t&lt;erorr message=\&quot;&quot; . $erorr . &quot;\&quot; /&gt;\n&quot;;
 	}else{
?&gt;
	&lt;dirs&gt;
&lt;?php
	if($dirs){
		foreach($dirs as $value){
			print &quot;\t\t&lt;dir name=\&quot;&quot; . $value . &quot;\&quot; /&gt;\n&quot;;
		}
	}
?&gt;
	&lt;/dirs&gt;
	&lt;files&gt;
&lt;?php
	if($files){
		foreach($files as $value){
			print &quot;\t\t&lt;file name=\&quot;&quot; . $value . &quot;\&quot; /&gt;\n&quot;;
		}
	}
?&gt;
 &lt;/files&gt;
&lt;?php
 }
?&gt;
&lt;/info&gt;
</pre>
<p>出力例</p>
<pre class="brush: php;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
&lt;info&gt;
 	&lt;dirs&gt;
 		&lt;dir name=&quot;css&quot; /&gt;
 		&lt;dir name=&quot;js&quot; /&gt;
 	&lt;/dirs&gt;
 	&lt;files&gt;
 		&lt;file name=&quot;index.html&quot; /&gt;
 		&lt;file name=&quot;top.html&quot; /&gt;
 	&lt;/files&gt;
&lt;/info&gt;
</pre>
<p>PHPのファイル名を<strong>dirInfo.php</strong>としたとする<br />
<strong>dirInfo.php</strong>にアクセスすると、カレントディレクトリの内容のXMLが吐き出される。<br />
また、<strong>dirInfo.php?dir=hogehoge</strong>とdirパラメータを渡すことで、<strong>hogehoge</strong>ディレクトリの内容のXMLが吐き出すことができる。</p>
<p>※悪用されると、このPHPを設置したディレクトリ以下で表示権限を持っているファイルは、すべて見られる可能性があるので注意すること。</p>]]>
        
    </content>
</entry>

<entry>
    <title>MovableTypeカスタムフィールドの「テキスト」で255文字以上入力する</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2009/08/movabletype255.html" />
    <id>tag:www.kazy.jp,2009:/note//10.347</id>

    <published>2009-08-05T15:04:58Z</published>
    <updated>2009-08-06T12:39:25Z</updated>

    <summary><![CDATA[データベースのmt &gt; mt_entry_meta &gt; entry_...]]></summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="MovableType" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<p>データベースの<br />mt &gt; mt_entry_meta &gt; entry_meta_vchar_idx の種別を<layer id="searchwp-highlighting0" highlight="term-1" class="searchwp-term">varchar</layer>型からtext型に変更する<br />&nbsp;</p>]]>
        
    </content>
</entry>

<entry>
    <title>検索サイトにインデックスさせない方法</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2009/07/post-12.html" />
    <id>tag:www.kazy.jp,2009:/note//10.346</id>

    <published>2009-07-29T10:32:58Z</published>
    <updated>2009-07-29T11:10:33Z</updated>

    <summary>■robots.txtを使う ディレクトリごとなど、複数のページを検索クロール禁...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="Webの運用" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<h3>■robots.txtを使う</h3>
<p>ディレクトリごとなど、複数のページを検索クロール禁止にするには、<br />
ドキュメントルートにrobots.txtを置いて設定すると早い。</p>
<p>例<br />
User-agent: *<br />
Disallow: /internet/<br />
Disallow: /av.html</p>
<h3>■metaタグを使う</h3>
<p>ドキュメントルートにrobots.txtをおけない場合や、<br />
１ページだけ検索クロール禁止すればいいだけの時はmetaタグで禁止する。</p>
<p>例<br />
&lt;meta name=&quot;robots&quot; content=&quot;noindex,nofollow&quot; /&gt;</p>
<h3>■リンク元から遮断する</h3>
<p>クロールされてほしくないページに直接metaタグを書き込めない場合は、<br />
そのページをリンクしているページに指定することができる。</p>
<p>例<br />
&lt;a href=&quot;http://hogehoge.com/&quot; rel=&quot;nofollow&quot;&gt;クロールされたくないリンク先&lt;/a&gt;</p>
<h3>■.htaccessで検索ボットのアクセスを遮断</h3>
<p>上記方法でクロールを禁止にできるのは、google、yahoo、msnなど代表的な検索サイトで、<br />
いくつかの検索サイトは上記方法をスルーしてしまう。（例えば、metaの方法はexciteには適応されないなど。）<br />
そういうサイトもブロックするには、webサーバー(apache)の設定ファイル.htaccessで、検索ボットの出入りを禁止する。</p>
<p>例</p>
<pre>
#　Google
SetEnvIf User-Agent &quot;Googlebot&quot; shutout
SetEnvIf User-Agent &quot;Googlebot-Image&quot; shutout
Deny from 66.249.64.0/19
</pre>
<h3>■緊急に削除したい場合</h3>
<p>googleの場合は、下記のURL 削除リクエスト ツールを使うと削除できます。<br />
<a href="http://www.google.com/support/webmasters/bin/answer.py?answer=61062" target="_blank">http://www.google.com/support/webmasters/bin/answer.py?answer=61062</a></p>]]>
        
    </content>
</entry>

<entry>
    <title>MTでhttpから始まるURLではなく、/から始まるルートパスを吐き出す</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2009/07/mthttpurl.html" />
    <id>tag:www.kazy.jp,2009:/note//10.345</id>

    <published>2009-07-23T13:08:20Z</published>
    <updated>2009-07-23T13:13:10Z</updated>

    <summary>mtで書き出す先のドメインと、本番サイトのドメインが違う時に便利正規表現プラグイ...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="MovableType" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<p>mtで書き出す先のドメインと、本番サイトのドメインが違う時に便利</p><p>正規表現プラグインを入れる<br />http://www.sixapart.jp/movabletype/plugins/regex.html</p><p>テンプレートにドメインを取り除く正規表現を書く<br />&lt;$MTAssetURL regex=&quot;s|http://www.xxxxx.jp||&quot;$&gt;</p>]]>
        
    </content>
</entry>

<entry>
    <title>FCKEditorテンプレート機能の置換えチェックボックスをはずす</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2009/07/fckeditor.html" />
    <id>tag:www.kazy.jp,2009:/note//10.344</id>

    <published>2009-07-21T11:23:32Z</published>
    <updated>2009-07-21T11:29:12Z</updated>

    <summary>mt-static/plugins/FCKeditor/fckeditor/fc...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="MovableType" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<p>mt-static/plugins/FCKeditor/fckeditor/fckconfig.js<br /><br />FCKConfig.TemplateReplaceAll = true ;<br />&darr;<br />FCKConfig.TemplateReplaceAll = false ;<br />&nbsp;</p>]]>
        
    </content>
</entry>

<entry>
    <title>ローカルマシンのwebサーバーでサブドメインを使う</title>
    <link rel="alternate" type="text/html" href="http://www.kazy.jp/note/2009/07/web.html" />
    <id>tag:www.kazy.jp,2009:/note//10.342</id>

    <published>2009-07-16T05:58:59Z</published>
    <updated>2009-07-16T06:10:04Z</updated>

    <summary>C:\Program Files\Apache Software Foundat...</summary>
    <author>
        <name>kazy</name>
        <uri>http://kazy.jp/</uri>
    </author>
    
        <category term="Webの制作" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="ja" xml:base="http://www.kazy.jp/note/">
        <![CDATA[<p>C:\Program Files\Apache Software Foundation\Apache2.2\conf の httpd.conf を編集（初回のみ）</p><p># Virtual hosts<br /> #Include conf/extra/httpd-vhosts.conf</p><p># Virtual hosts<br />Include conf/extra/httpd-vhosts.conf<br />&nbsp;</p><p>C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra の httpd-vhosts.conf を編集</p><p>&lt;VirtualHost *:80&gt;<br />&nbsp;&nbsp;&nbsp; ServerAdmin info@kazy.jp<br />&nbsp;&nbsp;&nbsp; DocumentRoot &quot;C:/Documents and Settings/kajii/My Documents/web/kazy&quot;<br />&nbsp;&nbsp;&nbsp; ServerName kazy.w-07-012<br />&nbsp;&nbsp;&nbsp; ServerAlias www.kazy.w-07-012<br />&nbsp;&nbsp;&nbsp; ErrorLog &quot;logs/kazy.localhost-error.log&quot;<br />&nbsp;&nbsp;&nbsp; CustomLog &quot;logs/kazy.localhost-access.log&quot; common<br />&lt;/VirtualHost&gt;<br /><br />&lt;Directory &quot;C:/Documents and Settings/kajii/My Documents/web/kazy&quot;&gt;&nbsp; <br />&nbsp;&nbsp;&nbsp; order deny,allow<br />&nbsp;&nbsp;&nbsp; allow from ALL<br />&nbsp;&nbsp;&nbsp; AllowOverride All<br />&lt;/Directory&gt;&nbsp; <br />&nbsp;</p><p>C:\WINDOWS\system32\drivers\etc の hosts を編集</p><p>127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; localhost<br />127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kazy.w-07-012</p>]]>
        
    </content>
</entry>

</feed>

