<?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>Vira's blog</title>
	<atom:link href="http://ivira.name/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://ivira.name/blog</link>
	<description>Blog about things that I love</description>
	<lastBuildDate>Wed, 12 May 2010 07:55:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Создание аудиокниг для iPod/iPhone</title>
		<link>http://ivira.name/blog/2010/05/12/%d1%81%d0%be%d0%b7%d0%b4%d0%b0%d0%bd%d0%b8%d0%b5-%d0%b0%d1%83%d0%b4%d0%b8%d0%be%d0%ba%d0%bd%d0%b8%d0%b3-%d0%b4%d0%bb%d1%8f-ipodiphone/</link>
		<comments>http://ivira.name/blog/2010/05/12/%d1%81%d0%be%d0%b7%d0%b4%d0%b0%d0%bd%d0%b8%d0%b5-%d0%b0%d1%83%d0%b4%d0%b8%d0%be%d0%ba%d0%bd%d0%b8%d0%b3-%d0%b4%d0%bb%d1%8f-ipodiphone/#comments</comments>
		<pubDate>Wed, 12 May 2010 07:54:21 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/?p=174</guid>
		<description><![CDATA[Ваш iPod умеет проигрывать аудиокниги &#8211; т.е. он просто запоминает позицию, на которой Вы закончили прослушивание. Формат поддерживаемых им аудиокниг  - m4b, но по сути это обычный m4a (&#8221;любимый&#8221; формат Apple для хранение музыки, используется в iTunes, iPod и тп.). Но проблема в том, что &#8220;у нас&#8221; аудиокниги обычно выкладывают в виде нескольких mp3-шек, чтобы [...]]]></description>
			<content:encoded><![CDATA[<p>Ваш iPod умеет проигрывать аудиокниги &#8211; т.е. он просто запоминает позицию, на которой Вы закончили прослушивание. Формат поддерживаемых им аудиокниг  - m4b, но по сути это обычный m4a (&#8221;любимый&#8221; формат Apple для хранение музыки, используется в iTunes, iPod и тп.). Но проблема в том, что &#8220;у нас&#8221; аудиокниги обычно выкладывают в виде нескольких mp3-шек, чтобы было возможно слушать проигрывателями, которые не умеют запоминать место, где Вы закончили &#8220;читать&#8221; книгу. Но как оказалось, из этого набора mp3 файлов достаточно легко сделать аудиокнигу для iPod-а.</p>
<p>Т.е. чтобы создать аудиокнигу в формате m4b для Apple-&#8221;мира&#8221; необходимо:</p>
<ol>
<li>Соединить все mp3-шки в одну. Можно сделать это в терминале при помощи команды &#8220;cat&#8221;: <em>cat *.mp3 &gt; outputAudioBook.mp3</em></li>
<li>Далее этот большой mp3-и файл добавить в iTunes (можно временно отключить копирование музыки в iTunes Library, чтобы не засорять ее и для скорости) и сконвертировать  в формат m4a: в главном меню Advanced -&gt; &#8220;Create AAC Version&#8221;</li>
<li>Далее в iTunes в контекстном меню для этого файла &#8220;Show in Finder&#8221; и меняем расширение на &#8220;m4b&#8221;.</li>
<li>Удаляем оба файла (m4a и mp3) из iTunes. И добавляем m4b. Он должен появиться в разделе &#8220;Books&#8221;. Если этого раздела нет, то его можно включить в настройках, вкладка &#8220;General&#8221;.</li>
</ol>
<p>Вот и все. Далее эти книги можно синхронизировать с iPod/iPhone.</p>
<p>Приятного прослушивания <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2010/05/12/%d1%81%d0%be%d0%b7%d0%b4%d0%b0%d0%bd%d0%b8%d0%b5-%d0%b0%d1%83%d0%b4%d0%b8%d0%be%d0%ba%d0%bd%d0%b8%d0%b3-%d0%b4%d0%bb%d1%8f-ipodiphone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cocoa Tip: Filtering NSArray using NSPredicate</title>
		<link>http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/</link>
		<comments>http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 22:13:35 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[cocoa]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/?p=160</guid>
		<description><![CDATA[Today I had a small task in one of my projects &#8211; to get subset of elements from NSArray. I&#8217;ve already started writing all this NSEnumerator-s stuff (need to support 10.4) when I remembered about NSPredicator. So, instead of iterating over an array and finding elements that satisfy some condition and adding them to some [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had a small task in one of my projects &#8211; to get subset of elements from NSArray. I&#8217;ve already started writing all this NSEnumerator-s stuff (need to support 10.4) when I remembered about NSPredicator. So, instead of iterating over an array and finding elements that satisfy some condition and adding them to some output array you just need to create predicate and filter your input array with it. Here is the sample code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="objc">NSPredicate <span style="color: #002200;">*</span>predicate <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>NSPredicate predicateWithFormat<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;storeState == 1&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #0000ff;">NSArray</span>  <span style="color: #002200;">*</span>outputArray <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>inputArray filteredArrayUsingPredicate<span style="color: #002200;">:</span>predicate<span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>Predicates language seems to be very powerful and simple. But I can&#8217;t tell you anything about performance, need to investigate.</p>
<p>Further reading: <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/index.html">Apple Predicates Programming Guide</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Google AJAX search API in Cocoa</title>
		<link>http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/</link>
		<comments>http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 17:05:12 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/?p=94</guid>
		<description><![CDATA[Sometimes it&#8217;s needed to allow user to find some information in the Web, without interrupting he/she from working with your application. In this small article I&#8217;ll describe simple solution to fulfill this task.
As for today, search = Google and I&#8217;m going to implement search using it. I&#8217;ve implemented category for Cocoa&#8217;s NSArray class for creating [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s needed to allow user to find some information in the Web, without interrupting he/she from working with your application. In this small article I&#8217;ll describe simple solution to fulfill this task.<br />
As for today, search = Google and I&#8217;m going to implement search using it. I&#8217;ve implemented category for Cocoa&#8217;s NSArray class for creating array of dictionaries. Each dictionary represents a search results. You can define where to search (web, news, video) etc and how many results to return. This code requires <a href="http://code.google.com/p/json-framework/">JSON Framework by Stig Brautaset</a></p>
<p>Here is the code of the main search method. The full project can be downloaded <a href='http://ivira.name/blog/wp-content/uploads/2009/10/iGoogle.zip'>here</a> (XCode 3.2, JSON Framework included)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
</pre></td><td class="code"><pre class="objc"><span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSArray</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>arrayWithSearchFor<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>query type<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>searchType range<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSRange</span><span style="color: #002200;">&#41;</span>range
<span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>range.location &gt; <span style="color: #0000dd;">56</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    	NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;Error while searching in Google : start must be in range [0;56]&quot;</span><span style="color: #002200;">&#41;</span>;
    	<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">nil</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">NSMutableArray</span> <span style="color: #002200;">*</span>results <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMutableArray</span> array<span style="color: #002200;">&#93;</span>;
    SBJSON <span style="color: #002200;">*</span>parser <span style="color: #002200;">=</span> <span style="color: #0000ff;">nil</span>;
    <span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span>json_string <span style="color: #002200;">=</span> <span style="color: #0000ff;">nil</span>;
    NSUInteger i <span style="color: #002200;">=</span> range.location;
&nbsp;
    <span style="color: #0000ff;">while</span> <span style="color: #002200;">&#40;</span>i &lt; range.length <span style="color: #002200;">+</span> range.location<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #0000ff;">@try</span> <span style="color: #002200;">&#123;</span>
    	    <span style="color: #0000ff;">NSURL</span> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSURL</span> URLWithString<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>BASE_URL stringByAppendingFormat<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;%@?v=%@&amp;q=%@&amp;start=%i&quot;</span>, searchType, @<span style="color: #666666;">&quot;1.0&quot;</span>, query, i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">NSMutableURLRequest</span> <span style="color: #002200;">*</span>request <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMutableURLRequest</span> requestWithURL<span style="color: #002200;">:</span>url
                                        cachePolicy<span style="color: #002200;">:</span>NSURLRequestReloadIgnoringCacheData
                                        timeoutInterval<span style="color: #002200;">:</span><span style="color: #0000dd;">120</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">NSError</span> <span style="color: #002200;">*</span>error <span style="color: #002200;">=</span> <span style="color: #0000ff;">nil</span>;
            <span style="color: #0000ff;">NSURLResponse</span> <span style="color: #002200;">*</span>response <span style="color: #002200;">=</span> <span style="color: #0000ff;">nil</span>;
            <span style="color: #0000ff;">NSData</span> <span style="color: #002200;">*</span>searchResults <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSURLConnection</span> sendSynchronousRequest<span style="color: #002200;">:</span>request
                                         returningResponse<span style="color: #002200;">:&amp;</span>response
                                        error<span style="color: #002200;">:&amp;</span>error<span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>searchResults<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                        <span style="color: #0000ff;">@throw</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSException</span> exceptionWithName<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;Failed to search cuz: %@&quot;</span> reason<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>error description<span style="color: #002200;">&#93;</span> userInfo<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>
            <span style="color: #ff0000;">//parse results</span>
            parser <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>SBJSON alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
            json_string <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSString</span> alloc<span style="color: #002200;">&#93;</span> initWithData<span style="color: #002200;">:</span>searchResults encoding<span style="color: #002200;">:</span>NSUTF8StringEncoding<span style="color: #002200;">&#93;</span>;
&nbsp;
            <span style="color: #ff0000;">//NSLog(@&quot;Raw JSON result %@&quot;, json_string);</span>
            <span style="color: #0000ff;">NSDictionary</span> <span style="color: #002200;">*</span>allResult <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>parser objectWithString<span style="color: #002200;">:</span>json_string error<span style="color: #002200;">:&amp;</span>error<span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>allResult || <span style="color: #002200;">&#91;</span>allResult isKindOfClass<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSNull</span> <span style="color: #0000ff;">class</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                    <span style="color: #0000ff;">@throw</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSException</span> exceptionWithName<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;Failed to parse all results JSON&quot;</span> reason<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>error description<span style="color: #002200;">&#93;</span> userInfo<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>allResult objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;responseStatus&quot;</span><span style="color: #002200;">&#93;</span> isEqualToNumber<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSNumber</span> numberWithInt<span style="color: #002200;">:</span><span style="color: #0000dd;">200</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                <span style="color: #0000ff;">@throw</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSException</span> exceptionWithName<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>allResult objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;responseStatus&quot;</span><span style="color: #002200;">&#93;</span> reason<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>allResult objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;responseDetails&quot;</span><span style="color: #002200;">&#93;</span> userInfo<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>
            allResult <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>allResult objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;responseData&quot;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>allResult || <span style="color: #002200;">&#91;</span>allResult isKindOfClass<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSNull</span> <span style="color: #0000ff;">class</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                <span style="color: #0000ff;">@throw</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSException</span> exceptionWithName<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;Failed to parse responseData&quot;</span> reason<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>error description<span style="color: #002200;">&#93;</span> userInfo<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>
            <span style="color: #0000ff;">NSArray</span> <span style="color: #002200;">*</span>newResults <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>allResult objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;results&quot;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>newResults<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                <span style="color: #0000ff;">@throw</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSException</span> exceptionWithName<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;Failed to parse results&quot;</span> reason<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>error description<span style="color: #002200;">&#93;</span> userInfo<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>		
&nbsp;
            <span style="color: #002200;">&#91;</span>results addObjectsFromArray<span style="color: #002200;">:</span>newResults<span style="color: #002200;">&#93;</span>;
            i <span style="color: #002200;">+=</span> SMALL_RESULT_SET;
        <span style="color: #002200;">&#125;</span> <span style="color: #0000ff;">@catch</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSException</span> <span style="color: #002200;">*</span> e<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
            NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;Exception during searching in Google: %@&quot;</span>, e<span style="color: #002200;">&#41;</span>;
        <span style="color: #002200;">&#125;</span> <span style="color: #0000ff;">@finally</span> <span style="color: #002200;">&#123;</span>
            <span style="color: #002200;">&#91;</span>parser release<span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#91;</span>json_string release<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#125;</span>
    <span style="color: #0000ff;">return</span> results;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSArray</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>arrayWithWebSearchFor<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>query range<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSRange</span><span style="color: #002200;">&#41;</span>range
<span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">return</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>self <span style="color: #0000ff;">class</span><span style="color: #002200;">&#93;</span> arrayWithSearchFor<span style="color: #002200;">:</span>query type<span style="color: #002200;">:</span>WEB_URL range<span style="color: #002200;">:</span>range<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>And the sample usage:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="objc"><span style="color: #0000ff;">NSArray</span> <span style="color: #002200;">*</span>results <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSArray</span> arrayWithWebSearchFor<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;apple&quot;</span> range<span style="color: #002200;">:</span>NSMakeRange<span style="color: #002200;">&#40;</span><span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">5</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
    NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;Search finished, found %i&quot;</span>, <span style="color: #002200;">&#91;</span>results count<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
    <span style="color: #0000ff;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSDictionary</span> <span style="color: #002200;">*</span>result in results<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;Url = %@&quot;</span>,  <span style="color: #002200;">&#91;</span>result objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;url&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
    <span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>In this sample code I&#8217;ve searched for &#8220;apple&#8221; and got the following results:</p>
<blockquote><p>2009-10-13 01:18:40.638 iGoogle[63665:a0f] Url = http://en.wikipedia.org/wiki/Apple_Inc.<br />
2009-10-13 01:18:40.641 iGoogle[63665:a0f] Url = http://www.info.apple.com/<br />
2009-10-13 01:18:40.641 iGoogle[63665:a0f] Url = http://www.crunchbase.com/company/apple<br />
2009-10-13 01:18:40.642 iGoogle[63665:a0f] Url = http://developer.apple.com/<br />
2009-10-13 01:18:40.642 iGoogle[63665:a0f] Url = http://apple.slashdot.org/<br />
2009-10-13 01:18:40.642 iGoogle[63665:a0f] Url = http://finance.yahoo.com/q%3Fs%3DAapl<br />
2009-10-13 01:18:40.644 iGoogle[63665:a0f] Url = http://support.apple.com/batteryprogram/<br />
2009-10-13 01:18:40.644 iGoogle[63665:a0f] Url = http://topics.nytimes.com/topics/news/business/companies/apple_computer_inc/index.html</p></blockquote>
<p>This code has never been used in production, so use on your own risk <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Open all icons on your Mac</title>
		<link>http://ivira.name/blog/2009/11/06/open-all-icons-on-your-mac/</link>
		<comments>http://ivira.name/blog/2009/11/06/open-all-icons-on-your-mac/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 22:27:21 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[fun]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[mac os]]></category>
		<category><![CDATA[preview]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/2009/11/06/open-all-icons-on-your-mac/</guid>
		<description><![CDATA[Just for fun   I decided to discover if it possible to open all icons (.icns files) with Preview and (as in real experiment) to measure how many resources this operation will take. To perform this I executed the following shell command:
find / -name *.icns -exec open {} \;
It is also better to change [...]]]></description>
			<content:encoded><![CDATA[<p>Just for fun <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I decided to discover if it possible to open all icons (.icns files) with Preview and (as in real experiment) to measure how many resources this operation will take. To perform this I executed the following shell command:</p>
<pre>find / -name *.icns -exec open {} \;</pre>
<p>It is also better to change Preview preferences to make it open all files in one window (it isn&#8217;t a good idea to open thousands of windows). And here is the results for my system</p>
<pre>MacBookPro5,4/Intel Core 2 Duo 2,53 GHz/4 GB DDR3/MacOS X 10.6.1</pre>
<p style="text-align: center"><img src="http://ivira.name/blog/wp-content/uploads/2009/11/screen-shot-2009-11-06-at-00.02.301.png" border="0" alt="Preview resources consumption" width="338" height="209" /></p>
<p>So, it&#8217;s taken about 45 minutes and 850 MB of memory to found 4144 icons on my system&#8230; It&#8217;s possible to work with all this icons in Preview, search in them and so on. But generating of PDF file from all these icons failed (in fact I cancelled it when Preview had &#8220;ate&#8221; 2 GB of memory <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). Here is screenshot of all this beauty.
<p style="text-align: center"><a title="All Icons in Preview" href="http://ivira.name/blog/wp-content/uploads/2009/11/icons-in-preview.png"><img src="http://ivira.name/blog/wp-content/uploads/2009/11/icons-in-preview.png" alt="All Icons in Preview" width="405" height="321" /></a></p>
<p>This could be useful for designers/programmers for researching/&#8221;stealing&#8221; icons.</p>
<p>E.g. I was surprised how the icon for &#8220;downloading in progress&#8221; file is drawn.</p>
<p style="text-align: center"><a title="screen-shot-2009-11-06-at-00.22.17.png" href="http://ivira.name/blog/wp-content/uploads/2009/11/screen-shot-2009-11-06-at-00.22.17.png"><img src="http://ivira.name/blog/wp-content/uploads/2009/11/screen-shot-2009-11-06-at-00.22.17.png" alt="screen-shot-2009-11-06-at-00.22.17.png" width="405" height="207" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2009/11/06/open-all-icons-on-your-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Say no to Twitter</title>
		<link>http://ivira.name/blog/2009/09/15/say-no-to-twitter/</link>
		<comments>http://ivira.name/blog/2009/09/15/say-no-to-twitter/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 21:11:16 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/2009/09/15/say-no-to-twitter/</guid>
		<description><![CDATA[Твитер хорошо, но блог лучше  Скоро начну опять писать что-то &#62; 140 символов&#8230; надеюсь
]]></description>
			<content:encoded><![CDATA[<p>Твитер хорошо, но блог лучше <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Скоро начну опять писать что-то &gt; 140 символов&#8230; надеюсь</p>
]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2009/09/15/say-no-to-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>People Net и Mac</title>
		<link>http://ivira.name/blog/2009/04/17/people-net-%d0%b8-mac/</link>
		<comments>http://ivira.name/blog/2009/04/17/people-net-%d0%b8-mac/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 20:24:28 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/2009/04/17/people-net-%d0%b8-mac/</guid>
		<description><![CDATA[По причине отсутствия интернете в моем родном городе Комсмольске решилась я таки купить какое-нибудь 3G решение. Выбор пал на People Net, в большей степени из-за раскрученности и в меньшей после сравнения с конкурентами  
Выбора модемов в отделении Приват-банка (где также можно подключиться) особого не было и &#8220;пришлось&#8221; брать Huawei EC 226. Не совсем пальцем [...]]]></description>
			<content:encoded><![CDATA[<p>По причине отсутствия интернете в моем родном городе Комсмольске решилась я таки купить какое-нибудь 3G решение. Выбор пал на People Net, в большей степени из-за раскрученности и в меньшей после сравнения с конкурентами <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Выбора модемов в отделении Приват-банка (где также можно подключиться) особого не было и &#8220;пришлось&#8221; брать Huawei EC 226. Не совсем пальцем в небо конечно &#8211; он поддерживает маки и вроде бы неплохой по отзывам.</p>
<p>На сайте people net-a в <a href="http://people.net.ua/equipments/modem/40/" title="модем интрукция">разделе</a> этого модема есть драйвера под мак и инструкция, но! Сразу у меня ничего естественно не получилось. При подключении выдавало &#8220;No carrier detected&#8230;&#8221; Как оказалось, необходимо просто отключить проверку PIN-кода под Windows из программы Mobile Partner, которая поставляется с модемом. Жаль этого не описано в официальной инструкции.</p>
<p>И еще один момент, драйвера написаны довольно таки криво и забивают syslog всякой гадостью. Вроде бы связано с тем, что модем заявляет себя как cd-rom, но примаунтить его не выходит. Попытки постоянно повторяются и в результате получаем никому не нужную нагрузку на систему. Надо будет разбираться, более детально <a href="http://discussions.apple.com/message.jspa?messageID=7303099" title="описание проблемы с ec 226">тут</a>.</p>
<p>P.S. Скорость довольно таки нормальная, порой лучше киевской Воли кабель <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2009/04/17/people-net-%d0%b8-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XCode tips</title>
		<link>http://ivira.name/blog/2009/03/31/xcode-tips/</link>
		<comments>http://ivira.name/blog/2009/03/31/xcode-tips/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 11:57:39 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/2009/03/31/xcode-tips/</guid>
		<description><![CDATA[Here will be short list of the XCode hotkeys most used by me. I&#8217;ll try to update it periodically.

Switch to header/source file &#8211; Opt+Cmd+Up
Show Console &#8211; Shift+Cmd+R
Move to the next argument in Code Completion &#8211; Control+slash
Jump to definition &#8211; Cmd+doubleClick
Code Completion &#8211; Esc
Open Quickly &#8211; Shift+Cmd+D

Cool shortcut&#8217;s list for XCode
]]></description>
			<content:encoded><![CDATA[<p>Here will be short list of the XCode hotkeys most used by me. I&#8217;ll try to update it periodically.</p>
<ul>
<li><strong>Switch to header/source file</strong> &#8211; Opt+Cmd+Up</li>
<li><strong>Show Console</strong> &#8211; Shift+Cmd+R</li>
<li><strong>Move to the next argument in Code Completion</strong> &#8211; Control+slash</li>
<li><strong>Jump to definition</strong> &#8211; Cmd+doubleClick</li>
<li><strong>Code Completion</strong> &#8211; Esc</li>
<li><strong>Open Quickly</strong> &#8211; Shift+Cmd+D</li>
</ul>
<p><a href="http://www.1729.us/xcode/Xcode%20Shortcuts.png" title="Xcode shortcuts">Cool shortcut&#8217;s list for XCode</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2009/03/31/xcode-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>+1 мак девел &#8211; подарок Стиву Джобсу на 54-летие )</title>
		<link>http://ivira.name/blog/2009/02/25/1-%d0%bc%d0%b0%d0%ba-%d0%b4%d0%b5%d0%b2%d0%b5%d0%bb-%d0%bf%d0%be%d0%b4%d0%b0%d1%80%d0%be%d0%ba-%d1%81%d1%82%d0%b8%d0%b2%d1%83-%d0%b4%d0%b6%d0%be%d0%b1%d1%81%d1%83-%d0%bd%d0%b0-54-%d0%bb%d0%b5%d1%82/</link>
		<comments>http://ivira.name/blog/2009/02/25/1-%d0%bc%d0%b0%d0%ba-%d0%b4%d0%b5%d0%b2%d0%b5%d0%bb-%d0%bf%d0%be%d0%b4%d0%b0%d1%80%d0%be%d0%ba-%d1%81%d1%82%d0%b8%d0%b2%d1%83-%d0%b4%d0%b6%d0%be%d0%b1%d1%81%d1%83-%d0%bd%d0%b0-54-%d0%bb%d0%b5%d1%82/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 10:22:56 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[trash]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/2009/02/25/1-%d0%bc%d0%b0%d0%ba-%d0%b4%d0%b5%d0%b2%d0%b5%d0%bb-%d0%bf%d0%be%d0%b4%d0%b0%d1%80%d0%be%d0%ba-%d1%81%d1%82%d0%b8%d0%b2%d1%83-%d0%b4%d0%b6%d0%be%d0%b1%d1%81%d1%83-%d0%bd%d0%b0-54-%d0%bb%d0%b5%d1%82/</guid>
		<description><![CDATA[Чаще всего не верю в совпадения&#8230; но приходится порой   24-го февраля окончательно кинула все старое и перешла в мак девелоперы, а вечером узнала что в этот же день у Стива ДР&#8230; Хороший знак надеюсь  
]]></description>
			<content:encoded><![CDATA[<p>Чаще всего не верю в совпадения&#8230; но приходится порой <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  24-го февраля окончательно кинула все старое и перешла в мак девелоперы, а вечером узнала что в этот же день у Стива ДР&#8230; Хороший знак надеюсь <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2009/02/25/1-%d0%bc%d0%b0%d0%ba-%d0%b4%d0%b5%d0%b2%d0%b5%d0%bb-%d0%bf%d0%be%d0%b4%d0%b0%d1%80%d0%be%d0%ba-%d1%81%d1%82%d0%b8%d0%b2%d1%83-%d0%b4%d0%b6%d0%be%d0%b1%d1%81%d1%83-%d0%bd%d0%b0-54-%d0%bb%d0%b5%d1%82/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipse tips: quick code assist</title>
		<link>http://ivira.name/blog/2009/01/16/eclipse-tips-quick-code-assist/</link>
		<comments>http://ivira.name/blog/2009/01/16/eclipse-tips-quick-code-assist/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 15:16:47 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Soft]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/2009/01/16/eclipse-tips-quick-code-assist/</guid>
		<description><![CDATA[Just a small tip I&#8217;ve discovered today:
Usually I use code assist in such way e.g.  to get System.out.print() press the following &#8220;S&#8221;+Ctrl+Space+Enter+dot+&#8221;o&#8221;+Enter+dot+&#8221;p&#8221;+Enter+&#8221;(&#8221;. But it can be done  faster &#8211; just enter &#8220;S&#8221;+Ctrl+Space+dot+&#8221;o&#8221;+dot+&#8221;p&#8221;+&#8221;(&#8221;. So Enter key can be omitted. Minus three keypressing -  cool  
P.S. BTW, for such a commonl thing as System.out.println() code template [...]]]></description>
			<content:encoded><![CDATA[<p>Just a small tip I&#8217;ve discovered today:</p>
<p>Usually I use code assist in such way e.g.  to get System.out.print() press the following &#8220;S&#8221;+Ctrl+Space+Enter+dot+&#8221;o&#8221;+Enter+dot+&#8221;p&#8221;+Enter+&#8221;(&#8221;. But it can be done  faster &#8211; just enter &#8220;S&#8221;+Ctrl+Space+dot+&#8221;o&#8221;+dot+&#8221;p&#8221;+&#8221;(&#8221;. So Enter key can be omitted. Minus three keypressing -  cool <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>P.S. BTW, for such a commonl thing as System.out.println() code template &#8220;sysout&#8221; can be used.</p>
]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2009/01/16/eclipse-tips-quick-code-assist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back your Mac to life</title>
		<link>http://ivira.name/blog/2008/12/26/back-your-mac-to-life/</link>
		<comments>http://ivira.name/blog/2008/12/26/back-your-mac-to-life/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 15:05:56 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/2008/12/26/back-your-mac-to-life/</guid>
		<description><![CDATA[Перезапускаю свой ноут я обычно в случаях крайней необходимости &#8211; апдейты поставить или просто что-то перестало/стало медленно работать.
Так и случилось на днях, пришлось перезапустить после апйдетов Safari и iTunes&#8230; Но после перезапуска загрузка доходила только для логин скрина&#8230; В этом посте я попытаюсь вкратце передать свой опыт воскрешения макос-а.

Вначале мне посоветовали почистить кеши и инпут [...]]]></description>
			<content:encoded><![CDATA[<p>Перезапускаю свой ноут я обычно в случаях крайней необходимости &#8211; апдейты поставить или просто что-то перестало/стало медленно работать.</p>
<p>Так и случилось на днях, пришлось перезапустить после апйдетов Safari и iTunes&#8230; Но после перезапуска загрузка доходила только для логин скрина&#8230; В этом посте я попытаюсь вкратце передать свой опыт воскрешения макос-а.</p>
<p><span id="more-83"></span></p>
<p>Вначале мне посоветовали почистить кеши и инпут менеджеры:</p>
<pre><strong><strong>rm -rf</strong></strong> <strong>/Library/Caches/*</strong></pre>
<pre><strong><strong>rm -rf</strong></strong> <strong>/System/Library/Caches/*</strong></pre>
<pre><strong><strong>rm -rf</strong></strong> <strong>~/Library/Caches</strong><strong><strong>/*</strong></strong></pre>
<pre><strong><strong>rm -rf</strong></strong> <strong>/Library/InputManagers</strong><strong><strong>/*</strong></strong></pre>
<pre><strong><strong>rm -rf</strong></strong> <strong>/System/Library/Extensions.mkext</strong></pre>
<p>Но это не помогло&#8230; <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  И тут я вспомнила что устанавливала такую &#8220;нехорошую&#8221; вещь как <a href="http://www.unsanity.com/haxies/ape">APE</a> (Application Enhancer), которая часто приводит к проблемам. Удаляем и его:</p>
<pre><strong>rm -rf /Library/Preference Panes/Application Enhancer.prefpane
 rm -rf /Library/Frameworks/ApplicationEnhancer.framework
 rm -rf /System/Library/SystemConfiguration/ApplicationEnhancer.bundle
 rm -rf /Library/Preferences/com.unsanity.ape.plist</strong></pre>
<p>Но стало еще хуже &#8211; kernel panic при старте <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Следующими подозреваемыми стали своп файлы, удаляем и их</p>
<pre><strong>rm -rf /var/vm/*</strong></pre>
<p>И вуаля, успешный запуск. Процедура восстановления работоспособности была довольно непоследовательной и проследить что именно стало причиной невозможно &#8211; скорее всего всё скопом: апйдеты+Bad APE+может еще чего. Но описанные выше действия вполне безобидны и могут применяться как первая помощь при проблемах с запуском MacOS X.</p>
<p>P.S. Хочу отметить, что манипуляции необходимо производить в single-user mode, в который можно попасть  нажав Command+S при старте и дополнительно</p>
<pre><strong>/sbin/fsck -y
/sbin/mount -uw /</strong></pre>
<p>для проверки файловой системы и монтирования рут раздела в режиме записи.</p>
]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2008/12/26/back-your-mac-to-life/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
