<?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>Doug Diego &#187; Code</title>
	<atom:link href="http://dougdiego.com/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://dougdiego.com</link>
	<description></description>
	<lastBuildDate>Tue, 17 Jan 2012 21:57:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>iPhone Development Helper:  Fill up your Address Book</title>
		<link>http://dougdiego.com/2009/06/12/iphone-development-helper-fill-up-your-address-book/</link>
		<comments>http://dougdiego.com/2009/06/12/iphone-development-helper-fill-up-your-address-book/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 06:00:56 +0000</pubDate>
		<dc:creator>doug</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[ABAddressBookRef]]></category>
		<category><![CDATA[ABAddressBookSave]]></category>
		<category><![CDATA[ABMultiValueAddValueAndLabel]]></category>
		<category><![CDATA[ABMutableMultiValueRef]]></category>
		<category><![CDATA[ABRecordRef]]></category>
		<category><![CDATA[ABRecordSetValue]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://dougdiego.com/?p=297</guid>
		<description><![CDATA[AddressBookFill is a simple application which populates your address book with contacts. This is useful when developing for the iPhone and working on the emulator. On many occasions, I&#8217;ve spent quite a bit of time adding contacts to the emulator to test something. Then when I change emulator version, they all get erased. This is [...]]]></description>
			<content:encoded><![CDATA[<p>AddressBookFill is a simple application which populates your address book with contacts. This is useful when developing for the iPhone and working on the emulator. </p>
<p>On many occasions, I&#8217;ve spent quite a bit of time adding contacts to the emulator to test something.  Then when I change emulator version, they all get erased.  This is very frustrating.  So I put together this simple application which allow you to programatically fill up your address book.</p>
<p>Currenly the address book is populated with U.S. Presidents.  Values are set for:<br />
* first name<br />
* last name<br />
* photo<br />
* phone number<br />
* birthday </p>
<p>I&#8217;ll make it more robust in the future. But you may find this useful for now.   The code might also be interesting if you&#8217;re learning how to program the address book.</p>
<p>Download: <a href="http://dougdiego.com/wp-content/uploads/2009/06/addressbookfill-1.0.tar.gz">addressbookfill-10.tar</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dougdiego.com/2009/06/12/iphone-development-helper-fill-up-your-address-book/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ASIHTTPRequest &#8211; Uploading Photos</title>
		<link>http://dougdiego.com/2009/04/08/asihttprequest-uploading-photos/</link>
		<comments>http://dougdiego.com/2009/04/08/asihttprequest-uploading-photos/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 15:46:16 +0000</pubDate>
		<dc:creator>doug</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://dougdiego.com/?p=252</guid>
		<description><![CDATA[Recently I used ASIHTTPRequest to upload images and other data from an iPhone application to a web server. I search around and looked at all the different options and this was best and easiest to use. It&#8217;s open source and comes with lots of good examples. I was particularly impressed with the network queue. The [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I used <a href="http://allseeing-i.com/ASIHTTPRequest/">ASIHTTPRequest</a> to upload images and other data from an iPhone application to a web server.  I search around and looked at all the different options and this was best and easiest to use.  It&#8217;s open source and comes with lots of good examples. I was particularly impressed with the network queue.</p>
<p>The one thing I did not find, was sample code for was posting an image to a server.  Here is some sample code:</p>
<pre class="brush: cpp; title: ; notranslate">
// Initilize Queue
[networkQueue setUploadProgressDelegate:statusProgressView];
[networkQueue setRequestDidFinishSelector:@selector(imageRequestDidFinish:)];
[networkQueue setQueueDidFinishSelector:@selector(imageQueueDidFinish:)];
[networkQueue setRequestDidFailSelector:@selector(requestDidFail:)];
[networkQueue setShowAccurateProgress:true];
[networkQueue setDelegate:self];

// Initilize Variables
NSURL *url;
ASIFormDataRequest * request;

// Add Image
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
     NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *dataPath = [documentsDirectory
     stringByAppendingPathComponent:@&quot;myImage.jpg&quot;];

// Get Image
NSData *imageData = [[[NSData alloc]
     initWithContentsOfFile:dataPath] autorelease];

// Return if there is no image
if(imageData != nil){
	url = [NSURL URLWithString:@&quot;http://myserver/upload.php&quot;];
	request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
	[request setPostValue:@&quot;myImageName&quot; forKey:@&quot;name&quot;];
	[request setData:imageData forKey:@&quot;file&quot;];
	[request setDidFailSelector:@selector(requestWentWrong:)];
	[request setTimeOutSeconds:500];
	[networkQueue addOperation:request];
	queueCount++;
}
[networkQueue go];
</pre>
<p>Note: It&#8217;s not necessary to use a queue here because I&#8217;m only uploading 1 thing.  But in my application I&#8217;m uploading many things and a queue was helpful.  It also runs in the asynchronously in the background, which prevents the UI from getting locked up.</p>
<p>Note 2: When sending large files you should use &#8220;setFile&#8221; instead of &#8220;setData&#8221;.  Files are then read from disk instead of memory.  Here is an updated example.  Thanks again to <a href="http://allseeing-i.com/ASIHTTPRequest/">Ben Copsey</a> for this library and his useful comments below.</p>
<pre class="brush: cpp; title: ; notranslate">
NSString *imagePath = [documentsDirectory
     stringByAppendingPathComponent:@&quot;myImage.jpg&quot;];
url = [NSURL URLWithString:@&quot;http://myserver/upload.php&quot;];
ASIFormDataRequest *request =
    [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[request setPostValue:@&quot;myImageName&quot; forKey:@&quot;name&quot;];
[request setFile:imagePath forKey:@&quot;photo&quot;];
</pre>
<p>More info on streaming here: <a href="http://allseeing-i.com/ASIHTTPRequest/How-to-use#streaming">http://allseeing-i.com/ASIHTTPRequest/How-to-use#streaming</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dougdiego.com/2009/04/08/asihttprequest-uploading-photos/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How To Rename an iPhone XCode Project</title>
		<link>http://dougdiego.com/2008/10/09/how-to-rename-an-iphone-xcode-project/</link>
		<comments>http://dougdiego.com/2008/10/09/how-to-rename-an-iphone-xcode-project/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 04:18:35 +0000</pubDate>
		<dc:creator>doug</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://dougdiego.com/?p=52</guid>
		<description><![CDATA[I recent created a new iPhone XCode project based off of one of the samples provided by Apple. Beause of this the XCode project was called AppleSample.xcodeproj and it built an app called AppleSample.app. I wanted to rename the project and give it my own name. It&#8217;s not as easy as it sounds. Here are [...]]]></description>
			<content:encoded><![CDATA[<p>I recent created a new iPhone XCode project based off of one of the samples provided by Apple.  Beause of this the XCode project was called AppleSample.xcodeproj and it built an app called AppleSample.app.  I wanted to rename the project and give it my own name.  It&#8217;s not as easy as it sounds.  Here are some instructions which are based off some instructions I found here (<a href="http://aplus.rs/cocoa/how-to-rename-project-in-xcode-3x/">http://aplus.rs/cocoa/how-to-rename-project-in-xcode-3x/</a>)</p>
<ul>
<li>Copy/rename the folder into new name</li>
<li>Get inside the new folder and rename the .pch and .xcodeproj files.  Example rename AppleSample.xcodeproj to MyCoolApp.xcodeproj &#8212; and &#8212; rename AppleSamplePrefix.pch to MyCoolApp_Prefix.pch</li>
<li>Delete the build folder. (Using the finder)</li>
<li>Open .xcodeproj file in text editor, like TextMate or TextWrangler. That’s actually a folder, which contains 4 files (you can also right-click and do Show package contents, which will reveal the files)</li>
<li>Open project.pbxproj in text editor and replace all instances of the old name with the new name.  Be careful not to do a find an replace.  Since the default name was AppleSample, there were several references to: AppleSampleAppDelegate.h and AppleSampleAppDelegate.m.  You do not want to replace these unless you also rename that file.</li>
<li>Open .pbxuser  where  is your user name.  Then repeat the previous step by renaming.  I&#8217;m not sure if this is necessary.  You may even be able to delete this file?  But changing this file worked for me.</li>
<li>Load the project file in XCode, do Build/Clean all targets</li>
</ul>
<p>After following these steps, I was able to open the project and build it to the simulator and the device.</p>
<p>I had one additional problem that I came across later that required a fix.  When I finially built the application for &#8220;deployment&#8221; to the App Store, I had problems signing the code.  I complained that it couldn&#8217;t find the Certificate for &#8220;Scott Anguish&#8221;.  I looked in the build settings and couldn&#8217;t find reference to this name.  So again I opened project.pbxproj inside of MyCoolApp.xcodeproj and found 2 instances of this line:</p>
<p>CODE_SIGN_IDENTITY = &#8220;Scott Anguish&#8221;;</p>
<p>I replaced both of them with the correct code signing identity and it worked!</p>
<p>UPDATE: Check out this bash script which does it for you automatically:<br />
<a href="http://mohrt.blogspot.com/2009/01/renaming-xcode-project-from-command.html">renameXcodeProject.sh</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dougdiego.com/2008/10/09/how-to-rename-an-iphone-xcode-project/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>WebStickies</title>
		<link>http://dougdiego.com/2008/07/11/webstickies/</link>
		<comments>http://dougdiego.com/2008/07/11/webstickies/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 05:28:37 +0000</pubDate>
		<dc:creator>doug</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[stickies]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://dougdiego.com/?p=4</guid>
		<description><![CDATA[I&#8217;ve been wanting to play around with the Google App Engine and Yahoo! User Interface Library (YUI), so I created a simple app called WebStickies: WebStickies is a place on the web to save your notes.  You can login using your Google Account and your stickies will be saved.  I&#8217;ve got lots of feature in [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been wanting to play around with the <a href="http://code.google.com/appengine/">Google App Engine</a> and <a href="http://developer.yahoo.com/yui/">Yahoo! User Interface Library (YUI)</a>, so I created a simple app called <a href="http://webstickies.appspot.com">WebStickies</a>:</p>
<p><strong>WebStickies</strong> is a place on the web to save your notes.  You can login using your Google Account and your stickies will be saved. </p>
<p><a href="http://dougdiego.com/wp-content/uploads/2008/07/webstickies_screenshot.png"><img class="alignnone size-medium wp-image-5" title="webstickies_screenshot" src="http://dougdiego.com/wp-content/uploads/2008/07/webstickies_screenshot.png" alt="" width="300" height="200" /></a></p>
<p>I&#8217;ve got lots of feature in mind, but who know if I&#8217;ll have time to add them.  Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougdiego.com/2008/07/11/webstickies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

