<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>source lab. note</title>
	<atom:link href="http://source-laboratory.net/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://source-laboratory.net/blog</link>
	<description></description>
	<lastBuildDate>Sat, 18 Feb 2012 03:19:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>知識0からiOSアプリ提出までの学習リソースメモ</title>
		<link>http://source-laboratory.net/blog/?p=778</link>
		<comments>http://source-laboratory.net/blog/?p=778#comments</comments>
		<pubDate>Sun, 12 Feb 2012 16:33:45 +0000</pubDate>
		<dc:creator>bouze</dc:creator>
				<category><![CDATA[INTRODUCTION]]></category>
		<category><![CDATA[OBJECTIVE-C]]></category>
		<category><![CDATA[TRYOUT]]></category>

		<guid isPermaLink="false">http://source-laboratory.net/blog/?p=778</guid>
		<description><![CDATA[初のObjective-C案件で自分（ActionScript 5年生）が参考にしたリソースまとめ。 ― 入門Objective-C 2.0 まずこの本でObjective-Cの基礎を理解。言語に関する書籍なのですごい退屈。「詳解Objective-C 2.0」の方が詳しいけど分厚すぎてXcode起動する前に心が折れたからこっちを先に読むほうが楽。 ― iOS Developer Library 「入門Objective-C 2.0」に並行してAppleの公式のドキュメントを読み砕いてく。PDFでダウンロードできるのでiPhone/iPadに突っ込んでうんこしながらも読む。iOSの開発に関してはここのドキュメント読むだけで十分ってぐらい充実してる。とりあえず最初はこのへんを読んどく。 iOSアプリケーションチュートリアル メモリ管理プログラミングガイド iOS Viewプログラミングガイド iOS View Controllerプログラミングガイド iOS Scroll Viewプログラミングガイド iOS Table Viewプログラミングガイド ― Xcode 4 入門 for iOS/Mac OS X 図版多めでサクッと読める。Xcode4の使い方、Instrumentsの使い方がサクッと把握できる。 ― iOS開発におけるパターンによるオートマティズム 実践的な「書き方」が多数掲載されてて勉強になる。安心の木下さん著作。 ぼんやりとCocoa Touchの使い方が見えかけてきたあたりで、効率のよいCocoa &#8230; <a href="http://source-laboratory.net/blog/?p=778">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>初のObjective-C案件で自分（ActionScript 5年生）が参考にしたリソースまとめ。</p>
<p>―</p>
<p><a href="http://www.amazon.co.jp/gp/product/4798119989/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4798119989" target="_blank"><img border="0" src="http://ws.assoc-amazon.jp/widgets/q?_encoding=UTF8&#038;Format=_SL160_&#038;ASIN=4798119989&#038;MarketPlace=JP&#038;ID=AsinImage&#038;WS=1&#038;tag=bouze07-22&#038;ServiceVersion=20070822" ></a><img src="http://www.assoc-amazon.jp/e/ir?t=bouze07-22&#038;l=as2&#038;o=9&#038;a=4798119989" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
<a href="http://www.amazon.co.jp/gp/product/4798119989/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4798119989" target="_blank">入門Objective-C 2.0</a></p>
<p>まずこの本でObjective-Cの基礎を理解。言語に関する書籍なのですごい退屈。「詳解Objective-C 2.0」の方が詳しいけど分厚すぎてXcode起動する前に心が折れたからこっちを先に読むほうが楽。</p>
<p>―</p>
<p><a href="https://developer.apple.com/jp/devcenter/ios/library/japanese.html" target="_blank">iOS Developer Library</a></p>
<p>「入門Objective-C 2.0」に並行してAppleの公式のドキュメントを読み砕いてく。PDFでダウンロードできるのでiPhone/iPadに突っ込んでうんこしながらも読む。iOSの開発に関してはここのドキュメント読むだけで十分ってぐらい充実してる。とりあえず最初はこのへんを読んどく。</p>
<ul>
<li><a href="https://developer.apple.com/jp/devcenter/ios/library/documentation/iPhone101.pdf" target="_blank">iOSアプリケーションチュートリアル</a></li>
<li><a href="https://developer.apple.com/jp/devcenter/ios/library/documentation/MemoryMgmt.pdf" target="_blank">メモリ管理プログラミングガイド</a></li>
<li><a href="https://developer.apple.com/jp/devcenter/ios/library/documentation/ViewPG_iPhoneOS.pdf" target="_blank">iOS Viewプログラミングガイド</a></li>
<li><a href="https://developer.apple.com/jp/devcenter/ios/library/documentation/ViewControllerPGforiPhoneOS.pdf" target="_blank">iOS View Controllerプログラミングガイド</a></li>
<li><a href="https://developer.apple.com/jp/devcenter/ios/library/documentation/UIScrollView_pg.pdf" target="_blank">iOS Scroll Viewプログラミングガイド</a></li>
<li><a href="https://developer.apple.com/jp/devcenter/ios/library/documentation/TableView_iPhone.pdf" target="_blank">iOS Table Viewプログラミングガイド</a></li>
</ul>
<p>―</p>
<p><a href="http://www.amazon.co.jp/gp/product/4798031046/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4798031046" target="_blank"><img border="0" src="http://ws.assoc-amazon.jp/widgets/q?_encoding=UTF8&#038;Format=_SL160_&#038;ASIN=4798031046&#038;MarketPlace=JP&#038;ID=AsinImage&#038;WS=1&#038;tag=bouze07-22&#038;ServiceVersion=20070822" ></a><img src="http://www.assoc-amazon.jp/e/ir?t=bouze07-22&#038;l=as2&#038;o=9&#038;a=4798031046" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
<a href="http://www.amazon.co.jp/gp/product/4798031046/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4798031046" target="_blank">Xcode 4 入門 for iOS/Mac OS X</a></p>
<p>図版多めでサクッと読める。Xcode4の使い方、Instrumentsの使い方がサクッと把握できる。</p>
<p>―</p>
<p><a href="http://www.amazon.co.jp/gp/product/4861007348/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4861007348" target="_blank"><img border="0" src="http://ws.assoc-amazon.jp/widgets/q?_encoding=UTF8&#038;Format=_SL160_&#038;ASIN=4861007348&#038;MarketPlace=JP&#038;ID=AsinImage&#038;WS=1&#038;tag=bouze07-22&#038;ServiceVersion=20070822" ></a><img src="http://www.assoc-amazon.jp/e/ir?t=bouze07-22&#038;l=as2&#038;o=9&#038;a=4861007348" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
<a href="http://www.amazon.co.jp/gp/product/4861007348/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4861007348" target="_blank">iOS開発におけるパターンによるオートマティズム</a></p>
<p>実践的な「書き方」が多数掲載されてて勉強になる。安心の木下さん著作。<br />
ぼんやりとCocoa Touchの使い方が見えかけてきたあたりで、効率のよいCocoa Touchの使い方をこの本で学ぶ。</p>
<p>―</p>
<p><a href="http://news.mynavi.jp/column/iphone/index.html" target="_blank">実践! iPhoneアプリ開発 | コラム | エンタープライズ | マイナビニュース</a></p>
<p>上記「<a href="http://www.amazon.co.jp/gp/product/4861007348/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4861007348" target="_blank">iOS開発におけるパターンによるオートマティズム</a>」の木下さんによる連載。サンプルコードがためになる。</p>
<p>―</p>
<p><a href="http://www.amazon.co.jp/gp/product/4897978440/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4897978440" target="_blank"><img border="0" src="http://ws.assoc-amazon.jp/widgets/q?_encoding=UTF8&#038;Format=_SL160_&#038;ASIN=4897978440&#038;MarketPlace=JP&#038;ID=AsinImage&#038;WS=1&#038;tag=bouze07-22&#038;ServiceVersion=20070822" ></a><img src="http://www.assoc-amazon.jp/e/ir?t=bouze07-22&#038;l=as2&#038;o=9&#038;a=4897978440" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
<a href="http://www.amazon.co.jp/gp/product/4897978440/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4897978440" target="_blank">iPhoneプログラミングUIKit詳解リファレンス</a></p>
<p>UIKit各クラスの基礎的な使い方が網羅されてる。分厚いからパラ見してどんなクラスがあるか把握しといて、いざ使うときになったら該当箇所を読み込むって使い方がよさげ。</p>
<p>―</p>
<p><a href="http://www.amazon.co.jp/gp/product/4797368276/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4797368276" target="_blank"><img border="0" src="http://ws.assoc-amazon.jp/widgets/q?_encoding=UTF8&#038;Format=_SL160_&#038;ASIN=4797368276&#038;MarketPlace=JP&#038;ID=AsinImage&#038;WS=1&#038;tag=bouze07-22&#038;ServiceVersion=20070822" ></a><img src="http://www.assoc-amazon.jp/e/ir?t=bouze07-22&#038;l=as2&#038;o=9&#038;a=4797368276" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
<a href="http://www.amazon.co.jp/gp/product/4797368276/ref=as_li_ss_il?ie=UTF8&#038;tag=bouze07-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4797368276" target="_blank">詳解Objective-C 2.0</a></p>
<p>数少ないObjective-Cの仕様を網羅した本。あとはひたすらこの本でObjective-Cの造詣を深めてゆく。分厚いから腕も辛い。</p>
<p>―</p>
<p>これぐらいの知識とGoogle力でとりあえず動くものは作れるようになった気がする。<br />
あと開発中にハマったとこは<a href="http://source-laboratory.net/blog/?p=651">こっちにメモ</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://source-laboratory.net/blog/?feed=rss2&#038;p=778</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>「100,000年後の安全」がおもしろかった</title>
		<link>http://source-laboratory.net/blog/?p=758</link>
		<comments>http://source-laboratory.net/blog/?p=758#comments</comments>
		<pubDate>Sat, 28 Jan 2012 08:42:32 +0000</pubDate>
		<dc:creator>bouze</dc:creator>
				<category><![CDATA[INTRODUCTION]]></category>

		<guid isPermaLink="false">http://source-laboratory.net/blog/?p=758</guid>
		<description><![CDATA[大輪さんがTwitterでツイートしてるのを見て「100,000年後の安全」をDMMで観てみた。 原発の話題が取りざたされる昨今、話題的にもタイムリーだしちょっと見てみようと思って見始めたら想像してた内容を飛び越してかなりおもしろかったのでブログ書いた。 話の舞台はフィンランドで建設中の世界初の放射性廃棄物永久処分場。 ここは放射能が減衰する10万年の間施設が保持されるように設計されてるらしい。この施設の建設プロジェクトを追ったドキュメンタリー。 ― 話題の中心は放射性廃棄物なんだけど、10万年の間放射性廃棄物を保持しておくという役割上、今の人類が滅びて次の人類が現れることを想定しなくてはいけない。 その次の人類に、地下に蓄積した放射性廃棄物に近づかないように警告するのはどうすればよいのか？プロジェクトに関わる人達は今なお議論している。 どの言語で伝えれば良いのか？ それ以前に言葉が通じるのか？ 通じなければどうやって伝えればよいのか？ そもそも伝えず忘れ去られる方がよいのではないか？ どうやったら忘れ去られるのか？ 今フィンランドでは国家レベルでこんなことを真剣に議論してるらしい。 ― 10万年ごしの引継ぎの話として捉えるとスケールのでかさがすさまじくSFぽくておもしろかった。1時間ちょっとでサクっと見れるのでｾﾞﾋ。 ― ストリーミング：DMM.com [100，000年後の安全] 映画ドラマ動画 DVD：Amazon.co.jp： 100,000年後の安全]]></description>
			<content:encoded><![CDATA[<p><a href="https://twitter.com/#!/superminimal/" target="_blank">大輪さん</a>がTwitterで<a href="https://twitter.com/#!/superminimal/status/163130281858056193" target="_blank">ツイート</a>してるのを見て「100,000年後の安全」を<a href="http://www.dmm.com/digital/cinema/-/detail/=/cid=5267100000y00001/" target="_blank">DMM</a>で観てみた。<br />
原発の話題が取りざたされる昨今、話題的にもタイムリーだしちょっと見てみようと思って見始めたら想像してた内容を飛び越してかなりおもしろかったのでブログ書いた。</p>
<p><iframe width="500" height="284" src="http://www.youtube.com/embed/BYl7_dkRNSU?rel=0" frameborder="0" allowfullscreen></iframe></p>
<p>話の舞台はフィンランドで建設中の世界初の放射性廃棄物永久処分場。<br />
ここは放射能が減衰する10万年の間施設が保持されるように設計されてるらしい。この施設の建設プロジェクトを追ったドキュメンタリー。</p>
<p>―</p>
<p>話題の中心は放射性廃棄物なんだけど、10万年の間放射性廃棄物を保持しておくという役割上、今の人類が滅びて次の人類が現れることを想定しなくてはいけない。</p>
<p>その次の人類に、地下に蓄積した放射性廃棄物に近づかないように警告するのはどうすればよいのか？プロジェクトに関わる人達は今なお議論している。</p>
<p>どの言語で伝えれば良いのか？<br />
それ以前に言葉が通じるのか？<br />
通じなければどうやって伝えればよいのか？<br />
そもそも伝えず忘れ去られる方がよいのではないか？<br />
どうやったら忘れ去られるのか？</p>
<p>今フィンランドでは国家レベルでこんなことを真剣に議論してるらしい。</p>
<p>―</p>
<p>10万年ごしの引継ぎの話として捉えるとスケールのでかさがすさまじくSFぽくておもしろかった。<br />1時間ちょっとでサクっと見れるのでｾﾞﾋ。</p>
<p>―</p>
<p>ストリーミング：<br /><a href="http://www.dmm.com/digital/cinema/-/detail/=/cid=5267100000y00001/" target="_blank">DMM.com [100，000年後の安全] 映画ドラマ動画</a></p>
<p>DVD：<br /><a href="http://amzn.to/zHenVq" target="_blank">Amazon.co.jp： 100,000年後の安全 </a></p>
]]></content:encoded>
			<wfw:commentRss>http://source-laboratory.net/blog/?feed=rss2&#038;p=758</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows7 64bit環境でScoutを使ってコンパイルしようとするとエラーが出るバグ</title>
		<link>http://source-laboratory.net/blog/?p=733</link>
		<comments>http://source-laboratory.net/blog/?p=733#comments</comments>
		<pubDate>Tue, 03 Jan 2012 09:02:22 +0000</pubDate>
		<dc:creator>bouze</dc:creator>
				<category><![CDATA[TRYOUT]]></category>

		<guid isPermaLink="false">http://source-laboratory.net/blog/?p=733</guid>
		<description><![CDATA[Windows7 64bit環境でScoutのバージョン0.5.0を使ってコンパイルしようとするとArgumentErrorが出て停止してしまう。 原因は「C:\Program Files (x86)\Scout\javascripts\app\process_interaction.js」の95行目でjava.exeのパスが32bit環境でのProgram Filesディレクトリを指している箇所。ここを64bit環境のパスに差し替えてやる。 これを return air.File.applicationDirectory.resolvePath("C:\\Program Files\\Java\\jre6\\bin\\java.exe"); こうする return air.File.applicationDirectory.resolvePath("C:\\Program Files (x86)\\Java\\jre6\\bin\\java.exe"); 詳細は下記参照のこと。 #19: ArgumentError on Windows7 &#8211; Issues &#8211; mhs/scout-app &#8211; GitHub]]></description>
			<content:encoded><![CDATA[<p>Windows7 64bit環境で<a href="http://mhs.github.com/scout-app/" target="_blank">Scout</a>のバージョン0.5.0を使ってコンパイルしようとするとArgumentErrorが出て停止してしまう。</p>
<p>原因は「C:\Program Files (x86)\Scout\javascripts\app\process_interaction.js」の95行目でjava.exeのパスが32bit環境でのProgram Filesディレクトリを指している箇所。ここを64bit環境のパスに差し替えてやる。</p>
<p>これを</p>
<pre name="code" class="js">
return air.File.applicationDirectory.resolvePath("C:\\Program Files\\Java\\jre6\\bin\\java.exe");
</pre>
<p>こうする</p>
<pre name="code" class="js">
return air.File.applicationDirectory.resolvePath("C:\\Program Files (x86)\\Java\\jre6\\bin\\java.exe");
</pre>
<p>詳細は下記参照のこと。<br />
<a href="https://github.com/mhs/scout-app/issues/19" target="_blank">#19: ArgumentError on Windows7 &#8211; Issues &#8211; mhs/scout-app &#8211; GitHub</a></p>
]]></content:encoded>
			<wfw:commentRss>http://source-laboratory.net/blog/?feed=rss2&#038;p=733</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iOS開発ハマりどころメモ</title>
		<link>http://source-laboratory.net/blog/?p=651</link>
		<comments>http://source-laboratory.net/blog/?p=651#comments</comments>
		<pubDate>Sat, 10 Dec 2011 15:07:04 +0000</pubDate>
		<dc:creator>bouze</dc:creator>
				<category><![CDATA[OBJECTIVE-C]]></category>
		<category><![CDATA[TRYOUT]]></category>

		<guid isPermaLink="false">http://source-laboratory.net/blog/?p=651</guid>
		<description><![CDATA[アプリ開発中にハマったポイントをメモ。下に行くほど古いので初歩的な内容。 ― ScrollViewのスクロール強制停止 スクロール中のUITableViewを強制的に停止させる時はcontentOffsetに現在地の座標を突っ込む。 [_tableView setContentOffset:_tableView.contentOffset animated:NO]; iphone &#8211; Programmatically force a UIScrollView to stop scrolling, for sharing a table view with multiple data sources &#8211; Stack Overflow ― NSMutableArrayのコピー [NSMutableArray copy]で返ってくるのはNSArray、NSMutableArrayとしてコピーがしたい時は[NSMutableArray mutableCopy]を使う。 Basilの息子｜ 「__NSArrayM」と「__NSArrayI」 ― バックグラウンドでアプリを終了させる ホームボタンが押されて、アプリがバックグラウンドに送られたときにアプリを完全に終了させる方法。 projectName-Info.plistに「Application does &#8230; <a href="http://source-laboratory.net/blog/?p=651">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<style>
.a div { margin-bottom: 1em }
.a strong { line-height: 3.5em }
</style>
<div class="a">
<div>
アプリ開発中にハマったポイントをメモ。下に行くほど古いので初歩的な内容。
</div>
<p>―</p>
<div>
<strong>ScrollViewのスクロール強制停止</strong><br />
スクロール中のUITableViewを強制的に停止させる時はcontentOffsetに現在地の座標を突っ込む。<br />
[_tableView setContentOffset:_tableView.contentOffset animated:NO];<br />
<a href="http://stackoverflow.com/questions/986392/programmatically-force-a-uiscrollview-to-stop-scrolling-for-sharing-a-table-vie" target="_blank">iphone &#8211; Programmatically force a UIScrollView to stop scrolling, for sharing a table view with multiple data sources &#8211; Stack Overflow</a>
</div>
<p>―</p>
<div>
<strong>NSMutableArrayのコピー</strong><br />
[NSMutableArray copy]で返ってくるのはNSArray、NSMutableArrayとしてコピーがしたい時は[NSMutableArray mutableCopy]を使う。<br />
<a href="http://sonsofbasil.blog55.fc2.com/blog-entry-22.html" target="_blank">Basilの息子｜ 「__NSArrayM」と「__NSArrayI」</a>
</div>
<p>―</p>
<div>
<strong>バックグラウンドでアプリを終了させる</strong><br />
ホームボタンが押されて、アプリがバックグラウンドに送られたときにアプリを完全に終了させる方法。<br />
projectName-Info.plistに「Application does not run in background」という項目を追加してValueをYESにする。<br />
<a href="http://d.hatena.ne.jp/paraches/20100715" target="_blank">UIApplicationExitsOnSuspend=YES を Info.plist に設定する &#8211; Debian GNU/Linux 3.1 on PowerMac G4</a>
</div>
<p>―</p>
<div>
<strong>イベント一括停止</strong><br />
[[UIApplication sharedApplication] beginIgnoringInteractionEvents]でアプリケーション内のすべてのタッチイベントを停止する。<br />
[[UIApplication sharedApplication] endIgnoringInteractionEvents]でタッチイベントの受信再開。<br />
<a href="http://developer.apple.com/jp/devcenter/ios/library/documentation/EventHandlingiPhoneOS.pdf" target="_blank">iOSイベント処理ガイド</a>
</div>
<p>―</p>
<div>
<strong>プロパティセマンティクス</strong><br />
プロパティの宣言につける型みたいなやつ（セマンティクス）。</p>
<ul>
<li>readwrite: 読み書き可能。デフォルト。</li>
<li>readonly: 読み取り専用。</li>
<li>strong: 強い参照。</li>
<li>weak: 弱い参照。参照先が解放されると自動的にnilが入る。iOS5から。</li>
<li>assign: 単純代入。デフォルト。</li>
<li>copy: copyを使って参照を保持する。代入前に自動でreleaseを送る。</li>
<li>retain: retainを使って参照を保持する。代入前に自動でreleaseを送る。</li>
<li>nonatomic: スレッドセーフでない。</li>
</ul>
<p><a href="http://developer.apple.com/jp/devcenter/ios/library/documentation/ObjC.pdf" target="_blank">Objective-Cプログラミング言語</a>
</div>
<p>―</p>
<div>
<strong>実行時間計測</strong><br />
ある瞬間からある瞬間の時間を計測する方法。終了タイミングのNSDateオブジェクトのtimeIntervalSinceDate:に開始タイミングのNSDateオブジェクトを渡す。<br />
<a href="http://d.hatena.ne.jp/mmasashi/20100524/1286123680" target="_blank">■[iPhone][Objective-C] 時間を計測する方法</a>
</div>
<p>―</p>
<div>
<strong>iOS デフォルトサウンド一覧</strong><br />
AudioServicesPlaySystemSoundで鳴らせるプリインストール済みのサウンドファイル一覧。<br />
<a href="http://iphonedevwiki.net/index.php/AudioServices" target="_blank">AudioServices &#8211; iPhone Development Wiki</a>
</div>
<p>―</p>
<div>
<strong>UIViewのアニメーションを停止</strong><br />
UIViewのアニメーションをキャンセルするには、アニメーションしているview.layerにremoveAllAnimationsを送る。<br />
<a href="http://stackoverflow.com/questions/4020863/cancel-uiview-animation" target="_blank">[btn.layer removeAllAnimations];</a>
</div>
<p>―</p>
<div>
<strong>デフォルト遷移アニメーションの実行時間を指定する</strong><br />
〜:animatedなアニメーションの実行時間はUIViewのanimateWithDuration:animations:で指定できる。その際animetedはNOにしないと反映されないから注意。<br />
<a href="http://serennz.sakura.ne.jp/sb/log/eid188.html" target="_blank">SimpleBoxes | ブロックを使ったアニメーション処理 (iPhone/iPad, Objective-C 2.0)</a>
</div>
<p>―</p>
<div>
<strong>NSArrayのソート</strong><br />
NSArray、NSMutableArrayのソートはsortedArrayUsingDescriptors:を使うとだいぶ楽。<br />
<a href="http://erguolinge.blogspot.com/2010/09/nsarray.html" target="_blank">蒼い惑星: NSArrayのソート方法について</a>
</div>
<p>―</p>
<div>
<strong>CGRectIsEmpty</strong><br />
CGRectが{0,0,0,0}もしくはNULLかどうかを判定する時はCGRectIsEmpty()。<br />
<a href="http://ameblo.jp/fanorekoso/entry-10811464714.html" target="_blank">CGRectのメソッド色々メモ 比較編（iOS SDK）｜ふぁのれこそは半角カタカナで</a>
</div>
<p>―</p>
<div>
<strong>Xcodeの補完が効かなくなったら</strong><br />
Xcodeのシンタックスハイライトが消えたり、補完が効かなくなったら、[~/Library/Developer/Xcode/DerivedData]にある該当プロジェクトのキャッシュを削除してXcodeを再起動する。<br />
<a href="http://stackoverflow.com/questions/5275004/xcode-4-auto-complete-jump-to-definition-broken-in-my-xcode-3-project" target="_blank">autocomplete &#8211; Xcode 4: Auto-complete &amp; Jump to Definition broken in my Xcode 3 Project &#8211; Stack Overflow</a>
</div>
<p>―</p>
<div>
<strong>UILabelのタッチイベントを取得する</strong><br />
UILabelはデフォルトだとタッチイベントがオフになってるのでuserInteractionEnabledをYESにする。<br />
<a href="http://profo.jp/wiki/index.php?UIButton" target="_blank">UIButton &#8211; 福井高専IT研究会OfficialWiki</a>
</div>
<p>―</p>
<div>
<strong>デバイス回転前に回転後のサイズを取得する</strong><br />
デバイス回転処理前のタイミングで回転後のサイズを取得したい時はUIViewControllerのwillAnimateRotationToInterfaceOrientation:duration:内でself.viewのframe、boundsを参照する。<br />
<a href="http://bynomial.com/blog/?p=85" target="_blank">Bynomial Code » Handling rotations in UIViewController</a>
</div>
<p>―</p>
<div>
<strong>透過PNGは重い</strong><br />
pngも含めた透過性のviewはスクロール負荷が高い。<br />
<a href="http://blog.natsuapps.com/2010/10/ios-tableview_6774.html" target="_blank">[iOS] TableView スクロールパフォーマンスの改善 &#8211; iOS 開発ブログ Natsu&apos;s note</a>
</div>
<p>―</p>
<div>
<strong>viewの階層構造を出力</strong><br />
UIViewのrecursiveDescriptionメソッドでviewの階層構造を出力できる。<br />
<a href="http://d.hatena.ne.jp/KishikawaKatsumi/20100521/1274451944" target="_blank">ビュー (UIView) の階層構造をダンプする非公開の便利メソッド &#8211; 24/7 twenty-four seven</a>
</div>
<p>―</p>
<div>
<strong>FPSを計測</strong><br />
InstrumentsのCore AnimationテンプレートでFPSを計測できる。<br />
<a href="http://blog.fenrir-inc.com/jp/2011/10/ios-animation-tuning.html" target="_blank">iPhone / iPad アプリのアニメーションをなめらかにするためのポイント3つ (フェンリル | デベロッパーズブログ)</a>
</div>
<p>―</p>
<div>
<strong>NSTimerはdeallocで解放しない</strong><br />
NSTimerを解放するときのinvalidateはdeallocではなくviewWillDisappear:あたりで行う。<br />
NSTimerのscheduledTimerWithTimeInterval:target:selector:userInfo:repeats:はtarget:で渡されたオブジェクトをretainするからNSTimerをinvalidateするまでtarget:に渡されたオブジェクトは解放されない。よってdealloc外でinvalidateを呼ばないとdeallocが呼ばれなくなってしまうため。<br />
<a href="http://akisute.com/2009/05/nstimerretainassign.html" target="_blank">A-Liaison BLOG: NSTimerは基本的にretainせずassignでよい</a>
</div>
<p>―</p>
<div>
<strong>CALayerの解放</strong><br />
CALayerの初期化は[CALayer layer]だけど解放時はlayer.contents = nilして[layer release]。<br />
<a href="http://www.ua-labo.com/entries/pid000057.html" target="_blank">CALayerのメモリ解放（メモ）｜UA LABO｜ユナイティア株式会社</a>
</div>
<p>―</p>
<div>
<strong>ファイルを右ペインに開く</strong><br />
Xcode4にてOption押しながらナビゲーター内のファイルを選択するとアシスタントエディタにファイルの内容を表示できる。
</div>
<p>―</p>
<div>
<strong>UIViewControllerのフロー</strong></p>
<p>・初期化</p>
<ol>
<li>alloc<br />
メモリの確保</li>
<li>init、init〜<br />
データ類の初期化</li>
<li>loadView<br />
viewの初期化</li>
<li>viewDidLoad<br />
viewのレイアウト、データの反映</li>
<li>viewWillAppear:（viewが画面に描画される場合）<br />
viewが画面に描画される直前の処理</li>
<li>viewDidAppear:（viewが画面に描画される場合）<br />
viewが画面に描画された直後の処理</li>
</ol>
<p>・メモリ不足</p>
<ol>
<li>didReceiveMemoryWarning<br />
不要なデータの解放</li>
<li>viewDidUnload<br />
viewの解放（変数にnilを代入してアクセスを防ぐ）</li>
</div>
<p>―</p>
<div>
<strong>デバイス回転時のUIViewController内のフロー</strong></p>
<p>・パターン1</p>
<ol>
<li>デバイスが回転</li>
<li>shouldAutorotateToInterfaceOrientation:<br />
サポートする角度の確認</li>
<li>willRotateToInterfaceOrientation:duration:<br />
view回転直前の処理</li>
<li>viewの回転</li>
<li>didRotateFromInterfaceOrientation:<br />
view回転直後の処理</li>
</ol>
<p>・パターン2</p>
<ol>
<li>デバイスが回転</li>
<li>shouldAutorotateToInterfaceOrientation:<br />
サポートする角度の確認</li>
<li>willRotateToInterfaceOrientation:duration:<br />
view回転直前の処理</li>
<li>willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:<br />
中間角度直前の処理</li>
<li>中間の角度</li>
<li>didAnimateFirstHalfOfRotationToInterfaceOrientation:<br />
中間角度直後の処理</li>
<li>willAnimateSecondHalfOfRotationToInterfaceOrientation:duration:<br />
回転済み直前の処理</li>
<li>viewの回転</li>
<li>didRotateFromInterfaceOrientation:<br />
回転直後の処理</li>
</ol>
<p><a href="http://developer.apple.com/jp/devcenter/ios/library/documentation/ViewControllerPGforiPhoneOS.pdf" target="_blank">iOS View Controller プログラミングガイド</a>
</div>
<p>―</p>
<div>
<strong>いろんなブレイクの種類</strong><br />
設定したブレイクポイントを右クリックして開いたメニューの[Edit Breakpoint]からブレイクさせる条件を設定できたり、ブレイクさせずにNSLogしたり、音を鳴らしたり、AppleScriptを実行したりできる。<br />
<a href="http://www.stripe-net.jp/cocoa/program/blog20110319.html" target="_blank">Xcode4でNSLogを過去にする | みるくCocoa</a>
</div>
<p>―</p>
<div>
<strong>実行前コードチェック</strong><br />
static analyzerで実行前に潜在的なメモリリーク等を検出してくれる。<br />
<a href="http://cocoadays.blogspot.com/2010/07/xcode-build-and-analyze.html" target="_blank">Cocoaの日々: Xcode &#8211; Build And Analyze</a><br />
<a href="http://cocoadays.blogspot.com/2010/07/xcode-build-and-analyze_13.html" target="_blank">Cocoaの日々: Xcode &#8211; Build And Analyze 〜 問題の例</a>
</div>
<p>―</p>
<div>
<strong>NSZombie</strong><br />
[Product]→[Edit Scheme...]→[Run {プロジェクト名}]→[Diagnostics]→[Memory Management]→[Enable Zombie Objects]にチェックを入れると実行時エラーが発生したその場で停止してその場所でエラーを吐いてくれるようになる。<br />
<a href="http://program.station.ez-net.jp/special/xcode/xcode4/leak-check.asp" target="_blank">EZ-NET: Xcode4 のデバッグ環境を整える</a>
</div>
<p>―</p>
<div>
<strong>リファクタリングショートカット</strong><br />
control+command+Eで[Edit All in Scope]が実行できる
</div>
<p>―</p>
<div>
<strong>公式ドキュメントのオフラインキャッシュ</strong><br />
Documentをオンラインで見ると遅いからローカルに保存しておく。<br />
[xcode]→[Preferences...]→[Downloads]→[Documentation]→[Check and Install Now]
</div>
<p>―</p>
<div>
<strong>Xcodeのカラーの変更</strong><br />
xcode4でカラーテーマの変更は[xcode]→[Preferences...]→[Fonts &#038; Colors]→[Theme]
</div>
<p>―</p>
<div>
<strong>Xcode4のRefactor機能</strong><br />
・Renameで変数名の一括変更<br />
・Extractで一部のコードをメソッドに変換<br />
・Create Superclassでスーパークラスの作成→継承<br />
・Move Upで変数、メソッドをスーパークラスに移動<br />
・Move Downでサブクラスに移動<br />
・Encapsulateで変数をプロパティー化<br />
<a href="http://sazameki.jp/translations/xcode4/IDEs/Conceptual/Xcode4TransitionGuide/Refactoring/Refactoring.html" target="_blank">Xcode 4 移行ガイド：テキストの置換とリファクタリング</a>
</div>
<p>―</p>
<div>
<strong>UIWebViewの解放</strong><br />
UIWebViewをdeallocする時はwebView.delegateにnilをつっこんどく。<br />
<a href="http://iphone-app-developer.seesaa.net/article/139982537.html" target="_blank">アプリが落ちないUIWebViewの使い方: iPhoneアプリ開発備忘録</a>
</div>
<p>―</p>
<div>
<strong>擬似グローバル</strong><br />
グローバルっぽいところにいろんなもの突っ込んで受け渡しする初心者実装のススメ。<br />
<a href="http://d.hatena.ne.jp/omaemona01/20111204/1322961924" target="_blank">iOSゆとりプログラミングのススメ &#8211; 仕事人の開発日誌</a>
</div>
<p>―</p>
<div>
<strong>戻るボタンを消す</strong><br />
ナビゲーションバーにデフォルトで表示される戻るボタンを非表示にする方法。UINavigationControllerにpushするcontroller内のviewDidLoadで[self.navigationItem setHidesBackButton:YES animated:NO]する。<br />
<a href="http://cheesememo.blog39.fc2.com/blog-entry-190.html" target="_blank">チーズくんの備忘録 [iOS]戻るボタンを消す方法</a>
</div>
<p>―</p>
<div>
<strong>オリジナルフォントを使う</strong><br />
プリインストールされていないフォントを使う方法。プロジェクトにttf、otfを読みこんでxxx-Info.plistに「Fonts provided by application」という項目を追加して各ファイル名をStringとして加える。あとはUIFontにフォント名をしてする。フォント名の取得はplistに追加したあと下記のコードを実行してインストール済みのフォントを出力して確認する。</p>
<pre name="code" class="objective-c">
NSEnumerator *e = [[UIFont familyNames] objectEnumerator];
NSString *font;
while(font = [e nextObject])
{
    NSLog(@"%@: %@", font, [UIFont fontNamesForFamilyName:font]);
}
</pre>
<p><a href="http://ksgejp.blog100.fc2.com/blog-entry-32.html" target="_blank">そうだ、プログラミングしよう　 フォントを組み込む方法</a>
</div>
<p>―</p>
<div>
<strong>デフォルトUIのグラデーションを消す</strong><br />
UINavigationBarのグラデーションを消したい時はカテゴリからdrawRect:を上書きしてCGContextSetFillColorで塗りつぶす。</p>
<p>iOS5以降の場合は[navigationBar setBackgroundImage:]で背景に無地の画像を敷き詰める。</p>
<pre name="code" class="objective-c">
UIImage* bgImage = [UIImage imageNamed: @"black.png"];
[bgImage drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[self.navigationBar setBackgroundImage:bgImage forBarMetrics:UIBarMetricsDefault];
</pre>
<p><a href="http://stackoverflow.com/questions/4904877/remove-gradient-on-uinavigationbar" target="_blank">iphone &#8211; Remove Gradient on UINavigationBar &#8211; Stack Overflow</a>
</div>
<p>―</p>
<div>
<strong>デフォルトのタイトルフォントを変更する</strong><br />
UINavigationBarのタイトルのフォント等のスタイルを変えたいときは、好きなUILabelを作ってnavigationItem.titleViewにつっこむ。</p>
<p>iOS5以降の場合は[navigationBar setTitleTextAttributes:]で設定できる。<br />
<a href="http://stackoverflow.com/questions/599405/iphone-navigation-bar-title-text-color" target="_blank">uinavigationbar &#8211; iPhone Navigation Bar Title text color &#8211; Stack Overflow</a>
</div>
<p>―</p>
<div>
<strong>同時ダウンロード</strong><br />
データの並列ダウンロードはNSOperationとNSOperationQueueで実装する。ActionScript Threadで言うところのThreadとParallelExecutorみたいな感じ。<br />
<a href="http://d.hatena.ne.jp/fn7/20100712/1278952274" target="_blank">NSOperationQueueを使ったスレッド処理の簡単な例 &#8211; fn7の日記</a><br />
<a href="http://d.hatena.ne.jp/glass-_-onion/20110527/1306499056" target="_blank">NSOperationQueue スレッドと処理の関係 &#8211; A Day In The Life</a><br />
<a href="http://news.mynavi.jp/column/iphone/006/index.html" target="_blank">実践! iPhoneアプリ開発 (6) RSSリーダの作り方 (2) &#8211; 複数のダウンロードを並行して処理する | エンタープライズ | マイナビニュース</a>
</div>
<p>―</p>
<div>
<strong>scrollViewDidScroll:の呼ばれるタイミング</strong><br />
UIScrollViewのscrollViewDidScroll:はcontentSize、contentOffsetが変化した時も呼ばれる。<br />
<a href="http://cocoadays.blogspot.com/2010/10/17.html" target="_blank">Cocoaの日々: 簡易スライドビューア [17] モードの切り替え</a>
</div>
<p>―</p>
<div>
<strong>NSTimerの解放</strong><br />
NSTimerにscheduledTimerWithTimeInterval:のtargetにselfを渡すと、selfがretainされる。NSTimerのinvalidateを呼ぶとreleaseしてくれる。<br />
<a href="http://i.studio23c.com/?p=141" target="_blank">NSTimerインスタンスは、生成元viewControllerを保持するのは分かっていたのに、<br />
それではまった。</a><br />
<a href="http://akisute.com/2009/05/nstimerretainassign.html" target="_blank">A-Liaison BLOG: NSTimerは基本的にretainせずassignでよい</a>
</div>
<p>―</p>
<div>
<strong>数値型と文字型のキャスト</strong><br />
NSStringからintへは[@"123" intValue]。<br />
intからNSStringへは[NSString stringWithFormat:@"%i", 123]。<br />
<a href="http://iphone-developer.sblo.jp/article/37061427.html" target="_blank">Objective-Cのキャスト（数値⇔文字）: iphoneアプリ開発の虎の巻ブログ</a>
</div>
<p>―</p>
<div>
<strong>BOOLの出力</strong><br />
BOOLは内部的にはint型なのでNSLogで出力するときはintにキャストして判定<br />
NSLog(@”%i”, (int)b);<br />
<a href="http://d.hatena.ne.jp/k2_k_hei/20100926/1285522440" target="_blank">Objective-Cでのデバック NSLogについて &#8211; k2ダイアリー</a>
</div>
<p>―</p>
<div>
<strong>NSArrayとNSMutableArrayのコピーの違い</strong><br />
copyメソッドを使った時、NSArrayは浅いコピー(shallow copy)、NSMutableArrayは深いコピー(deep copy)が実行される。要はNSArrayは参照を返して、NSMutableArrayは完全にコピーされた実オブジェクトが返される。<br />
<a href="http://d.hatena.ne.jp/glass-_-onion/20090831/1251723900" target="_blank">iPhoneアプリ開発時のメモリ管理で気をつけること &#8211; A Day In The Life</a>
</div>
<p>―</p>
<div>
<strong>イニシャライザの種類による解放の仕方の違い</strong><br />
alloc、alloc+init〜、copy〜以外のメソッドで生成したオブジェクトをreleaseすると潜在的に実行されてるautoreleaseが走った瞬間に落ちる。<br />
<a href="http://d.hatena.ne.jp/STAR_ZERO/20100911/1284220037" target="_blank">UIButtonはrelease不要 &#8211; 全力で気まぐれ</a>
</div>
<p>―</p>
<div>
<strong>非同期通信ライブラリ</strong><br />
jsonとかxml、画像なんかを読み込んでblocksで非同期処理が書けるライブラリ。<br />
<a href="https://github.com/AFNetworking/AFNetworking" target="_blank">AFNetworking/AFNetworking &#8211; GitHub</a><br />
<a href="http://cocoadays.blogspot.com/2011/11/info-afnetworking.html" target="_blank">Cocoaの日々: [Info] AFNetworking</a>
</div>
<p>―</p>
<div>
<strong>細かいレイアウトはUIWebViewを使う</strong><br />
処理速度求めないシチュエーションならUIWebViewで極力回避。<br />
<a href="http://www.dotapon.sakura.ne.jp/blog/?p=169" target="_blank">UIWebViewでつくるUI – yidevで発表してきました | DOTAPON Blog</a>
</div>
<p>―</p>
<div>
<strong>Blocks</strong><br />
^から始まる関数はblocksというクロージャ、jsでいうとこの無名関数。<br />
<a href="http://d.hatena.ne.jp/trashsuite/20100414/1271252150" target="_blank">C/Objective-C + Blocks でクロージャ &#8211; TrashSUITE</a><br />
<a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Blocks/Articles/bxGettingStarted.html#//apple_ref/doc/uid/TP40007502-CH7-SW1" target="_blank">Blocks Programming Topics: Getting Started with Blocks</a>
</div>
<p>―</p>
<div>
<strong>releaseの仕方</strong><br />
中身がnilのオブジェクトにメッセージ送ってもEXC_BAD_ACCESSにならないので、releaseしたらすぐにnil突っ込んどく。</p>
<pre name="code" class="objective-c">
[view release], view = nil;
</pre>
</div>
<p>―</p>
<div>
<strong>テキストの行の高さを取得する</strong><br />
NSStirngのsizeWithFont:forWidth:lineBreakMode:は一行の高さを取得、sizeWithFont:constrainedToSize:lineBreakMode:が複数行の高さを取得。<br />
constrainedToSize:にheightをおっきめに設定したCGRectを突っ込む。<br />
<a href="http://tech.actindi.net/3477191382" target="_blank">UITableViewCellの高さを内容に合わせて変化させる | アクトインディ技術部隊報告書</a>
</div>
<p>―</p>
<div>
<strong>デバッグTips</strong><br />
<a href="http://kray.jp/blog/iphone-debug/" target="_blank">iPhoneアプリ開発におけるデバッグのTIPS | KRAY Inc</a>
</div>
<p>―</p>
<div>
<strong>CoreTextなUILabelのサンプル</strong><br />
<a href="http://blog.fenrir-inc.com/jp/2011/10/core_text_sample.html" target="_blank">より豊かな表現のために、3つのステップで実装する Core Text (フェンリル | デベロッパーズブログ)</a><br />
<a href="http://hmdt.jp/blog/?p=88" target="_blank">属性付きラベルを作る その1 | HMDT Blog</a><br />
<a href="http://hmdt.jp/blog/?p=99" target="_blank">属性付きラベルを作る その2 | HMDT Blog</a><br />
<a href="http://hmdt.jp/blog/?p=105" target="_blank">属性付きラベルを作る その3 | HMDT Blog</a>
</div>
<p>―</p>
<div>
<strong>NSMutableArrayの初期化と開放の仕方</strong><br />
<a href="http://hamasyou.com/blog/archives/000383" target="_blank">[Objective-C] retain と release の関係について &#8211; それはBlog</a>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://source-laboratory.net/blog/?feed=rss2&#038;p=651</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CIDから対応する文字を取得する</title>
		<link>http://source-laboratory.net/blog/?p=658</link>
		<comments>http://source-laboratory.net/blog/?p=658#comments</comments>
		<pubDate>Thu, 01 Dec 2011 18:40:51 +0000</pubDate>
		<dc:creator>bouze</dc:creator>
				<category><![CDATA[FLASH]]></category>
		<category><![CDATA[TRYOUT]]></category>

		<guid isPermaLink="false">http://source-laboratory.net/blog/?p=658</guid>
		<description><![CDATA[わけあってCIDをもとに対応する文字を取得したい。 ざっと調べてみたら、CIDと文字が対になった一覧表はこのへんにあるんだけどプログラムからは使いにくい。 プログラムから使いやすそうな資料を探してみたところ、どうもAcrobat内部ではCIDをUnicodeに変換するようなことをしてるらしいことがわかった。その変換に関する資料がこれ。 すかさずこの資料の後半のMapping Fileを拝借。 CIDを投げたらCID→Unicode→String.fromCharCode()で文字を取得ってクラスを作ったんだけど、どうも取得したUnicodeが期待した文字に変換できてない。 この「Unicode」はString.fromCharCodeで変換できる「Unicode」じゃないのかなぁ？ うーん&#8230; と思ったら、FontForgeで使ってるcidmapっていうCIDのマッピングファイルに「Adobe-Japan1-6.cidmap」ってのがあった。これをコンバートして使ってみたらうまく変換できた。ﾜｰｲ。 どうも上記のデータはAdobe-Japan2のマッピングデータらしい。なるほろ。 package { public class CharCodeUtil { static private var list:Array; public function CharCodeUtil() { } static public function getCharFromCID(cid:uint):String { var char:String = ""; init(); for each (var obj:Object in &#8230; <a href="http://source-laboratory.net/blog/?p=658">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>わけあって<a href="http://ja.wikipedia.org/wiki/CID_(%E6%96%87%E5%AD%97%E3%82%B3%E3%83%BC%E3%83%89)" target="_blank">CID</a>をもとに対応する文字を取得したい。<br />
ざっと調べてみたら、CIDと文字が対になった一覧表は<a href="http://partners.adobe.com/public/developer/en/font/5078.Adobe-Japan1-6.pdf" target="_blank">このへん</a>にあるんだけどプログラムからは使いにくい。</p>
<p>プログラムから使いやすそうな資料を探してみたところ、どうもAcrobat内部ではCIDをUnicodeに変換するようなことをしてるらしいことがわかった。その変換に関する資料が<a href="http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/5411.ToUnicode.pdf" target="_blank">これ</a>。</p>
<p>すかさずこの資料の後半のMapping Fileを拝借。<br />
CIDを投げたらCID→Unicode→String.fromCharCode()で文字を取得ってクラスを作ったんだけど、どうも取得したUnicodeが期待した文字に変換できてない。</p>
<p>この「Unicode」はString.fromCharCodeで変換できる「Unicode」じゃないのかなぁ？</p>
<p>うーん&#8230;</p>
<p>と思ったら、<a href="http://fontforge.sourceforge.net/source-build.html#cidmaps" target="_blank">FontForgeで使ってるcidmap</a>っていうCIDのマッピングファイルに「Adobe-Japan1-6.cidmap」ってのがあった。これをコンバートして使ってみたらうまく変換できた。ﾜｰｲ。<br />
どうも上記のデータは<a href="http://shiromoji.net/wiki/Adobe-Japan2/" target="_blank">Adobe-Japan2</a>のマッピングデータらしい。なるほろ。</p>
<pre name="code" class="as3">
package
{

  public class CharCodeUtil
  {
    static private var list:Array;

    public function CharCodeUtil()
    {

    }

    static public function getCharFromCID(cid:uint):String
    {
      var char:String = "";

      init();

      for each (var obj:Object in list)
      {
        if (cid == uint(obj.c[0]))
        {
          char = String.fromCharCode(uint(obj.u));
          break;
        }
      }

      return char;
    }

    static private function init():void
    {
      if (list) return;

      list = [
        //ここに.cidmapをArray化したデータを
      ];
    }
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://source-laboratory.net/blog/?feed=rss2&#038;p=658</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>macでxampp環境セットアップするメモ</title>
		<link>http://source-laboratory.net/blog/?p=636</link>
		<comments>http://source-laboratory.net/blog/?p=636#comments</comments>
		<pubDate>Sun, 27 Nov 2011 12:50:02 +0000</pubDate>
		<dc:creator>bouze</dc:creator>
				<category><![CDATA[TRYOUT]]></category>

		<guid isPermaLink="false">http://source-laboratory.net/blog/?p=636</guid>
		<description><![CDATA[xamppでローカルにサーバー環境を持ってこれれば、dropbox配下でサーバーサイドの編集ができるじゃん、ということでmac(10.7)でxamppセットアップしてみた。 インストール 1. ここからxampp落としてくる。 2. dmgからインスコ 3. Applications/XAMPP/XAMPP Controlを起動。http://localhost/にアクセスしてxamppの「ようこそ」画面が出たらひとまずインスコ成功。 セキュリティの設定 1. Terminalを起動して「$ sudo /applications/xampp/xamppfiles/xampp security」を実行。 2. xamppのパスワード設定、MySQLの外部ネットワークからのアクセスを許可するかの設定、MySQLのパスワード設定、phpMyAdminのパスワード設定が順番に実行される。 3. http://localhost/xampp/security.phpでセキュリティのステータスを確認。すべて安全になっていたら完了。（ちなみに各サービスへのアクセスに必要なIDはxamppに設定されてる） VirtualHostの設定 1. 「/Applications/XAMPP/xamppfiles/etc/httpd.conf」を開き、 # Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf をコメントアウトし、httpd-vhosts.confの設定を読み込むようにする。 2. 「/Applications/XAMPP/etc/extra/httpd-vhosts.conf」を開き、httpd.conf内で設定されていたhttp://localhost/xampp/の設定を移す。 &#60;VirtualHost *:80&#62; DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" ServerName localhost &#60;/VirtualHost&#62; &#60;Directory "/Applications/XAMPP/xamppfiles/htdocs"&#62; Options Indexes FollowSymLinks &#8230; <a href="http://source-laboratory.net/blog/?p=636">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.apachefriends.org/jp/xampp-macosx.html" target="_blank">xampp</a>でローカルにサーバー環境を持ってこれれば、dropbox配下でサーバーサイドの編集ができるじゃん、ということでmac(10.7)で<a href="http://www.apachefriends.org/jp/xampp-macosx.html" target="_blank">xampp</a>セットアップしてみた。</p>
<p><strong>インストール</strong></p>
<p>1. <a href="http://www.apachefriends.org/jp/xampp-macosx.html" target="_blank">ここ</a>からxampp落としてくる。</p>
<p>2. dmgからインスコ</p>
<p>3. Applications/XAMPP/XAMPP Controlを起動。http://localhost/にアクセスしてxamppの「ようこそ」画面が出たらひとまずインスコ成功。</p>
<p><strong>セキュリティの設定</strong></p>
<p>1. Terminalを起動して「$ sudo /applications/xampp/xamppfiles/xampp security」を実行。</p>
<p>2. xamppのパスワード設定、MySQLの外部ネットワークからのアクセスを許可するかの設定、MySQLのパスワード設定、phpMyAdminのパスワード設定が順番に実行される。</p>
<p>3. http://localhost/xampp/security.phpでセキュリティのステータスを確認。すべて安全になっていたら完了。<br/>（ちなみに各サービスへのアクセスに必要なIDはxamppに設定されてる）</p>
<p><strong>VirtualHostの設定</strong></p>
<p>1. 「/Applications/XAMPP/xamppfiles/etc/httpd.conf」を開き、</p>
<pre name="code">
# Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
</pre>
<p>をコメントアウトし、httpd-vhosts.confの設定を読み込むようにする。</p>
<p>2. 「/Applications/XAMPP/etc/extra/httpd-vhosts.conf」を開き、httpd.conf内で設定されていたhttp://localhost/xampp/の設定を移す。</p>
<pre name="code">
&lt;VirtualHost *:80&gt;
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    ServerName localhost
&lt;/VirtualHost&gt;

&lt;Directory "/Applications/XAMPP/xamppfiles/htdocs"&gt;
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Order allow,deny
    Allow from localhost 127.0.0.1
&lt;/Directory&gt;
</pre>
<p>3. 表示したいアドレスとローカルのディレクトリを割り当てる。</p>
<pre name="code">
&lt;VirtualHost *:80&gt;
    ServerName {表示したいアドレス}
    DocumentRoot "{ローカルディレクトリ}"
&lt;/VirtualHost&gt;
</pre>
<p>4. 設定したアドレスへのアクセス権限を設定する。</p>
<pre name="code">
&lt;Directory "{3で設定したローカルディレクトリ}"&gt;
    Order allow,deny
    Allow from {公開する範囲、Allとかlocalhost}
&lt;/Directory&gt;
</pre>
<p>5. NameVirtualHost *:80がコメントアウトされていたら、これもコメントを外しておく。</p>
<p>6. こんな感じ。</p>
<pre name="code">
NameVirtualHost *:80

&lt;VirtualHost *:80&gt;
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    ServerName localhost
&lt;/VirtualHost&gt;

&lt;Directory "/Applications/XAMPP/xamppfiles/htdocs"&gt;
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Order allow,deny
    Allow from localhost 127.0.0.1
&lt;/Directory&gt;

&lt;VirtualHost *:80&gt;
    ServerName hogehoge.local
    DocumentRoot "/Users/bouze/htdocs"
&lt;/VirtualHost&gt;

&lt;Directory "/Users/bouze/htdocs"&gt;
    Order allow,deny
    Allow from localhost 127.0.0.1
&lt;/Directory&gt;
</pre>
<p>7. hostsファイルにhttpd-vhosts.confで指定したアドレスを追加しておく。GUIでhostファイルを編集できる<a href="http://www.redwinder.com/macapp/hoster/" target="_blank">Hoster</a>がよい感じ。</p>
<p>8. 設定したアドレスにアクセスしてローカルのファイルが表示されたら成功。<br/>※「要求されたディレクトリへのアクセス権限がありません。」的なエラーが出る場合はローカルディレクトリをさかのぼってパーミッションが読み取り可能な状態になっているか確認する。</p>
]]></content:encoded>
			<wfw:commentRss>http://source-laboratory.net/blog/?feed=rss2&#038;p=636</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlashPlayer 11.1.102.55で静止テキストフィールドのサイズがバグる</title>
		<link>http://source-laboratory.net/blog/?p=627</link>
		<comments>http://source-laboratory.net/blog/?p=627#comments</comments>
		<pubDate>Sun, 13 Nov 2011 17:42:28 +0000</pubDate>
		<dc:creator>bouze</dc:creator>
				<category><![CDATA[FLASH]]></category>

		<guid isPermaLink="false">http://source-laboratory.net/blog/?p=627</guid>
		<description><![CDATA[フォントが指定された静止テキストフィールドに、指定されたフォントで表示できない文字がテキストフィールドに入ってると、そのTextFieldが死ぬほど膨らむっぽい。FlashPlayerのバージョン11.0.1.152にて確認。 &#8212; bouze (@bouze) November 13, 2011 こんな感じに膨らむ。]]></description>
			<content:encoded><![CDATA[<blockquote class="twitter-tweet"><p>フォントが指定された静止テキストフィールドに、指定されたフォントで表示できない文字がテキストフィールドに入ってると、そのTextFieldが死ぬほど膨らむっぽい。FlashPlayerのバージョン11.0.1.152にて確認。</p>
<p>&mdash; bouze (@bouze) <a href="https://twitter.com/bouze/status/135771132203773952" data-datetime="2011-11-13T17:28:55+00:00">November 13, 2011</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<p>こんな感じに膨らむ。<br />
<a href="http://source-laboratory.net/wp/wp-content/uploads/2011/11/gSXz.screenshot_2011-11-14_2-06.png"><img src="http://source-laboratory.net/wp/wp-content/uploads/2011/11/gSXz.screenshot_2011-11-14_2-06.png" alt="" title="gSXz.screenshot_2011-11-14_2-06" width="1126" height="86" class="alignnone size-full wp-image-630" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://source-laboratory.net/blog/?feed=rss2&#038;p=627</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Away3DのWhiteShadingBitmapMaterialでメモリリーク</title>
		<link>http://source-laboratory.net/blog/?p=617</link>
		<comments>http://source-laboratory.net/blog/?p=617#comments</comments>
		<pubDate>Sat, 12 Nov 2011 05:46:30 +0000</pubDate>
		<dc:creator>bouze</dc:creator>
				<category><![CDATA[FLASH]]></category>

		<guid isPermaLink="false">http://source-laboratory.net/blog/?p=617</guid>
		<description><![CDATA[Away3DのWhiteShadingBitmapMaterialを普通に使ってるとBitmapDataをガンガンキャッシュしてメモリリーク起こすのでclearCache()してね、とのこと。 #away3d memory leak was on WhiteShadingBitmapMaterial &#8211; Rob added a clearCache function back in July that seems to solve it. Scary! ;o) &#8212; Jasper Stocker (@jasperstocker) February 10, 2011 Issue 95 &#8211; away3d &#8211; Feature to clear bitmap cache &#8230; <a href="http://source-laboratory.net/blog/?p=617">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Away3DのWhiteShadingBitmapMaterialを普通に使ってるとBitmapDataをガンガンキャッシュしてメモリリーク起こすのでclearCache()してね、とのこと。</p>
<blockquote class="twitter-tweet"><p><a href="https://twitter.com/search/%2523away3d">#away3d</a> memory leak was on WhiteShadingBitmapMaterial &#8211; Rob added a clearCache function back in July that seems to solve it. Scary! ;o)</p>
<p>&mdash; Jasper Stocker (@jasperstocker) <a href="https://twitter.com/jasperstocker/status/35746699813064704" data-datetime="2011-02-10T17:07:32+00:00">February 10, 2011</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<p><a href="http://code.google.com/p/away3d/issues/detail?id=95">Issue 95 &#8211; away3d &#8211; Feature to clear bitmap cache in WhiteShadingBitmapMaterial (or texture setter) &#8211; Realtime 3D engine for Flash &#8211; Google Project Hosting</a></p>
<p>取り急ぎ5秒おきにキャッシュクリアして回避。</p>
<pre name="code" class="as3">
package wimax.away3d.material
{
    import away3d.materials.WhiteShadingBitmapMaterial;
    import flash.display.BitmapData;
    import flash.events.TimerEvent;
    import flash.utils.Timer;

    public class ImprovedWhiteShadingBitmapMaterial extends WhiteShadingBitmapMaterial
    {
        public var clearCacheInterval:int = 5000;

        public function ImprovedWhiteShadingBitmapMaterial(bitmap:BitmapData, init:Object=null)
        {
            super(bitmap, init);

            var t:Timer = new Timer(clearCacheInterval);
            t.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void
            {
                clearCache();
            });
            t.start();
        }
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://source-laboratory.net/blog/?feed=rss2&#038;p=617</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iOSで行間調整、カーニングするメモ</title>
		<link>http://source-laboratory.net/blog/?p=614</link>
		<comments>http://source-laboratory.net/blog/?p=614#comments</comments>
		<pubDate>Sun, 09 Oct 2011 21:57:45 +0000</pubDate>
		<dc:creator>bouze</dc:creator>
				<category><![CDATA[OBJECTIVE-C]]></category>

		<guid isPermaLink="false">http://source-laboratory.net/blog/?p=614</guid>
		<description><![CDATA[UILabelの行間、カーニング調整できないクソ仕様に悶絶したので代替手段としてCoreTextを調べてみたメモ。 ・もろもろパラメータ設定したNSAttributedStringを用意する。指定できるパラメータはCoreText.framework内CTStringAttributes.hを参照。 ・CTFramesetterCreateWithAttributedString(CFAttributedString*)でCTFramesetterRef取得する。 ・CoreFoundationとObjective-Cのデータ型はだいたい互換性があるらしく、引数がCF～のとこに、同名のNS～を(CF～)NS～みたいにキャストしてつっこめれる。 ・CGPathCreateMutable()でCGMutablePathRef取得する。 ・CGPathAddRect(CGMutablePathRef, NULL, self.bounds)で描画範囲を設定。 ・取得したCTFramesetterRefとCGMutablePathRefからCTFramesetterCreateFrame(CTFramesetterRef, CFRange, CGPathRef, NULL)を使ってCTFrameRefを作る。 ・UIViewのdrawRect:(CGRect)rect内でUIGraphicsGetCurrentContext()使ってCGContextRef取得。 ・CTFrameDraw(CTFrameRef, CGContextRef)でテキスト描画。 ・UIViewとCoreGraphicsで座標系が違うので、 CGContextTranslateCTM(CGContextRef, 0, self.bounds.size.height); CGContextScaleCTM(CGContextRef, 1, -1); で上下反転させておく。 CoreFoundationとかガチのC言語な上、手続きがめんどすぎるのでよっぽどのことがない限りUIWebViewで描画した方がよい。 あとCoreTextの日本語資料少な過ぎで死ぬ。 参考： Core Text Programming Guide: Introduction Text Layout With Core Text CoreText.framework &#8211; iPhone Development &#8230; <a href="http://source-laboratory.net/blog/?p=614">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>UILabelの行間、カーニング調整できないクソ仕様に悶絶したので代替手段としてCoreTextを調べてみたメモ。</p>
<p>・もろもろパラメータ設定したNSAttributedStringを用意する。指定できるパラメータはCoreText.framework内CTStringAttributes.hを参照。</p>
<p>・CTFramesetterCreateWithAttributedString(CFAttributedString*)でCTFramesetterRef取得する。</p>
<p>・CoreFoundationとObjective-Cのデータ型はだいたい互換性があるらしく、引数がCF～のとこに、同名のNS～を(CF～)NS～みたいにキャストしてつっこめれる。</p>
<p>・CGPathCreateMutable()でCGMutablePathRef取得する。</p>
<p>・CGPathAddRect(CGMutablePathRef, NULL, self.bounds)で描画範囲を設定。</p>
<p>・取得したCTFramesetterRefとCGMutablePathRefからCTFramesetterCreateFrame(CTFramesetterRef, CFRange, CGPathRef, NULL)を使ってCTFrameRefを作る。</p>
<p>・UIViewのdrawRect:(CGRect)rect内でUIGraphicsGetCurrentContext()使ってCGContextRef取得。</p>
<p>・CTFrameDraw(CTFrameRef, CGContextRef)でテキスト描画。</p>
<p>・UIViewとCoreGraphicsで座標系が違うので、<br />
CGContextTranslateCTM(CGContextRef, 0, self.bounds.size.height);<br />
CGContextScaleCTM(CGContextRef, 1, -1);<br />
で上下反転させておく。</p>
<p>CoreFoundationとかガチのC言語な上、手続きがめんどすぎるのでよっぽどのことがない限りUIWebViewで描画した方がよい。<br />
あとCoreTextの日本語資料少な過ぎで死ぬ。</p>
<p>参考：<br />
<a href="http://bit.ly/rkQaAC" target="_blank">Core Text Programming Guide: Introduction</a><br />
<a href="http://slidesha.re/p3HLxr" target="_blank">Text Layout With Core Text</a><br />
<a href="http://bit.ly/nRVcLC" target="_blank">CoreText.framework &#8211; iPhone Development Wiki</a></p>
]]></content:encoded>
			<wfw:commentRss>http://source-laboratory.net/blog/?feed=rss2&#038;p=614</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>動的に生成されるURLに対して固有のOGPを生成する方法メモ</title>
		<link>http://source-laboratory.net/blog/?p=606</link>
		<comments>http://source-laboratory.net/blog/?p=606#comments</comments>
		<pubDate>Sun, 09 Oct 2011 21:54:48 +0000</pubDate>
		<dc:creator>bouze</dc:creator>
				<category><![CDATA[INTRODUCTION]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://source-laboratory.net/blog/?p=606</guid>
		<description><![CDATA[http://hoge.com/#1000 みたいな、ハッシュ以下の値に対してコンテンツを書き換えるサイトで、それぞれのハッシュに応じて異なるOpen Graph Protocol(OGP)を吐き出したい時の対処法。 フェイスブック、ミクシィ、グリーで使われている OGP (Open Graph Protocol) とは何かhttp://d.hatena.ne.jp/amachang/20110117/1295233078 1. まず同一ドメイン内に、OGP吐き出し用のPHPを用意する。 ex) http://hoge.com/share.php 2. 元のhtmlと同一のハッシュを受け取ってその値に応じたOGPを吐くようにする。 ex) http://hoge.com/share.php?id=1000 3. html内に設置したShareボタン、Likeボタンの対象URLを上記のshare.phpにする。 &#60;div data-href="http://hoge.com/share.php?id=1000" data-send=false data-layout="button_count" data-width=450 data-show-faces=false&#62;&#60;/div&#62; 4. このままだとウォールにshare.phpのURLが投稿されてしまい、ウォールからアクセスしたユーザーがshare.phpに飛んでしまうので、share.php内でfacebookのクローラー以外を元のhtmlにリダイレクトする。 facebookのクローラーはUserAgant内の“facebookexternalhit”の有無で判定する。 Best Practices &#8211; Facebook開発者http://developers.facebook.com/docs/best-practices/ 5. 以下share.phpの概要 &#60;?php $id = $_GET["id"]; $ua &#8230; <a href="http://source-laboratory.net/blog/?p=606">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>http://hoge.com/#1000 みたいな、ハッシュ以下の値に対してコンテンツを書き換えるサイトで、それぞれのハッシュに応じて異なるOpen Graph Protocol(OGP)を吐き出したい時の対処法。</p>
<p><a href="http://d.hatena.ne.jp/amachang/20110117/1295233078" target="_blank">フェイスブック、ミクシィ、グリーで使われている OGP (Open Graph Protocol) とは何か<br/>http://d.hatena.ne.jp/amachang/20110117/1295233078</a></p>
<p>1. まず同一ドメイン内に、OGP吐き出し用のPHPを用意する。</p>
<p>ex) http://hoge.com/share.php</p>
<p>2. 元のhtmlと同一のハッシュを受け取ってその値に応じたOGPを吐くようにする。</p>
<p>ex) http://hoge.com/share.php?id=1000</p>
<p>3. html内に設置したShareボタン、Likeボタンの対象URLを上記のshare.phpにする。</p>
<pre name="code" class="html">
 &lt;div data-href="http://hoge.com/share.php?id=1000" data-send=false data-layout="button_count" data-width=450 data-show-faces=false&gt;&lt;/div&gt;
</pre>
<p>4. このままだとウォールにshare.phpのURLが投稿されてしまい、ウォールからアクセスしたユーザーがshare.phpに飛んでしまうので、share.php内でfacebookのクローラー以外を元のhtmlにリダイレクトする。<br />
facebookのクローラーはUserAgant内の“facebookexternalhit”の有無で判定する。</p>
<p><a href="http://developers.facebook.com/docs/best-practices/" target="_blank">Best Practices &#8211; Facebook開発者<br/>http://developers.facebook.com/docs/best-practices/</a></p>
<p>5. 以下share.phpの概要</p>
<pre name="code" class="php">
&lt;?php
$id = $_GET["id"];
$ua = $_SERVER['HTTP_USER_AGENT'];

//facebook crowlerじゃなかったらリダイレクト
if (!preg_match('/facebookexternalhit/i', $ua))
{
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://hoge.com/#" . $id);
    exit;
}

//idに応じて情報を取得する
$api = "http://hoge.com/api?id=" . $id;
$json = file_get_contents($api);
$user_data = json_decode($json);
$username = htmlspecialchars($user_data-&gt;result-&gt;username);
$img_path = htmlspecialchars($user_data-&gt;result-&gt;img_path);

?&gt;&lt;!DOCTYPE html&gt;
&lt;html lang="en" xmlns:og="http://ogp.me/ns#"&gt;
    &lt;head&gt;
        &lt;meta charset="utf-8"&gt;
        &lt;meta property="og:title" content="&lt;?=$username?&gt;'s page"&gt;
        &lt;meta property="og:description" content="SITE DESCRIPTION"&gt;
        &lt;meta property="og:url" content="http://hoge.com/#&lt;?=$id?&gt;"&gt;
        &lt;meta property="og:image" content="&lt;?=$img_path?&gt;"&gt;
        &lt;link rel="image_src" href="&lt;?=$img_path?&gt;"&gt;
        &lt;title&gt;&lt;?=$username?&gt;'s page&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;script type="text/javascript"&gt;location.replace("http://hoge.com/#&lt;?=$id?&gt;");&lt;/script&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://source-laboratory.net/blog/?feed=rss2&#038;p=606</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

