<?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; Mac</title>
	<atom:link href="http://dougdiego.com/tag/mac/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>iPhone Address Book</title>
		<link>http://dougdiego.com/2008/11/11/iphone-address-book/</link>
		<comments>http://dougdiego.com/2008/11/11/iphone-address-book/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 01:42:45 +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=124</guid>
		<description><![CDATA[I found a great tutorial, with source code, for basic usage of the iPhone Address book: http://iphone.zcentric.com/2008/09/19/access-the-address-book/ It was very helpful for getting started with using the address book in my code.]]></description>
			<content:encoded><![CDATA[<p>I found a great tutorial, with source code, for basic usage of the iPhone Address book:</p>
<p><a href="http://iphone.zcentric.com/2008/09/19/access-the-address-book/">http://iphone.zcentric.com/2008/09/19/access-the-address-book/</a></p>
<p>It was very helpful for getting started with using the address book in my code.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougdiego.com/2008/11/11/iphone-address-book/feed/</wfw:commentRss>
		<slash:comments>1</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>MacOSX user Disappeared &amp; Restored</title>
		<link>http://dougdiego.com/2008/08/19/macosx-user-dissapeared/</link>
		<comments>http://dougdiego.com/2008/08/19/macosx-user-dissapeared/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 16:13:44 +0000</pubDate>
		<dc:creator>doug</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://dougdiego.com/?p=25</guid>
		<description><![CDATA[The other day, I opened my MacBook Pro a few hours after closing the lid and putting it to sleep.  It wouldn&#8217;t wake from sleep.  I tried several things to get it to try and wake up, but had no success.  This has happened a couple times in the past, and I usually just hold [...]]]></description>
			<content:encoded><![CDATA[<p>The other day, I opened my MacBook Pro a few hours after closing the lid and putting it to sleep.  It wouldn&#8217;t wake from sleep.  I tried several things to get it to try and wake up, but had no success.  This has happened a couple times in the past, and I usually just hold down the power key to restart it.  So that is what I did.</p>
<p>When it started back up and loaded the login page, I noticed something strange, my user was missing.  I have 4 user&#8217;s registered on my computer and now only 3 of them were showing.  So I logged in as one of the other users who an admin.</p>
<p>Upon login, I could see that my user&#8217;s account still existed on disk:  <em>/Users/doug</em>  When I went to the System Preferences, I did not list my user.  I wasn&#8217;t sure what was wrong.</p>
<p>I began searching through the file system and found there is a file for each user in <em>/var/db/dslocal/nodes/Default/users/</em>  Example:</p>
<p><em>/var/db/dslocal/nodes/Default/users/doug.plist</em></p>
<p>I opened up <em>doug.plist</em> and found that it was a binary file.  I could read some of the text in there and saw some mention of &#8220;Kernel&#8221; and other thing that suggested a stacktrace or dump.  I opened up the plist for another user and found that it was standard XML.  </p>
<p>So I copied the doug.plist from my Time Machine backup and replaced it with the one on my laptop.  I rebooted and my account was restored.</p>
<p>I&#8217;m not exactly sure what happened, but the moral of the store is:</p>
<ol>
<li>Create a Time Machine Backup</li>
<li>Have at least one other Admin user on your computer you can login to if all fails.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://dougdiego.com/2008/08/19/macosx-user-dissapeared/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

