<?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>iVira.name</title>
	<atom:link href="http://ivira.name/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://ivira.name/blog</link>
	<description>Mostly about programming, Apple and some random stuff</description>
	<lastBuildDate>Mon, 10 Oct 2011 09:39: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>Thank you, Steve Jobs</title>
		<link>http://ivira.name/blog/2011/10/09/thank-you-steve-jobs/</link>
		<comments>http://ivira.name/blog/2011/10/09/thank-you-steve-jobs/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 16:02:31 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/?p=225</guid>
		<description><![CDATA[
Мой мак-путь начался не так и давно &#8211; 2007-й год, год рождения iPhone. После убеждений моего тогдашнего одногруппника и будущего &#8220;начальника&#8221; Саши Косована, я стала счастливой обладательницей беленького макбука (который теперь радует своего уже 4-го владельца). &#8220;Заражение&#8221; вирусом Apple происходило не очень быстро, мозг был слишком инертен после 7-ми лет Windows. Но пути назад уже [...]]]></description>
			<content:encoded><![CDATA[<div align="center"><img src="http://ivira.name/blog/wp-content/uploads/2011/10/rip-steve-jobs-660x492-300x223.jpg" alt="rip steve jobs" title="rip steve jobs"/></div>
<p>Мой мак-путь начался не так и давно &#8211; 2007-й год, год рождения iPhone. После убеждений моего тогдашнего одногруппника и будущего &#8220;начальника&#8221; Саши Косована, я стала счастливой обладательницей беленького макбука (который теперь радует своего уже 4-го владельца). &#8220;Заражение&#8221; вирусом Apple происходило не очень быстро, мозг был слишком инертен после 7-ми лет Windows. Но пути назад уже не было и я этому очень благодарна. Я продолжила распространять этот &#8220;вирус&#8221; и &#8220;подсадила&#8221; уже около десятка людей. Надеюсь, что они меня за это не ненавидят ))</p>
<p>Как только ты начинаешь жить в мире Apple, то начинаешь видеть и ценить совершенное другие качества в продуктах. И становится совершенно невыносимо смотреть на интерфейсы с множеством кнопочек, которые предлагают сделать все на свете, но при этом скрывают главную функцию продукта.</p>
<p>Когда такой человек покидает этот мир, он оставляет свои идеи, а они безсмертны. И самое лучшее, что может каждый из нас сделать, так это продолжить следовать идеям Джобса: think different, stay foolish, stay hungry, attention to the details, etc. Я верю во всех нас и особенно в команду Apple. И даже если я покину мир Apple, то всегда буду руководствоваться этими принципами.</p>
<p>P.S. Самое вдохновляющее и мотивирующее видео, которое я когда-либо видела. Советую смотреть всем и почаще.</p>
<div align=center> <iframe width="420" height="315" src="http://www.youtube.com/embed/UF8uR6Z6KLc" frameborder="0" allowfullscreen></iframe> </div>
<p>&#8220;Память о том, что я скоро умру – самый важный инструмент, который помогает мне принимать сложные решения в моей жизни. Потому что всё остальное – чужое мнение, вся эта гордость, вся эта боязнь смущения или провала – все эти вещи падают пред лицом смерти, оставляя лишь то, что действительно важно. Память о смерти – лучший способ избежать мыслей о том, что у вас есть что терять. Вы уже голый. У вас больше нет причин не идти на зов своего сердца.&#8221; (c) Steve Jobs,<br />
Stanford Commencement Speech, 2005</p>
<div align=center>R.I.P. Steve Jobs</div>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2011/10/09/thank-you-steve-jobs/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Thank you, Steve Jobs+http://ivira.name/blog/2011/10/09/thank-you-steve-jobs/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Thank you, Steve Jobs&amp;uri=http://ivira.name/blog/2011/10/09/thank-you-steve-jobs/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2011/10/09/thank-you-steve-jobs/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2011/10/09/thank-you-steve-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Я.Субботник в Киеве 28 мая &#8211; собираюсь там быть</title>
		<link>http://ivira.name/blog/2011/05/19/%d1%8f-%d1%81%d1%83%d0%b1%d0%b1%d0%be%d1%82%d0%bd%d0%b8%d0%ba-%d0%b2-%d0%ba%d0%b8%d0%b5%d0%b2%d0%b5-28-%d0%bc%d0%b0%d1%8f-%d1%81%d0%be%d0%b1%d0%b8%d1%80%d0%b0%d1%8e%d1%81%d1%8c-%d1%82%d0%b0%d0%bc/</link>
		<comments>http://ivira.name/blog/2011/05/19/%d1%8f-%d1%81%d1%83%d0%b1%d0%b1%d0%be%d1%82%d0%bd%d0%b8%d0%ba-%d0%b2-%d0%ba%d0%b8%d0%b5%d0%b2%d0%b5-28-%d0%bc%d0%b0%d1%8f-%d1%81%d0%be%d0%b1%d0%b8%d1%80%d0%b0%d1%8e%d1%81%d1%8c-%d1%82%d0%b0%d0%bc/#comments</comments>
		<pubDate>Thu, 19 May 2011 10:13:46 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[events]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/?p=222</guid>
		<description><![CDATA[Третий Я.Субботник в Киеве пройдет 28 мая в бизнес-центре &#8220;Инком&#8221;.
Регистрация открыта. Количество мест ограничено.
Для тех, кто не попадёт в число участников или не сможет лично присутствовать на Я.Субботнике, будет организована онлайн-трансляция.
Информацию о мероприятии смотрите тут.
Поделиться этой информацией с другими: http://clck.ru/5dzJ
    More&#160;&#187;]]></description>
			<content:encoded><![CDATA[<p>Третий Я.Субботник в Киеве пройдет 28 мая в <a href="http://maps.yandex.ru/-/CBQJ4AiM">бизнес-центре &#8220;Инком&#8221;</a>.</p>
<p><a href="http://company.yandex.ru/public/subbotnik/reg.xml">Регистрация</a> открыта. Количество мест ограничено.</p>
<p>Для тех, кто не попадёт в число участников или не сможет лично присутствовать на Я.Субботнике, будет организована <a href="http://company.yandex.ru/public/subbotnik/online.xml">онлайн-трансляция</a>.</p>
<p>Информацию о мероприятии смотрите <a href="http://company.yandex.ru/public/subbotnik/">тут</a>.</p>
<p>Поделиться этой информацией с другими: <a href="http://clck.ru/5dzJ">http://clck.ru/5dzJ</a></p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2011/05/19/%d1%8f-%d1%81%d1%83%d0%b1%d0%b1%d0%be%d1%82%d0%bd%d0%b8%d0%ba-%d0%b2-%d0%ba%d0%b8%d0%b5%d0%b2%d0%b5-28-%d0%bc%d0%b0%d1%8f-%d1%81%d0%be%d0%b1%d0%b8%d1%80%d0%b0%d1%8e%d1%81%d1%8c-%d1%82%d0%b0%d0%bc/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Я.Субботник в Киеве 28 мая &#8211; собираюсь там быть+http://ivira.name/blog/2011/05/19/%d1%8f-%d1%81%d1%83%d0%b1%d0%b1%d0%be%d1%82%d0%bd%d0%b8%d0%ba-%d0%b2-%d0%ba%d0%b8%d0%b5%d0%b2%d0%b5-28-%d0%bc%d0%b0%d1%8f-%d1%81%d0%be%d0%b1%d0%b8%d1%80%d0%b0%d1%8e%d1%81%d1%8c-%d1%82%d0%b0%d0%bc/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Я.Субботник в Киеве 28 мая &#8211; собираюсь там быть&amp;uri=http://ivira.name/blog/2011/05/19/%d1%8f-%d1%81%d1%83%d0%b1%d0%b1%d0%be%d1%82%d0%bd%d0%b8%d0%ba-%d0%b2-%d0%ba%d0%b8%d0%b5%d0%b2%d0%b5-28-%d0%bc%d0%b0%d1%8f-%d1%81%d0%be%d0%b1%d0%b8%d1%80%d0%b0%d1%8e%d1%81%d1%8c-%d1%82%d0%b0%d0%bc/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2011/05/19/я-субботник-в-киеве-28-мая-собираюсь-там/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2011/05/19/%d1%8f-%d1%81%d1%83%d0%b1%d0%b1%d0%be%d1%82%d0%bd%d0%b8%d0%ba-%d0%b2-%d0%ba%d0%b8%d0%b5%d0%b2%d0%b5-28-%d0%bc%d0%b0%d1%8f-%d1%81%d0%be%d0%b1%d0%b8%d1%80%d0%b0%d1%8e%d1%81%d1%8c-%d1%82%d0%b0%d0%bc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Finder&#8217;s &#8220;Open With&#8221; Contextual Menu</title>
		<link>http://ivira.name/blog/2011/03/13/creating-open-with-contextual-menu-as-in-finder/</link>
		<comments>http://ivira.name/blog/2011/03/13/creating-open-with-contextual-menu-as-in-finder/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 15:03:21 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[cocoa]]></category>
		<category><![CDATA[finder]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/?p=196</guid>
		<description><![CDATA[Hello everyone and congrats with spring/Lion/iPad2! I haven&#8217;t written for such a long time and so many things have happened.
Today I want to share with you my experience of creating the analog of &#8220;Open With&#8221; menu, similar to Finder&#8217;s one. I&#8217;ve tried to create the exact copy of this menu: default application, list of other [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everyone and congrats with spring/Lion/iPad2! I haven&#8217;t written for such a long time and so many things have happened.</p>
<div id="attachment_206" class="wp-caption alignright" style="width: 160px"><a href="http://ivira.name/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-13-at-14.31.19.png"><img src="http://ivira.name/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-13-at-14.31.19-150x150.png" alt="Open With Menu" title="Open With Menu" width="150" height="150" class="size-thumbnail wp-image-206" /></a><p class="wp-caption-text">'Open With' Menu</p></div>
<p>Today I want to share with you my experience of creating the analog of &#8220;Open With&#8221; menu, similar to Finder&#8217;s one. I&#8217;ve tried to create the exact copy of this menu: default application, list of other apps and &#8220;Other…&#8221; option. I use this menu in the one of our projects &#8211; <a href="http://macpaw.com/machider">MacHider</a> and you have take a look of how it works.</p>
<p>When I&#8217;ve started to implement the menu, I was a bit surprised that this isn&#8217;t common component…After googling I haven&#8217;t found any ready to use solutions. So here is how I&#8217;ve implemented it <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<span id="more-196"></span><br />
To get the list of apps that can open specified file you can use LSCopyApplicationURLsForURL function. The second parameter to this function is role of the application: is it editor or viewer for this file. Default application could be obtained by calling LSGetApplicationForURL.</p>
<p>The core method in the presented below code is <code>openWithMenuItemForFile</code>. It returns NSMenu for specified file path and you can show this menu whenever and wherever you want. In our app I show it when system calls &#8220;validateMenuItem&#8221; for &#8220;Open With&#8221; menu item. Not the best solution, because user don&#8217;t necessary show this menu but it&#8217;s easy to implement and it works. Also I want to note, that building this menu takes some time. So be careful not to freeze UI.</p>

<div class="wp_syntax"><div class="code"><pre class="objc">&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #002200;">&#41;</span>openSelectedFileWithApplication<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>appPath
<span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span>filePath <span style="color: #002200;">=</span> &lt;get <span style="color: #0000ff;">file</span> path, e.g. from selected table row&gt;
    <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSWorkspace</span> sharedWorkspace<span style="color: #002200;">&#93;</span> openFile<span style="color: #002200;">:</span>filePath withApplication<span style="color: #002200;">:</span>appPath<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #ff0000;">/// menu item action</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #002200;">&#41;</span>openWithApplicationSelected<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">id</span><span style="color: #002200;">&#41;</span>sender
<span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span><span style="color: #002200;">&#91;</span>sender isKindOfClass<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMenuItem</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>
        NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;Sender should be nsmenuitem&quot;</span><span style="color: #002200;">&#41;</span>;
        <span style="color: #0000ff;">return</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">NSMenuItem</span> <span style="color: #002200;">*</span>menuItem <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSMenuItem</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>sender;
    <span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span>appPath <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>menuItem representedObject<span style="color: #002200;">&#93;</span>;
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>appPath<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;Could get app path from nsmenuitem represented object&quot;</span><span style="color: #002200;">&#41;</span>;
        <span style="color: #0000ff;">return</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#91;</span>self openSelectedFileWithApplication<span style="color: #002200;">:</span>appPath<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #002200;">&#41;</span>openWithApplicationOtherSelected<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">id</span><span style="color: #002200;">&#41;</span>sender
<span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">NSOpenPanel</span> <span style="color: #002200;">*</span>panel <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSOpenPanel</span> openPanel<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #002200;">&#91;</span>panel setAllowsMultipleSelection<span style="color: #002200;">:</span>NO<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>panel setCanChooseFiles<span style="color: #002200;">:</span>YES<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>panel setCanChooseDirectories<span style="color: #002200;">:</span>NO<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #002200;">&#91;</span>panel beginSheetForDirectory<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;/Applications&quot;</span>
                                               <span style="color: #0000ff;">file</span><span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span>
                                            types<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span>
                         modalForWindow<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>mainController window<span style="color: #002200;">&#93;</span>
                            modalDelegate<span style="color: #002200;">:</span>self
                            didEndSelector<span style="color: #002200;">:</span><span style="color: #0000ff;">@selector</span><span style="color: #002200;">&#40;</span>chooseAppSheetClosed<span style="color: #002200;">:</span>returnCode<span style="color: #002200;">:</span>contextInfo<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span>
                                 contextInfo<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;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #002200;">&#41;</span>chooseAppSheetClosed<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSOpenPanel</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>panel returnCode<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #002200;">&#41;</span>code contextInfo<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSNumber</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>useOptions
<span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>code <span style="color: #002200;">==</span> NSOKButton<span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
		<span style="color: #002200;">&#91;</span>panel close<span style="color: #002200;">&#93;</span>;
                <span style="color: #002200;">&#91;</span>self openSelectedFileWithApplication<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>panel filename<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #ff0000;">/// construct menu item for app</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSMenuItem</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>menuItemForOpenWithForApplication<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>appName path<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>appPath
<span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">NSMenuItem</span> <span style="color: #002200;">*</span>newAppItem <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMenuItem</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>newAppItem setTitle<span style="color: #002200;">:</span>appName<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>newAppItem setTarget<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>newAppItem setAction<span style="color: #002200;">:</span><span style="color: #0000ff;">@selector</span><span style="color: #002200;">&#40;</span>openWithApplicationSelected<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>newAppItem setRepresentedObject<span style="color: #002200;">:</span>appPath<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>newAppItem setImage<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSWorkspace</span> sharedWorkspace<span style="color: #002200;">&#93;</span> iconForFile<span style="color: #002200;">:</span>appPath<span style="color: #002200;">&#93;</span> imageByScalingToSize<span style="color: #002200;">:</span>NSMakeSize<span style="color: #002200;">&#40;</span><span style="color: #0000dd;">16</span>, <span style="color: #0000dd;">16</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #0000ff;">return</span> newAppItem;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #ff0000;">/// this method return open with menu for specified file</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSMenu</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>openWithMenuItemForFile<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>filePath
<span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">NSMenu</span> <span style="color: #002200;">*</span>subMenu <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMenu</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
    <span style="color: #0000ff;">NSURL</span> <span style="color: #002200;">*</span>fileURL <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSURL</span> fileURLWithPath<span style="color: #002200;">:</span>filePath<span style="color: #002200;">&#93;</span>;
   CFArrayRef cfArrayOfApps <span style="color: #002200;">=</span> LSCopyApplicationURLsForURL<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>CFURLRef<span style="color: #002200;">&#41;</span>fileURL, kLSRolesAll<span style="color: #002200;">&#41;</span>;
    CFIndex maxCount <span style="color: #002200;">=</span> <span style="color: #0000dd;">10</span>;
    <span style="color: #0000ff;">NSMutableSet</span> <span style="color: #002200;">*</span>alreadyAdded <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMutableSet</span> setWithCapacity<span style="color: #002200;">:</span>maxCount<span style="color: #002200;">&#93;</span>;
	<span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>cfArrayOfApps <span style="color: #002200;">!=</span> <span style="color: #0000ff;">nil</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		CFIndex count <span style="color: #002200;">=</span> CFArrayGetCount<span style="color: #002200;">&#40;</span>cfArrayOfApps<span style="color: #002200;">&#41;</span>;
        <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>count &gt; maxCount<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
            count <span style="color: #002200;">=</span> maxCount;
        <span style="color: #002200;">&#125;</span>
        <span style="color: #ff0000;">//get and add default app</span>
        CFURLRef defaultApp;
        LSGetApplicationForURL<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>CFURLRef<span style="color: #002200;">&#41;</span>fileURL, kLSRolesAll, <span style="color: #0000ff;">NULL</span>, <span style="color: #002200;">&amp;</span>defaultApp<span style="color: #002200;">&#41;</span>;
        <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>defaultApp<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
            NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;There is no default App for %@&quot;</span>, filePath<span style="color: #002200;">&#41;</span>;
            <span style="color: #0000ff;">NSMenuItem</span> <span style="color: #002200;">*</span>noneItem <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMenuItem</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#91;</span>noneItem setTitle<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;&lt;None&gt;&quot;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#91;</span>noneItem setEnabled<span style="color: #002200;">:</span>NO<span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#91;</span>subMenu addItem<span style="color: #002200;">:</span>noneItem<span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#91;</span>noneItem release<span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#91;</span>subMenu addItem<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMenuItem</span> separatorItem<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#125;</span>
        <span style="color: #0000ff;">else</span> <span style="color: #002200;">&#123;</span>
            <span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span>defaultAppPath <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSURL</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>defaultApp path<span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span>defaultAppName <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>defaultAppPath lastPathComponent<span style="color: #002200;">&#93;</span> stringByDeletingPathExtension<span style="color: #002200;">&#93;</span> stringByAppendingString<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot; (default)&quot;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">NSMenuItem</span> <span style="color: #002200;">*</span>newAppItem <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self menuItemForOpenWithForApplication<span style="color: #002200;">:</span>defaultAppName path<span style="color: #002200;">:</span>defaultAppPath<span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#91;</span>subMenu addItem<span style="color: #002200;">:</span>newAppItem<span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#91;</span>subMenu addItem<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMenuItem</span> separatorItem<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>count <span style="color: #002200;">!=</span> <span style="color: #0000dd;">0</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                <span style="color: #0000ff;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">int</span> index <span style="color: #002200;">=</span> <span style="color: #0000dd;">0</span>; index &lt; count; <span style="color: #002200;">++</span>index<span style="color: #002200;">&#41;</span>
                <span style="color: #002200;">&#123;</span>
                    <span style="color: #0000ff;">NSURL</span> <span style="color: #002200;">*</span>appURL <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSURL</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>CFArrayGetValueAtIndex<span style="color: #002200;">&#40;</span>cfArrayOfApps, index<span style="color: #002200;">&#41;</span>;
                    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>appURL isFileURL<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
                    <span style="color: #002200;">&#123;</span>
                        <span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span>appName <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>appURL path<span style="color: #002200;">&#93;</span> lastPathComponent<span style="color: #002200;">&#93;</span> stringByDeletingPathExtension<span style="color: #002200;">&#93;</span>;
                        <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>alreadyAdded containsObject<span style="color: #002200;">:</span>appName<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                            appName <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>appName stringByAppendingFormat<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot; (%@)&quot;</span>, <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSBundle</span> bundleWithPath<span style="color: #002200;">:</span>defaultAppPath<span style="color: #002200;">&#93;</span> infoDictionary<span style="color: #002200;">&#93;</span> valueForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;CFBundleVersion&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
                        <span style="color: #002200;">&#125;</span>
                        <span style="color: #0000ff;">NSMenuItem</span> <span style="color: #002200;">*</span>newAppItem <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self menuItemForOpenWithForApplication<span style="color: #002200;">:</span>appName path<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>appURL path<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
                        <span style="color: #002200;">&#91;</span>alreadyAdded addObject<span style="color: #002200;">:</span>appName<span style="color: #002200;">&#93;</span>;
                        <span style="color: #002200;">&#91;</span>subMenu addItem<span style="color: #002200;">:</span>newAppItem<span style="color: #002200;">&#93;</span>;
                    <span style="color: #002200;">&#125;</span>
                <span style="color: #002200;">&#125;</span>
                <span style="color: #002200;">&#91;</span>subMenu addItem<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMenuItem</span> separatorItem<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>            
        <span style="color: #002200;">&#125;</span>
&nbsp;
        <span style="color: #0000ff;">NSMenuItem</span> <span style="color: #002200;">*</span>otherAppItem <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMenuItem</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>otherAppItem setTitle<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;Other…&quot;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>otherAppItem setTarget<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>otherAppItem setAction<span style="color: #002200;">:</span><span style="color: #0000ff;">@selector</span><span style="color: #002200;">&#40;</span>openWithApplicationOtherSelected<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>subMenu addItem<span style="color: #002200;">:</span>otherAppItem<span style="color: #002200;">&#93;</span>;
&nbsp;
	CFRelease<span style="color: #002200;">&#40;</span>cfArrayOfApps<span style="color: #002200;">&#41;</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #0000ff;">return</span> subMenu;
<span style="color: #002200;">&#125;</span></pre></div></div>

<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2011/03/13/creating-open-with-contextual-menu-as-in-finder/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Creating Finder&#8217;s &#8220;Open With&#8221; Contextual Menu+http://ivira.name/blog/2011/03/13/creating-open-with-contextual-menu-as-in-finder/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Creating Finder&#8217;s &#8220;Open With&#8221; Contextual Menu&amp;uri=http://ivira.name/blog/2011/03/13/creating-open-with-contextual-menu-as-in-finder/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2011/03/13/creating-open-with-contextual-menu-as-in-finder/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2011/03/13/creating-open-with-contextual-menu-as-in-finder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=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/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Создание аудиокниг для iPod/iPhone+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/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Создание аудиокниг для iPod/iPhone&amp;uri=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/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2010/05/12/создание-аудиокниг-для-ipodiphone/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></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>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/?p=160</guid>
		<description><![CDATA[Today I&#8217;ve 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&#8217;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&#8217;ve 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&#8217;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"><div 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></div></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>UPDATE If you want to filter array with regular expressions just use a predicate like this one:</p>
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;" lang="objc">[NSPredicate predicateWithFormat:@"SELF MATCHES %@", regexp];</pre>
<p>Further reading: <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/index.html">Apple Predicates Programming Guide</a></p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Cocoa Tip: Filtering NSArray using NSPredicate+http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Cocoa Tip: Filtering NSArray using NSPredicate&amp;uri=http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></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>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Using Google AJAX search API in Cocoa+http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Using Google AJAX search API in Cocoa&amp;uri=http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></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>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2009/11/06/open-all-icons-on-your-mac/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Open all icons on your Mac+http://ivira.name/blog/2009/11/06/open-all-icons-on-your-mac/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Open all icons on your Mac&amp;uri=http://ivira.name/blog/2009/11/06/open-all-icons-on-your-mac/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2009/11/06/open-all-icons-on-your-mac/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></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; надеюсь
    More&#160;&#187;]]></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>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2009/09/15/say-no-to-twitter/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Say no to Twitter+http://ivira.name/blog/2009/09/15/say-no-to-twitter/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Say no to Twitter&amp;uri=http://ivira.name/blog/2009/09/15/say-no-to-twitter/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2009/09/15/say-no-to-twitter/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></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>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2009/04/17/people-net-%d0%b8-mac/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=People Net и Mac+http://ivira.name/blog/2009/04/17/people-net-%d0%b8-mac/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=People Net и Mac&amp;uri=http://ivira.name/blog/2009/04/17/people-net-%d0%b8-mac/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2009/04/17/people-net-и-mac/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></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[This post contains constantly updated list of my favorite XCode/GDB/etc tips.
XCode HotKeys:

Switch to header/source file : Opt + Cmd + Up
Show Console : Shift + Cmd + R
Move to the next argument in Code Completion : Control + / or just Tab (works the latest XCode)
Jump to definition: Cmd + Double Click
Code Completion: Esc
Open Quickly &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>This post contains constantly updated list of my favorite XCode/GDB/etc tips.</p>
<p>XCode HotKeys:</p>
<ul>
<li><strong>Switch to header/source file</strong> : Opt + Cmd + Up</li>
<li><strong>Show Console</strong> : Shift + Cmd + R</li>
<li><strong>Move to the next argument in Code Completion</strong> : Control + / or just Tab (works the latest XCode)</li>
<li><strong>Jump to definition</strong>: Cmd + Double Click</li>
<li><strong>Code Completion</strong>:<strong> </strong>Esc</li>
<li><strong>Open Quickly &#8211; </strong>fast search of symbols; great time-saver: Shift + Cmd + D</li>
</ul>
<p><a title="Xcode shortcuts" href="http://www.1729.us/xcode/Xcode%20Shortcuts.png">Cool shortcut&#8217;s list for XCode</a></p>
<p>GDB Tips:</p>
<ul>
<li>po &#8211; prints object description e.g. po self</li>
<li>t a a bt &#8211; all threads&#8217; descriptions</li>
</ul>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2009/03/31/xcode-tips/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=XCode Tips+http://ivira.name/blog/2009/03/31/xcode-tips/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=XCode Tips&amp;uri=http://ivira.name/blog/2009/03/31/xcode-tips/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2009/03/31/xcode-tips/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2009/03/31/xcode-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

