<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Scott Faisal</title>
	<atom:link href="http://scottfaisal.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://scottfaisal.com</link>
	<description>Absolute Automatification</description>
	<lastBuildDate>Tue, 27 Dec 2011 16:43:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Setting up Drupal development environment based on Ubuntu</title>
		<link>http://scottfaisal.com/setting-up-drupal-development-environment-based-on-ubuntu/</link>
		<comments>http://scottfaisal.com/setting-up-drupal-development-environment-based-on-ubuntu/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 21:58:26 +0000</pubDate>
		<dc:creator>Automater</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://scottfaisal.com/?p=339</guid>
		<description><![CDATA[http://www.vmirgorod.name/11/1/20/drupal-development-environment-based-ubuntu-1010 Share this on Reddit Stumble upon something good? Share it on StumbleUpon Get Shareaholic]]></description>
			<content:encoded><![CDATA[<p>http://www.vmirgorod.name/11/1/20/drupal-development-environment-based-ubuntu-1010</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Setting+up+Drupal+development+environment+based+on+Ubuntu&amp;link=http://scottfaisal.com/setting-up-drupal-development-environment-based-on-ubuntu/&amp;notes=http%3A%2F%2Fwww.vmirgorod.name%2F11%2F1%2F20%2Fdrupal-development-environment-based-ubuntu-1010&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Setting+up+Drupal+development+environment+based+on+Ubuntu&amp;link=http://scottfaisal.com/setting-up-drupal-development-environment-based-on-ubuntu/&amp;notes=http%3A%2F%2Fwww.vmirgorod.name%2F11%2F1%2F20%2Fdrupal-development-environment-based-ubuntu-1010&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://scottfaisal.com/setting-up-drupal-development-environment-based-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installation of Memcache in PHP on Ubuntu/Debian</title>
		<link>http://scottfaisal.com/installation-of-memcache-in-php-on-ubuntudebian/</link>
		<comments>http://scottfaisal.com/installation-of-memcache-in-php-on-ubuntudebian/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 20:13:59 +0000</pubDate>
		<dc:creator>Automater</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://scottfaisal.com/?p=334</guid>
		<description><![CDATA[Just a quick post about how to install Memcache in PHP on an Ubuntu or Debian server (I think it will apply to Redhat based servers, just substitute the apt-get for yum). Log on to your server as root (either directly or using sudo su), then install the Memcache daemon through apt: apt-get install memcached [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post about how to install Memcache in PHP on an Ubuntu or Debian server (I think it will apply to Redhat based servers, just substitute the apt-get for yum).</p>
<p>Log on to your server as root (either directly or using sudo su), then install the Memcache daemon through apt:<br />
<strong>apt-get install memcached</strong></p>
<p>Once installed you need to install the Memcache module into PHP. This is done through PECL which in turn is installed through PEAR. When they are both installed, you need to run the command:<br />
<strong>pecl install memcache</strong></p>
<p>This will install the memcache extension, and once done will tell you to add the the line “extension=memcache.so” into your php.ini file. I prefer keeping these in separate files (so that the php.ini file can be updated). The easy way to do this is:<br />
<strong>echo &#8220;extension=memcache.so&#8221; &gt; /etc/php5/conf.d/memcache.ini</strong></p>
<p>And finally, reload Apache<br />
<strong>/etc/init.d/apache2 reload</strong></p>
<p>If successful, Memcache will now appear in your phpinfo()</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Installation+of+Memcache+in+PHP+on+Ubuntu%2FDebian&amp;link=http://scottfaisal.com/installation-of-memcache-in-php-on-ubuntudebian/&amp;notes=Just%20a%20quick%20post%20about%20how%20to%20install%20Memcache%20in%20PHP%20on%20an%20Ubuntu%20or%20Debian%20server%20%28I%20think%20it%20will%20apply%20to%20Redhat%20based%20servers%2C%20just%20substitute%20the%20apt-get%20for%20yum%29.%0D%0A%0D%0ALog%20on%20to%20your%20server%20as%20root%20%28either%20directly%20or%20using%20sudo%20su%29%2C%20then%20install%20the%20Memcache%20daemon%20through%20apt%3A%0D%0Aapt-get%20insta&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Installation+of+Memcache+in+PHP+on+Ubuntu%2FDebian&amp;link=http://scottfaisal.com/installation-of-memcache-in-php-on-ubuntudebian/&amp;notes=Just%20a%20quick%20post%20about%20how%20to%20install%20Memcache%20in%20PHP%20on%20an%20Ubuntu%20or%20Debian%20server%20%28I%20think%20it%20will%20apply%20to%20Redhat%20based%20servers%2C%20just%20substitute%20the%20apt-get%20for%20yum%29.%0D%0A%0D%0ALog%20on%20to%20your%20server%20as%20root%20%28either%20directly%20or%20using%20sudo%20su%29%2C%20then%20install%20the%20Memcache%20daemon%20through%20apt%3A%0D%0Aapt-get%20insta&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://scottfaisal.com/installation-of-memcache-in-php-on-ubuntudebian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error Whilst Compiling iOS Apps</title>
		<link>http://scottfaisal.com/error-whilst-compiling-ios-apps/</link>
		<comments>http://scottfaisal.com/error-whilst-compiling-ios-apps/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 16:23:41 +0000</pubDate>
		<dc:creator>Automater</dc:creator>
				<category><![CDATA[ios]]></category>

		<guid isPermaLink="false">http://scottfaisal.com/?p=327</guid>
		<description><![CDATA[Apple&#8217;s instructions for provisioning are poor. It took me days to work out what was required. If you are having problems getting your app to build and run on your iPhone or iPod touch, the following may help you: CERTIFICATES All certificates have to be included in the &#8216;login&#8217; Keychain (section) of the &#8216;Keychain Access&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>Apple&#8217;s instructions for provisioning are poor. It took me days to work out what was required.</p>
<p>If you are having problems getting your app to build and run on your iPhone or iPod touch, the following may help you:</p>
<p>CERTIFICATES</p>
<p>All certificates have to be included in the &#8216;login&#8217; Keychain (section) of the &#8216;Keychain Access&#8217; app, which is used to manage all types of security on your Mac. There are other sections in Keychain Access; on my MacBook these are &#8216;System&#8217; and &#8216;System Roots&#8217;. Ignore these, and ensure that the &#8216;login&#8217; section is the default section. The default section shows up in bold typeface. If &#8216;login&#8217; is NOT in bold, but some other section is, you can make &#8216;login&#8217; the default section by right-clicking it, and selecting &#8216;Make Keychain &#8220;login&#8221; Default&#8217;. Some developers have reported that their default keychain is automatically (and inexplicably) switched to something other than &#8216;login&#8217;.</p>
<p>You need to have, in your login section of Keychain Access, the following 2 certificates:</p>
<p>1. A certificate called &#8216;Apple Worldwide Developer Relations Certification Authority&#8217;. Apple also calls this the WWDR intermediate certificate. You need this certificate on your keychain (i.e. on your Mac, and available to Xcode) because this is the trusted certificate that signs your own developer certificate.</p>
<p>2. Your own developer certificate, which has been signed by the WWDR certificate. Your developer certificate is the one that Xcode needs. Xcode will read in this certificate when it builds your iPhone application, and because your certificate has been signed by the WWDR certificate, Xcode needs access to the WWDR certificate too, which is why it must be on your keychain.</p>
<p>(Note that the pair of keys (e.g. Joe Bloggs, private key, and Joe Bloggs, public key) that were created when the CSR was created, are no longer needed. You can safely delete these two files from Keychain Access after you have added your developer certificate to Keychain Access. The keys were only needed to authenticate your developer certificate from Apple.)</p>
<p>ERRORS</p>
<p>Errors you may get:</p>
<p>Error: &#8220;A valid signing identity matching this profile could not be found in your keychain&#8221;</p>
<p>Solution: Most likely that you have not downloaded the necessary WWDR certificate from the Apple developer site. There is a link to download this certificate in the &#8216;Certificates&#8217; section of the developer portal. If you <strong>do</strong> have the certificate in your keychain, make sure that it has not expired (unlikely, as mine is valid until 2016). Also make sure that your developer certificate has not expired (these seem to be valid for only 12 months at a time).</p>
<p>Error: &#8220;Code Sign error: A valid provisioning profile matching the application&#8217;s Identifier (abcdef123456.com.yourdomain) could not be found&#8221;</p>
<p>Solution: remove &#8220;abcdef123456.&#8221; from the start of the Bundle Identifier in Xcode (.plist file)</p>
<p>Error: nothing happens when I click a button on the Apple site</p>
<p>Solution: DO NOT USE Firefox for visiting Apple&#8217;s Developer sites. There are problems when you click buttons, e.g. to Add, Delete or Edit items in your program portal (nothing happens in Firefox), leaving you uncertain about whether anything has happened. Apple&#8217;s own browser, Safari, works properly. I have not tried any other browser, but beware!</p>
<p>CSR COMMON NAME</p>
<p>When you create your CSR, the &#8220;common name&#8221; that you specify must match your own name, or the name of one of your development team that you have specified in the portal. Apple appears to add the prefix &#8220;iPhone Developer: &#8221; to the common name, and adds a 10-character suffix in parentheses, e.g. (CXW34YTRE4), but all you need is the developer&#8217;s first and last name.</p>
<p>STARTING FROM SCRATCH</p>
<p>If all else fails, START OVER:</p>
<p>1 Delete the WWDR certificate and your developer certificates from Keychain Access<br />
2 Ensure that the login keychain is set as the default keychain in Keychain Access<br />
3 Download the WWDR certificate and add it to your keychain in the login section<br />
4 Use Keychain Access to generate a CSR (Certificate Assistant&#8230; Request a Certificate&#8230;) for a developer<br />
5 Submit the CSR to the Apple portal<br />
6 When the developer certificate is ready, download it to your Mac and add it to your keychain in the login section<br />
7 In the Apple portal, specify the unique device ID (UDID) of your iPhone or iPod touch. You can find the device&#8217;s UDID in the Window&#8230; Organizer section of Xcode. The ID is the 40 character &#8220;Identifier&#8221; string in the &#8220;Summary&#8221; tab (e.g. 4ada8edc85bfdd3947696cb3277a8c7f731fb6c3)<br />
8 In the Apple portal, choose an App ID name. This can be anything, it is not related to any other data. However, the Bundle Identifier that you choose here MUST match the Bundle Identifier used in your Xcode .plist file, e.g. &#8220;com.mydomain&#8221;<br />
9 In the Apple portal, create a provisioning profile. The 3 ingredients for this are the name(s) of your developer certificates, your unique device ID(s) (UDID(s)), and your App ID. When you download this file, it will have a .mobileprovision extension. After you have downloaded it, open it in Finder, and drag it to the Xcode icon in your dock. The profile should now appear in Xcode. To check, go to the Xcode &#8220;Window&#8230; Organizer&#8221; menu and look under &#8220;iPhone Development&#8230; Provisioning Profiles&#8221;. If all is ok, you should not see any yellow error messages, and your profile should appear in the &#8220;Name&#8221; list.<br />
10 Do a clean build, so that previous precompiled headers and object files are deleted. In Xcode, choose &#8220;Build&#8230; Clean All Targets&#8221;, then &#8220;Build&#8230; Build and Run&#8221;. If your code compiles with no errors, Xcode will upload the app to your iPhone or iPod touch, using the USB cable attached to your device.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Error+Whilst+Compiling+iOS+Apps&amp;link=http://scottfaisal.com/error-whilst-compiling-ios-apps/&amp;notes=Apple%27s%20instructions%20for%20provisioning%20are%20poor.%20It%20took%20me%20days%20to%20work%20out%20what%20was%20required.%0D%0A%0D%0AIf%20you%20are%20having%20problems%20getting%20your%20app%20to%20build%20and%20run%20on%20your%20iPhone%20or%20iPod%20touch%2C%20the%20following%20may%20help%20you%3A%0D%0A%0D%0ACERTIFICATES%0D%0A%0D%0AAll%20certificates%20have%20to%20be%20included%20in%20the%20%27login%27%20Keychain%20%28se&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Error+Whilst+Compiling+iOS+Apps&amp;link=http://scottfaisal.com/error-whilst-compiling-ios-apps/&amp;notes=Apple%27s%20instructions%20for%20provisioning%20are%20poor.%20It%20took%20me%20days%20to%20work%20out%20what%20was%20required.%0D%0A%0D%0AIf%20you%20are%20having%20problems%20getting%20your%20app%20to%20build%20and%20run%20on%20your%20iPhone%20or%20iPod%20touch%2C%20the%20following%20may%20help%20you%3A%0D%0A%0D%0ACERTIFICATES%0D%0A%0D%0AAll%20certificates%20have%20to%20be%20included%20in%20the%20%27login%27%20Keychain%20%28se&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://scottfaisal.com/error-whilst-compiling-ios-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Comparison between REST Vs XML-RPC</title>
		<link>http://scottfaisal.com/a-comparison-between-rest-vs-xml-rpc-2/</link>
		<comments>http://scottfaisal.com/a-comparison-between-rest-vs-xml-rpc-2/#comments</comments>
		<pubDate>Tue, 24 May 2011 06:01:55 +0000</pubDate>
		<dc:creator>Automater</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://scottfaisal.com/?p=323</guid>
		<description><![CDATA[Rest protocol uses the HTTP GET and HTTP PUT methods to communicate with an application server. For example an API for a typical application would look like http://example.com/users/ http://example.com/users/{user} (one for each user) http://example.com/findUserForm http://example.com/locations/ http://example.com/locations/{location} (one for each location) http://example.com/findLocationForm &#160; The client typically a webbrowser needs to construct HTTP requests and parse XML [...]]]></description>
			<content:encoded><![CDATA[<p>Rest protocol uses the HTTP GET and HTTP PUT methods to communicate with an application server. For example an API for a typical application would look like</p>
<p><em>http://example.com/users/</em></p>
<p><em>http://example.com/users/{user} (one for each user)</em></p>
<p><em>http://example.com/findUserForm</em></p>
<p><em>http://example.com/locations/</em></p>
<p><em>http://example.com/locations/{location} (one for each location)</em></p>
<p><em>http://example.com/findLocationForm</em></p>
<p>&nbsp;</p>
<p>The client typically a webbrowser needs to construct HTTP requests and parse XML or HTML responses.</p>
<p>&nbsp;</p>
<p>XML-RPC uses XML protocol to make Remote procedure calls to execute functions defined on objects, over the network.</p>
<p>An RPC application might define operations such as the following:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre>
<pre>&lt;em&gt;getUser()&lt;/em&gt;

&lt;em&gt;addUser()&lt;/em&gt;

&lt;em&gt;removeUser()&lt;/em&gt;

&lt;em&gt;updateUser()&lt;/em&gt;

&lt;em&gt;getLocation()&lt;/em&gt;

&lt;em&gt;addLocation()&lt;/em&gt;

&lt;em&gt;removeLocation()&lt;/em&gt;

&lt;em&gt;updateLocation()&lt;/em&gt;

&lt;em&gt;listUsers()&lt;/em&gt;

&lt;em&gt;listLocations()&lt;/em&gt;

&lt;em&gt;findLocation()&lt;/em&gt;

&lt;em&gt;findUser()&lt;/em&gt;</pre>
</div>
<p>The client needs to construct an XML request and parse the XML response.</p>
<p>&nbsp;</p>
<p><strong>Comparison</strong></p>
<p>REST is an HTTP based protocol. Whereas XML-RPC is XML based.</p>
<p>IMO, REST being an HTTP based protocol works best when the client is a browser. XML-RPC on the other hand is XML based. So no assumption is made about the client which is going to use the protocol.</p>
<p>When the client is a browser, more efforts need to be put in by the client to use XML-RPC than to use REST.</p>
<p>An advantage of REST over XML-RPC is that each object has its own URL and can easily be cached, copied, and bookmarked.</p>
<p>Advantage of XML-RPC is that it is client independant. Any sort of client be it a desktop application a mobile application, a mashup using information from your site can easily integrate with XML-RPC.</p>
<p>Overall I think REST has its advantages in the browser world. But as more and more applications are using the web as a platform and accessing it through a variety of methods other than web browsers XML-RPC has and edge over REST.</p>
<p>&nbsp;</p>
<p><strong>Conclusion</strong></p>
<p>Web services should provide and XML based interface like XML-RPC. The could also provide a RESTful interface built on top of XML-RPC to support browser based clients.</p>
<p><a href="http://scottfaisal.com/wp-content/uploads/2011/05/image-1.gif"><img class="aligncenter size-medium wp-image-317" title="image 1" src="http://scottfaisal.com/wp-content/uploads/2011/05/image-1-300x281.gif" alt="" width="300" height="281" /></a></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=A+Comparison+between+REST+Vs+XML-RPC&amp;link=http://scottfaisal.com/a-comparison-between-rest-vs-xml-rpc-2/&amp;notes=Rest%20protocol%20uses%20the%20HTTP%20GET%20and%20HTTP%20PUT%20methods%20to%20communicate%20with%20an%20application%20server.%20For%20example%20an%20API%20for%20a%20typical%20application%20would%20look%20like%0D%0A%0D%0Ahttp%3A%2F%2Fexample.com%2Fusers%2F%0D%0A%0D%0Ahttp%3A%2F%2Fexample.com%2Fusers%2F%7Buser%7D%20%28one%20for%20each%20user%29%0D%0A%0D%0Ahttp%3A%2F%2Fexample.com%2FfindUserForm%0D%0A%0D%0Ahttp%3A%2F%2Fexample.com%2Flo&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=A+Comparison+between+REST+Vs+XML-RPC&amp;link=http://scottfaisal.com/a-comparison-between-rest-vs-xml-rpc-2/&amp;notes=Rest%20protocol%20uses%20the%20HTTP%20GET%20and%20HTTP%20PUT%20methods%20to%20communicate%20with%20an%20application%20server.%20For%20example%20an%20API%20for%20a%20typical%20application%20would%20look%20like%0D%0A%0D%0Ahttp%3A%2F%2Fexample.com%2Fusers%2F%0D%0A%0D%0Ahttp%3A%2F%2Fexample.com%2Fusers%2F%7Buser%7D%20%28one%20for%20each%20user%29%0D%0A%0D%0Ahttp%3A%2F%2Fexample.com%2FfindUserForm%0D%0A%0D%0Ahttp%3A%2F%2Fexample.com%2Flo&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://scottfaisal.com/a-comparison-between-rest-vs-xml-rpc-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding memory management in iOS</title>
		<link>http://scottfaisal.com/understanding-memory-management-in-ios/</link>
		<comments>http://scottfaisal.com/understanding-memory-management-in-ios/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 04:36:23 +0000</pubDate>
		<dc:creator>Automater</dc:creator>
				<category><![CDATA[ios]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone Consulting]]></category>
		<category><![CDATA[iPhone Development]]></category>

		<guid isPermaLink="false">http://scottfaisal.com/?p=313</guid>
		<description><![CDATA[Each object has a &#8220;retain count&#8221; which is increased by calling &#8220;retain&#8221; and decreased by calling &#8220;release&#8221;. Once the retain count hits 0, the object is released and the memory can be used for something else. You can &#8220;autorelease&#8221; objects. This means the retain count isn&#8217;t immediately decreased, but is decreased the next time the [...]]]></description>
			<content:encoded><![CDATA[<p>Each object has a &#8220;retain count&#8221; which is increased by calling &#8220;retain&#8221; and decreased by calling &#8220;release&#8221;. Once the retain count hits 0, the object is released and the memory can be used for something else.</p>
<p>You can &#8220;autorelease&#8221; objects. This means the retain count isn&#8217;t immediately decreased, but is decreased the next time the current autorelease pool is drained.</p>
<p>iOS apps have an event loop in which your code runs. After each iteration of the event loop, the autorelease pool is drained. Any object with a retain count of 0 is released.</p>
<p>By default, autoreleased objects are returned by methods that don&#8217;t begin with new, copy, mutableCopy, retain or init. This means you can use them immediately but if you don&#8217;t retain them the object will be gone on the next iteration of the run loop.</p>
<p>If you fail to release retained objects but no longer reference them then you will have a memory leak, this can be detected by the leaks tool in Instruments.</p>
<p>One strategy is to autorelease everything returned by the above named methods and store objects in retain properties (or copy for strings). In your object&#8217;s dealloc method, set all your properties to nil. Setting a retain/copy property to nil releases the object that it currently points to. As long as you don&#8217;t have any circular references (avoided by not using retain properties for &#8220;parent&#8221; objects such as delegates), you will never encounter any leaks.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Understanding+memory+management+in+iOS&amp;link=http://scottfaisal.com/understanding-memory-management-in-ios/&amp;notes=Each%20object%20has%20a%20%22retain%20count%22%20which%20is%20increased%20by%20calling%20%22retain%22%20and%20decreased%20by%20calling%20%22release%22.%20Once%20the%20retain%20count%20hits%200%2C%20the%20object%20is%20released%20and%20the%20memory%20can%20be%20used%20for%20something%20else.%0D%0A%0D%0AYou%20can%20%22autorelease%22%20objects.%20This%20means%20the%20retain%20count%20isn%27t%20immediately%20decreased%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Understanding+memory+management+in+iOS&amp;link=http://scottfaisal.com/understanding-memory-management-in-ios/&amp;notes=Each%20object%20has%20a%20%22retain%20count%22%20which%20is%20increased%20by%20calling%20%22retain%22%20and%20decreased%20by%20calling%20%22release%22.%20Once%20the%20retain%20count%20hits%200%2C%20the%20object%20is%20released%20and%20the%20memory%20can%20be%20used%20for%20something%20else.%0D%0A%0D%0AYou%20can%20%22autorelease%22%20objects.%20This%20means%20the%20retain%20count%20isn%27t%20immediately%20decreased%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://scottfaisal.com/understanding-memory-management-in-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Facebook ships code</title>
		<link>http://scottfaisal.com/how-facebook-ships-code/</link>
		<comments>http://scottfaisal.com/how-facebook-ships-code/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 14:46:48 +0000</pubDate>
		<dc:creator>Automater</dc:creator>
				<category><![CDATA[Best Practices]]></category>

		<guid isPermaLink="false">http://scottfaisal.com/?p=310</guid>
		<description><![CDATA[Came across a very interesting article that I wanted to share about how Facebook ships code: http://framethink.wordpress.com/2011/01/17/how-facebook-ships-code/ Share this on Reddit Stumble upon something good? Share it on StumbleUpon Get Shareaholic]]></description>
			<content:encoded><![CDATA[<p>Came across a very interesting article that I wanted to share about how Facebook ships code:</p>
<p><a href="http://framethink.wordpress.com/2011/01/17/how-facebook-ships-code/">http://framethink.wordpress.com/2011/01/17/how-facebook-ships-code/</a></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=How+Facebook+ships+code&amp;link=http://scottfaisal.com/how-facebook-ships-code/&amp;notes=Came%20across%20a%20very%20interesting%20article%20that%20I%20wanted%20to%20share%20about%20how%20Facebook%20ships%20code%3A%0D%0A%0D%0Ahttp%3A%2F%2Fframethink.wordpress.com%2F2011%2F01%2F17%2Fhow-facebook-ships-code%2F&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=How+Facebook+ships+code&amp;link=http://scottfaisal.com/how-facebook-ships-code/&amp;notes=Came%20across%20a%20very%20interesting%20article%20that%20I%20wanted%20to%20share%20about%20how%20Facebook%20ships%20code%3A%0D%0A%0D%0Ahttp%3A%2F%2Fframethink.wordpress.com%2F2011%2F01%2F17%2Fhow-facebook-ships-code%2F&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://scottfaisal.com/how-facebook-ships-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comments in Lua</title>
		<link>http://scottfaisal.com/comments-in-lua/</link>
		<comments>http://scottfaisal.com/comments-in-lua/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 19:24:34 +0000</pubDate>
		<dc:creator>Automater</dc:creator>
				<category><![CDATA[lua]]></category>

		<guid isPermaLink="false">http://scottfaisal.com/?p=295</guid>
		<description><![CDATA[As you know, you can put comments in LUA with the double hyphen (–): -- This is a comment DoSomething(); -- This is another comment. ReDoSomething(); But the double hyphen is not very convenient for commenting multiple lines. Like in C language, there is a multi-lines comment: --[[ This is a ... multiline... comment! --]] [...]]]></description>
			<content:encoded><![CDATA[<p>As you know, you can put comments in LUA with the double hyphen (–):</p>
<pre class="brush: text;">-- This is a comment
DoSomething();

-- This is another comment.
ReDoSomething();</pre>
<p>But the double hyphen is not very convenient for commenting multiple lines. Like in C language, there is a multi-lines comment:</p>
<pre class="brush: text;">--[[
This is a ...
multiline...
comment!
--]]
DoSomething();</pre>
<p>This multiline or block comment is really cool since you can enable or disable a piece of code using a single hyphen.<br />
Hereafter, the function mySqr_v1 is commented:</p>
<pre class="brush: text;">--[[
function mySqr_v1(a)
	return a * a;
end
--]]

function mySqr_v2(a)
	local b = a*a;
	return b;
end</pre>
<p>and now, you can simply uncomment it with one hyphen:</p>
<pre class="brush: text;">---[[
function mySqr_v1(a)
	return a * a;
end
--]]

function mySqr_v2(a)
	local b = a*a;
	return b;
end</pre>
<p>Now both functions are active!</p>
<p>Wath-out: –[[ .... --]] is the right manner. I often see –[[ .... ]]– which seems to work but it’s wrong.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Comments+in+Lua&amp;link=http://scottfaisal.com/comments-in-lua/&amp;notes=As%20you%20know%2C%20you%20can%20put%20comments%20in%20LUA%20with%20the%20double%20hyphen%20%28%E2%80%93%29%3A%0D%0A--%20This%20is%20a%20comment%0D%0ADoSomething%28%29%3B%0D%0A%0D%0A--%20This%20is%20another%20comment.%0D%0AReDoSomething%28%29%3B%0D%0ABut%20the%20double%20hyphen%20is%20not%20very%20convenient%20for%20commenting%20multiple%20lines.%20Like%20in%20C%20language%2C%20there%20is%20a%20multi-lines%20comment%3A%0D%0A--%5B%5B%0D%0AThis%20i&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Comments+in+Lua&amp;link=http://scottfaisal.com/comments-in-lua/&amp;notes=As%20you%20know%2C%20you%20can%20put%20comments%20in%20LUA%20with%20the%20double%20hyphen%20%28%E2%80%93%29%3A%0D%0A--%20This%20is%20a%20comment%0D%0ADoSomething%28%29%3B%0D%0A%0D%0A--%20This%20is%20another%20comment.%0D%0AReDoSomething%28%29%3B%0D%0ABut%20the%20double%20hyphen%20is%20not%20very%20convenient%20for%20commenting%20multiple%20lines.%20Like%20in%20C%20language%2C%20there%20is%20a%20multi-lines%20comment%3A%0D%0A--%5B%5B%0D%0AThis%20i&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://scottfaisal.com/comments-in-lua/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Added my provider profile at iPhone Contractors</title>
		<link>http://scottfaisal.com/added-my-provider-profile-at-iphone-contractors/</link>
		<comments>http://scottfaisal.com/added-my-provider-profile-at-iphone-contractors/#comments</comments>
		<pubDate>Sun, 06 Feb 2011 07:57:57 +0000</pubDate>
		<dc:creator>Automater</dc:creator>
				<category><![CDATA[ios]]></category>
		<category><![CDATA[iPhone Development]]></category>

		<guid isPermaLink="false">http://scottfaisal.com/?p=292</guid>
		<description><![CDATA[I wanted to add my provider profile at iPhone Contractors and so finally I found the time and did it. Hopefully I can pick up some iPhone development gigs.I have not seen that many projects but that is only because the site is new. Share this on Reddit Stumble upon something good? Share it on [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to add my provider profile at <a href="http://iphonecontractors.com" target="_blank">iPhone Contractors</a> and so finally I found the time and did it.<br />
Hopefully I can pick up some iPhone development gigs.I have not seen that many projects but that is only because the site is new.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Added+my+provider+profile+at+iPhone+Contractors&amp;link=http://scottfaisal.com/added-my-provider-profile-at-iphone-contractors/&amp;notes=I%20wanted%20to%20add%20my%20provider%20profile%20at%20iPhone%20Contractors%20and%20so%20finally%20I%20found%20the%20time%20and%20did%20it.%0D%0AHopefully%20I%20can%20pick%20up%20some%20iPhone%20development%20gigs.I%20have%20not%20seen%20that%20many%20projects%20but%20that%20is%20only%20because%20the%20site%20is%20new.&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Added+my+provider+profile+at+iPhone+Contractors&amp;link=http://scottfaisal.com/added-my-provider-profile-at-iphone-contractors/&amp;notes=I%20wanted%20to%20add%20my%20provider%20profile%20at%20iPhone%20Contractors%20and%20so%20finally%20I%20found%20the%20time%20and%20did%20it.%0D%0AHopefully%20I%20can%20pick%20up%20some%20iPhone%20development%20gigs.I%20have%20not%20seen%20that%20many%20projects%20but%20that%20is%20only%20because%20the%20site%20is%20new.&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://scottfaisal.com/added-my-provider-profile-at-iphone-contractors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding reference counting with Cocoa / Objective C</title>
		<link>http://scottfaisal.com/understanding-reference-counting-with-cocoa-objective-c/</link>
		<comments>http://scottfaisal.com/understanding-reference-counting-with-cocoa-objective-c/#comments</comments>
		<pubDate>Sat, 08 Jan 2011 21:53:37 +0000</pubDate>
		<dc:creator>Automater</dc:creator>
				<category><![CDATA[ios]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[objective C]]></category>

		<guid isPermaLink="false">http://scottfaisal.com/?p=290</guid>
		<description><![CDATA[Let&#8217;s start with retain and release; autorelease is really just a special case once you understand the basic concepts. In Cocoa, each object keeps track of how many times it is being referenced (specifically, the NSObject base class implements this). By calling retain on an object, you are telling it that you want to up [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s start with retain and release; autorelease is really just a special case once you understand the basic concepts.</p>
<p>In Cocoa, each object keeps track of how many times it is being referenced (specifically, the NSObject base class implements this). By calling retain on an object, you are telling it that you want to up its reference count by one. By calling release, you tell the object you are letting go of it, and its reference count is decremented. If, after calling release, the reference count is now zero, then that object&#8217;s memory is freed by the system.</p>
<p>The basic way this differs from malloc and free is that any given object doesn&#8217;t need to worry about other parts of the system crashing because you&#8217;ve freed memory they were using. Assuming everyone is playing along and retaining/releasing according to the rules, when one piece of code retains and then releases the object, any other piece of code also referencing the object will be unaffected.</p>
<p>What can sometimes be confusing is knowing the circumstances under which you should call retain and release. My general rule of thumb is that if I want to hang on to an object for some length of time (if it&#8217;s a member variable in a class, for instance), then I need to make sure the object&#8217;s reference count knows about me. As described above, an object&#8217;s reference count is incremented by calling retain. By convention, it is also incremented (set to 1, really) when the object is created with an &#8220;init&#8221; method. In either of these cases, it is my responsibility to call release on the object when I&#8217;m done with it. If I don&#8217;t, there will be a memory leak.</p>
<p>Example of object creation:</p>
<p>NSString* s = [[NSString alloc] init];  // Ref count is 1<br />
[s retain];                             // Ref count is 2 &#8211; silly<br />
                                        //   to do this after init<br />
[s release];                            // Ref count is back to 1<br />
[s release];                            // Ref count is 0, object is freed<br />
Now for autorelease. Autorelease is used as a convenient (and sometimes necessary) way to tell the system to free this object up after a little while. From a plumbing perspective, when autorelease is called, the current thread&#8217;s NSAutoreleasePool is alerted of the call. The NSAutoreleasePool now knows that once it gets an opportunity (after the current iteration of the event loop), it can call release on the object. From our perspective as programmers, it takes care of calling release for us, so we don&#8217;t have to (and in fact, we shouldn&#8217;t).</p>
<p>What&#8217;s important to note is that (again, by convention) all object creation class methods return an autoreleased object. For example, in the following example, the variable &#8220;s&#8221; has a reference count of 1, but after the event loop completes, it will be destroyed.</p>
<p>NSString* s = [NSString stringWithString:@"Hello World"];<br />
If you want to hang onto that string, you&#8217;d need to call retain explicitly, and then explicitly release it when you&#8217;re done.</p>
<p>Consider the following (very contrived) bit of code, and you&#8217;ll see a situation where autorelease is required:</p>
<p>- (NSString*)createHelloWorldString<br />
{<br />
    NSString* s = [[NSString alloc] initWithString:@&#8221;Hello World&#8221;];</p>
<p>    // Now what?  We want to return s, but we&#8217;ve upped its reference count.<br />
    // The caller shouldn&#8217;t be responsible for releasing it, since we&#8217;re the<br />
    // ones that created it.  If we call release, however, the reference<br />
    // count will hit zero and bad memory will be returned to the caller.<br />
    // The answer is to call autorelease before returning the string.  By<br />
    // explicitly calling autorelease, we pass the responsibility for<br />
    // releasing the string on to the thread&#8217;s NSAutoreleasePool, which will<br />
    // happen at some later time.  The consequence is that the returned string<br />
    // will still be valid for the caller of this function.<br />
    return [s autorelease];<br />
}<br />
I realize all of this is a bit confusing &#8211; at some point, though, it will click. Here are a few references to get you going:</p>
<p>Apple&#8217;s introduction to memory management.<br />
Cocoa Programming for Mac OS X (3rd Edition), by Aaron Hillegas &#8211; a very well written book will lots of great examples. It reads like a tutorial.<br />
If you&#8217;re truly diving in, you could head to Big Nerd Ranch. This is a training facility run by Aaron Hillegas &#8211; the author of the book mentioned above. I attended the Intro to Cocoa course there several years ago, and it was a great way to learn.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Understanding+reference+counting+with+Cocoa+%2F+Objective+C&amp;link=http://scottfaisal.com/understanding-reference-counting-with-cocoa-objective-c/&amp;notes=Let%27s%20start%20with%20retain%20and%20release%3B%20autorelease%20is%20really%20just%20a%20special%20case%20once%20you%20understand%20the%20basic%20concepts.%0D%0A%0D%0AIn%20Cocoa%2C%20each%20object%20keeps%20track%20of%20how%20many%20times%20it%20is%20being%20referenced%20%28specifically%2C%20the%20NSObject%20base%20class%20implements%20this%29.%20By%20calling%20retain%20on%20an%20object%2C%20you%20are%20tellin&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Understanding+reference+counting+with+Cocoa+%2F+Objective+C&amp;link=http://scottfaisal.com/understanding-reference-counting-with-cocoa-objective-c/&amp;notes=Let%27s%20start%20with%20retain%20and%20release%3B%20autorelease%20is%20really%20just%20a%20special%20case%20once%20you%20understand%20the%20basic%20concepts.%0D%0A%0D%0AIn%20Cocoa%2C%20each%20object%20keeps%20track%20of%20how%20many%20times%20it%20is%20being%20referenced%20%28specifically%2C%20the%20NSObject%20base%20class%20implements%20this%29.%20By%20calling%20retain%20on%20an%20object%2C%20you%20are%20tellin&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://scottfaisal.com/understanding-reference-counting-with-cocoa-objective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send Email From iPhone/iPad programmatically</title>
		<link>http://scottfaisal.com/send-email-from-iphoneipad-programmatically/</link>
		<comments>http://scottfaisal.com/send-email-from-iphoneipad-programmatically/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 21:04:16 +0000</pubDate>
		<dc:creator>Automater</dc:creator>
				<category><![CDATA[ios]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[objective C]]></category>

		<guid isPermaLink="false">http://scottfaisal.com/?p=288</guid>
		<description><![CDATA[This certainly is not the most secure way of sending an email by any means, but it does work. So you would like your iPhone application to be able to send an email &#8211; perhaps a feedback form of some kind, etc. The example supplied here contains a UITextField and a UIButton. A UIAlertView and [...]]]></description>
			<content:encoded><![CDATA[<p>This certainly is not the most secure way of sending an email by any means, but it does work. So you would like your iPhone application to be able to send an email &#8211; perhaps a feedback form of some kind, etc. The example supplied here contains a UITextField and a UIButton. A UIAlertView and a UIActionSheet are also used. Oh, and there is a little snippet of PHP to put on your server someplace (that&#8217;s the unsecure part here).</p>
<pre class="brush: php;">
Your .h file:
#import

@interface SendEmailViewController : UIViewController  {
IBOutlet UIButton *button;
IBOutlet UITextField *messageText;
IBOutlet UIButton *backgroundButton;
}

@property (nonatomic, retain) UIButton *button;
@property (nonatomic, retain) UITextField *messageText;
@property (nonatomic, retain) UIButton *backgroundButton;

-(IBAction)sendMail:(id)sender;
-(IBAction)textFieldDoneEditing:(id)sender;
-(IBAction)backgroundClick:(id)sender;

@end
And now your .m file:
#import "SendEmailViewController.h"

@implementation SendEmailViewController

@synthesize button, messageText, backgroundButton;

-(IBAction)textFieldDoneEditing:(id)sender {
[sender resignFirstResponder];
}

-(IBAction)backgroundClick:(id)sender {
[messageText resignFirstResponder];
}

-(void)displayAlert {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Email Sent" message:@"Thank you for contacting me" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[messageText setText:@""];
[alert show];
[alert release];
}

-(void)displaySheet {
NSString *msg = nil;
msg = [[NSString alloc] initWithFormat:@"Send Email? Your message:\"%@\"", messageText.text];
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:msg delegate:self cancelButtonTitle:@"Not yet" destructiveButtonTitle:@"Yes" otherButtonTitles:nil];
[actionSheet showInView:self.view];
[actionSheet release];
[msg release];
}

-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
if( !(buttonIndex == [actionSheet cancelButtonIndex]) ){
NSString *post = nil;
post = [[NSString alloc] initWithFormat:@"message=%@",messageText.text];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:@"http://www.yourserveraddy/yourScript.php"]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
[ NSURLConnection connectionWithRequest:request delegate:self ];

[post release];
[self displayAlert];
}
}

-(IBAction)sendMail:(id)sender {
[self displaySheet];
}

- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
[button release];
[messageText release];
[backgroundButton release];
}
And lastly your PHP file:
<!--?php<br /--> $message = $_REQUEST['message'] ;
mail( "recipient@server.com", "Test Message", $message );
?&gt;
</pre>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Send+Email+From+iPhone%2FiPad+programmatically&amp;link=http://scottfaisal.com/send-email-from-iphoneipad-programmatically/&amp;notes=This%20certainly%20is%20not%20the%20most%20secure%20way%20of%20sending%20an%20email%20by%20any%20means%2C%20but%20it%20does%20work.%20So%20you%20would%20like%20your%20iPhone%20application%20to%20be%20able%20to%20send%20an%20email%20-%20perhaps%20a%20feedback%20form%20of%20some%20kind%2C%20etc.%20The%20example%20supplied%20here%20contains%20a%20UITextField%20and%20a%20UIButton.%20A%20UIAlertView%20and%20a%20UIActi&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Send+Email+From+iPhone%2FiPad+programmatically&amp;link=http://scottfaisal.com/send-email-from-iphoneipad-programmatically/&amp;notes=This%20certainly%20is%20not%20the%20most%20secure%20way%20of%20sending%20an%20email%20by%20any%20means%2C%20but%20it%20does%20work.%20So%20you%20would%20like%20your%20iPhone%20application%20to%20be%20able%20to%20send%20an%20email%20-%20perhaps%20a%20feedback%20form%20of%20some%20kind%2C%20etc.%20The%20example%20supplied%20here%20contains%20a%20UITextField%20and%20a%20UIButton.%20A%20UIAlertView%20and%20a%20UIActi&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://scottfaisal.com/send-email-from-iphoneipad-programmatically/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

