<?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>Derek Neely &#187; Mac</title>
	<atom:link href="http://derekneely.com/category/mac-references-and-resources/feed/" rel="self" type="application/rss+xml" />
	<link>http://derekneely.com</link>
	<description>...what I care to share...</description>
	<lastBuildDate>Thu, 06 Oct 2011 15:10:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MacFUSE/Macfusion Fix for Newer Macs</title>
		<link>http://derekneely.com/2011/04/macfusemacfusion-fix-for-newer-macs/</link>
		<comments>http://derekneely.com/2011/04/macfusemacfusion-fix-for-newer-macs/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 13:46:10 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[64-bit]]></category>
		<category><![CDATA[64-bit kernel]]></category>
		<category><![CDATA[FTPFS]]></category>
		<category><![CDATA[MacBook]]></category>
		<category><![CDATA[MacBook Pro]]></category>
		<category><![CDATA[MacFUSE]]></category>
		<category><![CDATA[Macfusion]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[SSH Mount]]></category>
		<category><![CDATA[SSHFS]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=596</guid>
		<description><![CDATA[I recently picked  up one of the newly released MacBook Pros. If at all interested its awesome and FAST! Anyhow, I depend on MacFUSE and Macfusion daily to connect to various servers to knock out some development. Well, low and behold, mounting via SSH wasn&#8217;t working again (didn&#8217;t try FTP). Now, I have another fix [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://derekneely.com/wp-content/uploads/2009/06/apple.jpg"><img class="alignright size-full wp-image-283" title="Apple" src="http://derekneely.com/wp-content/uploads/2009/06/apple.jpg" alt="" width="119" height="135" /></a>I recently picked  up one of the newly released MacBook Pros. If at all interested its awesome and FAST! Anyhow, I depend on MacFUSE and Macfusion daily to connect to various servers to knock out some development. Well, low and behold, mounting via SSH wasn&#8217;t working again (didn&#8217;t try FTP).</p>
<p>Now, I have another fix for MacFUSE/Macfusion <a title="MacFUSE fix for Snow Leopard" href="http://derekneely.com/2009/08/macfuse-fix-for-snow-leopard/" target="_blank">here</a>, but unfortunately this did not work for the latest release of MacFUSE on the new MacBooks.</p>
<p>So, after much searching and hunting I FINALLY came across the solution. There is an unofficial release of MacFUSE that lets all the goodness of Macfusion work with SSH. Apparently, there is an issue with MacFUSE and 64-bit kernels. Links and references below:</p>
<p>Build download: <a title="MacFUSE Build Download" href="http://www.tuxera.com/mac/macfuse-core-10.5-2.1.9.dmg" target="_blank">macfuse-core-10.5-2.1.9.dmg</a><br />
Source download: <a title="MacFUSE Source Download" href="http://www.tuxera.com/mac/macfuse-rebel-2.1.9-src.tar.bz2" target="_blank">macfuse-rebel-2.1.9-src.tar.bz2</a></p>
<p>Local build download: <a title="MacFUSE Build Download" href="http://derekneely.com/Downloads/MacFUSE/macfuse-core-10.5-2.1.9.dmg" target="_blank">macfuse-core-10.5-2.1.9.dmg</a><br />
Local source download: <a title="MacFUSE Source Download" href="http://derekneely.com/Downloads/MacFUSE/macfuse-rebel-2.1.9-src.tar.bz2">macfuse-rebel-2.1.9-src.tar.bz2</a></p>
<p>Solution source: <a title="Google Groups - MacFUSE Fix" href="http://groups.google.com/group/macfuse/browse_thread/thread/f72982535ec44629" target="_blank">Google Groups</a></p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2011/04/macfusemacfusion-fix-for-newer-macs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom User-Agent Safari</title>
		<link>http://derekneely.com/2010/06/custom-user-agent-safari/</link>
		<comments>http://derekneely.com/2010/06/custom-user-agent-safari/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 18:43:12 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Google Bot]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[User-Agent]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=568</guid>
		<description><![CDATA[Safari offers a pretty nice Developer toolbar (once enabled under Safari-&#62;Preferences-&#62;Advanced-&#62;Show develop menu&#8230;). As part of the developer toolbar they offer a User-Agent switcher to allow you to seemingly be using a different browser. Now, if you&#8217;re familiar with the User-Agent Switcher on Firefox, you know you can add additional/custom user agents. However, Safari doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-283" title="Apple" src="http://derekneely.com/wp-content/uploads/2009/06/apple.jpg" alt="Apple" width="124" height="140" />Safari offers a pretty nice Developer toolbar (once enabled under Safari-&gt;Preferences-&gt;Advanced-&gt;Show develop menu&#8230;). As part of the developer toolbar they offer a User-Agent switcher to allow you to seemingly be using a different browser. Now, if you&#8217;re familiar with the User-Agent Switcher on Firefox, you know you can add additional/custom user agents. However, Safari doesn&#8217;t make it as easy to add additional/custom agents. Rest assured, there is still away.</p>
<p>The file you will be looking for is:</p>
<blockquote><p>/Applications/Safari.app/Contents/Resources/UserAgent.plist</p></blockquote>
<p>What I have done is copy this file off to my home directory. Open the file with the Property List Editor (provided with Apple&#8217;s developer tools). I will add 2 entries into this file. One to give a nice divider for my custom agents and another for the Google Bot Agent.</p>
<p><strong>For the divider:</strong></p>
<ol>
<li>Select the last &#8216;Item&#8217; (be sure the &#8216;Item&#8217; is not expanded) and click the &#8216;+&#8217; sign to add a new &#8216;Item&#8217;</li>
<li>Change this &#8216;Item&#8217; to a &#8216;Dictionary&#8217; under the &#8216;Type&#8217; column.</li>
<li>Expand this &#8216;Item&#8217; and press the &#8216;Add sub-item button&#8217; (replaced the &#8216;+&#8217; sign after expanding)</li>
<li>Rename this sub-item&#8217;s key to &#8216;separator&#8217;, change the type to Boolean, and select the Value checkbox.</li>
</ol>
<p><img class="alignnone size-full wp-image-574" title="User-Agent Separator Config" src="http://derekneely.com/wp-content/uploads/2010/06/Screen-shot-2010-06-09-at-2.34.49-PM.png" alt="User-Agent Separator Config" width="599" height="37" /></p>
<p><strong>For the new User-Agent:</strong></p>
<ol>
<li>Add a new &#8216;Item&#8217; as you did in step 1 above.</li>
<li>Change this &#8216;Item&#8217; to a &#8216;Dictionary&#8217; under the &#8216;Type&#8217; column.</li>
<li>Expand this &#8216;Item&#8217; and press the &#8216;Add sub-item button&#8217; (replaced the &#8216;+&#8217; sign after expanding) 4 times.</li>
<li>Set the key, type, value for each as follows:</li>
</ol>
<ul>
<blockquote>
<li>name, String, Google Bot</li>
<li>version, String, 2.1</li>
<li>platform, String, Mac (not sure if this matters or not)</li>
<li>user-agent, String, Googlebot/2.1 (+http://www.google.com/bot.html)</li>
</blockquote>
</ul>
<p><img class="alignnone size-full wp-image-577" title="User-Agent Custom Config" src="http://derekneely.com/wp-content/uploads/2010/06/Screen-shot-2010-06-09-at-2.35.31-PM.png" alt="User-Agent Custom Config" width="643" height="89" /></p>
<p>Save this file. Quit Safari. Replace the original with the new one.</p>
<blockquote><p>$ sudo su -</p>
<p># rm /Applications/Safari.app/Contents/Resources/UserAgents.plist</p>
<p># cp /Users/derek/UserAgents.plist /Applications/Safari.app/Contents/Resources/</p></blockquote>
<p>Fire Safari back up and there you have it. A new custom user-agent. Repeat as necessary to add more.</p>
<p><img class="alignnone size-full wp-image-583" title="User-Agent Menu" src="http://derekneely.com/wp-content/uploads/2010/06/Screen-shot-2010-06-09-at-2.46.07-PM.png" alt="User-Agent Menu" width="545" height="551" /></p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2010/06/custom-user-agent-safari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone &#8211; UITableViewCell Custom Selection Style Color</title>
		<link>http://derekneely.com/2010/01/uitableviewcell-custom-selection-style-color/</link>
		<comments>http://derekneely.com/2010/01/uitableviewcell-custom-selection-style-color/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 04:16:59 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Custom UITableView]]></category>
		<category><![CDATA[Custom UITableViewCell]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Selection Style]]></category>
		<category><![CDATA[Selection Style Color]]></category>
		<category><![CDATA[UITableView]]></category>
		<category><![CDATA[UITableViewCell]]></category>
		<category><![CDATA[UITableViewCellSelectionStyle]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=516</guid>
		<description><![CDATA[Oddly, Apple has given you the ability to vastly customize the primary view of  a UITableViewCell. However, the selection style view is much more difficult to do such. Apple kindly gave us UITableViewSelectionStyleBlue/Gray/None. Well, that doesn&#8217;t always cut it does it? There are already some very good tutorials on revamping the whole table view.  Google [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-479" title="xcode-icon" src="http://derekneely.com/wp-content/uploads/2009/11/xcode-icon.png" alt="xcode-icon" width="154" height="154" />Oddly, Apple has given you the ability to vastly customize the primary view of  a UITableViewCell. However, the selection style view is much more difficult to do such. Apple kindly gave us UITableViewSelectionStyleBlue/Gray/None. Well, that doesn&#8217;t always cut it does it?</p>
<p>There are already some very good tutorials on revamping the whole table view.  <a title="Google - Custom UITableView" href="http://www.google.com/search?q=custom+uitableview&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a" target="_blank">Google it!</a> The best I came across was from <a title="Cocoa with Love - Custom UITableView" href="http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html" target="_blank">Cocoa with Love &#8211; Custom UITableView</a>.</p>
<p>However, this can be a bit overkill for some situations. It can also take a good bit of time to setup all the necessary images. What I needed was a quick and easy way to &#8216;theme&#8217; the application and thus the selection style for a UITableViewCell. This needed to work with both plain and grouped table view styles and custom cells as well. You can see now why this may take  a while using the above methods.</p>
<p>Here is a quick and easy method to do just that.</p>
<p><strong>SomeViewController.h</strong></p>
<pre>#import &lt;UIKit/UIKit.h&gt;

@interface SomeViewController : UITableViewController {
     UITableViewCell *currentSelectedCell;
}

@property (nonatomic, retain) UITableViewCell *currentSelectedCell;

- (void)setSelectedCell:(UITableViewCell *)selectedCell
     deselectedCell:(UITableViewCell *)deselectedCell;

@end</pre>
<p><strong>SomeViewController.m</strong></p>
<pre>#import "SomeViewController.h"

@implementation SomeViewController

@synthesize currentSelectedCell;

- (void)setSelectedCell:(UITableViewCell *)selectedCell deselectedCell:(UITableViewCell *)deselectedCell {
     //revert deselected cell
     if (deselectedCell != nil) {
          deselectedCell.backgroundColor = [UIColor whiteColor];
          for (UIView *subView in [deselectedCell.contentView subviews]) {
               if ([subView isKindOfClass:[UILabel class]]) {
                    UILabel *label = (UILabel *)subView;
                    label.textColor = [UIColor blackColor];
               }

               if ([subView isKindOfClass:[UITextField class]]) {
                    UITextField *textField = (UITextField *)subView;
                    textField.textColor = [UIColor blackColor];
               }
          }
     }

     //setup selected cell
     selectedCell.backgroundColor = [UIColor redColor]; //Some defined UIColor
     for (UIView *subView in [selectedCell.contentView subviews]) {
          if ([subView isKindOfClass:[UILabel class]]) {
               UILabel *label = (UILabel *)subView;
               label.textColor = [UIColor whiteColor];
          }

          if ([subView isKindOfClass:[UITextField class]]) {
               UITextField *textField = (UITextField *)subView;
               textField.textColor = [UIColor whiteColor];
          }
     }
}

#pragma mark -
#pragma mark Table View Delegate Methods

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:
     (NSIndexPath *)indexPath {

     setSelectedCell:[tableView cellForRowAtIndexPath:indexPath]
          deselectedCell:currentSelectedCell];

     currentSelectedCell = [tableView cellForRowAtIndexPath:indexPath];
}

#pragma mark -
#pragma mark Table View Data Source Methods

- (UITableViewCell *)tableView:(UITableView *)tableView
     cellForRowAtIndexPath:(NSIndexPath *)indexPath {

     //........Setup UITableViewCell...........//

     cell.selectionStyle = UITableViewCellSelectionStyleNone;

     return cell;
}

- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:
     (NSInteger)section {

     return count;
}

@end</pre>
<p>Now, I&#8217;ve provided this in one class but what I&#8217;ve done is setup an &#8216;application&#8217; singleton that has this function and is called from each UITableView&#8217;s didSelectRowAtIndexPath delegate. Works great on standard, custom, plain, and grouped views.</p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2010/01/uitableviewcell-custom-selection-style-color/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Development &#8211; Continuous Picker</title>
		<link>http://derekneely.com/2009/12/iphone-development-continuous-picker/</link>
		<comments>http://derekneely.com/2009/12/iphone-development-continuous-picker/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 21:42:21 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Continuous Picker]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Picker]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=513</guid>
		<description><![CDATA[Coming soon&#8230;been hard at work on some projects.]]></description>
			<content:encoded><![CDATA[<p>Coming soon&#8230;been hard at work on some projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/12/iphone-development-continuous-picker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Development &#8211; Global Variables (Singleton)</title>
		<link>http://derekneely.com/2009/11/iphone-development-global-variables/</link>
		<comments>http://derekneely.com/2009/11/iphone-development-global-variables/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 15:20:41 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[App Delegate]]></category>
		<category><![CDATA[Global]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Singleton]]></category>
		<category><![CDATA[Variables]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=480</guid>
		<description><![CDATA[In iPhone development, if/when you need a single instance of a variable that can be shared and manipulated where and how should you implement this. Thus far I have found 2 ways of doing so. The first would be to add the global variables to your AppDelegate (which can be done and will be explained [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-479" title="xcode-icon" src="http://derekneely.com/wp-content/uploads/2009/11/xcode-icon.png" alt="xcode-icon" width="143" height="143" />In iPhone development, if/when you need a single instance of a variable that can be shared and manipulated where and how should you implement this. Thus far I have found 2 ways of doing so. The first would be to add the global variables to your AppDelegate (which can be done and will be explained but isn&#8217;t the preferred method). The second and &#8216;correct&#8217; way of going about globals is to create a Singleton.</p>
<p>For the following examples we will assume the global variable you are trying to implement is a User object.</p>
<p>User.h</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #df0002;"><span style="color: #7d4726;">#import </span>&lt;Foundation/Foundation.h&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@interface</span> User : NSObject {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span>NSString<span style="color: #000000;"><span style="white-space: pre;"> </span>*</span><span style="color: #438288;">username</span><span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span>NSString<span style="color: #000000;"><span style="white-space: pre;"> </span>*</span><span style="color: #438288;">password</span><span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008d00;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span><span style="color: #7a0eac;">NSString</span><span style="color: #000000;"><span style="white-space: pre;"> </span>*</span><span style="color: #438288;">accountType</span><span style="color: #000000;">; </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@property</span> (<span style="color: #c900a4;">nonatomic</span>, <span style="color: #c900a4;">retain</span>) NSString *username;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@property</span> (<span style="color: #c900a4;">nonatomic</span>, <span style="color: #c900a4;">retain</span>) NSString *password;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@property</span> (<span style="color: #c900a4;">nonatomic</span>, <span style="color: #c900a4;">retain</span>) NSString *accountType;</p>
</blockquote>
<p>User.m</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7d4726;">#import <span style="color: #df0002;">&#8220;User.h&#8221;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@implementation<span style="color: #000000;"> User</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@synthesize<span style="color: #000000;"> username;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@synthesize<span style="color: #000000;"> password;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@synthesize</span> accountType;</p>
</blockquote>
<hr /><strong>App Delegate Method</strong></p>
<p>ApplicationAppDelegate.h</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7d4726;">#import <span style="color: #df0002;">&#8220;User.h&#8221;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7d4726;"><span style="color: #df0002;"><br />
</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@interface</span> ApplicationAppDelegate : NSObject &lt;UIApplicationDelegate&gt; {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;"><span style="color: #000000;"> </span>NSManagedObjectModel<span style="color: #000000;"> *</span><span style="color: #438288;">managedObjectModel</span><span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;"><span style="color: #000000;"> </span>NSManagedObjectContext<span style="color: #000000;"> *</span><span style="color: #438288;">managedObjectContext</span><span style="color: #000000;">;<span style="white-space: pre;"> </span> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;"><span style="color: #000000;"> </span>NSPersistentStoreCoordinator<span style="color: #000000;"> *</span><span style="color: #438288;">persistentStoreCoordinator</span><span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;"><span style="color: #000000;"> </span>UIWindow<span style="color: #000000;"> *</span><span style="color: #438288;">window</span><span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #438288;">User</span> *user;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@property</span> (<span style="color: #c900a4;">nonatomic</span>, <span style="color: #c900a4;">retain</span>, <span style="color: #c900a4;">readonly</span>) NSManagedObjectModel *managedObjectModel;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@property</span> (<span style="color: #c900a4;">nonatomic</span>, <span style="color: #c900a4;">retain</span>, <span style="color: #c900a4;">readonly</span>) NSManagedObjectContext *managedObjectContext;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@property</span> (<span style="color: #c900a4;">nonatomic</span>, <span style="color: #c900a4;">retain</span>, <span style="color: #c900a4;">readonly</span>) NSPersistentStoreCoordinator *persistentStoreCoordinator;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@property<span style="color: #000000;"> (</span>nonatomic<span style="color: #000000;">, </span>retain<span style="color: #000000;">) </span>IBOutlet<span style="color: #000000;"> UIWindow *window;</span></p>
<div><span style="font-family: Menlo, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: small;"><span style="line-height: normal;"> </span></span></div>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@property<span style="color: #000000;"> (</span>nonatomic<span style="color: #000000;">, </span>retain<span style="color: #000000;">) User *user;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;"><span style="color: #000000;"><br />
</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">
</blockquote>
<p>ApplicationAppDelegate.m</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #df0002;"><span style="color: #7d4726;">#import </span>&#8220;ApplicationAppDelegate.h&#8221;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@implementation</span> ApplicationAppDelegate</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@synthesize<span style="color: #000000;"> window;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@synthesize</span> user;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7d4726;">#pragma mark -</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7d4726;">#pragma mark Application lifecycle</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">- (<span style="color: #c900a4;">void</span>)applicationDidFinishLaunching:(<span style="color: #7a0eac;">UIApplication</span> *)application {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #438288;"><span style="color: #000000;"> [</span>window<span style="color: #000000;"> </span><span style="color: #450084;">addSubview</span><span style="color: #000000;">:</span>tabBarController<span style="color: #000000;">.</span><span style="color: #450084;">view</span><span style="color: #000000;">];</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008d00;"><span style="color: #000000;"> </span>// Override point for customization after app launch</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #450084;"><span style="color: #000000;"><span style="white-space: pre;"> </span>[</span><span style="color: #438288;">window</span><span style="color: #000000;"> </span>makeKeyAndVisible<span style="color: #000000;">];</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #450084;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;"> </span>user = [[<span style="color: #438288;">User</span> <span style="color: #450084;">alloc</span>] <span style="color: #450084;">init</span>];</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
</blockquote>
<p>Then from any view controller you can access the Delegate variable as such.</p>
<p>SomeViewController.m</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;">UIApplication<span style="color: #000000;"> *app = [</span>UIApplication<span style="color: #000000;"> </span><span style="color: #450084;">sharedApplication</span><span style="color: #000000;">];</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;"><span style="color: #000000;">app.user.username = @&#8221;Username&#8221;;</span></p>
</blockquote>
<p>While this can be done and will work. The overall use of the AppDelegate for this functionality is incorrect. The AppDelegate should be used for the following 2 reasons:</p>
<ul style="padding-left: 26px;">
<li>implemenations of the <code style="font-family: Courier, monospace; font-size: 12px;">NSApplication</code> delegate methods (including<code style="font-family: Courier, monospace; font-size: 12px;">applicationDidFinishLaunching:</code> to finalize application construction)</li>
<li>handling menu items for items that don&#8217;t exist in a window (for example, opening the application Preferences window)</li>
</ul>
<p>So, on that note, lets implement a Singleton. The &#8216;correct&#8217; way of creating a single global instance of an object that can be accessed and manipulated by the view controllers.</p>
<hr /><strong>Singleton Method</strong></p>
<p>First we need to make some changes to our User class as such:</p>
<p>User.h</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #df0002;"><span style="color: #7d4726;">#import </span>&lt;Foundation/Foundation.h&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@interface</span> User : NSObject {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span>NSString<span style="color: #000000;"><span style="white-space: pre;"> </span>*</span><span style="color: #438288;">username</span><span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7a0eac;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span>NSString<span style="color: #000000;"><span style="white-space: pre;"> </span>*</span><span style="color: #438288;">password</span><span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008d00;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span><span style="color: #7a0eac;">NSString</span><span style="color: #000000;"><span style="white-space: pre;"> </span>*</span><span style="color: #438288;">accountType</span><span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@property</span> (<span style="color: #c900a4;">nonatomic</span>, <span style="color: #c900a4;">retain</span>) NSString *username;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@property</span> (<span style="color: #c900a4;">nonatomic</span>, <span style="color: #c900a4;">retain</span>) NSString *password;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@property</span> (<span style="color: #c900a4;">nonatomic</span>, <span style="color: #c900a4;">retain</span>) NSString *accountType;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">+ (<span style="color: #438288;">User</span> *)sharedUser;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@end</p>
</blockquote>
<p>User.m</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7d4726;">#import <span style="color: #df0002;">&#8220;User.h&#8221;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">static</span> User *sharedUser = <span style="color: #c900a4;">nil</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@implementation<span style="color: #000000;"> User</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@synthesize<span style="color: #000000;"> username;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@synthesize<span style="color: #000000;"> password;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="color: #c900a4;">@synthesize</span> accountType;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7d4726;">#pragma mark -</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7d4726;">#pragma mark Singleton Methods</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">+ (<span style="color: #438288;">User</span> *)sharedUser {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #438288;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span><span style="color: #c900a4;">if</span><span style="color: #000000;">(</span>sharedUser<span style="color: #000000;"> == </span><span style="color: #c900a4;">nil</span><span style="color: #000000;">){</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #450084;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span><span style="color: #438288;">sharedUser</span><span style="color: #000000;"> = [[</span><span style="color: #c900a4;">super</span><span style="color: #000000;"> </span>allocWithZone<span style="color: #000000;">:</span><span style="color: #c900a4;">NULL</span><span style="color: #000000;">] </span>init<span style="color: #000000;">];</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #438288;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span><span style="color: #c900a4;">return</span><span style="color: #000000;"> </span>sharedUser<span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">+ (<span style="color: #c900a4;">id</span>)allocWithZone:(<span style="color: #7a0eac;">NSZone</span> *)zone {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #275a5e;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span><span style="color: #c900a4;">return</span><span style="color: #000000;"> [[</span><span style="color: #c900a4;">self</span><span style="color: #000000;"> </span>sharedManager<span style="color: #000000;">] </span><span style="color: #450084;">retain</span><span style="color: #000000;">];</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">- (<span style="color: #c900a4;">id</span>)copyWithZone:(<span style="color: #7a0eac;">NSZone</span> *)zone {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span>return<span style="color: #000000;"> </span>self<span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">- (<span style="color: #c900a4;">id</span>)retain {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span>return<span style="color: #000000;"> </span>self<span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">- (<span style="color: #c900a4;">unsigned</span>)retainCount {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7d4726;"><span style="color: #c900a4;"> return</span><span style="color: #000000;"> </span>NSUIntegerMax<span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">- (<span style="color: #c900a4;">void</span>)release {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008d00;">//do nothing</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">- (<span style="color: #c900a4;">id</span>)autorelease {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span>return<span style="color: #000000;"> </span>self<span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@end</p>
</blockquote>
<p>Now, in any view controller we need to access/manipulate the &#8216;global&#8217; user we can do:</p>
<p>SomeViewController.m</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #df0002;"><span style="color: #7d4726;">#import </span>&#8220;SomeViewController.h&#8221;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7d4726;">#import <span style="color: #df0002;">&#8220;User.h&#8221;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@implementation<span style="color: #000000;"> SomeViewController</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">- (<span style="color: #c900a4;">void</span>)someFunction{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #438288;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span>User<span style="color: #000000;"> *</span>user<span style="color: #000000;"> = [</span>User<span style="color: #000000;"> </span><span style="color: #275a5e;">sharedUser</span><span style="color: #000000;">];</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #438288;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span>user<span style="color: #000000;">.</span>username<span style="color: #000000;"> = </span><span style="color: #df0002;">@&#8221;Username&#8221;</span><span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c900a4;">@end</p>
</blockquote>
<p>References and resources that made this post and my learning possible.</p>
<ul>
<li><a title="Cocoa Fundamentals Guide" href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html" target="_blank">Cocoa&#8217;s Fundamentals Guide</a> (by Apple)</li>
<li><a title="Cocoa With Love" href="http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html" target="_blank">Cocoa With Love</a></li>
<li><a title="Matt Galloway" href="http://iphone.galloway.me.uk/iphone-sdktutorials/singleton-classes/" target="_blank">Matt Galloway</a></li>
<li><a title="Stack Overflow" href="http://stackoverflow.com/questions/338734/iphone-proper-usage-of-application-delegate" target="_blank">Stack Overflow</a></li>
</ul>
<p>- Updated: 11.17.09 &#8211; Reviewed Apple&#8217;s documentation on singletons and made the proper changes. <a title="Apple's Singleton Documentation" href="http://developer.apple.com/iphone/library/DOCUMENTATION/General/Conceptual/DevPedia-CocoaCore/Singleton.html" target="_blank">Apple&#8217;s Singleton Documentation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/11/iphone-development-global-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use MacFUSE and Macfusion SSH Mount</title>
		<link>http://derekneely.com/2009/06/fs-use-macfuse-and-macfusion-ssh-mount/</link>
		<comments>http://derekneely.com/2009/06/fs-use-macfuse-and-macfusion-ssh-mount/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 02:24:14 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[FTPFS]]></category>
		<category><![CDATA[MacFUSE]]></category>
		<category><![CDATA[Macfusion]]></category>
		<category><![CDATA[Remote Filesystem]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[SSHFS]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=312</guid>
		<description><![CDATA[Constantly needing to edit files on remote systems? Find it tasking and annoying to edit localy and upload via ftp or ssh? Want to use your favorite editor to edit the files on the remote system rather than relying on the remote &#8216;vi&#8217; or &#8216;nano&#8217;? MacFUSE and Macfusion can be a very powerful tool that [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-283" title="Apple" src="http://derekneely.com/wp-content/uploads/2009/06/apple.jpg" alt="Apple" width="120" height="136" />Constantly needing to edit files on remote systems? Find it tasking and annoying to edit localy and upload via ftp or ssh? Want to use your favorite editor to edit the files on the remote system rather than relying on the remote &#8216;vi&#8217; or &#8216;nano&#8217;? MacFUSE and Macfusion can be a very powerful tool that can remedy all of the above. Below is a quick tutorial on how to setup and use it.</p>
<p>Download and install: <a title="MacFUSE" href="http://code.google.com/p/macfuse/" target="_blank">MacFUSE</a> and <a title="Macfusion" href="http://www.macfusionapp.org/" target="_blank">Macfusion</a></p>
<p>Enable Macfusion to run at startup and enable the menu item for quick mounting and remote file system access. Run Macfusion &#8211;&gt; Preferences &#8211;&gt; General &#8211;&gt; &#8216;When I login, start&#8217; &#8211;&gt; &#8216;the macfusion agent&#8217; and &#8216;the macfusion menu item&#8217;.</p>
<p><img class="alignnone" title="Macfusion Preference Menu" src="http://gallery.derekneely.com/images/screen_shots/macfuse_macfusion/macfusion_pref.png" alt="" width="381" height="282" /></p>
<p>After reboot you will see a new Icon in your Menu Bar. If you select it, it will look something like&#8230;  <img class="alignnone" title="Macfusion Menu Item" src="http://gallery.derekneely.com/images/screen_shots/macfuse_macfusion/macfusion_menuitem.png" alt="" width="236" height="149" /></p>
<p>Here you can see your various options and current mounted file systems. To setup a connection to a server, &#8216;Macfusion Menu Item&#8217; &#8211;&gt; &#8216;Open Configuration &#8230;&#8217; &#8211;&gt; &#8216;+&#8217; &#8211;&gt; Select connection type: SSHFS/FTPFS.  <img class="alignnone" title="Connection Selection" src="http://gallery.derekneely.com/images/screen_shots/macfuse_macfusion/connect_selection.png" alt="" width="656" height="116" /></p>
<p>Configure the Connection Name, Hostname, User Name, Password.</p>
<p><img class="alignnone" title="Connection Setup" src="http://gallery.derekneely.com/images/screen_shots/macfuse_macfusion/connection_setup.png" alt="" width="341" height="315" /></p>
<p>Whalla! You should be all setup and able to edit and browse the files as if it was a local file system. Works great with your favorite editor (in this case <a title="TextMate" href="http://macromates.com/" target="_blank">TextMate</a>).</p>
<p>TextMate tweak to prevent remote meta data files that can slowly make a mess out of the file system. Copy and paste the below line in the command line.</p>
<blockquote><p><code>defaults write com.macromates.textmate OakDocumentDisableFSMetaData 1</code></p></blockquote>
<p>TextMate <a title="TextMate - Saving Files" href="http://manual.macromates.com/en/saving_files" target="_blank">Manual on Saving Files</a>. <a title="TextMate - Manual" href="http://manual.macromates.com/en/" target="_blank">TextMate Manual</a></p>
<p>To view hidden files via finder add the following line on the command line.</p>
<blockquote><p><code>defaults write com.apple.finder AppleShowAllFiles TRUE<br />
killall Finder</code></p></blockquote>
<p>Original Source: <a title="Source" href="http://minimaldesign.net/articles/read/remote-textmate-projects" target="_blank">http://minimaldesign.net/articles/read/remote-textmate-projects</a></p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/06/fs-use-macfuse-and-macfusion-ssh-mount/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Password Access (Mac)</title>
		<link>http://derekneely.com/2009/06/root-password-access-mac/</link>
		<comments>http://derekneely.com/2009/06/root-password-access-mac/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 12:09:51 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[strings]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=269</guid>
		<description><![CDATA[A good friend of mine (Huggz) discovered a way of pulling your root password on your Mac. The oveall concept is that you are dumping the human readable text out of /dev/vm/sleepimage into another file in which you will find some interesting stuff including your root password. Kinda scary! This takes a good while to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="Apple" src="http://gallery.derekneely.com/images/general_and_random/my_icons/apple.jpg" alt="" width="95" height="107" />A good friend of mine (<a title="Huggz" href="http://davehuggins.com/" target="_blank">Huggz</a>) discovered a way of pulling your root password on your Mac. The oveall concept is that you are dumping the human readable text out of /dev/vm/sleepimage into another file in which you will find some interesting stuff including your root password. Kinda scary!</p>
<p><span>This takes a good while to dump all the content as that file can be upwards to 2GB. Search through the /var/vm/sleepimage-ascii file and you will see some goodies.</span></p>
<blockquote><p><span>mac:~ me$ sudo su -<br />
mac:~ root# cd /var/vm<br />
mac:vm root# strings -n 4 sleepimage &gt; sleepimage-ascii</span></p></blockquote>
<p><span>I found my password all through this file. While most of these will be your password just on a line, and depending on your password, would be hard to know it was a password. However, one line I ran across blatenly says passwordXXXXusernameXXXX (line: </span><span>4186701 &#8211; for me)</span><span>. If you search throuh more you will see other lines that clearly displays hostname, username, password, home directory (lines: 7810286-7810293 &#8211; for me). If you keep digging you can find not only the login information for this particular machine but others for Samba mounts, ftp, web sites, etc. Good stuff!!!<br />
</span></p>
<p><span>There is also a more complete and detailed write up of other file dumps over at <a title="theInterW3bs" href="http://theinterw3bs.com/?p=46" target="_blank">theInterW3bs</a>.<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/06/root-password-access-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Lock Desktop &#8211; Mac</title>
		<link>http://derekneely.com/2009/05/quick-lock-desktop-mac/</link>
		<comments>http://derekneely.com/2009/05/quick-lock-desktop-mac/#comments</comments>
		<pubDate>Sun, 24 May 2009 17:19:17 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Lock Desktop]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=106</guid>
		<description><![CDATA[One of my small peeves with a Mac is the lack of a quick utility or short-cut to lock your computer. So, I took it upon myself to make one out of the apps they already give us. First off set your Mac to require a password when waking from the screen saver and disable  automatic [...]]]></description>
			<content:encoded><![CDATA[<p>One of my small peeves with a Mac is the lack of a quick utility or short-cut to lock <a href="http://www.apple.com"><img class="alignright" title="Apple Mac" src="http://derekneely.com/MyImages/Icons/apple.jpg" alt="" width="98" height="113" /></a>your computer. So, I took it upon myself to make one out of the apps they already give us.</p>
<p>First off set your Mac to require a password when waking from the screen saver and disable  automatic logins. Apple &#8211;&gt; System Preferences &#8211;&gt; Security &#8211;&gt; &#8216;Require password to wake this computer from sleep or screen saver&#8217; &amp; &#8216;Disable automatic login&#8217;.</p>
<p>You can download the one I created that &#8216;should&#8217; work automatically after installing. If not or you want to get creative and make your own with your own icon or what have you, the instructions are below on what I did. You can also set a keyboard shortcut to the app for a keyboard style lock.</p>
<p><strong>Pre-made Screen Saver/Lock App:</strong><br />
Download: <a title="MacDLock.tar" href="http://derekneely.com/Downloads/MacDLock.tar" target="_blank">MacDLock</a> (MacDLock.tar &#8211; 280KB)<br />
Installation:</p>
<blockquote><p>$&gt; tar xvf MacDLock.tar<br />
$&gt; mv MacDLock.app /Applications</p></blockquote>
<p>That&#8217;s it! Now if you open your Applications folder you should be able to click the Lock icon for MacDLock and it will launch your screensaver. Upon wake, you will be prompted for you username and password that you set up to do earlier. I put a launch icon on the launch bar and setup a shortcut to the application to make for quick screen locking while I&#8217;m away. Enjoy!</p>
<p><strong>Custom Screen Saver/Lock:</strong></p>
<blockquote><p>$&gt; cp -r /System/Library/Frameworks/ScreenSaver.framework/Versions/A/\<br />
Resources/ScreenSaverEngine.app /Applications/MacDLock.app</p></blockquote>
<p>This will give you the standard ScreenSaver but located in your /Applications directory. You can also do it with a soft link such as this:</p>
<blockquote><p>$&gt; ln -s<br />
/System/Library/Frameworks/ScreenSaver.framework/Versions/A/\<br />
Resources/ScreenSaverEngine.app /Applications/MacDLock.app</p></blockquote>
<p>I did the first because I wanted to change out the icon to something more &#8216;cool&#8217; or &#8216;secure&#8217; looking (like a lock) without changing the actual ScreenSaverEngine.app.</p>
<p>Changing out the Icon:</p>
<ol>
<li>Find the icon you&#8217;d like to use in either .png, .gif, .jpg format.</li>
<li>I used this site to convert my image to an icon: <a title="iConvert" href="http://iconverticons.com/" target="_blank">iConvert</a></li>
<li>Download your new .icns file.</li>
<li>Copy your .icns file to the application directory.</li>
</ol>
<blockquote><p>$&gt; cp ~/[Icon_FileName].icns /Applications/MacDLock.app/\<br />
Contents/Resources/ScreenSaverEngine.icns</p></blockquote>
<p>And there you go! You have your custom Screen Saver/Desktop Lock. If you notice any kind of bug in my above code please let me know. I took many other steps while originally doing this so hope they are in the right order and I&#8217;m not missing anything.</p>
<p>One of my projects when I have some free time is to setup a Python script or something that embeds an icon into the Menu Bar for quick locking. If this is already available or you feel I&#8217;ve recreated the wheel please let me know of the other apps that are out there that may already do this. Always interested in seeing what other have done. Thanks! And hope you enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/05/quick-lock-desktop-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Proxy (how-to)</title>
		<link>http://derekneely.com/2009/05/ssh-proxy-how-to/</link>
		<comments>http://derekneely.com/2009/05/ssh-proxy-how-to/#comments</comments>
		<pubDate>Sat, 23 May 2009 20:57:32 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=83</guid>
		<description><![CDATA[SSH Proxying is one of my every day tools. Sitting at work with a Barracuda firewall looking, snooping, and possibly blocking everything that I do. Hanging at a coffee shop when you see a suspicious person most likely snooping your information out of the air. In the first case I&#8217;m primarily just trying to get [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-286" title="Terminal" src="http://derekneely.com/wp-content/uploads/2009/06/terminal.png" alt="Terminal" width="117" height="103" />SSH Proxying is one of my every day tools. Sitting at work with a Barracuda firewall looking, snooping, and possibly blocking everything that I do. Hanging at a coffee shop when you see a suspicious <a title="Huggs" href="#" target="_blank">person</a> most likely snooping your information out of the air. In the first case I&#8217;m primarily just trying to get around a hurdle. In both cases I want my traffic encrypted and hidden from 3rd parties.</p>
<p>What is SSH Proxying?<br />
This is a means of setting up a Secure Shell (SSH) and then piping your various web requests across this pipe or tunnel.</p>
<p>I&#8217;ve got 2 different SSH Proxies that I use daily.</p>
<p><strong>Web Traffic &#8211; SSH Tunnel/Proxy:</strong></p>
<blockquote><p>ssh -CqN -D 8080 [username]@[hostname]</p></blockquote>
<p>For above tunnel I&#8217;m using the following:</p>
<blockquote><p>-D: bind port &#8211; in this case 8080 locally<br />
-C: enables compression<br />
-q: quiet mode (suppresses any warnings)<br />
-N: don&#8217;t execute any remote commands</p></blockquote>
<p>The -CqN are just some bells and whistles I use for the connection but not required. Please see below on configuring your browser to use the newly established SSH Tunnel.</p>
<p><strong>Various other traffic (IRC, VNC, Torrent, etc&#8230;) &#8211; SSH Port Forwarding</strong></p>
<blockquote><p>ssh -L 6667:irc.[hostname]:6667 [username]@[hostname]</p></blockquote>
<p>In this example, I&#8217;m binding a local port (-L 6667) to a remote boxes port (6667) through the server I have SSH&#8217;ed into. You can also add some of the bells and whistles from the web proxy to this one as well. Please see below for using this port forward with and IRC client.</p>
<p><strong>Configuring the Browser:<br />
</strong>The general idea (for Firefox) is to go to: Preferences &#8211;&gt; Advanced &#8211;&gt; Network &#8211;&gt; Connection &#8211;&gt; Settings. Select &#8216;Manual proxy configuration&#8217;. Set SOCKS Host: localhost Port: 8080. Click OK/Save and you should be good to go.</p>
<p>Here&#8217;s a screen shot of my settings:</p>
<p><img title="Firefox SSH Proxy Config" src="http://derekneely.com/MyImages/SSH_Proxy/Firefox_SSH_Proxy_Config.png" alt="Firefox SSH Proxy Config" width="450" height="376" /></p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/05/ssh-proxy-how-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bwm-ng (command line bandwidth monitor)</title>
		<link>http://derekneely.com/2009/05/bwm-ng/</link>
		<comments>http://derekneely.com/2009/05/bwm-ng/#comments</comments>
		<pubDate>Fri, 22 May 2009 02:47:54 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[bwm-ng]]></category>
		<category><![CDATA[System Tools]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=67</guid>
		<description><![CDATA[bwm-ng is a great little command line bandwidth monitor. HUGE fan. Its available with most all distros so use your favorite package manager to add it. Works on all *nix distributions including the Mac too. bwm-ng home page: http://www.gropp.org/?id=projects&#38;sub=bwm-ng On the Mac it works great with a little application called GeekTool (will cover more later) [...]]]></description>
			<content:encoded><![CDATA[<p><a title="bwm-ng" href="http://www.gropp.org/?id=projects&amp;sub=bwm-ng" target="_blank">bwm-ng</a> is a great little command line bandwidth monitor. HUGE fan. Its available with <img class="alignright" title="Terminal" src="http://derekneely.com/MyImages/Icons/terminal.png" alt="" width="131" height="116" />most all distros so use your favorite package manager to add it. Works on all *nix distributions including the Mac too.</p>
<p>bwm-ng home page: <a title="bwm-ng" href="http://www.gropp.org/?id=projects&amp;sub=bwm-ng" target="_blank">http://www.gropp.org/?id=projects&amp;sub=bwm-ng</a></p>
<p>On the Mac it works great with a little application called <a title="GeekTool" href="http://projects.tynsoe.org/en/geektool/" target="_blank">GeekTool</a> (will cover more later) with the following options:</p>
<blockquote><p>/Users/derek/Applications/bwm-ng/bin/bwm-ng -o plain -c 1</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/05/bwm-ng/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

