<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DEEDQ347eyp7ImA9WhRaE0o.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767</id><updated>2012-02-16T09:17:52.003+02:00</updated><category term="Visual Studio" /><category term="Windows Mobile" /><category term="UIButton" /><category term="Xcode" /><category term="AppleScript" /><category term="C" /><category term="About Nothing" /><category term="Photo" /><category term="ActionScript" /><category term="Navigation" /><category term="Experts-Exchange" /><category term="Apple" /><category term="C#" /><category term="C++" /><category term="ATL" /><category term="Carbon" /><category term="iPhone" /><category term="Graphics" /><category term="STL" /><category term="Objective-C" /><category term="Win32" /><category term="Mac OS X" /><category term="Cocoa" /><category term="GDI+" /><category term="iOS" /><category term="iPad" /><category term="RAPI" /><category term="Windows CE" /><category term="Core Graphics" /><category term="OpenGL" /><title>Software Developer</title><subtitle type="html">Programming in Objective-C and C/C++ for iOS,
Mac OS X, Microsoft Windows and Windows Mobile.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://www.wmdeveloper.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>298</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/wmdeveloper/gfPj" /><feedburner:info uri="wmdeveloper/gfpj" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;A08NQ30yeyp7ImA9WhRVFEg.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-6130407948209168150</id><published>2012-01-13T15:04:00.003+02:00</published><updated>2012-01-13T15:04:52.393+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-13T15:04:52.393+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="Xcode" /><category scheme="http://www.blogger.com/atom/ns#" term="iOS" /><category scheme="http://www.blogger.com/atom/ns#" term="UIButton" /><title>UIButton with gradient</title><content type="html">The following code adds a gradient effect to the button:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="color: #733ea4; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;CAGradientLayer&lt;span style="color: black;"&gt;* gradientLayer = [[&lt;/span&gt;CAGradientLayer&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #401f7d;"&gt;alloc&lt;/span&gt;&lt;span style="color: black;"&gt;] &lt;/span&gt;&lt;span style="color: #401f7d;"&gt;init&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp; [gradientLayer &lt;span style="color: #401f7d;"&gt;setBounds&lt;/span&gt;:[&lt;span style="color: #4d8186;"&gt;buttonTest&lt;/span&gt; &lt;span style="color: #401f7d;"&gt;bounds&lt;/span&gt;]];&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp; [gradientLayer &lt;span style="color: #401f7d;"&gt;setPosition&lt;/span&gt;:&lt;/div&gt;
&lt;div style="color: #401f7d; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;/span&gt;CGPointMake&lt;span style="color: black;"&gt;([&lt;/span&gt;&lt;span style="color: #4d8186;"&gt;buttonTest&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;bounds&lt;span style="color: black;"&gt;].&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;size&lt;/span&gt;&lt;span style="color: black;"&gt;.&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;width&lt;/span&gt;&lt;span style="color: black;"&gt;/&lt;/span&gt;&lt;span style="color: #2f2fd1;"&gt;2&lt;/span&gt;&lt;span style="color: black;"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [&lt;span style="color: #4d8186;"&gt;buttonTest&lt;/span&gt; &lt;span style="color: #401f7d;"&gt;bounds&lt;/span&gt;].&lt;span style="color: #733ea4;"&gt;size&lt;/span&gt;.&lt;span style="color: #733ea4;"&gt;height&lt;/span&gt;/&lt;span style="color: #2f2fd1;"&gt;2&lt;/span&gt;)];&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 17.0px;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp; [gradientLayer &lt;span style="color: #401f7d;"&gt;setColors&lt;/span&gt;:&lt;/div&gt;
&lt;div style="color: #401f7d; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; [&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;NSArray&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;arrayWithObjects&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #401f7d; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; (&lt;/span&gt;&lt;span style="color: #be299d;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;)[[&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;UIColor&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;blueColor&lt;span style="color: black;"&gt;] &lt;/span&gt;CGColor&lt;span style="color: black;"&gt;],&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; (&lt;span style="color: #be299d;"&gt;id&lt;/span&gt;)[[&lt;span style="color: #733ea4;"&gt;UIColor&lt;/span&gt; &lt;span style="color: #401f7d;"&gt;cyanColor&lt;/span&gt;] &lt;span style="color: #401f7d;"&gt;CGColor&lt;/span&gt;], &lt;span style="color: #be299d;"&gt;nil&lt;/span&gt;]];&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp; [[&lt;span style="color: #4d8186;"&gt;buttonTest&lt;/span&gt; &lt;span style="color: #401f7d;"&gt;layer&lt;/span&gt;] &lt;span style="color: #401f7d;"&gt;insertSublayer&lt;/span&gt;:gradientLayer &lt;span style="color: #401f7d;"&gt;atIndex&lt;/span&gt;:&lt;span style="color: #2f2fd1;"&gt;0&lt;/span&gt;]; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp; [gradientLayer &lt;span style="color: #401f7d;"&gt;release&lt;/span&gt;];&lt;/div&gt;
&lt;div&gt;
The result may look so:&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-iuUff3eFTMg/TxAr1Uy79fI/AAAAAAAACTM/ivEdtwMTwmQ/s1600/s5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="244" src="http://2.bp.blogspot.com/-iuUff3eFTMg/TxAr1Uy79fI/AAAAAAAACTM/ivEdtwMTwmQ/s320/s5.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-6130407948209168150?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/Zz7kXo6fmR8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/6130407948209168150/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2012/01/uibutton-with-gradient.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6130407948209168150?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6130407948209168150?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/Zz7kXo6fmR8/uibutton-with-gradient.html" title="UIButton with gradient" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-iuUff3eFTMg/TxAr1Uy79fI/AAAAAAAACTM/ivEdtwMTwmQ/s72-c/s5.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2012/01/uibutton-with-gradient.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QHQX47eCp7ImA9WhRVFEg.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-2095233494160091074</id><published>2012-01-13T14:55:00.001+02:00</published><updated>2012-01-13T14:55:30.000+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-13T14:55:30.000+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="Xcode" /><category scheme="http://www.blogger.com/atom/ns#" term="iOS" /><category scheme="http://www.blogger.com/atom/ns#" term="UIButton" /><title>UIButton with a border</title><content type="html">Let's say, you know how to add a button to your application. &amp;nbsp;Now let's add a border:&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-X4F7B_XHmns/TxApawC7vgI/AAAAAAAACTE/apsn0M3eh_8/s1600/s3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-X4F7B_XHmns/TxApawC7vgI/AAAAAAAACTE/apsn0M3eh_8/s320/s3.jpg" width="219" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This effect should be done the code, for example in&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt;-&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt;viewDidLoad&amp;nbsp;&lt;/span&gt;method:&lt;/div&gt;
&lt;div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
- (&lt;span style="color: #be299d;"&gt;void&lt;/span&gt;)viewDidLoad&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
{&lt;/div&gt;
&lt;div style="color: #401f7d; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; [&lt;/span&gt;&lt;span style="color: #be299d;"&gt;super&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;viewDidLoad&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #401f7d; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; [[&lt;/span&gt;&lt;span style="color: #4d8186;"&gt;buttonTest&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;layer&lt;span style="color: black;"&gt;] &lt;/span&gt;setCornerRadius&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #2f2fd1;"&gt;8.0f&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #401f7d; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; [[&lt;/span&gt;&lt;span style="color: #4d8186;"&gt;buttonTest&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;layer&lt;span style="color: black;"&gt;] &lt;/span&gt;setMasksToBounds&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #be299d;"&gt;YES&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #401f7d; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; [[&lt;/span&gt;&lt;span style="color: #4d8186;"&gt;buttonTest&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;layer&lt;span style="color: black;"&gt;] &lt;/span&gt;setBorderWidth&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #2f2fd1;"&gt;3.0f&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-2095233494160091074?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/5yGzkqTCmJs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/2095233494160091074/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2012/01/uibutton-with-border.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2095233494160091074?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2095233494160091074?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/5yGzkqTCmJs/uibutton-with-border.html" title="UIButton with a border" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-X4F7B_XHmns/TxApawC7vgI/AAAAAAAACTE/apsn0M3eh_8/s72-c/s3.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2012/01/uibutton-with-border.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkAFQXk9eip7ImA9WhRVFEg.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-1820540865573102852</id><published>2012-01-13T14:45:00.000+02:00</published><updated>2012-01-13T14:45:10.762+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-13T14:45:10.762+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="iOS" /><category scheme="http://www.blogger.com/atom/ns#" term="UIButton" /><title>UIButton. Change the background color in Interface Builder</title><content type="html">It could be funny, if it was not sad - it was not very easy to change the button color in Interface Builder. :) The key is the button type - set it to "Custom":
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-arLnVMiS1wA/TxAmqvbYdfI/AAAAAAAACSw/xFtRElcrh1M/s1600/s1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="170" src="http://1.bp.blogspot.com/-arLnVMiS1wA/TxAmqvbYdfI/AAAAAAAACSw/xFtRElcrh1M/s400/s1.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
Then, you can find where to change the background color:
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-B8kTUASIFTk/TxAnCaKYwDI/AAAAAAAACS8/mMt-dhCGuZU/s1600/s2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="111" src="http://4.bp.blogspot.com/-B8kTUASIFTk/TxAnCaKYwDI/AAAAAAAACS8/mMt-dhCGuZU/s400/s2.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-1820540865573102852?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/brSQDpxVLig" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/1820540865573102852/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2012/01/uibutton-change-background-color-in.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/1820540865573102852?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/1820540865573102852?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/brSQDpxVLig/uibutton-change-background-color-in.html" title="UIButton. Change the background color in Interface Builder" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-arLnVMiS1wA/TxAmqvbYdfI/AAAAAAAACSw/xFtRElcrh1M/s72-c/s1.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2012/01/uibutton-change-background-color-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IAQ305fSp7ImA9WhRWEUk.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-6457030291861877204</id><published>2011-12-29T09:59:00.000+02:00</published><updated>2011-12-29T09:59:02.325+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-29T09:59:02.325+02:00</app:edited><title>@synchronized</title><content type="html">In case you need to synchronize:
&lt;a href="http://perpendiculo.us/?p=133"&gt;@synchronized, NSLock, pthread, OSSpinLock showdown, done right&lt;/a&gt;
Occasionally found this article and I think it's very helpful - in extreamely short form, as working examples, it shows all synchronization tools.&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-6457030291861877204?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/hASvIyLZRp0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/6457030291861877204/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/12/synchronized.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6457030291861877204?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6457030291861877204?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/hASvIyLZRp0/synchronized.html" title="@synchronized" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/12/synchronized.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMCR30zfip7ImA9WhRXGEw.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-1954291704030388524</id><published>2011-12-25T14:51:00.001+02:00</published><updated>2011-12-25T14:51:06.386+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-25T14:51:06.386+02:00</app:edited><title>Read data from a file in the application bundle</title><content type="html">Very simple:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="color: #401f7d; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: #733ea4;"&gt;NSString&lt;/span&gt;&lt;span style="color: black;"&gt;* filePath = [[&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;NSBundle&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;mainBundle&lt;span style="color: black;"&gt;] &lt;/span&gt;pathForResource&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #d42722;"&gt;@"Name"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;ofType&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #d42722;"&gt;@"dat"&lt;/span&gt;&lt;span style="color: black;"&gt;]; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: #733ea4;"&gt;NSData&lt;/span&gt;* data = [&lt;span style="color: #733ea4;"&gt;NSData&lt;/span&gt; &lt;span style="color: #401f7d;"&gt;dataWithContentsOfFile&lt;/span&gt;:filePath];&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
Or, in case of a text data:&lt;/div&gt;
&lt;div&gt;
&lt;div style="color: #401f7d; font: normal normal normal 14px/normal Courier; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;span style="color: #733ea4;"&gt;NSString&lt;/span&gt;&lt;span style="color: black;"&gt;* filePath = [[&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;NSBundle&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;mainBundle&lt;span style="color: black;"&gt;]&amp;nbsp;&lt;/span&gt;pathForResource&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #d42722;"&gt;@"Name"&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;ofType&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #d42722;"&gt;@"txt"&lt;/span&gt;&lt;span style="color: black;"&gt;];&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: #733ea4;"&gt;NSString&lt;/span&gt;* text = [&lt;span style="color: #733ea4;"&gt;NSString&lt;/span&gt; &lt;span style="color: #401f7d;"&gt;stringWithContentsOfFile&lt;/span&gt;:filePath&amp;nbsp;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #401f7d;"&gt;encoding&lt;/span&gt;:&lt;span style="color: #401f7d;"&gt;NSUTF8StringEncoding&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #401f7d;"&gt;error&lt;/span&gt;:&lt;span style="color: #be299d;"&gt;nil&lt;/span&gt;];&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-1954291704030388524?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/nc_GXrsUekY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/1954291704030388524/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/12/read-data-from-file-in-application.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/1954291704030388524?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/1954291704030388524?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/nc_GXrsUekY/read-data-from-file-in-application.html" title="Read data from a file in the application bundle" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/12/read-data-from-file-in-application.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MAR3k6eip7ImA9WhRQFUo.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-7089476466764531751</id><published>2011-12-11T06:54:00.001+02:00</published><updated>2011-12-11T06:57:26.712+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-11T06:57:26.712+02:00</app:edited><title>Android UI vs iPhone UI</title><content type="html">I found an article talking about UI in Android and iPhone:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.cultofmac.com/133624/why-android-will-always-be-laggier-than-ios/"&gt;Why Android Will Always Be Laggier Than iOS&lt;/a&gt;
The author says that UI tasks in Android is running in the main thread with the normal priority and only now got the hardware acceleration. The iPhone gives the high priority to the UI tasks. And it's good, etc.&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-7089476466764531751?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/hVJPqkc7Zxs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/7089476466764531751/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/12/android-ui-vs-iphone-ui.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/7089476466764531751?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/7089476466764531751?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/hVJPqkc7Zxs/android-ui-vs-iphone-ui.html" title="Android UI vs iPhone UI" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/12/android-ui-vs-iphone-ui.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkEHRn4-cCp7ImA9WhRRGEk.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-2214604094420662123</id><published>2011-12-02T18:33:00.001+02:00</published><updated>2011-12-02T18:50:37.058+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-02T18:50:37.058+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C" /><title>Accelerometer. It's simple</title><content type="html">The simplest way to use accelerometer in an iPhone application is UIAccelerometer class:&lt;br /&gt;
&lt;div style="color: #733ea4; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;UIAccelerometer&lt;span style="color: black;"&gt;* accelerometer = [&lt;/span&gt;UIAccelerometer&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #401f7d;"&gt;sharedAccelerometer&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;
This code above shows how to get the accelerometer instance in the code.&lt;br /&gt;
The following line sets up the update interval:&lt;br /&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;[accelerometer &lt;span style="color: #401f7d;"&gt;setUpdateInterval&lt;/span&gt;: &lt;span style="color: #2f2fd1;"&gt;1.0&lt;/span&gt; / &lt;span style="color: #2f2fd1;"&gt;10.0f&lt;/span&gt;];&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp; [accelerometer &lt;span style="color: #401f7d;"&gt;setDelegate&lt;/span&gt;:&lt;span style="color: #be299d;"&gt;self&lt;/span&gt;];&lt;/div&gt;
each 0.1 second the accelerometer will update the program that implements delegate&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: small;"&gt;method:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span class="Apple-style-span" style="font-family: Times; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt;- (&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt;&lt;span style="color: #be299d;"&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt;)accelerometer:(&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt;&lt;span style="color: #733ea4;"&gt;UIAccelerometer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt; *)acel didAccelerate:(&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt;&lt;span style="color: #733ea4;"&gt;UIAcceleration&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt; *)aceler&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
{&lt;/div&gt;
&lt;div style="color: #d42722; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: #401f7d;"&gt;NSLog&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;@"acceleration.x = %+.6f"&lt;span style="color: black;"&gt;, aceler.&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;x&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #d42722; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: #401f7d;"&gt;NSLog&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;@"acceleration.y = %+.6f"&lt;span style="color: black;"&gt;, aceler.&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;y&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #d42722; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: #401f7d;"&gt;NSLog&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;@"acceleration.z = %+.6f"&lt;span style="color: black;"&gt;, aceler.&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;z&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 17.0px;"&gt;
}&lt;/div&gt;
Do not forget to add&amp;nbsp;&lt;span class="Apple-style-span" style="color: #733ea4; font-family: Courier; font-size: 14px;"&gt;UIAccelerometerDelegate&lt;/span&gt;, for example, to a view controller class:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="color: #733ea4; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: #be299d;"&gt;@interface&lt;/span&gt;&lt;span style="color: black;"&gt; ViewController : &lt;/span&gt;UIViewController&lt;span style="color: black;"&gt; &amp;lt;&lt;/span&gt;UIAccelerometerDelegate&lt;span style="color: black;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
So here is the step-by-step scenario for beginners:&lt;/div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
1. Create new Single-View project in Xcode.&lt;/div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
2. In ViewController.h file add&amp;nbsp;&lt;span class="Apple-style-span" style="color: #733ea4; font-family: Courier; font-size: 14px;"&gt;&lt;span style="color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #733ea4; font-family: Courier; font-size: 14px;"&gt;UIAccelerometerDelegate&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #733ea4; font-family: Courier; font-size: 14px;"&gt;&lt;span style="color: black;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;after&amp;nbsp;&lt;span class="Apple-style-span" style="color: #733ea4; font-family: Courier; font-size: 14px;"&gt;UIViewController&lt;/span&gt;.&lt;/div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
3. In ViewController.m file, modify&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: Courier; font-size: 14px;"&gt;viewDidLoad &lt;/span&gt;method:&lt;/div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
- (&lt;span style="color: #be299d;"&gt;void&lt;/span&gt;)viewDidLoad&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
{&lt;/div&gt;
&lt;div style="color: #401f7d; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; [&lt;/span&gt;&lt;span style="color: #be299d;"&gt;super&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;viewDidLoad&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #733ea4; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;UIAccelerometer&lt;span style="color: black;"&gt;* accelerometer = [&lt;/span&gt;UIAccelerometer&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #401f7d;"&gt;sharedAccelerometer&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp; [accelerometer &lt;span style="color: #401f7d;"&gt;setUpdateInterval&lt;/span&gt;: &lt;span style="color: #2f2fd1;"&gt;1.0&lt;/span&gt; / &lt;span style="color: #2f2fd1;"&gt;10.0f&lt;/span&gt;];&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&amp;nbsp; &amp;nbsp; [accelerometer &lt;span style="color: #401f7d;"&gt;setDelegate&lt;/span&gt;:&lt;span style="color: #be299d;"&gt;self&lt;/span&gt;];&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
}&lt;/div&gt;
&lt;div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
4. In ViewController.m file, add new method:&lt;/div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
- (&lt;span style="color: #be299d;"&gt;void&lt;/span&gt;)accelerometer:(&lt;span style="color: #733ea4;"&gt;UIAccelerometer&lt;/span&gt; *)acel didAccelerate:(&lt;span style="color: #733ea4;"&gt;UIAcceleration&lt;/span&gt; *)aceler&amp;nbsp;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
{&lt;/div&gt;
&lt;div style="color: #d42722; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: #401f7d;"&gt;NSLog&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;@"acceleration.x = %+.6f"&lt;span style="color: black;"&gt;, aceler.&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;x&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #d42722; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: #401f7d;"&gt;NSLog&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;@"acceleration.y = %+.6f"&lt;span style="color: black;"&gt;, aceler.&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;y&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #d42722; font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: #401f7d;"&gt;NSLog&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;@"acceleration.z = %+.6f"&lt;span style="color: black;"&gt;, aceler.&lt;/span&gt;&lt;span style="color: #733ea4;"&gt;z&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 14.0px Courier; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 17.0px;"&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
This program works on iPhone. It does not make much sense to test it simulator.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-2214604094420662123?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/_ZdBQwA68V8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/2214604094420662123/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/12/accelerometer-its-simple.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2214604094420662123?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2214604094420662123?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/_ZdBQwA68V8/accelerometer-its-simple.html" title="Accelerometer. It's simple" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/12/accelerometer-its-simple.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4HRX48eip7ImA9WhRRGE8.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-2601080665663426854</id><published>2011-12-02T12:16:00.001+02:00</published><updated>2011-12-02T12:48:54.072+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-02T12:48:54.072+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Xcode" /><title>Xcode 4: Add Existing Framework</title><content type="html">1. Select your project in the project navigator - on the left side of the Xcode window.&lt;br /&gt;
2. On the right side of the window, choose the target.&lt;br /&gt;
3. Choose Summary page (press on the Summary button on the top of the window).&lt;br /&gt;
4. Scroll down till find "Linked Frameworks and Libraries".&lt;br /&gt;
5. Press on plus button to add an existing framework from the list:
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-XPUnRSNTJJA/TtisFKjnfAI/AAAAAAAACSg/y--HQu0AZew/s1600/Screen%2BShot%2B2011-12-02%2Bat%2B12.02.14%2BPM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="326" src="http://2.bp.blogspot.com/-XPUnRSNTJJA/TtisFKjnfAI/AAAAAAAACSg/y--HQu0AZew/s400/Screen%2BShot%2B2011-12-02%2Bat%2B12.02.14%2BPM.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a href="https://developer.apple.com/library/ios/#recipes/xcode_help-project_editor/Articles/AddingaLibrarytoaTarget.html#//apple_ref/doc/uid/TP40010155-CH17-SW1"&gt;iOS Developer Library. Linking To A Library Or Framework.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-2601080665663426854?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/JowNqSMpY0s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/2601080665663426854/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/12/xcode-4-add-existing-framework.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2601080665663426854?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2601080665663426854?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/JowNqSMpY0s/xcode-4-add-existing-framework.html" title="Xcode 4: Add Existing Framework" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-XPUnRSNTJJA/TtisFKjnfAI/AAAAAAAACSg/y--HQu0AZew/s72-c/Screen%2BShot%2B2011-12-02%2Bat%2B12.02.14%2BPM.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/12/xcode-4-add-existing-framework.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8AQ3k4fSp7ImA9WhRRGE8.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-2707970326879711902</id><published>2011-11-26T23:02:00.001+02:00</published><updated>2011-12-02T12:47:22.735+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-02T12:47:22.735+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C" /><category scheme="http://www.blogger.com/atom/ns#" term="Cocoa" /><title>Sort String Array</title><content type="html">The following code demonstrates how to sort an array of strings in Objective-C:
&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#004a43; '&gt;#import &lt;/span&gt;&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#004a43; '&gt;Foundation&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;&lt;span style='color:#004a43; '&gt;Foundation&lt;/span&gt;&lt;span style='color:#808030; '&gt;.&lt;/span&gt;&lt;span style='color:#004a43; '&gt;h&lt;/span&gt;&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;

&lt;span style='color:#800000; font-weight:bold; '&gt;int&lt;/span&gt; &lt;span style='color:#400000; '&gt;main&lt;/span&gt; &lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#800000; font-weight:bold; '&gt;int&lt;/span&gt; argc&lt;span style='color:#808030; '&gt;,&lt;/span&gt; &lt;span style='color:#800000; font-weight:bold; '&gt;const&lt;/span&gt; &lt;span style='color:#800000; font-weight:bold; '&gt;char&lt;/span&gt; &lt;span style='color:#808030; '&gt;*&lt;/span&gt; argv&lt;span style='color:#808030; '&gt;[&lt;/span&gt;&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;
&lt;span style='color:#800080; '&gt;{&lt;/span&gt;

    &lt;span style='color:#808030; '&gt;@&lt;/span&gt;autoreleasepool &lt;span style='color:#800080; '&gt;{&lt;/span&gt;
        
        NSArray &lt;span style='color:#808030; '&gt;*&lt;/span&gt;stringsArray &lt;span style='color:#808030; '&gt;=&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;NSArray arrayWithObjects&lt;span style='color:#800080; '&gt;:&lt;/span&gt;
                                 &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;string 1&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt;
                                 &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;String 21&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt;
                                 &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;string 12&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt;
                                 &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;String 11&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt;
                                 &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;String 02&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; nil&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
        &lt;span style='color:#800000; font-weight:bold; '&gt;static&lt;/span&gt; NSStringCompareOptions comparisonOptions &lt;span style='color:#808030; '&gt;=&lt;/span&gt; NSCaseInsensitiveSearch &lt;span style='color:#808030; '&gt;|&lt;/span&gt; NSNumericSearch &lt;span style='color:#808030; '&gt;|&lt;/span&gt;
        NSWidthInsensitiveSearch &lt;span style='color:#808030; '&gt;|&lt;/span&gt; NSForcedOrderingSearch&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
        NSLocale &lt;span style='color:#808030; '&gt;*&lt;/span&gt;currentLocale &lt;span style='color:#808030; '&gt;=&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;NSLocale currentLocale&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
        NSComparator finderSort &lt;span style='color:#808030; '&gt;=&lt;/span&gt; &lt;span style='color:#808030; '&gt;^&lt;/span&gt;&lt;span style='color:#808030; '&gt;(&lt;/span&gt;id string1&lt;span style='color:#808030; '&gt;,&lt;/span&gt; id string2&lt;span style='color:#808030; '&gt;)&lt;/span&gt; &lt;span style='color:#800080; '&gt;{&lt;/span&gt;
            NSRange string1Range &lt;span style='color:#808030; '&gt;=&lt;/span&gt; NSMakeRange&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#008c00; '&gt;0&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;string1 length&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
            &lt;span style='color:#800000; font-weight:bold; '&gt;return&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;string1 compare&lt;span style='color:#800080; '&gt;:&lt;/span&gt;string2 options&lt;span style='color:#800080; '&gt;:&lt;/span&gt;comparisonOptions range&lt;span style='color:#800080; '&gt;:&lt;/span&gt;string1Range locale&lt;span style='color:#800080; '&gt;:&lt;/span&gt;currentLocale&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
        &lt;span style='color:#800080; '&gt;}&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
        
        NSArray&lt;span style='color:#808030; '&gt;*&lt;/span&gt; sortedArray &lt;span style='color:#808030; '&gt;=&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;stringsArray sortedArrayUsingComparator&lt;span style='color:#800080; '&gt;:&lt;/span&gt;finderSort&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
        NSLog&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;finderSort: %@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; sortedArray&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;        
    &lt;span style='color:#800080; '&gt;}&lt;/span&gt;
    &lt;span style='color:#800000; font-weight:bold; '&gt;return&lt;/span&gt; &lt;span style='color:#008c00; '&gt;0&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
&lt;span style='color:#800080; '&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;a href="http://developer.apple.com/library/ios/#featuredarticles/Short_Practical_Guide_Blocks/_index.html"&gt;This code is taken from iOS Developer Library.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-2707970326879711902?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/aoRF8nEJuek" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/2707970326879711902/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/11/sort-string-array.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2707970326879711902?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2707970326879711902?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/aoRF8nEJuek/sort-string-array.html" title="Sort String Array" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/11/sort-string-array.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0UERXkyeyp7ImA9WhRRE0k.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-6864011969018586868</id><published>2011-11-26T15:24:00.001+02:00</published><updated>2011-11-26T23:00:04.793+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-26T23:00:04.793+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C" /><title>The Blocks</title><content type="html">Apple introduced &lt;i&gt;blocks&lt;/i&gt;&amp;nbsp;(a segment of code that can be executed any time) in C and Objective-c. It happened in Mac OS X 10.6. &lt;a href="http://thirdcog.eu/pwcblocks/"&gt;Later on this feature was back-ported to Mac OS X 10.5 and iPhone by Plausible Labs.&lt;/a&gt;&amp;nbsp; The blocks are also called &lt;i&gt;closures&lt;/i&gt;, because they close around variables. Also the blocks can be called &lt;i&gt;lambdas&lt;/i&gt;.&lt;br /&gt;
I'd say that the blocks are the same as the regular function pointers in C. From a very general point of view, the main difference is just the symbol caret (^) before the block name instead of the asterisk (*) before the function pointer. 
Here is a trivial example:
&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: #004a43;"&gt;#import &lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;/&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;&lt;span style="color: #004a43;"&gt;h&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; &lt;span style="color: #400000;"&gt;main&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; argc&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;const&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt; argv&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;

    &lt;span style="color: #808030;"&gt;@&lt;/span&gt;autoreleasepool &lt;span style="color: purple;"&gt;{&lt;/span&gt;

        &lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;^&lt;/span&gt;now&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;^&lt;/span&gt;&lt;span style="color: purple;"&gt;{&lt;/span&gt; 
            NSDate&lt;span style="color: #808030;"&gt;*&lt;/span&gt; moment &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSDate date&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Now: %@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; moment&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        
        
        now&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
The program output is:
[Switching to process 41322 thread 0x0]
2011-11-26 18:07:25.202 block4[41322:707] Now: 2011-11-26 16:07:25 +0000
Program ended with exit code: 0

The following program simply creates and synchronously performs a block:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: #004a43;"&gt;#import &lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;/&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;&lt;span style="color: #004a43;"&gt;h&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; &lt;span style="color: #400000;"&gt;main&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; argc&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;const&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt; argv&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;

    &lt;span style="color: #808030;"&gt;@&lt;/span&gt;autoreleasepool &lt;span style="color: purple;"&gt;{&lt;/span&gt;

        &lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;^&lt;/span&gt;theBlock&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;^&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; x&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;x = &lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%d&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; x&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        
        theBlock&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #008c00;"&gt;12&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
typedef can be used with the blocks:
&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: #004a43;"&gt;#import &lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;/&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;&lt;span style="color: #004a43;"&gt;h&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; &lt;span style="color: #400000;"&gt;main&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; argc&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;const&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt; argv&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;

    &lt;span style="color: #808030;"&gt;@&lt;/span&gt;autoreleasepool &lt;span style="color: purple;"&gt;{&lt;/span&gt;

        &lt;span style="color: maroon; font-weight: bold;"&gt;typedef&lt;/span&gt; NSInteger &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;^&lt;/span&gt;Multiply&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger&lt;span style="color: #808030;"&gt;,&lt;/span&gt; NSInteger&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        
        Multiply multiply &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;^&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger x&lt;span style="color: #808030;"&gt;,&lt;/span&gt; NSInteger y&lt;span style="color: #808030;"&gt;)&lt;/span&gt; 
        &lt;span style="color: purple;"&gt;{&lt;/span&gt; 
            NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Entering &lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%s&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; __FUNCTION__&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            NSInteger z &lt;span style="color: #808030;"&gt;=&lt;/span&gt; x &lt;span style="color: #808030;"&gt;*&lt;/span&gt; y&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; z&lt;span style="color: purple;"&gt;;&lt;/span&gt; 
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        
        NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%li&lt;/span&gt;&lt;span style="color: #0000e6;"&gt; * &lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%li&lt;/span&gt;&lt;span style="color: #0000e6;"&gt; = &lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%li&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;5&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;6&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; multiply&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #008c00;"&gt;5&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;6&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;br /&gt;
The main purpose of the blocks is the dispatching them in Grand Central Dispatch. For example:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: #004a43;"&gt;#import &lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;/&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;&lt;span style="color: #004a43;"&gt;h&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; &lt;span style="color: #400000;"&gt;main&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; argc&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;const&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt; argv&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: #808030;"&gt;@&lt;/span&gt;autoreleasepool &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Hello&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\r&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        dispatch_queue_t queue &lt;span style="color: #808030;"&gt;=&lt;/span&gt; dispatch_get_global_queue &lt;span style="color: #808030;"&gt;(&lt;/span&gt; DISPATCH_QUEUE_PRIORITY_DEFAULT&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        dispatch_sync&lt;span style="color: #808030;"&gt;(&lt;/span&gt;queue&lt;span style="color: #808030;"&gt;,&lt;/span&gt;  &lt;span style="color: #808030;"&gt;^&lt;/span&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: #dd0000; background-image: initial; background-origin: initial; color: white; font-style: italic; font-weight: bold;"&gt;{&lt;/span&gt; &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;This is the block&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt; &lt;span style="background-attachment: initial; background-clip: initial; background-color: #dd0000; background-image: initial; background-origin: initial; color: white; font-style: italic; font-weight: bold;"&gt;}&lt;/span&gt; &lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;br /&gt;
and here is the output console:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
[Switching to process 38217 thread 0x0]&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;b&gt;Hello&lt;/b&gt;&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;b&gt;This is the block&lt;/b&gt;&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
Program ended with exit code: 0&lt;/div&gt;
In a more formal way, that the block is a self-contained unit of a work, an arranged part of the source code, very similar to the C-style function. The block may contain own variables and can access the variables from outside its own lexical scope. The block can read values of variables defined in the parent scope. Variables, accessed by the block, are copied to the block data structure and can be used by the block later. It's preferred to keep these variables in the read-only format. However, the blocks can use variables declared with the keyword __block in the parent scope prepended to return data back from the blocks.&lt;br /&gt;
&lt;br /&gt;
That's, actually, it. And this is an example of practical use of the blocks - enumeration of the array:
&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: #004a43;"&gt;#import &lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;/&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;&lt;span style="color: #004a43;"&gt;h&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; &lt;span style="color: #400000;"&gt;main&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; argc&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;const&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt; argv&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;

    &lt;span style="color: #808030;"&gt;@&lt;/span&gt;autoreleasepool &lt;span style="color: purple;"&gt;{&lt;/span&gt;

        NSArray&lt;span style="color: #808030;"&gt;*&lt;/span&gt; array &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSArray arrayWithObjects&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;First&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Second&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Third&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; nil&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: #808030;"&gt;[&lt;/span&gt;array enumerateObjectsUsingBlock&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;^&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;id object&lt;span style="color: #808030;"&gt;,&lt;/span&gt; NSUInteger index&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #603000;"&gt;BOOL&lt;/span&gt;&lt;span style="color: #808030;"&gt;*&lt;/span&gt; stop&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
         &lt;span style="background-attachment: initial; background-clip: initial; background-color: #dd0000; background-image: initial; background-origin: initial; color: white; font-style: italic; font-weight: bold;"&gt;{&lt;/span&gt;
             NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;%@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; object&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
         &lt;span style="background-attachment: initial; background-clip: initial; background-color: #dd0000; background-image: initial; background-origin: initial; color: white; font-style: italic; font-weight: bold;"&gt;}&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;"&gt;&lt;div style="font-family: Times; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; white-space: normal;"&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/pre&gt;
The following example is interesting because the block is used here as a parameter in the method of a class:
&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: #004a43;"&gt;#import &lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;/&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;&lt;span style="color: #004a43;"&gt;h&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;

&lt;span style="color: #808030;"&gt;@&lt;/span&gt;interface Test &lt;span style="color: purple;"&gt;:&lt;/span&gt; NSObject

&lt;span style="color: #808030;"&gt;-&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger&lt;span style="color: #808030;"&gt;)&lt;/span&gt;calculate&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger&lt;span style="color: #808030;"&gt;)&lt;/span&gt;number withBlock&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;^&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;block&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&lt;span style="color: #808030;"&gt;@&lt;/span&gt;end

&lt;span style="color: #808030;"&gt;@&lt;/span&gt;implementation Test

&lt;span style="color: #808030;"&gt;-&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger&lt;span style="color: #808030;"&gt;)&lt;/span&gt;calculate&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger&lt;span style="color: #808030;"&gt;)&lt;/span&gt;number withBlock&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;^&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;block
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;the number is &lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%li&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; number&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    NSInteger result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; block&lt;span style="color: #808030;"&gt;(&lt;/span&gt;number&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; result&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: #808030;"&gt;@&lt;/span&gt;end

&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; &lt;span style="color: #400000;"&gt;main&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; argc&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;const&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt; argv&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;

    &lt;span style="color: #808030;"&gt;@&lt;/span&gt;autoreleasepool &lt;span style="color: purple;"&gt;{&lt;/span&gt;

        Test&lt;span style="color: #808030;"&gt;*&lt;/span&gt; test &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;Test alloc&lt;span style="color: #808030;"&gt;]&lt;/span&gt; init&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        NSInteger result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;test calculate&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #008c00;"&gt;5&lt;/span&gt; withBlock&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;^&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSInteger number&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="background-attachment: initial; background-clip: initial; background-color: #dd0000; background-image: initial; background-origin: initial; color: white; font-style: italic; font-weight: bold;"&gt;{&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; number &lt;span style="color: #808030;"&gt;*&lt;/span&gt; number&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="background-attachment: initial; background-clip: initial; background-color: #dd0000; background-image: initial; background-origin: initial; color: white; font-style: italic; font-weight: bold;"&gt;}&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;the result is &lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%li&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; result&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: #808030;"&gt;[&lt;/span&gt;test release&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
The output:

&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
[Switching to process 41948 thread 0x0]&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;b&gt;2011-11-26 18:33:44.383 block5[41948:707] the number is 5&lt;/b&gt;&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;b&gt;2011-11-26 18:33:44.385 block5[41948:707] the result is 25&lt;/b&gt;&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
Program ended with exit code: 0&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;
&lt;br /&gt;&lt;/div&gt;
More about the blocks:
&lt;br /&gt;
1. &lt;a href="http://developer.apple.com/library/ios/#featuredarticles/Short_Practical_Guide_Blocks/_index.html"&gt;iOS Developer Library. A Short Practical Guide to Blocks.&lt;/a&gt;
&lt;br /&gt;
2. &lt;a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Blocks/Articles/00_Introduction.html"&gt;iOS Developer Library. Blocks Programming Topics.&lt;/a&gt;&lt;br /&gt;
3.&amp;nbsp;&lt;a href="http://clang.llvm.org/docs/BlockLanguageSpec.txt"&gt;Language Specifications For Blocks.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: monospace; white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-6864011969018586868?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/_jhtWn1VUGQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/6864011969018586868/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/11/block.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6864011969018586868?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6864011969018586868?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/_jhtWn1VUGQ/block.html" title="The Blocks" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/11/block.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUAHRnwycSp7ImA9WhRTGU0.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-4856453755698404496</id><published>2011-11-10T08:48:00.001+02:00</published><updated>2011-11-10T08:48:57.299+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-10T08:48:57.299+02:00</app:edited><title>No Longer Develop Flash for Mobile Platforms</title><content type="html">Adobe announced that it would no longer develop Flash for mobile platforms.
&lt;a href="http://www.macworld.com/article/163497/2011/11/end_to_mobile_development_bodes_ill_for_flash.html#lsrc.nl_mwnws_h_crawl"&gt;End to mobile development bodes ill for Flash&lt;/a&gt;
&lt;a href="http://blogs.adobe.com/conversations/2011/11/flash-focus.html?PID=4165004"&gt;Flash to Focus on PC Browsing and Mobile Apps; Adobe to More Aggressively Contribute to HTML5&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-4856453755698404496?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/OZmzIDZCTwM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/4856453755698404496/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/11/no-longer-develop-flash-for-mobile.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/4856453755698404496?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/4856453755698404496?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/OZmzIDZCTwM/no-longer-develop-flash-for-mobile.html" title="No Longer Develop Flash for Mobile Platforms" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/11/no-longer-develop-flash-for-mobile.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQESX4zeyp7ImA9WhRTFEw.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-5648761465551918493</id><published>2011-11-04T15:48:00.001+02:00</published><updated>2011-11-04T16:18:28.083+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-04T16:18:28.083+02:00</app:edited><title>Automatic Reference Counting</title><content type="html">&lt;span class="Apple-style-span" style="color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, sans-serif; line-height: 18px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Automatic&lt;/span&gt;&lt;span class="Apple-style-span" style="line-height: 33px;"&gt;&amp;nbsp;Reference Counting is available in Xcode 4.2. The following articles explain the ARC:&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h2 style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-weight: normal; line-height: 1.4em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;






&lt;span class="Apple-style-span" style="font-family: 'Myriad Pro', 'Lucida Grande', 'Lucida Sans Unicode', 'Trebuchet MS', Arial; font-size: small;"&gt;&lt;a href="http://www.learn-cocos2d.com/2011/11/everything-know-about-arc/"&gt;Everything you need to know about automatic reference counting (ARC)&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;a href="http://www.mikeash.com/pyblog/friday-qa-2011-09-30-automatic-reference-counting.html"&gt;Friday Q&amp;amp;A 2011-09-30: Automatic Reference Counting&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Main idea:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;1. no &lt;i&gt;retain&lt;/i&gt;, &lt;i&gt;release&lt;/i&gt;, &lt;i&gt;autortelease&lt;/i&gt; anymore&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;2. &lt;i&gt;strong&lt;/i&gt; and &lt;i&gt;weak&lt;/i&gt; as the property classifiers instead of &lt;i&gt;retain&lt;/i&gt; and &lt;i&gt;assign&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;3. &lt;i&gt;autorelease&lt;/i&gt; {} instead of&amp;nbsp;&lt;span class="Apple-style-span" style="line-height: 18px; white-space: nowrap;"&gt;&lt;i&gt;NSAutoreleasePool&lt;/i&gt;&lt;span class="sy2" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font: normal normal normal 13px/1.4em Monaco, 'Lucida Console', monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;*&lt;/span&gt;&amp;nbsp;&lt;i&gt;pool&lt;/i&gt;....&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="line-height: 18px; white-space: nowrap;"&gt;Probably , this is the "primary source":&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"&gt;&lt;a href="http://developer.apple.com/library/mac/#releasenotes/ObjectiveC/RN-TransitioningToARC/_index.html#//apple_ref/doc/uid/TP40011226"&gt;Transitioning to ARC Release Notes&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-5648761465551918493?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/iU6fEIwROOQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/5648761465551918493/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/11/automatic-reference-counting.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/5648761465551918493?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/5648761465551918493?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/iU6fEIwROOQ/automatic-reference-counting.html" title="Automatic Reference Counting" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/11/automatic-reference-counting.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0IBR3s9eCp7ImA9WhdaFk8.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-5182999412049921047</id><published>2011-10-26T11:30:00.000+02:00</published><updated>2011-10-26T11:32:36.560+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-26T11:32:36.560+02:00</app:edited><title>iOS Hardware Guide</title><content type="html">&lt;br /&gt;
Following link shows iOS hardware available:&lt;br /&gt;
&lt;br /&gt;
&lt;h1 style="clear: both; color: black; line-height: 25px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.7em;"&gt;
&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit; font-size: small;"&gt;&lt;a href="http://unity3d.com/support/documentation/Manual/iphone-Hardware.html"&gt;iOS Hardware Guide.&amp;nbsp;&lt;span class="Apple-style-span" style="line-height: 17px;"&gt;Hardware models&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div class="manual-body" style="color: #352f28; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 17px;"&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
The most interesting models for now:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;iPhone 3GS&lt;/b&gt;&lt;br /&gt;
ARM Cortex A8, 600 MHz CPU&lt;br /&gt;
PowerVR SGX graphics processor&lt;br /&gt;
256MB of memory&lt;br /&gt;
3 megapixel camera with video capture capability&lt;br /&gt;
Speaker and microphone&lt;br /&gt;
Vibration support&lt;br /&gt;
Silent switch&lt;br /&gt;
GPS support&lt;br /&gt;
Compass support&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;iPhone 4&lt;/b&gt;&lt;br /&gt;
ARM Cortex-A8 Apple A4 CPU&lt;br /&gt;
ARM Cortex-A8 Apple A4 graphics processor&lt;br /&gt;
512MB of memory&lt;br /&gt;
Cameras&lt;br /&gt;
Rear 5.0 MP backside illuminated CMOS image sensor with 720p HD video at 30 fps and LED flash&lt;br /&gt;
Front 0.3 MP (VGA) with geotagging, tap to focus, and 480p SD video at 30 fps&lt;br /&gt;
Screen: 960x640 pixels, LCD at 326 ppi, 800:1 contrast ratio.&lt;br /&gt;
Speaker and microphone&lt;br /&gt;
Vibration Support&lt;br /&gt;
Silent switch&lt;br /&gt;
GPS support&lt;br /&gt;
Compass Support&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-5182999412049921047?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/uzCktkt6tyc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/5182999412049921047/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/10/ios-hardware-guide.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/5182999412049921047?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/5182999412049921047?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/uzCktkt6tyc/ios-hardware-guide.html" title="iOS Hardware Guide" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/10/ios-hardware-guide.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIGSHg6fSp7ImA9WhdbFE8.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-6899583482153160260</id><published>2011-10-12T13:55:00.000+02:00</published><updated>2011-10-12T13:55:29.615+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-12T13:55:29.615+02:00</app:edited><title>New C++ Standard</title><content type="html">ISO published C++11 Standard:
&lt;a href="http://www.iso.org/iso/pressrelease.htm?refid=Ref1472"&gt;C++ language gets high marks on performance with new ISO/IEC standard&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-6899583482153160260?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/nBY42EvJ0mo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/6899583482153160260/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/10/new-c-standard.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6899583482153160260?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6899583482153160260?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/nBY42EvJ0mo/new-c-standard.html" title="New C++ Standard" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/10/new-c-standard.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUECR348cSp7ImA9WhdUGEU.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-860025757215623832</id><published>2011-10-06T08:47:00.001+02:00</published><updated>2011-10-06T08:47:46.079+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-06T08:47:46.079+02:00</app:edited><title>The Great</title><content type="html">&lt;a href="http://iphoneincubator.com/blog/general/steve-jobs-2005-stanford-commencement-address#utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+IphoneDevelopment+%28iPhone+Development+Blog%29"&gt;Steve Jobs’ 2005 Stanford Commencement Address&lt;/a&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-V4jUy8QtIvQ/To1PBpsmknI/AAAAAAAACRw/EvMt7frBuYc/s1600/SteveJobs.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="365" width="400" src="http://4.bp.blogspot.com/-V4jUy8QtIvQ/To1PBpsmknI/AAAAAAAACRw/EvMt7frBuYc/s400/SteveJobs.png" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-860025757215623832?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/Uc2290x810k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/860025757215623832/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/10/great.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/860025757215623832?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/860025757215623832?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/Uc2290x810k/great.html" title="The Great" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-V4jUy8QtIvQ/To1PBpsmknI/AAAAAAAACRw/EvMt7frBuYc/s72-c/SteveJobs.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/10/great.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEICRXo6cSp7ImA9WhdQEEg.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-6299238590747629829</id><published>2011-08-11T11:46:00.001+03:00</published><updated>2011-08-11T11:49:24.419+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-11T11:49:24.419+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C" /><title>Simplest serialization on iPhone</title><content type="html">The following simple program demonstrates the simplest serialization that works fine on iPhone:
&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: #004a43;"&gt;#import &lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;amp;lt;&lt;/span&gt;&lt;span style="color: #004a43;"&gt;UIKit&lt;/span&gt;&lt;span style="color: #808030;"&gt;/&lt;/span&gt;&lt;span style="color: #004a43;"&gt;UIKit&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;&lt;span style="color: #004a43;"&gt;h&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;amp;gt;&lt;/span&gt;

&lt;span style="color: #808030;"&gt;@&lt;/span&gt;interface Book &lt;span style="color: purple;"&gt;:&lt;/span&gt; NSObject&lt;span style="color: #808030;"&gt;&amp;amp;lt;&lt;/span&gt;NSCoding&lt;span style="color: #808030;"&gt;&amp;amp;gt;&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    NSString &lt;span style="color: #808030;"&gt;*&lt;/span&gt;title&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    NSString &lt;span style="color: #808030;"&gt;*&lt;/span&gt;author&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: #808030;"&gt;@&lt;/span&gt;property &lt;span style="color: #808030;"&gt;(&lt;/span&gt;nonatomic&lt;span style="color: #808030;"&gt;,&lt;/span&gt; copy&lt;span style="color: #808030;"&gt;)&lt;/span&gt; NSString &lt;span style="color: #808030;"&gt;*&lt;/span&gt;title&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: #808030;"&gt;@&lt;/span&gt;property &lt;span style="color: #808030;"&gt;(&lt;/span&gt;nonatomic&lt;span style="color: #808030;"&gt;,&lt;/span&gt; copy&lt;span style="color: #808030;"&gt;)&lt;/span&gt; NSString &lt;span style="color: #808030;"&gt;*&lt;/span&gt;author&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&lt;span style="color: #808030;"&gt;@&lt;/span&gt;end

&lt;span style="color: #808030;"&gt;@&lt;/span&gt;implementation Book

&lt;span style="color: #808030;"&gt;@&lt;/span&gt;synthesize title&lt;span style="color: #808030;"&gt;,&lt;/span&gt; author&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&lt;span style="color: #808030;"&gt;-&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;encodeWithCoder&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSCoder &lt;span style="color: #808030;"&gt;*&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;coder 
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: #808030;"&gt;[&lt;/span&gt;coder encodeObject&lt;span style="color: purple;"&gt;:&lt;/span&gt;author forKey&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;author&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: #808030;"&gt;[&lt;/span&gt;coder encodeObject&lt;span style="color: purple;"&gt;:&lt;/span&gt;title forKey&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;title&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: #808030;"&gt;-&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;id&lt;span style="color: #808030;"&gt;)&lt;/span&gt;initWithCoder&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSCoder &lt;span style="color: #808030;"&gt;*&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;coder &lt;span style="color: purple;"&gt;{&lt;/span&gt;
    author &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;coder decodeObjectForKey&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;author&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; retain&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    title &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;coder decodeObjectForKey&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;title&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; retain&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; self&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: #808030;"&gt;@&lt;/span&gt;end

&lt;span style="color: #603000;"&gt;BOOL&lt;/span&gt; Save&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSString&lt;span style="color: #808030;"&gt;*&lt;/span&gt; path&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;BOOL&lt;/span&gt; result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; NO&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;path &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; nil&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        Book &lt;span style="color: #808030;"&gt;*&lt;/span&gt;book &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;Book alloc&lt;span style="color: #808030;"&gt;]&lt;/span&gt; init&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        book&lt;span style="color: #808030;"&gt;.&lt;/span&gt;author &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Leo Tolstoy&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        book&lt;span style="color: #808030;"&gt;.&lt;/span&gt;title &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;War and Peace&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        
        result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSKeyedArchiver archiveRootObject&lt;span style="color: purple;"&gt;:&lt;/span&gt;book toFile&lt;span style="color: purple;"&gt;:&lt;/span&gt;path&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        
        &lt;span style="color: #808030;"&gt;[&lt;/span&gt;book release&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; result&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: #603000;"&gt;BOOL&lt;/span&gt; Load&lt;span style="color: #808030;"&gt;(&lt;/span&gt;NSString &lt;span style="color: #808030;"&gt;*&lt;/span&gt;path&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;BOOL&lt;/span&gt; result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; NO&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;path &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; nil&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        Book &lt;span style="color: #808030;"&gt;*&lt;/span&gt;book &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSKeyedUnarchiver unarchiveObjectWithFile&lt;span style="color: purple;"&gt;:&lt;/span&gt;path&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;book &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; nil&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Author: %@, title: %@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; book&lt;span style="color: #808030;"&gt;.&lt;/span&gt;author&lt;span style="color: #808030;"&gt;,&lt;/span&gt; book&lt;span style="color: #808030;"&gt;.&lt;/span&gt;title&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; result&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; &lt;span style="color: #400000;"&gt;main&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; argc&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt;argv&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; 
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    NSAutoreleasePool &lt;span style="color: #808030;"&gt;*&lt;/span&gt; pool &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSAutoreleasePool alloc&lt;span style="color: #808030;"&gt;]&lt;/span&gt; init&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    NSString &lt;span style="color: #808030;"&gt;*&lt;/span&gt;path &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSHomeDirectory&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; stringByAppendingPathComponent&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Documents/books.xml&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;the path is %@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; path&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    
    Save&lt;span style="color: #808030;"&gt;(&lt;/span&gt;path&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    Load&lt;span style="color: #808030;"&gt;(&lt;/span&gt;path&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    
    &lt;span style="color: #808030;"&gt;[&lt;/span&gt;pool release&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
Class Book implements the protocol NSCoding and it allows to save Book object in an xml-file
&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-6299238590747629829?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/A-aCs3gQOtU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/6299238590747629829/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/08/following-simple-program-demonstrates.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6299238590747629829?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6299238590747629829?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/A-aCs3gQOtU/following-simple-program-demonstrates.html" title="Simplest serialization on iPhone" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/08/following-simple-program-demonstrates.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIFRHw9fSp7ImA9WhdQEEk.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-4907801940675427876</id><published>2011-08-11T08:10:00.007+03:00</published><updated>2011-08-11T08:28:35.265+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-11T08:28:35.265+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C" /><title>Save data in XML on iPhone</title><content type="html">Seems like the simplest way to save data in the XML-format from the iPhone program is to use the NSDictionary class as it is shown in the following program:
&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#004a43; '&gt;#import &lt;/span&gt;&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#004a43; '&gt;UIKit&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;&lt;span style='color:#004a43; '&gt;UIKit&lt;/span&gt;&lt;span style='color:#808030; '&gt;.&lt;/span&gt;&lt;span style='color:#004a43; '&gt;h&lt;/span&gt;&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;

&lt;span style='color:#800000; font-weight:bold; '&gt;int&lt;/span&gt; &lt;span style='color:#400000; '&gt;main&lt;/span&gt;&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#800000; font-weight:bold; '&gt;int&lt;/span&gt; argc&lt;span style='color:#808030; '&gt;,&lt;/span&gt; &lt;span style='color:#800000; font-weight:bold; '&gt;char&lt;/span&gt; &lt;span style='color:#808030; '&gt;*&lt;/span&gt;argv&lt;span style='color:#808030; '&gt;[&lt;/span&gt;&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt; &lt;span style='color:#800080; '&gt;{&lt;/span&gt;
    
    NSAutoreleasePool &lt;span style='color:#808030; '&gt;*&lt;/span&gt; pool &lt;span style='color:#808030; '&gt;=&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;&lt;span style='color:#808030; '&gt;[&lt;/span&gt;NSAutoreleasePool alloc&lt;span style='color:#808030; '&gt;]&lt;/span&gt; init&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;

    NSLog&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;main&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
    NSDictionary &lt;span style='color:#808030; '&gt;*&lt;/span&gt;dictionary &lt;span style='color:#808030; '&gt;=&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;NSDictionary dictionaryWithObjectsAndKeys&lt;span style='color:#800080; '&gt;:&lt;/span&gt;
                                &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;First Object&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;First Key&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt;
                                &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;Second Object&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;Second Key&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt;
                                &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;Third Object&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;Third Key&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt;
                                nil
                                &lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
    
    NSString &lt;span style='color:#808030; '&gt;*&lt;/span&gt;path &lt;span style='color:#808030; '&gt;=&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;NSHomeDirectory&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt; stringByAppendingPathComponent&lt;span style='color:#800080; '&gt;:&lt;/span&gt;&lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;Documents/test_dictionary.xml&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
    NSLog&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;the path is %@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; path&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
    
    &lt;span style='color:#603000; '&gt;BOOL&lt;/span&gt; result &lt;span style='color:#808030; '&gt;=&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;dictionary writeToFile&lt;span style='color:#800080; '&gt;:&lt;/span&gt; path atomically&lt;span style='color:#800080; '&gt;:&lt;/span&gt;YES&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
    NSLog&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;%@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; result &lt;span style='color:#800080; '&gt;?&lt;/span&gt; &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;saved&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt; &lt;span style='color:#800080; '&gt;:&lt;/span&gt; &lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;not saved&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
        
    &lt;span style='color:#808030; '&gt;[&lt;/span&gt;pool release&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
    &lt;span style='color:#800000; font-weight:bold; '&gt;return&lt;/span&gt; &lt;span style='color:#008c00; '&gt;0&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
&lt;span style='color:#800080; '&gt;}&lt;/span&gt;
&lt;/pre&gt;
Here is the saved file:
&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#800080; '&gt;?&lt;/span&gt;xml version&lt;span style='color:#808030; '&gt;=&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;1.0&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt; encoding&lt;span style='color:#808030; '&gt;=&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;UTF-8&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#800080; '&gt;?&lt;/span&gt;&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#808030; '&gt;!&lt;/span&gt;DOCTYPE plist PUBLIC &lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;-//Apple//DTD PLIST 1.0//EN&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt; &lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;http://www.apple.com/DTDs/PropertyList-1.0.dtd&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;plist version&lt;span style='color:#808030; '&gt;=&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;1.0&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;dict&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
    &lt;span style='color:#800080; '&gt;&amp;lt;&lt;/span&gt;key&lt;span style='color:#800080; '&gt;&gt;&lt;/span&gt;First Key&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;key&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
    &lt;span style='color:#800080; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#603000; '&gt;string&lt;/span&gt;&lt;span style='color:#800080; '&gt;&gt;&lt;/span&gt;First Object&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;&lt;span style='color:#603000; '&gt;string&lt;/span&gt;&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
    &lt;span style='color:#800080; '&gt;&amp;lt;&lt;/span&gt;key&lt;span style='color:#800080; '&gt;&gt;&lt;/span&gt;Second Key&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;key&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
    &lt;span style='color:#800080; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#603000; '&gt;string&lt;/span&gt;&lt;span style='color:#800080; '&gt;&gt;&lt;/span&gt;Second Object&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;&lt;span style='color:#603000; '&gt;string&lt;/span&gt;&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
    &lt;span style='color:#800080; '&gt;&amp;lt;&lt;/span&gt;key&lt;span style='color:#800080; '&gt;&gt;&lt;/span&gt;Third Key&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;key&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
    &lt;span style='color:#800080; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#603000; '&gt;string&lt;/span&gt;&lt;span style='color:#800080; '&gt;&gt;&lt;/span&gt;Third Object&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;&lt;span style='color:#603000; '&gt;string&lt;/span&gt;&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;dict&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
&lt;span style='color:#808030; '&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;plist&lt;span style='color:#808030; '&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;

In order to read this file, to restore the dictionary, use this code:
&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#800000; font-weight:bold; '&gt;if&lt;/span&gt; &lt;span style='color:#808030; '&gt;(&lt;/span&gt;result&lt;span style='color:#808030; '&gt;)&lt;/span&gt;
&lt;span style='color:#800080; '&gt;{&lt;/span&gt;
    NSDictionary&lt;span style='color:#808030; '&gt;*&lt;/span&gt; readData &lt;span style='color:#808030; '&gt;=&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;NSDictionary dictionaryWithContentsOfFile&lt;span style='color:#800080; '&gt;:&lt;/span&gt;path&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
    &lt;span style='color:#800000; font-weight:bold; '&gt;for&lt;/span&gt; &lt;span style='color:#808030; '&gt;(&lt;/span&gt;NSString &lt;span style='color:#808030; '&gt;*&lt;/span&gt;key in readData&lt;span style='color:#808030; '&gt;)&lt;/span&gt;
        NSLog&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;%@: %@&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; key&lt;span style='color:#808030; '&gt;,&lt;/span&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;readData objectForKey&lt;span style='color:#800080; '&gt;:&lt;/span&gt; key&lt;span style='color:#808030; '&gt;]&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
&lt;span style='color:#800080; '&gt;}&lt;/span&gt;
&lt;/pre&gt;
Here is the Console log from the program:
&lt;br /&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 28.0px; text-indent: -28.0px;"&gt;
[Session started at 2011-08-11 08:14:39 +0300.]&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 28.0px; text-indent: -28.0px;"&gt;
&lt;b&gt;2011-08-11 08:14:39.981 PListTest[37923:207] main&lt;/b&gt;&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 28.0px; text-indent: -28.0px;"&gt;
&lt;b&gt;2011-08-11 08:14:39.983 PListTest[37923:207] the path is /Users/pgnatyuk/Library/Application Support/iPhone Simulator/4.3/Applications/3E8A25F8-345A-43D4-900D-6F248F2A5738/Documents/test_dictionary.xml&lt;/b&gt;&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 28.0px; text-indent: -28.0px;"&gt;
&lt;b&gt;2011-08-11 08:14:39.986 PListTest[37923:207] saved&lt;/b&gt;&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 28.0px; text-indent: -28.0px;"&gt;
&lt;b&gt;2011-08-11 08:14:39.986 PListTest[37923:207] First Key: First Object&lt;/b&gt;&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 28.0px; text-indent: -28.0px;"&gt;
&lt;b&gt;2011-08-11 08:14:39.987 PListTest[37923:207] Third Key: Third Object&lt;/b&gt;&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 28.0px; text-indent: -28.0px;"&gt;
&lt;b&gt;2011-08-11 08:14:39.987 PListTest[37923:207] Second Key: Second Object&lt;/b&gt;&lt;/div&gt;
&lt;div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 28.0px; text-indent: -28.0px;"&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-4907801940675427876?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/_a5ftoC-qc4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/4907801940675427876/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/08/save-data-in-xml-on-iphone.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/4907801940675427876?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/4907801940675427876?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/_a5ftoC-qc4/save-data-in-xml-on-iphone.html" title="Save data in XML on iPhone" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/08/save-data-in-xml-on-iphone.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0YGQHs8fCp7ImA9WhdRFk4.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-6524570674031875489</id><published>2011-08-06T16:55:00.002+03:00</published><updated>2011-08-06T16:58:41.574+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-06T16:58:41.574+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C" /><title>Initialize C-style structures in Objective-C</title><content type="html">In order to initialize a variable of a structure type, you simply list the initial values of the structure members inside a pair of braces. For example as in the following C-program:&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: #004a43;"&gt;#&lt;/span&gt;&lt;span style="color: #004a43;"&gt;include &lt;/span&gt;&lt;span style="color: maroon;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #40015a;"&gt;iostream&lt;/span&gt;&lt;span style="color: maroon;"&gt;&amp;gt;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;struct&lt;/span&gt; date
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; year&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; month&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; day&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; &lt;span style="color: #400000;"&gt;main&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; argc&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;const&lt;/span&gt; argv&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; 
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;struct&lt;/span&gt; date a &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt; &lt;span style="color: #008c00;"&gt;2011&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;6&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;8&lt;/span&gt; &lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    std&lt;span style="color: purple;"&gt;::&lt;/span&gt;cout &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; a&lt;span style="color: #808030;"&gt;.&lt;/span&gt;year &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt; &lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; a&lt;span style="color: #808030;"&gt;.&lt;/span&gt;month &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt; &lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; a&lt;span style="color: #808030;"&gt;.&lt;/span&gt;day &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;br /&gt;
Of course this way works for Objective-C as well:&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: #004a43;"&gt;#import &lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;/&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;&lt;span style="color: #004a43;"&gt;h&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;struct&lt;/span&gt; date 
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; year&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; month&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; day&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; &lt;span style="color: #400000;"&gt;main&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; argc&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;const&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt; argv&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; 
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    NSAutoreleasePool &lt;span style="color: #808030;"&gt;*&lt;/span&gt; pool &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSAutoreleasePool alloc&lt;span style="color: #808030;"&gt;]&lt;/span&gt; init&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;struct&lt;/span&gt; date a &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt; &lt;span style="color: #008c00;"&gt;2011&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;8&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;6&lt;/span&gt; &lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%d&lt;/span&gt;&lt;span style="color: #0000e6;"&gt; &lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%d&lt;/span&gt;&lt;span style="color: #0000e6;"&gt; &lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%d&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; a&lt;span style="color: #808030;"&gt;.&lt;/span&gt;year&lt;span style="color: #808030;"&gt;,&lt;/span&gt; a&lt;span style="color: #808030;"&gt;.&lt;/span&gt;month&lt;span style="color: #808030;"&gt;,&lt;/span&gt; a&lt;span style="color: #808030;"&gt;.&lt;/span&gt;day&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    
    &lt;span style="color: #808030;"&gt;[&lt;/span&gt;pool drain&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;br /&gt;
Beside it, Objective-C allows to specify the structure member in such initialization list:&lt;br /&gt;
&lt;pre style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black;"&gt;&lt;span style="background-color: white; color: #004a43;"&gt;#import &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background-color: white; color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;/&lt;/span&gt;&lt;span style="background-color: white; color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;.&lt;/span&gt;&lt;span style="background-color: white; color: #004a43;"&gt;h&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;

&lt;/span&gt;&lt;span style="background-color: white; color: maroon; font-weight: bold;"&gt;struct&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; date 
&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;
    &lt;/span&gt;&lt;span style="background-color: white; color: maroon; font-weight: bold;"&gt;int&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; year&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;
    &lt;/span&gt;&lt;span style="background-color: white; color: maroon; font-weight: bold;"&gt;int&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; month&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;
    &lt;/span&gt;&lt;span style="background-color: white; color: maroon; font-weight: bold;"&gt;int&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; day&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;
&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;}&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;

&lt;/span&gt;&lt;span style="background-color: white; color: maroon; font-weight: bold;"&gt;int&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; &lt;/span&gt;&lt;span style="background-color: white; color: #400000;"&gt;main&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;(&lt;/span&gt;&lt;span style="background-color: white; color: maroon; font-weight: bold;"&gt;int&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; argc&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;,&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; &lt;/span&gt;&lt;span style="background-color: white; color: maroon; font-weight: bold;"&gt;const&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; &lt;/span&gt;&lt;span style="background-color: white; color: maroon; font-weight: bold;"&gt;char&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;*&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; argv&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;[&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;]&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;)&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; 
&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;
    NSAutoreleasePool &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;*&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; pool &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;=&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;[&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;[&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;NSAutoreleasePool alloc&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;]&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; init&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;]&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;

    &lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;struct&lt;/span&gt; date a &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt; &lt;span style="color: #808030;"&gt;.&lt;/span&gt;year &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;2011&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;.&lt;/span&gt;month &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;8&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;.&lt;/span&gt;day &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;6&lt;/span&gt; &lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;
    NSLog&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;(&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;@&lt;/span&gt;&lt;span style="background-color: white; color: maroon;"&gt;"&lt;/span&gt;&lt;span style="background-color: white; color: #0f69ff;"&gt;%d&lt;/span&gt;&lt;span style="background-color: white; color: #0000e6;"&gt; &lt;/span&gt;&lt;span style="background-color: white; color: #0f69ff;"&gt;%d&lt;/span&gt;&lt;span style="background-color: white; color: #0000e6;"&gt; &lt;/span&gt;&lt;span style="background-color: white; color: #0f69ff;"&gt;%d&lt;/span&gt;&lt;span style="background-color: white; color: maroon;"&gt;"&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;,&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; a&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;.&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;year&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;,&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; a&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;.&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;month&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;,&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; a&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;.&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;day&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;)&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;
    
    &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;[&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;pool drain&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;]&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;
    &lt;/span&gt;&lt;span style="background-color: white; color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt; &lt;/span&gt;&lt;span style="background-color: white; color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;
&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
With this notation, specific members can be listed in any order.&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-6524570674031875489?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/qUFKDTs2264" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/6524570674031875489/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/08/initialize-c-style-structures-in.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6524570674031875489?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/6524570674031875489?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/qUFKDTs2264/initialize-c-style-structures-in.html" title="Initialize C-style structures in Objective-C" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/08/initialize-c-style-structures-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UEQ3g4fyp7ImA9WhdRFk4.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-2241237168491136497</id><published>2011-08-03T15:55:00.003+03:00</published><updated>2011-08-06T17:00:02.637+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-06T17:00:02.637+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><title>How-To's for iOS</title><content type="html">Very useful link:&lt;br /&gt;
&lt;a href="http://developer.apple.com/library/ios/#codinghowtos/UserExperience/_index.html#//apple_ref/doc/uid/TP40007420-CH1-DontLinkElementID_20"&gt;User Experience Coding How-To's&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-2241237168491136497?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/59cZHDZhjPQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/2241237168491136497/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/08/how-tos-for-ios.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2241237168491136497?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2241237168491136497?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/59cZHDZhjPQ/how-tos-for-ios.html" title="How-To's for iOS" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/08/how-tos-for-ios.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUIESH87eCp7ImA9WhdREkg.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-923243866523165177</id><published>2011-08-02T06:58:00.001+03:00</published><updated>2011-08-02T06:58:29.100+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-02T06:58:29.100+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Cocoa" /><title>Cocoa. Date and Time</title><content type="html">This small program below detects the current date:&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: #004a43;"&gt;#import &lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;/&lt;/span&gt;&lt;span style="color: #004a43;"&gt;Foundation&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;&lt;span style="color: #004a43;"&gt;h&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; &lt;span style="color: #400000;"&gt;main&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; argc&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;const&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt; argv&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt;
    NSAutoreleasePool &lt;span style="color: #808030;"&gt;*&lt;/span&gt; pool &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSAutoreleasePool alloc&lt;span style="color: #808030;"&gt;]&lt;/span&gt; init&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

     NSDate&lt;span style="color: #808030;"&gt;*&lt;/span&gt; today &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSDate alloc&lt;span style="color: #808030;"&gt;]&lt;/span&gt; init&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
     NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;today is: %@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; today&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    
    &lt;span style="color: #808030;"&gt;[&lt;/span&gt;today release&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;        
    &lt;span style="color: #808030;"&gt;[&lt;/span&gt;pool drain&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
In the console you'll see:&lt;br /&gt;
&lt;br /&gt;
run&lt;br /&gt;
[Switching to process 12401 local thread 0x3f03]&lt;br /&gt;
Running…&lt;br /&gt;
2010-03-06 17:05:45.217 DayOfToday[12401:a0f] today is: 2010-03-06 17:05:45 +0200&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-923243866523165177?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/aF6-fiVk1PY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/923243866523165177/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/08/cocoa-date-and-time.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/923243866523165177?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/923243866523165177?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/aF6-fiVk1PY/cocoa-date-and-time.html" title="Cocoa. Date and Time" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/08/cocoa-date-and-time.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk4DRn45eip7ImA9WhdTGEQ.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-7570617895350263790</id><published>2011-07-17T12:29:00.001+03:00</published><updated>2011-07-17T12:29:37.022+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-17T12:29:37.022+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>C#: Simplest server and client programs</title><content type="html">This is the simplest server:&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;IO&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Net&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Sockets&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Net&lt;span style="color: purple;"&gt;;&lt;/span&gt;

namespace SimpleServer
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    class SimpleListener
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        private &lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; Listen&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            Console&lt;span style="color: #808030;"&gt;.&lt;/span&gt;WriteLine&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Start listening&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            &lt;span style="color: dimgrey;"&gt;// Listen post 50001.&lt;/span&gt;
            TcpListener tcpListener &lt;span style="color: #808030;"&gt;=&lt;/span&gt; new TcpListener&lt;span style="color: #808030;"&gt;(&lt;/span&gt;IPAddress&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Any&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;50001&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            tcpListener&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Start&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            &lt;span style="color: dimgrey;"&gt;// Wait till a client comes&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;while&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;true&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                Socket newSocket &lt;span style="color: #808030;"&gt;=&lt;/span&gt; tcpListener&lt;span style="color: #808030;"&gt;.&lt;/span&gt;AcceptSocket&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;newSocket&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Connected&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                    Console&lt;span style="color: #808030;"&gt;.&lt;/span&gt;WriteLine&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;New client came&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                    NetworkStream networkStream &lt;span style="color: #808030;"&gt;=&lt;/span&gt; new NetworkStream&lt;span style="color: #808030;"&gt;(&lt;/span&gt;newSocket&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                    &lt;span style="color: dimgrey;"&gt;// Send a data&lt;/span&gt;
                    byte&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; buf &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;byte&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;'H'&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;byte&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;'e'&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;byte&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;'l'&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;byte&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;'l'&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;byte&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;'o'&lt;/span&gt; &lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                    networkStream&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Write&lt;span style="color: #808030;"&gt;(&lt;/span&gt;buf&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;5&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                    networkStream&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Flush&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                    networkStream&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Close&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                    newSocket&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Close&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                    &lt;span style="color: maroon; font-weight: bold;"&gt;break&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: purple;"&gt;}&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;

            Console&lt;span style="color: #808030;"&gt;.&lt;/span&gt;WriteLine&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Stop listening&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            Console&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Read&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;

        &lt;span style="color: maroon; font-weight: bold;"&gt;static&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; Main&lt;span style="color: #808030;"&gt;(&lt;/span&gt;string&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; args&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            SimpleListener listener &lt;span style="color: #808030;"&gt;=&lt;/span&gt; new SimpleListener&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            listener&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Listen&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
This is the simplest client:&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;IO&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Net&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Net&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Sockets&lt;span style="color: purple;"&gt;;&lt;/span&gt;

namespace SimpleClient
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    class Program
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;static&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; Main&lt;span style="color: #808030;"&gt;(&lt;/span&gt;string&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; args&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            TcpClient newSocket &lt;span style="color: #808030;"&gt;=&lt;/span&gt; new TcpClient&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;localhost&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;50001&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            NetworkStream networkStrem &lt;span style="color: #808030;"&gt;=&lt;/span&gt; newSocket&lt;span style="color: #808030;"&gt;.&lt;/span&gt;GetStream&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            byte&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; buf &lt;span style="color: #808030;"&gt;=&lt;/span&gt; new byte&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #008c00;"&gt;100&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            networkStrem&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Read&lt;span style="color: #808030;"&gt;(&lt;/span&gt;buf&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;100&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; buf2 &lt;span style="color: #808030;"&gt;=&lt;/span&gt; new &lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #008c00;"&gt;100&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; i &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt; i &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: #008c00;"&gt;100&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt; &lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;+&lt;/span&gt;i&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                buf2&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;char&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;buf&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;

            Console&lt;span style="color: #808030;"&gt;.&lt;/span&gt;WriteLine&lt;span style="color: #808030;"&gt;(&lt;/span&gt;buf2&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            networkStrem&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Close&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            newSocket&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Close&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            Console&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Read&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-7570617895350263790?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/SpmS3GTU4Uo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/7570617895350263790/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/07/c-simplest-server-and-client-programs.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/7570617895350263790?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/7570617895350263790?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/SpmS3GTU4Uo/c-simplest-server-and-client-programs.html" title="C#: Simplest server and client programs" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/07/c-simplest-server-and-client-programs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk4NSHg9cSp7ImA9WhdTGEQ.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-4671520526790673086</id><published>2011-07-17T10:23:00.005+03:00</published><updated>2011-07-17T12:29:59.669+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-17T12:29:59.669+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>C#: Create and save a simple XML</title><content type="html">This is a simple C# program that creates a standard XML document with one element Book and saves it in a file:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Text&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Xml&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;IO&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;namespace&lt;/span&gt; XmlTest
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &lt;span style="color: maroon; font-weight: bold;"&gt;class&lt;/span&gt; Program
&amp;nbsp; &amp;nbsp; &lt;span style="color: purple;"&gt;{&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: maroon; font-weight: bold;"&gt;static&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; Main&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;string&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; args&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: purple;"&gt;{&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XmlDocument xmlDocument &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;new&lt;/span&gt; XmlDocument&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlDocument&lt;span style="color: #808030;"&gt;.&lt;/span&gt;PrependChild&lt;span style="color: #808030;"&gt;(&lt;/span&gt;xmlDocument&lt;span style="color: #808030;"&gt;.&lt;/span&gt;CreateXmlDeclaration&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;1.0&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;yes&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XmlElement element &lt;span style="color: #808030;"&gt;=&lt;/span&gt; xmlDocument&lt;span style="color: #808030;"&gt;.&lt;/span&gt;CreateElement&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Book&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; element&lt;span style="color: #808030;"&gt;.&lt;/span&gt;SetAttribute&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;author&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Leo Tolstoy&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; element&lt;span style="color: #808030;"&gt;.&lt;/span&gt;AppendChild&lt;span style="color: #808030;"&gt;(&lt;/span&gt;xmlDocument&lt;span style="color: #808030;"&gt;.&lt;/span&gt;CreateTextNode&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Peace and War&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlDocument&lt;span style="color: #808030;"&gt;.&lt;/span&gt;AppendChild&lt;span style="color: #808030;"&gt;(&lt;/span&gt;element&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; StringWriter stringWriter &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;new&lt;/span&gt; StringWriter&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XmlTextWriter xmlTextWriter &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;new&lt;/span&gt; XmlTextWriter&lt;span style="color: #808030;"&gt;(&lt;/span&gt;stringWriter&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlTextWriter&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Formatting &lt;span style="color: #808030;"&gt;=&lt;/span&gt; Formatting&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Indented&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlDocument&lt;span style="color: #808030;"&gt;.&lt;/span&gt;WriteTo&lt;span style="color: #808030;"&gt;(&lt;/span&gt;xmlTextWriter&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlTextWriter&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Flush&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Write&lt;span style="color: #808030;"&gt;(&lt;/span&gt;stringWriter&lt;span style="color: #808030;"&gt;.&lt;/span&gt;ToString&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: maroon; font-weight: bold;"&gt;string&lt;/span&gt; fileName &lt;span style="color: #808030;"&gt;=&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Environment&lt;span style="color: #808030;"&gt;.&lt;/span&gt;GetEnvironmentVariable&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;TMP&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;\\Book.xml&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlDocument&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Save&lt;span style="color: #808030;"&gt;(&lt;/span&gt;fileName&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: purple;"&gt;}&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-4671520526790673086?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/UqwSbYnGj-g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/4671520526790673086/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/07/c-create-and-save-simple-xml.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/4671520526790673086?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/4671520526790673086?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/UqwSbYnGj-g/c-create-and-save-simple-xml.html" title="C#: Create and save a simple XML" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/07/c-create-and-save-simple-xml.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIDQ3YzcCp7ImA9WhdTGU0.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-3087567478397845736</id><published>2011-07-14T16:49:00.009+03:00</published><updated>2011-07-17T14:52:52.888+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-17T14:52:52.888+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>C#: OpenFileDialog in a console program</title><content type="html">&lt;br /&gt;
Into a C# console program add reference for System.Windows.Forms, then, add "using System.Windows.Forms" to the program code, add [STAThread] before the Main function and now, you can use OpenFileDialog like it is shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Collections&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Generic&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Linq&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Text&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Windows&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Forms&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;namespace&lt;/span&gt; OpenDialogTest
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &lt;span style="color: maroon; font-weight: bold;"&gt;class&lt;/span&gt; Program
&amp;nbsp; &amp;nbsp; &lt;span style="color: purple;"&gt;{&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: dimgrey;"&gt;// Make the program thread safe for COM.&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: dimgrey;"&gt;// Windows Forms should always declare the appartment style they're using.&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: dimgrey;"&gt;// http://blogs.msdn.com/b/jfoscoding/archive/2005/04/07/406341.aspx&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: dimgrey;"&gt;// This program uses a single-appartment state.&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;STAThread&lt;span style="color: #808030;"&gt;]&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: maroon; font-weight: bold;"&gt;static&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; Main&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;string&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; args&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: purple;"&gt;{&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OpenFileDialog dlg &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;new&lt;/span&gt; OpenFileDialog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;dlg&lt;span style="color: #808030;"&gt;.&lt;/span&gt;ShowDialog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; DialogResult&lt;span style="color: #808030;"&gt;.&lt;/span&gt;OK&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console&lt;span style="color: #808030;"&gt;.&lt;/span&gt;WriteLine&lt;span style="color: #808030;"&gt;(&lt;/span&gt;dlg&lt;span style="color: #808030;"&gt;.&lt;/span&gt;FileName&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console&lt;span style="color: #808030;"&gt;.&lt;/span&gt;ReadLine&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: purple;"&gt;}&lt;/span&gt;
&amp;nbsp; &amp;nbsp; &lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;"&gt;&lt;span class="Apple-style-span" style="color: purple;"&gt;
&lt;/span&gt;&lt;/pre&gt;Or, a bit more advanced example allowing a multiselection for the image-files&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Text&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Windows&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Forms&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;namespace&lt;/span&gt; OpenDialogMultiSelectTest
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;class&lt;/span&gt; Program
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #808030;"&gt;[&lt;/span&gt;STAThread&lt;span style="color: #808030;"&gt;]&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;static&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; Main&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;string&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; args&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            OpenFileDialog dlg &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;new&lt;/span&gt; OpenFileDialog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            dlg&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Multiselect &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;true&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            dlg&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Title &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Choose few files&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            dlg&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Filter &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Images|*.jpg|AllFiles|*.*&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;dlg&lt;span style="color: #808030;"&gt;.&lt;/span&gt;ShowDialog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; DialogResult&lt;span style="color: #808030;"&gt;.&lt;/span&gt;OK&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;foreach&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;string&lt;/span&gt; str &lt;span style="color: maroon; font-weight: bold;"&gt;in&lt;/span&gt; dlg&lt;span style="color: #808030;"&gt;.&lt;/span&gt;FileNames&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                    Console&lt;span style="color: #808030;"&gt;.&lt;/span&gt;WriteLine&lt;span style="color: #808030;"&gt;(&lt;/span&gt;str&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: purple;"&gt;}&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
Or a bit more practical example - create a backup copy of a selected file:&lt;br /&gt;
&lt;pre style="background: #ffffff; color: black;"&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;IO&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: maroon; font-weight: bold;"&gt;using&lt;/span&gt; System&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Windows&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Forms&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;namespace&lt;/span&gt; FileStreamTest
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;class&lt;/span&gt; Program
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #808030;"&gt;[&lt;/span&gt;STAThread&lt;span style="color: #808030;"&gt;]&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;static&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; Main&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;string&lt;/span&gt;&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; args&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            OpenFileDialog ofd &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;new&lt;/span&gt; OpenFileDialog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            ofd&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Title &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Select a file to copy&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;ofd&lt;span style="color: #808030;"&gt;.&lt;/span&gt;ShowDialog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; DialogResult&lt;span style="color: #808030;"&gt;.&lt;/span&gt;OK&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                FileStream inStream &lt;span style="color: #808030;"&gt;=&lt;/span&gt; File&lt;span style="color: #808030;"&gt;.&lt;/span&gt;OpenRead&lt;span style="color: #808030;"&gt;(&lt;/span&gt;ofd&lt;span style="color: #808030;"&gt;.&lt;/span&gt;FileName&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                FileStream outStream &lt;span style="color: #808030;"&gt;=&lt;/span&gt; File&lt;span style="color: #808030;"&gt;.&lt;/span&gt;OpenWrite&lt;span style="color: #808030;"&gt;(&lt;/span&gt;ofd&lt;span style="color: #808030;"&gt;.&lt;/span&gt;FileName &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;.bak&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                &lt;span style="color: maroon; font-weight: bold;"&gt;bool&lt;/span&gt; cont &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;true&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;do&lt;/span&gt;
                &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                    &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; b &lt;span style="color: #808030;"&gt;=&lt;/span&gt;  inStream&lt;span style="color: #808030;"&gt;.&lt;/span&gt;ReadByte&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                    cont &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;b &lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;cont&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                        outStream&lt;span style="color: #808030;"&gt;.&lt;/span&gt;WriteByte&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;byte&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;b&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: purple;"&gt;}&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;while&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;cont&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                outStream&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Flush&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                outStream&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Close&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                inStream&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Close&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;br /&gt;
Or, let's use MemoryStream:&lt;br /&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#800000; font-weight:bold; '&gt;using&lt;/span&gt; System&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
&lt;span style='color:#800000; font-weight:bold; '&gt;using&lt;/span&gt; System&lt;span style='color:#808030; '&gt;.&lt;/span&gt;IO&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
&lt;span style='color:#800000; font-weight:bold; '&gt;using&lt;/span&gt; System&lt;span style='color:#808030; '&gt;.&lt;/span&gt;Windows&lt;span style='color:#808030; '&gt;.&lt;/span&gt;Forms&lt;span style='color:#800080; '&gt;;&lt;/span&gt;

namespace MemoryStreamTest
&lt;span style='color:#800080; '&gt;{&lt;/span&gt;
    class Program
    &lt;span style='color:#800080; '&gt;{&lt;/span&gt;
        public &lt;span style='color:#800000; font-weight:bold; '&gt;static&lt;/span&gt; &lt;span style='color:#800000; font-weight:bold; '&gt;void&lt;/span&gt; SaveMemoryStream&lt;span style='color:#808030; '&gt;(&lt;/span&gt;MemoryStream ms&lt;span style='color:#808030; '&gt;,&lt;/span&gt; string fileName&lt;span style='color:#808030; '&gt;)&lt;/span&gt;
        &lt;span style='color:#800080; '&gt;{&lt;/span&gt;
            FileStream outStream &lt;span style='color:#808030; '&gt;=&lt;/span&gt; File&lt;span style='color:#808030; '&gt;.&lt;/span&gt;OpenWrite&lt;span style='color:#808030; '&gt;(&lt;/span&gt;fileName&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
            ms&lt;span style='color:#808030; '&gt;.&lt;/span&gt;WriteTo&lt;span style='color:#808030; '&gt;(&lt;/span&gt;outStream&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
            outStream&lt;span style='color:#808030; '&gt;.&lt;/span&gt;Flush&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
            outStream&lt;span style='color:#808030; '&gt;.&lt;/span&gt;Close&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
        &lt;span style='color:#800080; '&gt;}&lt;/span&gt;

        &lt;span style='color:#808030; '&gt;[&lt;/span&gt;STAThread&lt;span style='color:#808030; '&gt;]&lt;/span&gt;
        &lt;span style='color:#800000; font-weight:bold; '&gt;static&lt;/span&gt; &lt;span style='color:#800000; font-weight:bold; '&gt;void&lt;/span&gt; Main&lt;span style='color:#808030; '&gt;(&lt;/span&gt;string&lt;span style='color:#808030; '&gt;[&lt;/span&gt;&lt;span style='color:#808030; '&gt;]&lt;/span&gt; args&lt;span style='color:#808030; '&gt;)&lt;/span&gt;
        &lt;span style='color:#800080; '&gt;{&lt;/span&gt;
            OpenFileDialog ofd &lt;span style='color:#808030; '&gt;=&lt;/span&gt; new OpenFileDialog&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
            &lt;span style='color:#800000; font-weight:bold; '&gt;if&lt;/span&gt; &lt;span style='color:#808030; '&gt;(&lt;/span&gt;ofd&lt;span style='color:#808030; '&gt;.&lt;/span&gt;ShowDialog&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt; &lt;span style='color:#808030; '&gt;=&lt;/span&gt;&lt;span style='color:#808030; '&gt;=&lt;/span&gt; DialogResult&lt;span style='color:#808030; '&gt;.&lt;/span&gt;OK&lt;span style='color:#808030; '&gt;)&lt;/span&gt;
            &lt;span style='color:#800080; '&gt;{&lt;/span&gt;
                FileStream inStream &lt;span style='color:#808030; '&gt;=&lt;/span&gt; File&lt;span style='color:#808030; '&gt;.&lt;/span&gt;OpenRead&lt;span style='color:#808030; '&gt;(&lt;/span&gt;ofd&lt;span style='color:#808030; '&gt;.&lt;/span&gt;FileName&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
                MemoryStream ms &lt;span style='color:#808030; '&gt;=&lt;/span&gt; new MemoryStream&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
                ms&lt;span style='color:#808030; '&gt;.&lt;/span&gt;SetLength&lt;span style='color:#808030; '&gt;(&lt;/span&gt;inStream&lt;span style='color:#808030; '&gt;.&lt;/span&gt;Length&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
                inStream&lt;span style='color:#808030; '&gt;.&lt;/span&gt;Read&lt;span style='color:#808030; '&gt;(&lt;/span&gt;ms&lt;span style='color:#808030; '&gt;.&lt;/span&gt;GetBuffer&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; &lt;span style='color:#008c00; '&gt;0&lt;/span&gt;&lt;span style='color:#808030; '&gt;,&lt;/span&gt; &lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#800000; font-weight:bold; '&gt;int&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;inStream&lt;span style='color:#808030; '&gt;.&lt;/span&gt;Length&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
                ms&lt;span style='color:#808030; '&gt;.&lt;/span&gt;Flush&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
                inStream&lt;span style='color:#808030; '&gt;.&lt;/span&gt;Close&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
                SaveMemoryStream&lt;span style='color:#808030; '&gt;(&lt;/span&gt;ms&lt;span style='color:#808030; '&gt;,&lt;/span&gt; ofd&lt;span style='color:#808030; '&gt;.&lt;/span&gt;FileName &lt;span style='color:#808030; '&gt;+&lt;/span&gt; &lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;.bak&lt;/span&gt;&lt;span style='color:#800000; '&gt;"&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
                ms&lt;span style='color:#808030; '&gt;.&lt;/span&gt;Close&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;;&lt;/span&gt;
            &lt;span style='color:#800080; '&gt;}&lt;/span&gt;
        &lt;span style='color:#800080; '&gt;}&lt;/span&gt;
    &lt;span style='color:#800080; '&gt;}&lt;/span&gt;
&lt;span style='color:#800080; '&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-3087567478397845736?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/_4DRTxjjof8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/3087567478397845736/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/07/c-openfiledialog-in-console-program.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/3087567478397845736?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/3087567478397845736?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/_4DRTxjjof8/c-openfiledialog-in-console-program.html" title="C#: OpenFileDialog in a console program" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/07/c-openfiledialog-in-console-program.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcBSXoyeyp7ImA9WhZVFkk.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-3992617132010188017</id><published>2011-05-28T23:21:00.002+03:00</published><updated>2011-05-29T08:30:58.493+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-29T08:30:58.493+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ActionScript" /><title>Actionscript undefined</title><content type="html">&lt;i&gt;&lt;iframe align="left" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?t=software0203-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=bpl&amp;amp;asins=0596526946&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;m=amazon&amp;amp;lc1=0000FF&amp;amp;bc1=000000&amp;amp;bg1=FFFFFF&amp;amp;f=ifr" style="align: left; height: 245px; padding-right: 10px; padding-top: 5px; width: 131px;"&gt;&lt;/iframe&gt;undefined&lt;/i&gt; is a type: &lt;i&gt;typeof(undefined)&lt;/i&gt; returns "undefined" - a string, the type name. &lt;br /&gt;
This type (&lt;i&gt;undefined&lt;/i&gt;) has only one value and this value is &lt;i&gt;undefined&lt;/i&gt;, that means that a variable or a parameter or a return value, that was declared without the type name, has not been assigned to any value yet. &lt;br /&gt;
Also an array element becomes &lt;i&gt;undefined&lt;/i&gt; if instruction &lt;i&gt;delete&lt;/i&gt; is applied for it.&lt;br /&gt;
Typed variables cannot be &lt;i&gt;undefined&lt;/i&gt;. &lt;i&gt;Undefined&lt;/i&gt; is equal to &lt;i&gt;null&lt;/i&gt;, if &lt;i&gt;operator ==&lt;/i&gt; is used. For &lt;i&gt;operator ===&lt;/i&gt;&lt;strike style="text-decoration: line-through;"&gt;&lt;i&gt;&lt;/i&gt;&lt;/strike&gt; &lt;i&gt;undefined&lt;/i&gt; and &lt;i&gt;null&lt;/i&gt; are not equal:&lt;br /&gt;
&lt;i&gt;trace(null == undefined); //true&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;trace(null === undefined); //false&lt;/i&gt;&lt;br /&gt;
&lt;a href="http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary811.html"&gt;Actionscript Dictionary&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-3992617132010188017?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/TMqYKzs3doI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/3992617132010188017/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/05/actionscript-undefined.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/3992617132010188017?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/3992617132010188017?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/TMqYKzs3doI/actionscript-undefined.html" title="Actionscript undefined" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/05/actionscript-undefined.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08ERXczcCp7ImA9WhZVE08.&quot;"><id>tag:blogger.com,1999:blog-4530101601581439767.post-2774777447356534862</id><published>2011-05-25T16:22:00.001+03:00</published><updated>2011-05-25T16:23:24.988+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-25T16:23:24.988+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Random String Generator (C#)</title><content type="html">&lt;p&gt;In case someone else needs it&lt;/p&gt; &lt;p&gt;using System;&lt;br&gt;using System.Collections.Generic;&lt;br&gt;using System.Linq;&lt;br&gt;using System.Text;&lt;/p&gt; &lt;p&gt;namespace RandomStringGenerator&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class Program&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static Random rnd = new Random();&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[] args)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Random string (1): {0}", Generate(1));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Random string (2): {0}", Generate(2));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Random string (4): {0}", Generate(4));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Random string (10): {0}", Generate(10));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Random string (32): {0}", Generate(32));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Random string (64): {0}", Generate(64));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static string Generate(int size)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringBuilder str = new StringBuilder();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; size; ++i)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; char ch = Convert.ToChar(rnd.Next(32, 128));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str.Append(ch);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return str.ToString();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Pavel Gnatyuk
www.wmdeveloper.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4530101601581439767-2774777447356534862?l=www.wmdeveloper.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wmdeveloper/gfPj/~4/YDnzjC-S2Js" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.wmdeveloper.com/feeds/2774777447356534862/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.wmdeveloper.com/2011/05/random-string-generator-c.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2774777447356534862?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4530101601581439767/posts/default/2774777447356534862?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/wmdeveloper/gfPj/~3/YDnzjC-S2Js/random-string-generator-c.html" title="Random String Generator (C#)" /><author><name>Pavel Gnatyuk</name><uri>https://profiles.google.com/111194315370833282238</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-Ps4mqOsfuW4/AAAAAAAAAAI/AAAAAAAACU0/KUgTu1DgER8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.wmdeveloper.com/2011/05/random-string-generator-c.html</feedburner:origLink></entry></feed>

