<?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>Code? - Design?</title>
	<atom:link href="http://wizard.st/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://wizard.st/blog</link>
	<description></description>
	<lastBuildDate>Wed, 19 Nov 2014 04:20:28 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WordPressの投稿記事に有効期限を設ける</title>
		<link>http://wizard.st/blog/archives/170</link>
		<comments>http://wizard.st/blog/archives/170#comments</comments>
		<pubDate>Mon, 06 Feb 2012 18:40:33 +0000</pubDate>
		<dc:creator>motodimago</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wizard.st/blog/?p=170</guid>
		<description><![CDATA[チャオ！ WordPressの投稿記事に有効期限を付けたくて検索すると日本語ではPost Expiratorを使う記事ばっかりだった。 でもWordPress 3.3.1だとなんか上手くうごかなかった。 あと動いてもPo [...]]]></description>
			<content:encoded><![CDATA[<p>チャオ！</p>
<p>WordPressの投稿記事に有効期限を付けたくて検索すると日本語ではPost Expiratorを使う記事ばっかりだった。<br />
でもWordPress 3.3.1だとなんか上手くうごかなかった。<br />
あと動いてもPost Expiratorだと時刻を-9時間しないといけなかったするらしい・・・・。</p>
<p>そこでおすすめなのが<strong>Simple expires</strong>ってヤツです！<br />
有効期限日時も<strong>日本の時間いれまくりで問題ナッシング！</strong></p>
<h3>インストール</h3>
<p>インストールはプラグインの新規追加でSimple expiresを入れて検索して今すぐインストールをクリックするだけ！</p>
<p><a href="http://wizard.st/blog/wp-content/uploads/2012/02/wp-SimpleExpires1.gif"><img src="http://wizard.st/blog/wp-content/uploads/2012/02/wp-SimpleExpires1-300x173.gif" alt="" title="wordpress simpleexipresインストール" width="300" height="173" class="aligncenter size-medium wp-image-172" /></a></p>
<h3>使い方</h3>
<p>投稿記事に下記のようなボックスがあらわれるので、Enabledを選択して公開終了日時を入れるだけでOKです。</p>
<p><a href="http://wizard.st/blog/wp-content/uploads/2012/02/wp-SimpleExpires2.gif"><img src="http://wizard.st/blog/wp-content/uploads/2012/02/wp-SimpleExpires2-300x261.gif" alt="" title="wordpress simpleexipres使用" width="300" height="261" class="aligncenter size-medium wp-image-173" /></a></p>
<p>記事の有効期限や有効・無効は下記な感じでとれます。</p>
<pre>
while ( have_posts() ) : the_post(); 

// 有効期限を有効にしているか
get_post_meta($post->ID, 'scadenza-enable', true);

// 有効期限の日付
get_post_meta($post->ID, 'scadenza-date', true);

endwhile; // End the loop. Whew.
</pre>
<h3>おまけ　有効期限順にソートする</h3>
<p>カッコイイ実装じゃないけどこんな感じで有効期限でソートできると思います。</p>
<pre>
<?php
  $loop = 0;
  $tmp = array(); // 記事の一時格納
  $sort = array(); // ソートに仕様するデータのいれ場所

  while ( have_posts() ) : the_post();
    // もし有効期限があればソートターゲットに有効期限を入れる
    if ( get_post_meta($post->ID, 'scadenza-enable', true) ) {
      $sort[$loop]['expireDate'] = strtotime(get_post_meta($post->ID, 'scadenza-date', true));
    // 有効期限がなければおっきい数字を入れる
    } else {
      $sort[$loop]['expireDate'] = 9999999999;
    }
    // 記事のリンクを貯めておく
    $tmp[$loop] = '<a href="'.get_permalink().'">'.get_the_post_thumbnail($post->ID).the_title('','',false).'</a>';
    $loop++;
  endwhile; // End the loop. Whew.

  // 有効期限でソートして表示する
  if ($tmp) {
    array_multisort($sort, SORT_ASC, $tmp);
    foreach($tmp as $post) {
      echo $post;
    }
  }
?>
</pre>
<p>&nbsp;</p>
<p>WordPressの投稿記事の有効期限はSimple expiresで決まりだね！</p>
]]></content:encoded>
			<wfw:commentRss>http://wizard.st/blog/archives/170/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhoneアプリから設定の位置情報サービス画面を開く</title>
		<link>http://wizard.st/blog/archives/165</link>
		<comments>http://wizard.st/blog/archives/165#comments</comments>
		<pubDate>Tue, 06 Dec 2011 15:32:39 +0000</pubDate>
		<dc:creator>motodimago</dc:creator>
				<category><![CDATA[iOS SDK]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://wizard.st/blog/?p=165</guid>
		<description><![CDATA[チャオ！ 位置情報を使うサービスで基本的には位置情報はいらないけど、 これを使うには絶対でいるの！！アンタさっき許可しなかったよね！！ ってことがありますね？もう一回ポップアップ出すものいいんですが、 アプリから本体の位 [...]]]></description>
			<content:encoded><![CDATA[<p>チャオ！</p>
<p>位置情報を使うサービスで基本的には位置情報はいらないけど、<br />
これを使うには絶対でいるの！！アンタさっき許可しなかったよね！！</p>
<p>ってことがありますね？もう一回ポップアップ出すものいいんですが、<br />
アプリから本体の位置情報サービス画面に誘導したいときってありません？</p>
<p>そんなときは</p>
<pre>
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]];
</pre>
<p>を呼ぶだけでOK!</p>
<p>DidViewLoadedとかに書くとページ開く瞬間にドッキリできますよ！</p>
<p>日本語のソース（iPhone開発やっている人で日本語で検索するなとか言わないで）<br />
がなかったので、書いてみました。</p>
<p>それじゃ！</p>
]]></content:encoded>
			<wfw:commentRss>http://wizard.st/blog/archives/165/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>navigationItemのUIBarButtonItemを好きな色にする</title>
		<link>http://wizard.st/blog/archives/156</link>
		<comments>http://wizard.st/blog/archives/156#comments</comments>
		<pubDate>Sun, 27 Nov 2011 10:34:53 +0000</pubDate>
		<dc:creator>motodimago</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://wizard.st/blog/?p=156</guid>
		<description><![CDATA[チャオ！ iOS5からはUIBarButtonItemにもtintColorが設定できるようになって超めでたしめでたしと思っていたらiOS4で死ねと言われて使えねーって状態になりました。 そこで画像とか用意しないで好きな [...]]]></description>
			<content:encoded><![CDATA[<p>チャオ！</p>
<p>iOS5からはUIBarButtonItemにもtintColorが設定できるようになって超めでたしめでたしと思っていたらiOS4で死ねと言われて使えねーって状態になりました。</p>
<p>そこで画像とか用意しないで好きな色のボタン置けないかと探してたらいい方法が！</p>
<p>以下な感じでやればOKです！</p>
<pre>
- (void)viewDidLoad {
[super viewDidLoad];
UIColor *color = [UIColor colorWithRed:0.30 green:0.70 blue:0.00 alpha:1.0];
self.navigationItem.rightBarButtonItem =
[self barButtonItemWithTint:color
                      title:@"test"
                     target:self
                   selector:@selector(test:)];
}

-(UIBarButtonItem *)barButtonItemWithTint:(UIColor *)color title:(NSString *)title target:(id)target selector:(SEL)selector
{
	UISegmentedControl *btn = [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:title, nil]] autorelease];
	btn.momentary = YES;
	btn.segmentedControlStyle = UISegmentedControlStyleBar;
	btn.tintColor = color;
	[btn addTarget:target action:selector forControlEvents:UIControlEventValueChanged];

	UIBarButtonItem *barBtn = [[[UIBarButtonItem alloc] initWithCustomView:btn] autorelease];

	return barBtn;
}
</pre>
<p>・・・・鬼の見づらさですね・・・<br />
ようはUIBarButtonItemにtintColorのあるsegmentedControlをつっこんで、代わりにしようねっ♪って感じです。</p>
<p>ただし角丸の通常ボタンしか駄目なので、戻るとかはやっぱ画像がいるんだろうな・・・</p>
<p>UIBarButtonItemを作ってくれる関数はどこからでも呼べるようにしているといいかと思います！</p>
<p>以下のサイトから学びました！<br />
<a href="http://fredandrandall.com/blog/2011/03/31/how-to-change-the-color-of-a-uibarbuttonitem/" target="_blank">How to change the color of a UIBarButtonItem</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wizard.st/blog/archives/156/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-Cでの色設定を簡単に行うサービスを作ったよ</title>
		<link>http://wizard.st/blog/archives/150</link>
		<comments>http://wizard.st/blog/archives/150#comments</comments>
		<pubDate>Sun, 13 Nov 2011 15:40:24 +0000</pubDate>
		<dc:creator>motodimago</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://wizard.st/blog/?p=150</guid>
		<description><![CDATA[チャオ！ Objective-Cで色を作るときに、Photoshopから取った色をいちいち255で割って入力することに疲れたのでそれ用のサービスを作りました！ 以下を設定しておくと色々楽できるのですが、 設定 #defi [...]]]></description>
			<content:encoded><![CDATA[<p>チャオ！</p>
<p>Objective-Cで色を作るときに、Photoshopから取った色をいちいち255で割って入力することに疲れたのでそれ用のサービスを作りました！</p>
<p>以下を設定しておくと色々楽できるのですが、</p>
<pre>設定
#define RGB(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]

使う時
text.color = RPG(255, 0, 0);</pre>
<pre></pre>
<p>グラデーションのとかで、どーしても色がいるんだよ！！とかあるので作りました。</p>
<p><a href="http://wizard.st/color/" target="_blank"><img class="size-full wp-image-151 aligncenter" title="Color Maker For Objective-C" src="http://wizard.st/blog/wp-content/uploads/2011/11/banner_color_objective-C.png" alt="" width="181" height="55" /></a></p>
<pre>
f00
ff0
</pre>
<p>とか改行で複数入れると複数の色を返してくれるよ！<br />
あとヒストリーに残るので、また使いたい！とかのとき便利なはず！</p>
<p>それじゃ！</p>
]]></content:encoded>
			<wfw:commentRss>http://wizard.st/blog/archives/150/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-CでNSArray配列の順番を逆にする</title>
		<link>http://wizard.st/blog/archives/142</link>
		<comments>http://wizard.st/blog/archives/142#comments</comments>
		<pubDate>Fri, 11 Nov 2011 16:04:09 +0000</pubDate>
		<dc:creator>motodimago</dc:creator>
				<category><![CDATA[iOS SDK]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://wizard.st/blog/?p=142</guid>
		<description><![CDATA[チャオ！ NSArrayで中身の順番を逆にしたい場合は以下でOKOKです！ NSArray *reverseAr = [[元配列 reverseObjectEnumerator] allObjects]; &#160;  [...]]]></description>
			<content:encoded><![CDATA[<p>チャオ！</p>
<p>NSArrayで中身の順番を逆にしたい場合は以下でOKOKです！</p>
<pre>NSArray *reverseAr = [[元配列 reverseObjectEnumerator] allObjects];</pre>
<p>&nbsp;</p>
<p>こんな感じで使います。</p>
<pre>NSArray *array = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", nil];
NSArray *reverseAr = [[array reverseObjectEnumerator] allObjects];

NSLog(@"%@\n%@", array, reverseAr);
array
(
    1,
    2,
    3,
    4
)
reverseAr
(
    4,
    3,
    2,
    1
)</pre>
<p>&nbsp;</p>
<p>以上！</p>
]]></content:encoded>
			<wfw:commentRss>http://wizard.st/blog/archives/142/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>魔法少女まどか☆マギカにでてくる入力インターフェースのライブラリー作ったー</title>
		<link>http://wizard.st/blog/archives/129</link>
		<comments>http://wizard.st/blog/archives/129#comments</comments>
		<pubDate>Wed, 09 Nov 2011 16:14:09 +0000</pubDate>
		<dc:creator>motodimago</dc:creator>
				<category><![CDATA[iOS SDK]]></category>
		<category><![CDATA[Library]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://wizard.st/blog/?p=129</guid>
		<description><![CDATA[魔法少女まどか☆マギカを見ていて何話のどのシーンか忘れちゃったんだけど、壁のタッチパネルをツルツルーって操作していて、なんかいいなと思ったのでそれが簡単に実装出来る感じのライブラリを作ってみた。 ちなみにマミさん押しです [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-116" title="まぎか☆スライダー" src="http://wizard.st/blog/wp-content/uploads/2011/11/magicasliderTitle.png" alt="" width="540" height="121" /></p>
<p>魔法少女まどか☆マギカを見ていて何話のどのシーンか忘れちゃったんだけど、壁のタッチパネルをツルツルーって操作していて、なんかいいなと思ったのでそれが簡単に実装出来る感じのライブラリを作ってみた。<br />
ちなみにマミさん押しです。</p>
<p><del datetime="2011-11-09T18:56:56+00:00">（何話のどの辺か分かっている人おせーて）</del><br />
‎6話で風呂の温度設定するシーンだとK氏が教えてくれた！<br />
デフォルトの色をそれにします！w</p>
<p>Objective-cです・・いろんな意味ですいません・・・・。<br />
でっでもiphoneとかipadとかで使えばいいじゃない！！<br />
Objective-c真面目にやりだしの最近だから色々突っ込んでくれたらうれしいんだからね！</p>
<p><a href="https://github.com/motodimago/MagicaSlider" target="MagicaSlider"><img class="size-full wp-image-133 aligncenter" title="btnMSdownload" src="http://wizard.st/blog/wp-content/uploads/2011/11/btnMSdownload.png" alt="" width="300" height="60" /></a></p>
<h3>インストール方法</h3>
<p>ダウンロードしたファイルにLibrayフォルダがあるので、それを自分のプロジェクトにコピーするだけOK！</p>
<h3>使い方</h3>
<p>基本的にはダウンロードしてサンプルのMagicaSlider.xcodeprojを見て<br />
貰えると大体わかるかと思うんですが一応以下な感じです。</p>
<pre>// ライブラリをインポート
#import "MagicaSlider.h"

// 各種設定を詰める（願いを決める）
NSMutableDictionary *wish1 = [NSMutableDictionary dictionary];
[wish1 setObject:@"90" forKey:@"defalutDeg"]; //例）初期値

// 設定と表示したい場所・サイズともにインスタンス化（願いと共に契約！）
MagicaSlider *soulGem = [[MagicaSlider alloc] contractWithWish:CGRectMake(10, 20, 170, 170) wish:wish1];

// スライダーを動かした場合のコールバックを設定（魔法を使う）
[soulGem setMagic:self magic:@selector(callBack1:)];

// ビューに追加（思いつかない・・・）
[self.view addSubview:soulGem];</pre>
<p>コールバックではNSNumberで</p>
<ul>
<li>円の場合は角度</li>
<li>バーの場合は横か縦のサイズ</li>
<li>STEPを設定している場合はstep数</li>
</ul>
<p>を返します。</p>
<h3>設定・デザインできる項目</h3>
<table>
<tbody>
<tr>
<th>キー</th>
<th>機能</th>
<th>設定例</th>
</tr>
<tr>
<th>defalutDeg</th>
<td>スライダーの初期値</td>
<td>@"15"</td>
</tr>
<tr>
<th>step</th>
<td>ステップ数</td>
<td>@"5"</td>
</tr>
<tr>
<th>type</th>
<td>円かバー</td>
<td>@"circle" @"bar"(デフォルトは円)</td>
</tr>
<tr>
<th>color</th>
<td>円・バーの色</td>
<td>@"255,0,125,0.1"</td>
</tr>
<tr>
<th>backgroundColor</th>
<td>背景の色</td>
<td>@"255,0,125,0.1"</td>
</tr>
<tr>
<th>offset</th>
<td>外側から円・バーまでの距離</td>
<td>@"5"</td>
</tr>
<tr>
<th>lineColor</th>
<td>枠線の色</td>
<td>@"255,0,125,0.1"</td>
</tr>
<tr>
<th>lineWidth</th>
<td>枠線の太さ</td>
<td>@"1"</td>
</tr>
<tr>
<th>vertical</th>
<td>バーの場合縦か</td>
<td>@"YES"</td>
</tr>
<tr>
<th>barRadius</th>
<td>バーの角丸</td>
<td>@"10"</td>
</tr>
<tr>
<th>backgroundRadius</th>
<td>バーの背景、枠線の角丸</td>
<td>@"10"</td>
</tr>
</tbody>
</table>
<p><strong>★STEPについて</strong><br />
STEPを設定すると、「全体 / STEP数」刻みでスライダーが増え、callbackに渡される数も0〜指定ステップ数になります。</p>
<p>例えば円の場合は通常0〜360まで1刻みで値が返ってきますが、stepを6に設定すると、スライダーの増え方が60度ごとになり<br />
callbackに返される数も0〜6になります。</p>
<p><strong>★typeについて</strong><br />
typeは何も設定しない場合は円です。circle以外の文字をいれるとバーになります。</p>
<p><strong>★各デザイン要素について</strong><br />
<span style="color: #ff0000;">色は@"R,G,B,透明度"を文字で渡してください。</span><br />
RGBは0〜255で、透明度は0.0〜1.0で指定してください。</p>
<p>デザインがらみの設定は以下な感じです。<br />
<img class="alignnone size-full wp-image-39" title="setting" src="http://wizard.st/blog/wp-content/uploads/2011/11/setting.png" alt="" width="420" height="470" /></p>
<h3>願いと共に契約とかキモい人へ</h3>
<p>以下でもできるかもねー(棒読み)</p>
<pre>MagicaSlider *ms = [[MagicaSlider alloc]
　　　　　　　　　　　　　initWithFrame:CGRectMake(10, 20, 300, 40)];
NSMutableDictionary *design = [NSMutableDictionary dictionary];
[design setObject:@"90" forKey:@"defalutDeg"];
[ms setDesign:design];
[ms addTarget:self action:@selector(callBack1:)];
[self.view addSubview:ms];</pre>
]]></content:encoded>
			<wfw:commentRss>http://wizard.st/blog/archives/129/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>犬でもわかるforsquareAPIの使い方</title>
		<link>http://wizard.st/blog/archives/88</link>
		<comments>http://wizard.st/blog/archives/88#comments</comments>
		<pubDate>Mon, 07 Nov 2011 15:57:51 +0000</pubDate>
		<dc:creator>motodimago</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[foursquare]]></category>

		<guid isPermaLink="false">http://wizard.st/blog/?p=88</guid>
		<description><![CDATA[チャオ！ foursquareAPIの使い方が簡単すぎて濡れた。 誰かの解説サイトも見ずに使いこなせるAPIなんて初めて♥（ビクンビクン） ってなわけで犬でもわかるforsquareAPIの使い方です。 現行のAPIでは [...]]]></description>
			<content:encoded><![CDATA[<p>チャオ！</p>
<p>foursquareAPIの使い方が簡単すぎて濡れた。</p>
<p>誰かの解説サイトも見ずに使いこなせるAPIなんて初めて♥（ビクンビクン）</p>
<p>ってなわけで犬でもわかるforsquareAPIの使い方です。</p>
<p>現行のAPIではユーザー情報とかは<strong><span style="color: #ff0000;">認証した本人のデータしか引っ張れない</span></strong>ので、あしからず！</p>
<p>APIを使ってユーザーの情報をとったり、チェックインをしたりするためにはaccess tokenって言う物がいるんですね。そのために、まずは「クライアントID(CLIENT ID)」と「シークレットキー(CLIENT SECRET)」を手に入れましょう〜。</p>
<p>以下のURLからログイン！アカウント持っていない人は作ればいいと思います！</p>
<p><a href="https://ja.foursquare.com/oauth/" target="_blank"></p>
<p>https://ja.foursquare.com/oauth/</p>
<p></a></p>
<p>右にある「REGISTER A NEW CONSUMER」をクリック！</p>
<p><a href="http://wizard.st/blog/wp-content/uploads/2011/11/api4sq1-1.png"><img class="alignnone size-full wp-image-94" title="api4sq1-1" src="http://wizard.st/blog/wp-content/uploads/2011/11/api4sq1-1.png" alt="" width="394" height="302" /></a></p>
<p>以下の３つを入れろって言われるから入れてね（全部必須）</p>
<p>あとで全部変えられるからガンガンいっちゃえばいいよ。</p>
<p><a href="http://wizard.st/blog/wp-content/uploads/2011/11/api4sq1-2.png"><img class="alignnone size-full wp-image-95" title="api4sq1-2" src="http://wizard.st/blog/wp-content/uploads/2011/11/api4sq1-2.png" alt="" width="533" height="405" /></a></p>
<p><strong>APPLICATION NAME</strong></p>
<p>アプリ・サービスの名前</p>
<p>（ユーザーに認証を求める時に表示されます。）</p>
<p><strong>APPLICATION WEB SITE</strong></p>
<p>アプリ・サービスのURL</p>
<p>（ユーザーに認証を求める時に表示されます。）</p>
<p><strong>CALLBACK URL</strong></p>
<p>認証後にaccess_tokenと共に戻って欲しいURL</p>
<p>入れて「RESISTER APPLICATION」を押すとトップに下記ような感じで「CLIENT ID」と「CLIENT SECRET」がゲットできます！</p>
<p><a href="http://wizard.st/blog/wp-content/uploads/2011/11/api4sq1-3.png"><img class="alignnone size-full wp-image-96" title="api4sq1-3" src="http://wizard.st/blog/wp-content/uploads/2011/11/api4sq1-3.png" alt="" width="581" height="201" /></a></p>
<p>これで用意が整いました！超簡単！</p>
<p>でわ早速アクセスして自分のチェックイン情報を取っちゃいましょう！</p>
<p>今回の例はjavascriptなので「CLIENT SECRET」は使いません！</p>
<p>サーバーサイドでやる場合は必要です！</p>
<p><strong><a href="https://developer.foursquare.com/docs/oauth.html" target="_blank">ここに超イケている例</a>があります！</strong></p>
<pre>ログインボタンを押すと下記が動くようにする。
function login()
{
	var ci = 'ゲットしたCLIENT ID';
	var ru = '認証後戻ってきて欲しいURL';
	var authUrl = 'https://foursquare.com/oauth2/authenticate?client_id='+ci+'&amp;response_type=token&amp;redirect_uri='+ru;
	location.href = authUrl;
}

認証後戻ってくるページ
$(function()
{
        var lh = location.hash;
	if (lh.indexOf('access_token') != -1) { //access_tokenがある場合
		var pos = lh.indexOf('=');

		// access_token を　access_tokenに入れる
		var access_token = lh.substring(pos+1);

		// 取りに行くAPIへのURLを作る
		var url = 'https://api.foursquare.com/v2/users/self/checkins';
		url += '?oauth_token=' + access_token;		

		// urlにアクセスして反てってきたjsonから名前を取り出してbodyに突っ込む
		$.getJSON(url, function(json){
			datas = json.response.checkins.items;
			var len = datas.length;

			for (var i = 0; i &lt; len; i++) {
				$('body').append(datas[i].venue.name);
			}
		});
	}
});</pre>
<p>こんな感じでガシガシ取れる！<span style="color: #ff0000;"><strong>認証した本人のデータだけ</strong></span>だけど！<br />
日付がUNXIタイムなのがちょっとだけ面倒だけど！</p>
<p><strong>どんなデータがとれるかとは<a href="https://developer.foursquare.com/docs/index_docs.html" target="_blank">ここを見ればいい感じ！</a></strong></p>
<p>あと、とりあえず試してみたい人向けにソースおいておきますね。</p>
<p>ソースの上の方にある'<strong>ゲットしたCLIENT ID</strong>'と'<strong>認証後戻ってきて欲しいURL</strong>'だけ書き換えて試してみてね♪</p>
<p>'認証後戻ってきて欲しいURL'は<strong>登録した時の戻り先URLと違うとおこられる</strong>からhttp://xxxxxx/sample.htmlとかにしないとだめだぞ♪</p>
<p><a href="./download/sample.html.zip">サンプルhtml(1.5kb)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wizard.st/blog/archives/88/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>foursquareAPIを使ってサービスを作ってみた</title>
		<link>http://wizard.st/blog/archives/78</link>
		<comments>http://wizard.st/blog/archives/78#comments</comments>
		<pubDate>Sun, 06 Nov 2011 11:58:48 +0000</pubDate>
		<dc:creator>motodimago</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[webサービス]]></category>

		<guid isPermaLink="false">http://wizard.st/blog/?p=78</guid>
		<description><![CDATA[チャオ！ foursquareAPIが素敵すぎたので、サービスを作ってみたよ！ 一応スマホ対応もしているよ！ foursquareにアップした画像を見れるだけのサービスなんで、 画像上げてない人は何も表示されないよー。  [...]]]></description>
			<content:encoded><![CDATA[<p>チャオ！</p>
<p>foursquareAPIが素敵すぎたので、サービスを作ってみたよ！</p>
<p>一応スマホ対応もしているよ！</p>
<p>foursquareにアップした画像を見れるだけのサービスなんで、<br />
画像上げてない人は何も表示されないよー。</p>
<p style="text-align: center;">
<a title="4sq album" href="http://wizard.st/4sq/" target="_blank"><img class="size-full wp-image-81" title="4sq album" src="http://wizard.st/blog/wp-content/uploads/2011/11/title.png" alt="4sq album" width="304" height="55" /><br />
4sq album</a>
</p>
<p>いいギャラリーライブラリーがなかったのと動きとかに手をかけすぎて<br />
おもったより時間かかっちゃったー。</p>
<p>次はpostするのも作りたいなぁー。</p>
]]></content:encoded>
			<wfw:commentRss>http://wizard.st/blog/archives/78/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-Cで経緯・緯度から２点間の距離を出す</title>
		<link>http://wizard.st/blog/archives/52</link>
		<comments>http://wizard.st/blog/archives/52#comments</comments>
		<pubDate>Fri, 04 Nov 2011 17:39:05 +0000</pubDate>
		<dc:creator>motodimago</dc:creator>
				<category><![CDATA[iOS SDK]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://wizard.st/blog/?p=52</guid>
		<description><![CDATA[チャオ！ Objective-cで２点間の距離を出すのは超簡単！ ２つのCLLocationデータから出すサンプルは結構あるんですが、経緯・緯度からってのがあんまりなかったので！って言っても簡単する過ぎて記事がすぐ終わり [...]]]></description>
			<content:encoded><![CDATA[<p>チャオ！</p>
<p>Objective-cで２点間の距離を出すのは超簡単！</p>
<p>２つのCLLocationデータから出すサンプルは結構あるんですが、経緯・緯度からってのがあんまりなかったので！って言っても簡単する過ぎて記事がすぐ終わりング</p>
<p>まず、以下のframeworkを突っ込んでおく。</p>
<pre>CoreLocation.framework</pre>
<p>&nbsp;</p>
<p>次に、距離を出したいファイル（*.hでも良いです）でCoreLocationをimport</p>
<pre>#import &lt;CoreLocation/CoreLocation.h&gt;</pre>
<p>&nbsp;</p>
<p>最後に下記で距離をゲット、距離は<strong>メートル</strong>で取れる感じです。<br />
（下記は大阪城から皇居までw）</p>
<pre>
// 2点の経緯・緯度を設定
double latA = 135.5258549;
double lngA = 34.6873527;
double latB = 139.75313186645508;
double lngB = 35.68525668970075;

// 経緯・緯度からCLLocationを作成
CLLocation *A = [[CLLocation alloc] initWithLatitude:latA longitude:lngA];
CLLocation *B = [[CLLocation alloc] initWithLatitude:latB longitude:lngB];

//　距離を取得
CLLocationDistance distance = [A distanceFromLocation:B];

// お約束の開放
[A release];
[B release];

// 距離をコンソールに表示
NSLog(@"distance:%f", distance);
</pre>
<p>以上！<br />
簡単だね♪</p>
]]></content:encoded>
			<wfw:commentRss>http://wizard.st/blog/archives/52/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>tableViewの上にIndicatorViewなどを表示</title>
		<link>http://wizard.st/blog/archives/5</link>
		<comments>http://wizard.st/blog/archives/5#comments</comments>
		<pubDate>Mon, 24 Oct 2011 16:12:29 +0000</pubDate>
		<dc:creator>motodimago</dc:creator>
				<category><![CDATA[iOS SDK]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://wizard.st/blog/?p=5</guid>
		<description><![CDATA[チャオ！ IndicatorとかをaddSubviewしても、tableViewの上にきてくれくれず表示されない！ どうしようかと悩んでたら、いい解決方法があった。 // indicatorを入れる箱を作る UIActi [...]]]></description>
			<content:encoded><![CDATA[<p>チャオ！</p>
<p>IndicatorとかをaddSubviewしても、tableViewの上にきてくれくれず表示されない！</p>
<p>どうしようかと悩んでたら、いい解決方法があった。</p>
<pre>// indicatorを入れる箱を作る
UIActivityIndicatorView *indicator;

// indicatorのサイズ
CGRect indicatorFrame = CGRectMake(0, 0, 32.0f, 32.0f);

// indicatorを作成
indicator = [[UIActivityIndicatorView alloc] initWithFrame:indicatorFrame];

// indicatorの色を設定
[indicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];

// 中央に表示するように設定
[indicator setCenter:CGPointMake(160.0f, 240.0f)];

// ぐるぐるスタート
[indicator startAnimating];

// indicatorをviewに追加
[self.view addSubview:indicator];

// 追加したindicatorが一番上に来るように設定
[self.view bringSubviewToFront:indicator];

// indicatorの開放
[indicator release];</pre>
<p>&nbsp;</p>
<p><strong>[self.view bringSubviewToFront:追加したView];</strong><br />
で無事tableViewの上に持ってこれる。<br />
逆に一番下に配置したい場合は<br />
<strong>[self.view sendSubviewToBack:追加したView];</strong></p>
<p>今回はindicatorだったけど、他のviewでもOKOK！</p>
]]></content:encoded>
			<wfw:commentRss>http://wizard.st/blog/archives/5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
