<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xml:lang="ja">
	<channel>
		<title>うまい棒の断片</title>
		<link>http://fragments.g.hatena.ne.jp/hogem/</link>
		<description>うまい棒の断片</description>
		<dc:creator>hogem</dc:creator>


		<item>
			<title>[objective-c]Cocoa Foundation memo</title>
			<link>http://fragments.g.hatena.ne.jp/hogem/20100826/1282839443</link>

			<description><![CDATA[
		<div class="section">
			<ul>
				<li> メソッド呼び出し</li>
			</ul>
			<p>[Class(or instance) methodo: arg1]</p>
			<p>変態記法</p>
			<ul>
				<li> NSRange</li>
			</ul>
			<p>文字列の位置と長さ</p>
			<ul>
				<li> NSPoint</li>
			</ul>
			<p>座標</p>
			<ul>
				<li> NSString</li>
			</ul>
			<p>イミュータブルな文字列。@"hoge" 。</p>
			<ul>
				<li> (id) stringWithFormat:</li>
			</ul>
			<p>printf的な。"%@" はobjective-cオブジェクト。</p>
<pre class="syntax-highlight">
NSString *foo;
foo = [NSString stringWithFormat: @<span class="synConstant">&quot;foo bar baz </span><span class="synSpecial">%d</span><span class="synConstant">&quot;</span>, <span class="synConstant">100</span>];
</pre>

			<ul>
				<li> (BOOL) isEqualToString:</li>
			</ul>
			<p>文字列の比較</p>
			<ul>
				<li> (NSComparisonResult) compare:</li>
			</ul>
			<p>文字列の比較。戻り値がbooleanじゃなくてオブジェクト。(左が大きかったら1とか)</p>
			<ul>
				<ul>
					<li> option</li>
				</ul>
			</ul>
			<p>ignorecase したいときは</p>
<pre class="syntax-highlight">
<span class="synStatement">if</span> ( [foo compare: bar options: NSCaseInsensitiveSearch]
== NSOrderdSame) {
NSLog(@<span class="synConstant">&quot;hogehoge&quot;</span>);
}
</pre>

			<ul>
				<li> (BOOL) hasPrefix:</li>
				<li> (BOOL) hasSuffix:</li>
			</ul>
			<ul>
				<li> NSMutableString</li>
			</ul>
			<p>ミュータタブルな文字列</p>
			<p>appendしたりdeleteしたり。</p>
			<ul>
				<li> (id) stringWithCapacity</li>
			</ul>
			<p>文字列の箱作成メソッド。引数の数字はよくわからん。</p>
			<p>ヒントらしいけど、最大値とかいうわけでもないし。</p>
<pre class="syntax-highlight">
NSMutableString *foo;
foo = [NSMutableString stringWithCapacity:<span class="synConstant">100</span>];
</pre>

			<ul>
				<li> (void) appendString</li>
				<li> (void) appendFormat</li>
				<li> (void) deleteCharactersInRange: (NSRange) range;</li>
			</ul>
			<ul>
				<li> NSArray</li>
			</ul>
			<p>イミュータブルな配列。格納できるのはobjective-cなオブジェクトのみ。</p>
			<p>int、floatとかは無理。(やってみたらセグフォした)</p>
			<p>最後の要素にはnilを。</p>
<pre class="syntax-highlight">
NSArray *array;
array = [NSArray arrayWithObjects: @<span class="synConstant">&quot;foo&quot;</span>, @<span class="synConstant">&quot;bar&quot;</span>, @<span class="synConstant">&quot;baz&quot;</span>, nil];
</pre>

			<ul>
				<li> (unsinged) count</li>
			</ul>
			<p>数を返すメソッド。</p>
			<ul>
				<li> (id) objectAtIndex</li>
			</ul>
			<p>普通の配列でいう foo[10] みたいなことをやる</p>
<pre class="syntax-highlight">
<span class="synType">int</span> i;
<span class="synStatement">for</span> (i = <span class="synConstant">0</span>; i &amp;#<span class="synConstant">60</span>; [array count]; i++) {
NSLog(@<span class="synConstant">&quot;array[</span><span class="synSpecial">%d</span><span class="synConstant">] =&amp;#62; %@&quot;</span>, i, [array objectAtIndex: i];
<span class="synError">}</span>
</pre>

			<ul>
				<li> NSMutableArray</li>
			</ul>
			<p>ミュータブルな配列。追加/削除可能</p>
			<ul>
				<li> (id) arrayWithCapacity</li>
			</ul>
			<p>stringWithCapacityと同様に引数の数値が謎。</p>
			<ul>
				<li> イテレータ</li>
			</ul>
			<p>めんどくさ</p>
			<ul>
				<li> (NSEnumerator *) objectEnumerator;</li>
				<li> (id) nextObject</li>
			</ul>
<pre class="syntax-highlight">
NSEnumerator *enumerator;
enumerator = [array objectEnumerator];
id foo;
<span class="synStatement">while</span> (foo = [enumerator nextObject]) {
NSLog(<span class="synConstant">&quot;hogehoge %@&quot;</span>, foo);
}
</pre>

			<ul>
				<li> objective-2.0 以降 (leopard以降)</li>
			</ul>
			<p>LLっぽいforで。</p>
<pre class="syntax-highlight">
<span class="synStatement">for</span> (NSString *foo in array) {
NSLog(@<span class="synConstant">&quot;hoge %@&quot;</span>, foo);
}
</pre>

			<ul>
				<li> NSDictionary</li>
			</ul>
			<p>連想配列、いわゆるハッシュ。値もキーもobjective-cオブジェクト。</p>
			<ul>
				<li> dictionaryWithObjectsAndKeys</li>
			</ul>
			<p>長いわ。値、キーっていう順番がしっくりこない。</p>
			<ul>
				<li> (id) objecForKey:</li>
			</ul>
<pre class="syntax-highlight">
NSDictionary *foo;
foo = [NSDictionary dictionaryWithObjectsAndKeys:
[MyClass new], @<span class="synConstant">&quot;hoge&quot;</span>]
MyClass *bar = [foo objectForKey: @<span class="synConstant">&quot;hoge&quot;</span>];
</pre>

		</div>
]]></description>

			<dc:creator>hogem</dc:creator>

			<pubDate>Thu, 26 Aug 2010 16:17:23 GMT</pubDate>


			<category>objective-c</category>


		</item>

		<item>
			<title>[perl]perlでgzip圧縮/展開</title>
			<link>http://fragments.g.hatena.ne.jp/hogem/20091124/1259077522</link>

			<description><![CDATA[
		<div class="section">
			<ul>
				<li> perldoc Compress::Zlib</li>
			</ul>
<pre class="syntax-highlight">
<span class="synIdentifier">$dest</span> = Compress::Zlib::memGzip(<span class="synIdentifier">$buffer</span>) ;
<span class="synIdentifier">$dest</span> = Compress::Zlib::memGunzip(<span class="synIdentifier">$buffer</span>) ;
</pre>

		</div>
]]></description>

			<dc:creator>hogem</dc:creator>

			<pubDate>Tue, 24 Nov 2009 15:45:22 GMT</pubDate>


			<category>perl</category>


		</item>

		<item>
			<title>[bash]bashでcd後に自動でls</title>
			<link>http://fragments.g.hatena.ne.jp/hogem/20091122/1258904524</link>

			<description><![CDATA[
		<div class="section">
			<p>.bashrcとかに書く。</p>
<pre class="syntax-highlight">
function cd() {
  builtin cd $@
  ls -a
}
</pre>

			<p>zshはchpwd()にlsって書くだけ？</p>
		</div>
]]></description>

			<dc:creator>hogem</dc:creator>

			<pubDate>Sun, 22 Nov 2009 15:42:04 GMT</pubDate>


			<category>bash</category>


		</item>

		<item>
			<title>[postgresql]postgresqlのSQLのexplain</title>
			<link>http://fragments.g.hatena.ne.jp/hogem/20090613/1244904809</link>

			<description><![CDATA[
		<div class="section">
			<ul>
				<li> <a href="http://www.postgresql.jp/document/pg837doc/html/sql-explain.html" target="_blank">http://www.postgresql.jp/document/pg837doc/html/sql-explain.html</a></li>
			</ul>
			<p>postgresqlにもあったのか。</p>
		</div>
]]></description>

			<dc:creator>hogem</dc:creator>

			<pubDate>Sat, 13 Jun 2009 14:53:29 GMT</pubDate>


			<category>postgresql</category>


		</item>

	</channel>
</rss>

