<?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>Степень свободы &#187; Objective C</title>
	<atom:link href="http://www.snut.ru/?feed=rss2&#038;tag=objective-c" rel="self" type="application/rss+xml" />
	<link>http://www.snut.ru</link>
	<description>Немного слов о жизни и IT</description>
	<lastBuildDate>Tue, 14 Dec 2010 19:11:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>WP-Syntax</title>
		<link>http://www.snut.ru/?p=186</link>
		<comments>http://www.snut.ru/?p=186#comments</comments>
		<pubDate>Thu, 18 Feb 2010 09:45:32 +0000</pubDate>
		<dc:creator>Snut</dc:creator>
				<category><![CDATA[Новости]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://www.snut.ru/?p=186</guid>
		<description><![CDATA[Отличный плагин, теперь код в моем блоге будет иметь привычный вид и подсветку. Actionscript 3: 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 [...]]]></description>
			<content:encoded><![CDATA[<p>Отличный плагин, теперь код в моем блоге будет иметь привычный вид и подсветку.</p>
<p><strong>Actionscript 3:</strong></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
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">EventDispatcher</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">MouseEvent</span>;
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * @author					Snut
	 * @version					1.0
	 * @playerversion			Flash 9
	 * @langversion				3.0
	 */</span>	
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Test extends <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #009900;">//------------------------</span>
		<span style="color: #009900;">//</span>
		<span style="color: #009900;">//  Constructor</span>
		<span style="color: #009900;">//</span>
		<span style="color: #009900;">//------------------------</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * Contructor
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Test<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span>.<span style="color: #004993;">stage</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ADDED_TO_STAGE</span>, <span style="color: #0033ff; font-weight: bold;">this</span>.handler_added<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handler_added<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span>.<span style="color: #004993;">stage</span>.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ADDED_TO_STAGE</span>, <span style="color: #0033ff; font-weight: bold;">this</span>.handler_added <span style="color: #000000;">&#41;</span>;
			<span style="color: #0033ff; font-weight: bold;">super</span>.<span style="color: #004993;">stage</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>, <span style="color: #0033ff; font-weight: bold;">this</span>.handler_click<span style="color: #000000;">&#41;</span>;
			<span style="color: #0033ff; font-weight: bold;">super</span>.<span style="color: #004993;">stage</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">REMOVED_FROM_STAGE</span>, <span style="color: #0033ff; font-weight: bold;">this</span>.handler_removed<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handler_removed<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span>.<span style="color: #004993;">stage</span>.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>, <span style="color: #0033ff; font-weight: bold;">this</span>.handler_click<span style="color: #000000;">&#41;</span>;
			<span style="color: #0033ff; font-weight: bold;">super</span>.<span style="color: #004993;">stage</span>.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">REMOVED_FROM_STAGE</span>, <span style="color: #0033ff; font-weight: bold;">this</span>.handler_removed<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> myMethod<span style="color: #000000;">&#40;</span>string<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span> <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handler_click<span style="color: #000000;">&#40;</span>evt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span>.myMethod<span style="color: #000000;">&#40;</span><span style="color: #990000;">'WP-syntax'</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p><strong>Objective-C:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &lt;Foundation/Foundation.h&gt;</span>
&nbsp;
<span style="color: #a61390;">int</span> main <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span> argc, <span style="color: #a61390;">const</span> <span style="color: #a61390;">char</span> <span style="color: #002200;">*</span> argv<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSAutoreleasePool</span> <span style="color: #002200;">*</span> pool <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSAutoreleasePool</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #11740a; font-style: italic;">// insert code here...</span>
    NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Hello, World!&quot;</span><span style="color: #002200;">&#41;</span>;
    <span style="color: #002200;">&#91;</span>pool drain<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">return</span> <span style="color: #2400d9;">0</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.snut.ru/?feed=rss2&amp;p=186</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>На ночь глядя</title>
		<link>http://www.snut.ru/?p=173</link>
		<comments>http://www.snut.ru/?p=173#comments</comments>
		<pubDate>Tue, 16 Feb 2010 23:45:51 +0000</pubDate>
		<dc:creator>Snut</dc:creator>
				<category><![CDATA[Новости]]></category>
		<category><![CDATA[File System]]></category>
		<category><![CDATA[First App]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Objective C]]></category>

		<guid isPermaLink="false">http://www.snut.ru/?p=173</guid>
		<description><![CDATA[Ну что ж, первая маленькая программуля на Obj-C готова. Она консольная и всего лишь находит файл с заданным расширением и удаляет его (Ухаха, потирает ручки): Program loaded. run [Switching to process 3567] Running… 2010-02-17 02:39:24.903 FileWalker[3567:a0f] find: Documents/ifoundyou.lulext 2010-02-17 02:39:24.959 FileWalker[3567:a0f] /Users/snut/Documents/ifoundyou.lulext succesfully removed Debugger stopped. Program exited with status value:0. Program loaded. run [Switching [...]]]></description>
			<content:encoded><![CDATA[<p>Ну что ж, первая маленькая программуля на Obj-C готова. Она консольная и всего лишь находит файл с заданным расширением и удаляет его (Ухаха, потирает ручки):</p>
<div id="_mcePaste">
<div id="_mcePaste">Program loaded.</div>
<div id="_mcePaste">run</div>
<div id="_mcePaste">[Switching to process 3567]</div>
<div id="_mcePaste">Running…</div>
<div id="_mcePaste">2010-02-17 02:39:24.903 FileWalker[3567:a0f] find: Documents/ifoundyou.lulext</div>
<div id="_mcePaste">2010-02-17 02:39:24.959 FileWalker[3567:a0f] /Users/snut/Documents/ifoundyou.lulext succesfully removed</div>
<div id="_mcePaste">Debugger stopped.</div>
<div id="_mcePaste">Program exited with status value:0.</div>
<div id="_mcePaste">Program loaded.</div>
<div id="_mcePaste">run</div>
<div id="_mcePaste">[Switching to process 3578]</div>
<div id="_mcePaste">Running…</div>
<div id="_mcePaste">2010-02-17 02:39:35.473 FileWalker[3578:a0f] Can&#8217;t find files with extension lulext</div>
<div id="_mcePaste">Debugger stopped.</div>
<div id="_mcePaste">Program exited with status value:0.</div>
</div>
<div>Листинг под катом.</div>
<div><span id="more-173"></span></div>

<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
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &lt;Foundation/Foundation.h&gt;</span>
&nbsp;
<span style="color: #a61390;">int</span> main <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span> argc, <span style="color: #a61390;">const</span> <span style="color: #a61390;">char</span> <span style="color: #002200;">*</span> argv<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSAutoreleasePool</span> <span style="color: #002200;">*</span> pool <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSAutoreleasePool</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>extension <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;lulext&quot;</span>;
	<span style="color: #400080;">NSFileManager</span> <span style="color: #002200;">*</span>manager <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSFileManager</span> defaultManager<span style="color: #002200;">&#93;</span>;
	<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>home <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;~&quot;</span> stringByExpandingTildeInPath<span style="color: #002200;">&#93;</span>;
	<span style="color: #400080;">NSMutableArray</span> <span style="color: #002200;">*</span>filesArray <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableArray</span> arrayWithCapacity<span style="color: #002200;">:</span><span style="color: #2400d9;">42</span><span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>filename <span style="color: #a61390;">in</span> <span style="color: #002200;">&#91;</span>manager enumeratorAtPath<span style="color: #002200;">:</span>home<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>filename pathExtension<span style="color: #002200;">&#93;</span> isEqualTo<span style="color: #002200;">:</span> extension<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
			<span style="color: #002200;">&#91;</span>filesArray addObject<span style="color: #002200;">:</span> filename<span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#125;</span>
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>filesArray count<span style="color: #002200;">&#93;</span> &gt; <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>filename <span style="color: #a61390;">in</span> filesArray<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
			NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;find: %@&quot;</span>, filename<span style="color: #002200;">&#41;</span>;
			<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>fullpath <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>home stringByAppendingString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;/&quot;</span><span style="color: #002200;">&#93;</span> 
							stringByAppendingString<span style="color: #002200;">:</span>filename<span style="color: #002200;">&#93;</span>;
			<span style="color: #a61390;">BOOL</span> result <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>manager removeItemAtPath<span style="color: #002200;">:</span>fullpath
								error<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
			<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>result <span style="color: #002200;">==</span> <span style="color: #a61390;">YES</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
				NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%@ succesfully removed&quot;</span>, fullpath <span style="color: #002200;">&#41;</span>;
			<span style="color: #002200;">&#125;</span> <span style="color: #a61390;">else</span> <span style="color: #002200;">&#123;</span>
				NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%@ do not removed&quot;</span>, fullpath <span style="color: #002200;">&#41;</span>;
			<span style="color: #002200;">&#125;</span>
&nbsp;
		<span style="color: #002200;">&#125;</span>
	<span style="color: #002200;">&#125;</span> <span style="color: #a61390;">else</span> <span style="color: #002200;">&#123;</span>
		NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Can't find files with extension %@&quot;</span>, extension<span style="color: #002200;">&#41;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #002200;">&#91;</span>pool drain<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">return</span> <span style="color: #2400d9;">0</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.snut.ru/?feed=rss2&amp;p=173</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Приятная неожиданность</title>
		<link>http://www.snut.ru/?p=171</link>
		<comments>http://www.snut.ru/?p=171#comments</comments>
		<pubDate>Tue, 16 Feb 2010 22:41:56 +0000</pubDate>
		<dc:creator>Snut</dc:creator>
				<category><![CDATA[Новости]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[Study]]></category>

		<guid isPermaLink="false">http://www.snut.ru/?p=171</guid>
		<description><![CDATA[В столь поздний час я сижу за замечательной книгой Objective-C 2.0 и программирование для Mac. В одном из примеров есть 2 строки: NSMutableArray *array; array = [NSMutableArray arrayWithCapacity:42]; и пояснение: &#171;Мы не знаем сколько имен .jpg-файлов будет найдено, так что взяли число 42 с потолка&#187;. Но мы, друзья, знаем, что это число не простое А тем [...]]]></description>
			<content:encoded><![CDATA[<p>В столь поздний час я сижу за замечательной книгой Objective-C 2.0 и программирование для Mac. В одном из примеров есть 2 строки:</p>
<blockquote><p>NSMutableArray *array;<br />
array = [NSMutableArray arrayWithCapacity:42];</p></blockquote>
<p>и пояснение: <em>&laquo;Мы не знаем сколько имен .jpg-файлов будет найдено, так что взяли число 42 с потолка&raquo;.</em> Но мы, друзья, знаем, что это число не простое <img src='http://www.snut.ru/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  А тем кто не знает советую почитать &laquo;Автостопом по галактике&raquo; (англ. <em>The Hitchhiker&#8217;s Guide to the Galaxy</em>) Дугласа Адамса.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.snut.ru/?feed=rss2&amp;p=171</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective C</title>
		<link>http://www.snut.ru/?p=168</link>
		<comments>http://www.snut.ru/?p=168#comments</comments>
		<pubDate>Thu, 11 Feb 2010 09:53:48 +0000</pubDate>
		<dc:creator>Snut</dc:creator>
				<category><![CDATA[Новости]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.snut.ru/?p=168</guid>
		<description><![CDATA[Забавный язык я вам скажу]]></description>
			<content:encoded><![CDATA[<p>Забавный язык я вам скажу</p>
]]></content:encoded>
			<wfw:commentRss>http://www.snut.ru/?feed=rss2&amp;p=168</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
