<?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>Yuyak Blog</title>
	<atom:link href="http://www.yuyak.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yuyak.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 27 Aug 2010 06:23:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>さようならQuickSilver、こんにちはQSB</title>
		<link>http://www.yuyak.com/blog/2010/08/26/497/</link>
		<comments>http://www.yuyak.com/blog/2010/08/26/497/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 17:36:10 +0000</pubDate>
		<dc:creator>yuyak</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.yuyak.com/blog/?p=497</guid>
		<description><![CDATA[1日のうち5回くらい機嫌を損ねるQuickSilverを捨て、QSBに乗り換えました。
QSBのいいところ

軽い、速い、かっこいい！
メールとかいろいろ検索できる
プラグイン機能
ちゃんとバージョンアップされてる
オー [...]]]></description>
			<content:encoded><![CDATA[<p>1日のうち5回くらい機嫌を損ねる<a href="http://www.blacktree.com/">QuickSilver</a>を捨て、<a href="http://code.google.com/p/qsb-mac/">QSB</a>に乗り換えました。</p>
<h3>QSBのいいところ</h3>
<ul>
<li>軽い、速い、かっこいい！</li>
<li>メールとかいろいろ検索できる</li>
<li>プラグイン機能</li>
<li>ちゃんとバージョンアップされてる</li>
<li>オープンソース</li>
<li>QuickSilverの開発者も参加してるとかしてないとか</li>
</ul>
<p>QuickSilverに不満がある人は乗り換えたら幸せになれるかもしれません！</p>
<h3>ちょっと豆知識</h3>
<p>インストール仕立てのとき、日本語環境では「terminal」と打っても「ターミナル」は出てきません。<br />
しかし、一度「Applications」→「ユーティリティ」→「terminal」と進んでいっておくと、次回からは「ter」とか打つだけで「ターミナル.app」が候補に上がってきます。</p>
<h3>具体的なやり方</h3>
<p>まずは、「app」と打ってみる。。<br />
<a href="http://www.yuyak.com/blog/files/886f2b94ef01da96122745ae9b0b87b2.png"><img src="http://www.yuyak.com/blog/files/886f2b94ef01da96122745ae9b0b87b2.png" alt="" title="sc（2010-08-26 2.29.03）" width="434" height="331" class="alignnone size-full wp-image-499" /></a><br />
ここで、Tabキーを押すとそのフォルダ以下に入れる。</p>
<p><a href="http://www.yuyak.com/blog/files/87df2b39e34f5dbb607a70a9ea550b0c.png"><img src="http://www.yuyak.com/blog/files/87df2b39e34f5dbb607a70a9ea550b0c.png" alt="" title="sc（2010-08-26 2.29.14）" width="436" height="356" class="alignnone size-full wp-image-500" /></a><br />
ターミナルは、「ユーティリティ」フォルダ以下なので、「ユーティリティ」フォルダを選択してTabキー。</p>
<p><a href="http://www.yuyak.com/blog/files/c05d8a47b03c381a87b90bc7cbfa46a1.png"><img src="http://www.yuyak.com/blog/files/c05d8a47b03c381a87b90bc7cbfa46a1.png" alt="" title="sc（2010-08-26 2.29.22）" width="430" height="157" class="alignnone size-full wp-image-501" /></a><br />
この状態で「ter」と打つと「ターミナル」が出てきます。</p>
<p>すると次回からは上記のめんどくさいステップを踏まなくとも「ter」だけで「ターミナル」が出てくるようになります！</p>
<h3>関連リンク</h3>
<ul>
<li><a href="http://code.google.com/p/qsb-mac/">qsb-mac &#8211; Project Hosting on Google Code</a></li>
<li><a href="http://journal.mycom.co.jp/column/osx/311/index.html">【コラム】OS X ハッキング! (311) QSBのちょっとイカレ^Hした使い方 | パソコン | マイコミジャーナル</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.yuyak.com/blog/2010/08/26/497/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPressのネットワーク機能で予約語のblogを使う方法</title>
		<link>http://www.yuyak.com/blog/2010/08/25/487/</link>
		<comments>http://www.yuyak.com/blog/2010/08/25/487/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 18:37:25 +0000</pubDate>
		<dc:creator>yuyak</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.yuyak.com/blog/?p=487</guid>
		<description><![CDATA[WordPress3.0からは複数ブログを設置できるようになりました。
ですが、そのブログ名には登録できない名前（いわゆる予約語）があり、もしその予約語で登録しようとすると、以下のようなエラーメッセージが表示されます。
 [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress3.0からは複数ブログを設置できるようになりました。</p>
<p>ですが、そのブログ名には登録できない名前（いわゆる予約語）があり、もしその予約語で登録しようとすると、以下のようなエラーメッセージが表示されます。</p>
<p><span style="color: #ff0000;">以下の語句は WordPress の機能によって予約されており、ブログ名として使うことはできません: page, comments, blog, files, feed</span></p>
<p>しかし、この中にあるblogという予約語ですが、実はこれって互換性のために予約語として残してあったとかだったと思うのですよね。だから別に使っても大した問題はなかったはず…ですので使えるようにしちゃいましょう。</p>
<p>バージョン: WordPress 3.0.1 ja</p>
<p>以下、修正点です。</p>
<h4>/wp-includes/ms-functions.php</h4>
<p>516行目</p>
<pre class="prettyprint"><code>$illegal_names = array_merge($illegal_names, apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) ) );</code></pre>
<p>↓</p>
<pre class="prettyprint"><code>$illegal_names = array_merge($illegal_names, apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'files', 'feed' ) ) );</code></pre>
<h4>/wp-admin/ms-edit.php:</h4>
<p>154行目</p>
<pre class="prettyprint"><code>$subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) );</code></pre>
<p>↓</p>
<pre class="prettyprint"><code>$subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'files', 'feed' ) );</code></pre>
<h4>/wp-includes/ms-settings.php</h4>
<p>72行目</p>
<pre class="prettyprint"><code>$reserved_blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' );</code></pre>
<p>↓</p>
<pre class="prettyprint"><code>$reserved_blognames = array( 'page', 'comments', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' );</code></pre>
<p>配列から&#8217;blog&#8217;を取り除いていくだけです。簡単ですね。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yuyak.com/blog/2010/08/25/487/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS Xにfortuneをインストール</title>
		<link>http://www.yuyak.com/blog/2010/08/19/476/</link>
		<comments>http://www.yuyak.com/blog/2010/08/19/476/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 17:04:56 +0000</pubDate>
		<dc:creator>yuyak</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://www.yuyak.com/blog/?p=476</guid>
		<description><![CDATA[Macにはデフォルトでfortuneが入っていない。
というわけでfortuneをportでインストールしてみる。
% sudo port install fortune
---&#62;  Computing depen [...]]]></description>
			<content:encoded><![CDATA[<p>Macにはデフォルトでfortuneが入っていない。<br />
というわけでfortuneをportでインストールしてみる。</p>
<pre class="prettyprint"><code>% sudo port install fortune
---&gt;  Computing dependencies for fortune
---&gt;  Fetching fortune
---&gt;  Attempting to fetch fortune-6.2.0-RELEASE.tar.bz2 from http://distfiles.macports.org/fortune
---&gt;  Verifying checksum(s) for fortune
---&gt;  Extracting fortune
---&gt;  Applying patches to fortune
---&gt;  Configuring fortune
---&gt;  Building fortune
---&gt;  Staging fortune into destroot
---&gt;  Installing fortune @6.2.0-RELEASE_0
---&gt;  Activating fortune @6.2.0-RELEASE_0
---&gt;  Cleaning fortune</code></pre>
<p>無事、インストール成功。</p>
<p>実行してみるとありがたい名言が見れます。</p>
<pre class="prettyprint"><code>% fortune
Hoare's Law of Large Problems:
	Inside every large problem is a small
	problem struggling to get out.
</code></pre>
<pre class="prettyprint"><code>% fortune
The world is coming to an end.  Please log off.
</code></pre>
<p>ありがたやありがたや。</p>
<p>~/.zshrcとかにfortuneって書いておくと名言が定期的に見れますよ！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yuyak.com/blog/2010/08/19/476/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;The program being debugged is not being run&#8221;と表示されてXCodeで実機テスト中のiPhoneアプリが落ちる</title>
		<link>http://www.yuyak.com/blog/2010/07/06/464/</link>
		<comments>http://www.yuyak.com/blog/2010/07/06/464/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 16:19:59 +0000</pubDate>
		<dc:creator>yuyak</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.yuyak.com/blog/?p=464</guid>
		<description><![CDATA[XCodeでiPhoneの実機テストをしようとすると、アプリの起動画面が表示されるがすぐ落ちて、XCodeのエラーメッセージには「The program being debugged is not being run」と [...]]]></description>
			<content:encoded><![CDATA[<p>XCodeでiPhoneの実機テストをしようとすると、アプリの起動画面が表示されるがすぐ落ちて、XCodeのエラーメッセージには「The program being debugged is not being run」と表示されることがあります。</p>
<p>これには、以下のような原因が考えられます。</p>
<blockquote><p>構成が Debug 以外になっている<br />
プロビジョニングファイルの期限が切れている</p></blockquote>
<p><a href="http://iphone-dev.g.hatena.ne.jp/laiso/20100305/1267789308">laiso &#8211; iPhoneアプリ開発グループ</a>より引用。</p>
<p>その他にも違うバージョンのアプリがすでに入っている場合にも同じようなことが起きます。</p>
<h3>参考リンク</h3>
<ol>
<li><a href="http://iphone-dev.g.hatena.ne.jp/laiso/20100305/1267789308">Q: Xcodeビルドして実機デバッギはじめると &quot;The program being debugged is not being run.&quot; とかでて即終了してしまうよ！ &#8211; laiso &#8211; iPhoneアプリ開発グループ</a></li>
<li><a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/51071-error-debugger-program-being-debugged-not-being-run.html">Error from Debugger: The program being debugged is not being run. &#8211; iPhone Dev SDK Forum</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.yuyak.com/blog/2010/07/06/464/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPhoneアプリのテンプレートを作ってみる</title>
		<link>http://www.yuyak.com/blog/2010/07/03/457/</link>
		<comments>http://www.yuyak.com/blog/2010/07/03/457/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 08:28:50 +0000</pubDate>
		<dc:creator>yuyak</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://www.yuyak.com/blog/?p=457</guid>
		<description><![CDATA[XCodeでiPhone OSの新規プロジェクトを作るとき、いつもxibファイルを抹消する作業から始めるのが煩いので、抹消済みのテンプレートがほしい！と思ったので作ってみました。
そんなわけで、iPhoneアプリのテンプ [...]]]></description>
			<content:encoded><![CDATA[<p>XCodeでiPhone OSの新規プロジェクトを作るとき、いつもxibファイルを抹消する作業から始めるのが煩いので、抹消済みのテンプレートがほしい！と思ったので作ってみました。</p>
<p>そんなわけで、iPhoneアプリのテンプレートの作り方。</p>
<p>ちなみに、完成予想図は以下の通り。<br />
<a href="http://www.yuyak.com/blog/files/sc-2010-06-30-at-12.21.03.png"><img src="http://www.yuyak.com/blog/files/sc-2010-06-30-at-12.21.03-475x381.png" alt="" title="sc 2010-06-30 at 12.21.03" width="475" height="381" class="alignnone size-large wp-image-458" /></a></p>
<h3>まずはそれぞれの場所</h3>
<p>ベースとなるiPhone OSのテンプレート</p>
<pre>/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application</pre>
<p>ベースとなるMac OS Xのテンプレート</p>
<pre>/Developer/Library/Xcode/Project Templates</pre>
<p>今回作るユーザーテンプレートの保存場所</p>
<pre>/Library/Application Support/Developer/Shared/Xcode/Project Templates</pre>
<h3>作り方</h3>
<p>XCodeはiPhone OSという名称を貫き通す感じだと思いますが、せっかくなのでフォルダ名をiOSとしてみます。<br />
以下のコマンドで出来上がります。<br />
今回は、iPhone OSのView-based Applicationをベースにしました。</p>
<pre><code>% cd /Library/Application\ Support/Developer/Shared/Xcode/Project\ Templates
% mkdir iOS
% cd iOS
% sudo cp -R /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project\ Templates/Application/View-based\ Application ./</code></pre>
<p>あとは、自分の思うがままにいじりまくったらOKです！</p>
<h3>参考リンク</h3>
<ol>
<li><a href="http://d.hatena.ne.jp/tsurushuu/20081027/1225131379">xcodeでテンプレート &#8211; tsurushuuの日記</a></li>
<li><a href="http://d.hatena.ne.jp/griffin-stewie/20090315/p1">Xcodeのテンプレートを作成 &#8211; griffin-stewieの日記</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.yuyak.com/blog/2010/07/03/457/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-Cで二次元配列を扱う</title>
		<link>http://www.yuyak.com/blog/2010/07/02/452/</link>
		<comments>http://www.yuyak.com/blog/2010/07/02/452/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 16:54:10 +0000</pubDate>
		<dc:creator>yuyak</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.yuyak.com/blog/?p=452</guid>
		<description><![CDATA[クラスのプロパティに二次元配列を持たせます。
ここでは、メモリを動的に確保する方向でいきます（そんなわけで、実際はただのポインタのポインタ）。
ArrayClass.h
@interface ArrayClass : N [...]]]></description>
			<content:encoded><![CDATA[<p>クラスのプロパティに二次元配列を持たせます。<br />
ここでは、メモリを動的に確保する方向でいきます（そんなわけで、実際はただのポインタのポインタ）。</p>
<h4>ArrayClass.h</h4>
<pre class="prettyprint"><code>@interface ArrayClass : NSObject {
  char **array;
}

@property (nonatomic) char **array;

@end</code></pre>
<h4>ArrayClass.m</h4>
<pre class="prettyprint"><code>@implementation ArrayClass

@synthesize array;

-(id)init {
  self = [super init];

  if (self) {
    array = (char**)malloc(sizeof(char*)*10);
    for (int i = 0; i &lt; 10; i++) {
      array[i] = (char*)malloc(sizeof(char)*15);
    }
  }

  return self;
}

-(void)dealloc {
  for (int i = 0 ; i &lt; 10; i++) {
    free(array[i]);
  }
  free(array);
  [super dealloc];
}

@end</code></pre>
<p>こうすることで、</p>
<pre class="prettyprint"><code>ArrayClass *obj = [[[ArrayClass alloc] init] autorelease];
obj.array[0][1] = 1;</code></pre>
<p>のように扱うことができます。</p>
<h3>参考リンク</h3>
<ol>
<li><a href="http://www.aso.ecei.tohoku.ac.jp/~shun/multi_dim.html">Dynamic allocation of two dimensional array by C</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.yuyak.com/blog/2010/07/02/452/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MacBookで日本語入力ができなくなった</title>
		<link>http://www.yuyak.com/blog/2010/05/28/439/</link>
		<comments>http://www.yuyak.com/blog/2010/05/28/439/#comments</comments>
		<pubDate>Thu, 27 May 2010 17:29:30 +0000</pubDate>
		<dc:creator>yuyak</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.yuyak.com/blog/?p=439</guid>
		<description><![CDATA[僕のMacBookでは、「かなキー」を押すと日本語入力モード、「英数キー」を押すと英語入力モードになる（ちなみに、Google日本語入力）のですが、いくら「かなキー」を押しても日本語入力モードに変わらなくなってしまいまし [...]]]></description>
			<content:encoded><![CDATA[<p>僕のMacBookでは、「かなキー」を押すと日本語入力モード、「英数キー」を押すと英語入力モードになる（ちなみに、Google日本語入力）のですが、いくら「かなキー」を押しても日本語入力モードに変わらなくなってしまいました。ずっと英語入力モードのままなわけなのです。</p>
<p>さすがにそれではちょっと困るので、色々試した挙句、Activity Monitorを開いて調べると、QuicksilverのCPU使用率が89%とかいってました。</p>
<p>案の定、Quicksilverの例の窓が出てこない。。<br />
（ちなみに、この状態でQuicksilverのショートカットキーを打ちまくると、後でその回数分、開いたり閉じたりを繰り返してどえらい二次災害が発生します）</p>
<p>そんなわけで、Quicksilverを強制終了して、「かなキー」を押すと、無事、日本語入力モードにができるようになりました。</p>
<p>とまぁ、今回QuickSilverだけを槍玉に挙げましたが、実際のところ、他のアプリでもそれが暴走状態にあると、モードの変更ができないみたいです。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yuyak.com/blog/2010/05/28/439/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#でのINIファイルの操作</title>
		<link>http://www.yuyak.com/blog/2010/05/28/433/</link>
		<comments>http://www.yuyak.com/blog/2010/05/28/433/#comments</comments>
		<pubDate>Thu, 27 May 2010 17:16:47 +0000</pubDate>
		<dc:creator>yuyak</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.yuyak.com/blog/?p=433</guid>
		<description><![CDATA[C#.NETには、標準ではINIファイルを簡単に利用できるクラスが存在していない。というのも.NETでは、INIファイルの使用が推奨されていないからだ。
そんなわけで「＠IT：.NET TIPS INIファイルを読み書き [...]]]></description>
			<content:encoded><![CDATA[<p>C#.NETには、標準ではINIファイルを簡単に利用できるクラスが存在していない。というのも.NETでは、INIファイルの使用が推奨されていないからだ。</p>
<p>そんなわけで「<a href="http://www.atmarkit.co.jp/fdotnet/dotnettips/039inifile/inifile.html">＠IT：.NET TIPS INIファイルを読み書きするには？ &#8211; C#</a>」を参考にクラスを書いてみました。</p>
<pre class="prettyprint"><code>using System;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;

namespace util
{
  class IniFileManager
  {
    #region Member

    private string path;

    #endregion
    #region Accessor

    public string Path
    {
      set { path = value; }
      get { return path; }
    }

    #endregion
    #region Contructor

    /// &lt;summary&gt;
    /// コンストラクタ
    /// &lt;/summary&gt;
    public IniFileManager()
    {

    }

    /// &lt;summary&gt;
    /// コンストラクタ
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;path&quot;&gt;INIファイルのパス&lt;/param&gt;
    public IniFileManager(string path)
    {
      Path = path;
    }

    #endregion
    #region Public Method

    /// &lt;summary&gt;
    /// プロパティを書き込む
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;path&quot;&gt;INIファイルのパス&lt;/param&gt;
    public void writeProperty (string section, string key, string property)
    {
      WritePrivateProfileString(section, key, property, path);
    }

    /// &lt;summary&gt;
    /// セクションとキーからプロパティを取得する
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;path&quot;&gt;INIファイルのパス&lt;/param&gt;
    /// &lt;returns&gt;指定したセクション内にあるキーのプロパティ&lt;/returns&gt;
    public string getProperty(string section, string key) {
      StringBuilder sb = new StringBuilder(1024);
      GetPrivateProfileString(section, key, &quot;&quot;, sb, (uint)sb.Capacity, path);
      return sb.ToString();
    }

    /// &lt;summary&gt;
    /// セクションとキーから整数としてプロパティを取得する
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;path&quot;&gt;INIファイルのパス&lt;/param&gt;
    /// &lt;returns&gt;指定したセクション内にあるキーの整数プロパティ&lt;/returns&gt;
    public int getPropertyInt(string section, string key)
    {
      return (int)GetPrivateProfileInt(section, key, 0, path);
    }

    /// &lt;summary&gt;
    /// セクション一覧を取得する
    /// &lt;/summary&gt;
    /// &lt;returns&gt;セクション一覧&lt;/returns&gt;
    public String[] getSections()
    {
      byte[] b = new byte[1024];

      uint resultSize = GetPrivateProfileStringByByteArray(null, null, &quot;&quot;, b, (uint)b.Length, path);

      if (resultSize == 0)
      {
        return null;
      }

      string result = Encoding.Default.GetString(b, 0, (int)resultSize - 1);

      return result.Split(&#39;&#39;);
    }

    /// &lt;summary&gt;
    /// セクションからキー一覧を取得する
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;section&quot;&gt;セクション名&lt;/param&gt;
    /// &lt;returns&gt;指定したセクション内にあるキー一覧&lt;/returns&gt;
    public string[] getKeys(string section)
    {
      byte[] b = new byte[1024];

      uint resultSize = GetPrivateProfileStringByByteArray(
        section, null, &quot;&quot;, b, (uint)b.Length, path);

      if (resultSize == 0)
      {
        return null;
      }

      string result = Encoding.Default.GetString(b, 0, (int)resultSize - 1);

      return result.Split(&#39;&#39;);
    }

    /// &lt;summary&gt;
    /// 指定したセクション内にあるキーのプロパティを削除する
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;section&quot;&gt;セクション名&lt;/param&gt;
    /// &lt;param name=&quot;key&quot;&gt;キー&lt;/param&gt;
    public void removeAt(string section, string key)
    {
      WritePrivateProfileString(section, key, null, path);
    }

    /// &lt;summary&gt;
    /// 指定したセクション内にあるキーをすべて削除する
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;section&quot;&gt;セクション名&lt;/param&gt;
    public void removeAt(string section)
    {
      WritePrivateProfileString(section, null, null, path);
    }

    #endregion
    #region KERNEL32.DLL

    [DllImport(&quot;KERNEL32.DLL&quot;)]
    public static extern uint
     GetPrivateProfileString(string lpAppName,
     string lpKeyName, string lpDefault,
     StringBuilder lpReturnedString, uint nSize,
     string lpFileName);

    [DllImport(&quot;KERNEL32.DLL&quot;,
      EntryPoint = &quot;GetPrivateProfileString&quot;)]
    public static extern uint
     GetPrivateProfileStringByByteArray(string lpAppName,
     string lpKeyName, string lpDefault,
     byte[] lpReturnedString, uint nSize,
     string lpFileName);

    [DllImport(&quot;KERNEL32.DLL&quot;)]
    public static extern uint
     GetPrivateProfileInt(string lpAppName,
     string lpKeyName, int nDefault, string lpFileName);

    [DllImport(&quot;KERNEL32.DLL&quot;)]
    public static extern uint WritePrivateProfileString(
     string lpAppName,
     string lpKeyName,
     string lpString,
     string lpFileName);

    #endregion
  }
}</code></pre>
<h3>注意</h3>
<p>どのプロパティをゲットしようとしても、nullが返ってくる場合、ファイルパスが誤ってる可能性があります。<br />
筆者の場合、それでかなり悩みました(&#8216;A`)</p>
<h3>参考リンク</h3>
<ol>
<li><a href="http://uchukamen.com/Programming/iniFile/">C# Programming</a></li>
<li><a href="http://www.atmarkit.co.jp/fdotnet/dotnettips/039inifile/inifile.html">＠IT：.NET TIPS INIファイルを読み書きするには？ &#8211; C#</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.yuyak.com/blog/2010/05/28/433/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhoneアプリにAdMob広告を追加する方法</title>
		<link>http://www.yuyak.com/blog/2010/04/30/421/</link>
		<comments>http://www.yuyak.com/blog/2010/04/30/421/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 18:59:54 +0000</pubDate>
		<dc:creator>yuyak</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[AdMob]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.yuyak.com/blog/?p=421</guid>
		<description><![CDATA[ここでは、プログラム的に追加する（Interface Builderを一切使わない）方法を説明します。
こちらの環境は以下の通りです。
Mac OS X 10.6.3
Xcode 3.2.2
iPhoneシミュレータ 3 [...]]]></description>
			<content:encoded><![CDATA[<p>ここでは、プログラム的に追加する（Interface Builderを一切使わない）方法を説明します。</p>
<p>こちらの環境は以下の通りです。</p>
<p>Mac OS X 10.6.3<br />
Xcode 3.2.2<br />
iPhoneシミュレータ 3.1.3</p>
<h3>プロジェクトのセットアップ</h3>
<p>Xcodeで、プロジェクトを作成します（View-based Applicationを選択）。</p>
<p>プロジェクト名は、「AdMob」としました。</p>
<p><a href="http://www.yuyak.com/blog/files/sc.png"><img src="http://www.yuyak.com/blog/files/sc-475x394.png" title="sc" width="475" height="394" class="alignnone size-large wp-image-422" /></a></p>
<p>Frameworksグループを右クリックして[追加] -&gt; [既存のフレームワーク]で、以下のフレームワークを追加します。</p>
<ul>
<li>AudioToolbox.framework</li>
<li>QuartzCore.framework</li>
<li>MediaPlayer.framework</li>
<li>MessageUI.framework</li>
</ul>
<p>続いて、AdMobのサイトでダウンロードしてきたiPhone用のAdMobのSDKに含まれている以下の二つをプロジェクトに追加します（FinderからXcodeプロジェクトにドラッグアンドドロップで追加できます）。</p>
<ul>
<li>AdMob</li>
<li>TouchJSON</li>
</ul>
<p><a href="http://www.yuyak.com/blog/files/sc-11.png"><img src="http://www.yuyak.com/blog/files/sc-11.png" title="sc-1" width="414" height="388" class="alignnone size-full wp-image-423" /></a></p>
<p>このとき、「デスティネーショングループのフォルダに項目をコピーする（必要な場合）」にチェックが入っていることを確認し、[追加]を選択します。</p>
<h3>InterFace Builderを使わないための設定</h3>
<p>Resourceの中にある以下の2ファイルを削除します。</p>
<ul>
<li>AdMobViewController.xib</li>
<li>MainWindow.nib</li>
</ul>
<p>そして、Admob-info.plistの中の「Main nib file base name」という行を削除します。</p>
<p>続いて、Other Sources/main.mを以下のように書きかえます。</p>
<pre class="prettyprint"><code>int retVal = UIApplicationMain(argc, argv, nil, nil);</code></pre>
<pre class="prettyprint"><code>int retVal = UIApplicationMain(argc, argv, nil, @"AdMobAppDelegate");</code></pre>
<p>そして、Classes/AdMobAppDelegate.mを以下のように書きかえます。</p>
<pre class="prettyprint"><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

  // Override point for customization after app launch
  [window addSubview:viewController.view];
  [window makeKeyAndVisible];

  return YES;
}</code></pre>
<p>↓</p>
<pre class="prettyprint"><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  CGRect frame = [[UIScreen mainScreen] bounds];
  window = [[UIWindow alloc] initWithFrame:frame];

  viewController = [[AdMobViewController alloc] init];

  // Override point for customization after app launch
  [window addSubview:viewController.view];
  [window makeKeyAndVisible];

  return YES;
}</code></pre>
<h3>実装</h3>
<p>実際にAdMobを組み込む処理を追加します。AdMobのSDKに含まれているサンプルを参考にしました。</p>
<h4>Classes/AdMobViewController.h</h4>
<pre class="prettyprint"><code>#define AD_REFRESH_PERIOD 12.5 // display fresh ads every 12.5 seconds

#import &lt;UIKit/UIKit.h&gt;
#import &quot;AdMobView.h&quot;
#import &quot;AdMobAppDelegate.h&quot;
#import &quot;AdMobDelegateProtocol.h&quot;

@interface AdMobViewController : UIViewController&lt;AdMobDelegate&gt; {
  AdMobView *adMobAd;
  NSTimer *refreshTimer;
}

@end</code></pre>
<h4>Classes/AdMobViewController.m</h4>
<pre class="prettyprint"><code>#import &quot;AdMobViewController.h&quot;

@implementation AdMobViewController

/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
  if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
    // Custom initialization
  }
  return self;
}
*/

// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
  // get the window frame here.
  CGRect appFrame = [UIScreen mainScreen].applicationFrame;

  UIView *view = [[UIView alloc] initWithFrame:appFrame];
  // making flexible because this will end up in a navigation controller.
  view.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  self.view = view;

  [view release];

  // Request an ad
  adMobAd = [AdMobView requestAdWithDelegate:self]; // start a new ad request
  [adMobAd retain]; // this will be released when it loads (or fails to load)
}

- (NSString *)publisherId {
  return @&quot;a14bd9a27f5f572&quot;; // this should be prefilled; if not, get it from www.admob.com
}

- (UIViewController *)currentViewController {
  return self;
}

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
  [super viewDidLoad];
}
*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  // Return YES for supported orientations
  return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
  // Releases the view if it doesn&#39;t have a superview.
  [super didReceiveMemoryWarning];

  // Release any cached data, images, etc that aren&#39;t in use.
}

- (void)viewDidUnload {
  // Release any retained subviews of the main view.
  // e.g. self.myOutlet = nil;
}

- (void)didReceiveAd:(AdMobView *)adView {
  NSLog(@&quot;AdMob: Did receive ad&quot;);
  // get the view frame
  CGRect frame = self.view.frame;

  // put the ad at the bottom of the screen
  adMobAd.frame = CGRectMake(0, frame.size.height - 48, frame.size.width, 48);

  [self.view addSubview:adMobAd];
  [refreshTimer invalidate];
  refreshTimer = [NSTimer scheduledTimerWithTimeInterval:AD_REFRESH_PERIOD target:self selector:@selector(refreshAd:) userInfo:nil repeats:YES];
}

- (void)refreshAd:(NSTimer *)timer {
  [adMobAd requestFreshAd];
}

// Sent when an ad request failed to load an ad
- (void)didFailToReceiveAd:(AdMobView *)adView {
  NSLog(@&quot;AdMob: Did fail to receive ad&quot;);
  [adMobAd removeFromSuperview];  // Not necessary since never added to a view, but doesn&#39;t hurt and is good practice
  [adMobAd release];
  adMobAd = nil;
  // we could start a new ad request here, but in the interests of the user&#39;s battery life, let&#39;s not
}

- (void)dealloc {
  [super dealloc];
}

@end</code></pre>
<h3>いざ実行！</h3>
<p>実行してみるとこんな感じになると思います。<br />
<a href="http://www.yuyak.com/blog/files/sc-21.png"><img src="http://www.yuyak.com/blog/files/sc-21-376x700.png" alt="" title="sc-2" width="376" height="700" class="alignnone size-large wp-image-424" /></a><br />
下の方に広告が表示されていますね！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yuyak.com/blog/2010/04/30/421/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Macでダイアログのフォーカス移動をTabキーで行えるようにする</title>
		<link>http://www.yuyak.com/blog/2010/04/30/411/</link>
		<comments>http://www.yuyak.com/blog/2010/04/30/411/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 17:32:27 +0000</pubDate>
		<dc:creator>yuyak</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.yuyak.com/blog/?p=411</guid>
		<description><![CDATA[
Macを常用していると、上のような画面がよく出ると思うのですが、いちいちマウスで[保存]とか[キャンセル]選択するのはめんどくさいですよね。
Windowsとかだと、デフォルトでTabキー押すとフォーカス移動、そしてE [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.yuyak.com/blog/files/sc-3.png"><img src="http://www.yuyak.com/blog/files/sc-3.png" title="sc-3" width="466" height="145" class="alignnone size-full wp-image-412" /></a></p>
<p>Macを常用していると、上のような画面がよく出ると思うのですが、いちいちマウスで[保存]とか[キャンセル]選択するのはめんどくさいですよね。</p>
<p>Windowsとかだと、デフォルトでTabキー押すとフォーカス移動、そしてEnterでフォーカスの当たってるボタンを選択できるようになっているのですが、Macではその機能がデフォルトOffになっている模様。</p>
<p>そんなわけで、以下はその設定方法です。</p>
<p>左上の[林檎マーク] -&gt; [システム環境設定] -&gt; [キーボード] と進んでいき、</p>
<p><a href="http://www.yuyak.com/blog/files/sc-1.png"><img src="http://www.yuyak.com/blog/files/sc-1-475x342.png" title="sc-1" width="475" height="342" class="alignnone size-large wp-image-413" /></a></p>
<p>下の方にある「すべてのコントロール」を選択するだけです。</p>
<p><a href="http://www.yuyak.com/blog/files/sc-2.png"><img src="http://www.yuyak.com/blog/files/sc-2-475x429.png" title="sc-2" width="475" height="429" class="alignnone size-large wp-image-414" /></a></p>
<p>これで、快適Tabキー生活が送れるようになれます！</p>
<h3>参考リンク</h3>
<ol>
<li><a href="http://wakabamac.blog95.fc2.com/blog-entry-831.html">わかばマークのMacの備忘録 : Open· Saveダイアログ ではいろいろ操作できる</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.yuyak.com/blog/2010/04/30/411/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
