<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><!-- generator="wordpress/2.3.3" --><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Mac Developer Tips</title>
	<link>http://MacDeveloperTips.com</link>
	<description>Tips, tools and code for developers working on a Mac</description>
	<pubDate>Mon, 12 May 2008 07:08:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/MacDeveloperTips" type="application/rss+xml" /><feedburner:emailServiceId>1745523</feedburner:emailServiceId><feedburner:feedburnerHostname>http://www.feedburner.com</feedburner:feedburnerHostname><feedburner:browserFriendly>Welcome to Mac Developer Tips!</feedburner:browserFriendly><item>
		<title>Login Screenshot Challenge</title>
		<link>http://feeds.feedburner.com/~r/MacDeveloperTips/~3/288509538/login-screenshot-challenge.html</link>
		<comments>http://MacDeveloperTips.com/system/login-screenshot-challenge.html#comments</comments>
		<pubDate>Mon, 12 May 2008 07:08:33 +0000</pubDate>
		<dc:creator>john</dc:creator>
		
		<category><![CDATA[System]]></category>

		<category><![CDATA[login]]></category>

		<category><![CDATA[screenshot]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/system/login-screenshot-challenge.html</guid>
		<description><![CDATA[Capturing a screenshot of the login screen in Mac OS X Leopard appears to be something of a trick. Join this challenge on how to capture this elusive screenshot.]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://macdevelopertips.com/system/working-as-root.html" target="_blank">last post</a> I was showing various options for working with the root account. Near the end of the post I was planning to show how when logging in as root, the login dialog does not offer <em>root</em> as one of the available login names (instead, the name <em>Other</em> is listed).</p>
<p>Attempting to capture the login screen has been an interesting diversion. Up to this point I&#8217;ve been unsuccessful in capturing the elusive screenshot.</p>
<p>So here&#8217;s a challenge for you&#8230;can you be the first to figure out how to capture a screenshot of the login screen? There are a couple of ground rules:</p>
<ol>
<li>You must be running Leopard (or at a minimum, the solution must work on Leopard).</li>
<li>Since I want to show how the login screen does not display <em>root</em> as one of the available login accounts, the screenshot will have to be of the login window. Put another way, simply selecting a name from the drop-down of the fast user switching dialog is not an option.</li>
<li>Finally, I am looking for a solution that doesn&#8217;t require more than one Mac (e.g. using SSH from one Mac to another doesn&#8217;t qualify).</li>
</ol>
<p>To save you some time, I&#8217;ve listed below the options I&#8217;ve tried:</p>
<p><strong>Attempt #1</strong> - Hotkeys<br />
From the login screenscreen, I tried the following hotkeys:</p>
<p>- Shift+Command+3 (capture entire screen to file)<br />
- Control+Shift+Command+3 (capture entire screen to clipboard)<br />
- Shift+Command+4 (capture area defined with mouse to file)<br />
Each of the above greeted me with a pleasant beep, nothing more.</p>
<p><strong>Attempt #2</strong> - Grab application<br />
My next attempt was to try the timed capture option with the Grab application. Seemed like a clever idea, however, when I started the timer and logged out (to get to the login screen), Grab just seems to quietly go away. No warning, no error, no screenshot.</p>
<p><strong>Attempt #3</strong> - Fast Switching<br />
Next, I enabled fast user switching. My thinking was, maybe if I don&#8217;t logout per se, and request the Login Window (see the figure below) that the login screen might somehow be different (as in, something I can capture using hotkeys):</p>
<p><img src="http://MacDeveloperTips.com/wp-content/uploads/2008/05/screenshot1.png" style="max-width: 800px" /></p>
<p>Seemed logical, however, upon choosing Login Window I was shuffled over to the same login screen as if logging out. No luck.</p>
<p><strong>Attempt #4</strong> -  Getting a little more creative, I tried this from within a terminal:</p>
<p><font color="#800000"><em>screen -d -m bash -c &#8220;sleep 30; screencapture /Users/John/login.png&#8221;</em></font></p>
<p>This option uses a screen manager (more on that in an upcoming post) and calls the screencapture application after sleeping for 30 seconds. Once I ran this option from a terminal, I quickly logged out and patiently waited&#8230;I heard the camera sound of the screencapture application and was psyched, &#8220;yes!&#8221;&#8230;I navigated to my home directory and located the file login.png&#8230;I opened the file with the Preview application&#8230;and much to my dismay&#8230;it was an image alright&#8230;a big, black, blank image. So close, but no cigar.</p>
<p>So, now it&#8217;s up to you. Can you figure what it takes to capture the login screenshot? You can submit your idea as a comment (below) or <a href="http://macdevelopertips.com/?page_id=91" target="_blank">drop me an email</a>. And please verify your trick works with Leopard, as other published solutions I&#8217;ve found seem to work only on releases prior to Leopard.</p>
<p>I&#8217;m doing my best to see if I can find a volunteer to donate a prize (software, book, t-shirt, etc). If that doesn&#8217;t come through, what I can offer is a little lime-light, blog style. If you are the first to contact me with a solution (within the parameters above), we can collaborate on a post where you can tell the world how you got so smart :)  and share your bio, picture, blog/website, etc.</p>
<p>If anyone reading is interested in donating a prize, <a href="http://macdevelopertips.com/?page_id=91" target="_blank">contact me</a> and we&#8217;ll get the ball rolling.</p>
<p>I am very intrigued to see if/how this can be done.</p>

<!-- start wp-tags-to-technorati 0.9 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/login' rel='tag' target='_blank'>login</a>, <a class='technorati-link' href='http://technorati.com/tag/screenshot' rel='tag' target='_blank'>screenshot</a></p>

<!-- end wp-tags-to-technorati -->
<img src="http://feeds.feedburner.com/~r/MacDeveloperTips/~4/288509538" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/system/login-screenshot-challenge.html/feed</wfw:commentRss>
		<feedburner:origLink>http://MacDeveloperTips.com/system/login-screenshot-challenge.html</feedburner:origLink></item>
		<item>
		<title>Working as Root</title>
		<link>http://feeds.feedburner.com/~r/MacDeveloperTips/~3/286638668/working-as-root.html</link>
		<comments>http://MacDeveloperTips.com/system/working-as-root.html#comments</comments>
		<pubDate>Fri, 09 May 2008 07:08:07 +0000</pubDate>
		<dc:creator>john</dc:creator>
		
		<category><![CDATA[System]]></category>

		<category><![CDATA[root]]></category>

		<category><![CDATA[sudo]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/system/working-as-root.html</guid>
		<description><![CDATA[Working with the root account on Mac OS X.]]></description>
			<content:encoded><![CDATA[<p>Root is the uber system account. Although handy at times (for example when installing applications), it&#8217;s generally recommended that root not be used as your everyday login. What follows are some options for working as root.</p>
<p>If you need to run a command as root, you can use the sudo command. For example, to run the script for daily system maintenance, you can run this command (the $represent the terminal prompt):</p>
<p><font color="#800000"><em>$ sudo periodic daily</em></font></p>
<p>Now that&#8217;s all well and good, however, it&#8217;s generally applicable only for one command. What if you are in a terminal and want to login as root to do some larger scale maintenance or system work? Try this:</p>
<p><font color="#800000"><em>$ sudo -s</em></font></p>
<p>This command will enable the root account and update your prompt as shown in the figure below:</p>
<p><img src="http://MacDeveloperTips.com/wp-content/uploads/2008/05/sudo1.png" /></p>
<p>The above screenshot assumes you are using the bash shell and have admin rights on the account you are logged in with. The $ typically represents a user account whereas # represents root.</p>
<p>The last option is to create/enable a root account, thus you can login (when restarting/rebooting) as root. This approach offers the most flexibility and power, however, use with caution as there are no limits to what (damage) you can do.</p>
<p><strong>Root account option #1</strong>:  Enter the following from a terminal:</p>
<p><font color="#800000">$ dsenableroot</font></p>
<p>You&#8217;ll be prompted for your (current) password, as well as the new root password.</p>
<p><strong>Root account, option #2</strong>:  Enter the following from a terminal:</p>
<p><font color="#800000">$ sudo passwd</font></p>
<p>You&#8217;ll be prompted for the same series of passwords as above.</p>
<p><strong>Root account, option #3</strong>:  Follow the steps below:</p>
<p>- Start the Directory Utility application (/Applications/Utilities/Directory Utility)<br />
- Click the lock icon in the lower left corner (to unlock it)<br />
- From the Edit menu (across the top of screen), select <em>Enable Root User</em></p>
<p>To wrap up this post I was planning to show you how the login window changes when a root account is enabled. Unlike other accounts on your system where a name is typically displayed as one of the login options, the root account shows up as <em>Other</em> (for security reasons).</p>
<p>However, getting a screenshot of the login screen is a considerable feat. This is a great segue to a post coming next week where I&#8217;ll show the tricks that I tried for capturing the elusive login screen and I will pose an intriguing challenge for you&#8230;</p>

<!-- start wp-tags-to-technorati 0.9 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/root' rel='tag' target='_blank'>root</a>, <a class='technorati-link' href='http://technorati.com/tag/sudo' rel='tag' target='_blank'>sudo</a></p>

<!-- end wp-tags-to-technorati -->
<img src="http://feeds.feedburner.com/~r/MacDeveloperTips/~4/286638668" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/system/working-as-root.html/feed</wfw:commentRss>
		<feedburner:origLink>http://MacDeveloperTips.com/system/working-as-root.html</feedburner:origLink></item>
		<item>
		<title>Dashcode 2, Beta</title>
		<link>http://feeds.feedburner.com/~r/MacDeveloperTips/~3/285331959/dashcode-2-beta.html</link>
		<comments>http://MacDeveloperTips.com/dashcode/dashcode-2-beta.html#comments</comments>
		<pubDate>Wed, 07 May 2008 12:21:53 +0000</pubDate>
		<dc:creator>john</dc:creator>
		
		<category><![CDATA[Dashcode]]></category>

		<category><![CDATA[dashboard]]></category>

		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/dashcode/dashcode-2-beta.html</guid>
		<description><![CDATA[If you are interested in working with the next beta of Dashcode, although there is no public announcement of the beta, it is available, read on for the details&#8230;

If you are not familiar with Dashcode, it&#8217;s a development tool created by Apple for building Dashboard widgets. The 1.0x release was bundled with Leopard. Dashcode is [...]]]></description>
			<content:encoded><![CDATA[<p>If you are interested in working with the next beta of Dashcode, although there is no public announcement of the beta, it is available, read on for the details&#8230;</p>
<p><img src="http://MacDeveloperTips.com/wp-content/uploads/2008/05/dashcode-1.png" align="left" /></p>
<p>If you are not familiar with Dashcode, it&#8217;s a development tool created by Apple for building Dashboard widgets. The 1.0x release was bundled with Leopard. Dashcode is an impressive application, with drag-n-drop support and a no-coding option for creating a widget. Of course, as with any &#8220;no coding required&#8221; statement there is the unstated disclaimer that there are limitations on how far you can take a widget without digging into some code. And on that note, Dashcode offers excellent support for both writing and debugging code that make up a widget (CSS, HTML and JavaScript).</p>
<p>To give you an idea of what you can do with Dashcode, the widget below is an RSS feed of this blog that was created with version 1.0x.</p>
<p><img src="http://MacDeveloperTips.com/wp-content/uploads/2008/05/dashcode-2.png" /></p>
<p>You can try Dashcode 1.0 if you are running Leopard by installing the developer tools on the Leopard install DVD.</p>
<p>Interested to try the 2.0 Beta? There isn&#8217;t a download solely for Dashcode, however, if you download the <a href="http://developer.apple.com/iphone/" target="_blank">iPhone SDK</a>, Dashcode is one of many tools included in the download. If you do not have an Apple ID, follow the link near the bottom of <a href="http://developer.apple.com/iphone/program/" target="_blank">this page</a> to download the iPhone SDK, where you&#8217;ll find an option to create an ID.</p>
<p>Important note: if you import a 1.0 project into the beta, be aware that you might be able to work in the project with 1.0 if you save the project. To get around this, save any imported project with a new name (and/or location). An additional suggestion is to install the iPhone SDK in a different directory than the default <em>/Developer</em>. I opted to install the beta into <em>/Developer/Beta</em> such that I can use both versions of the tools.</p>
<p>In a screencast to follow, I&#8217;ll show you how I created the widget above with Dashcode 1.0.</p>

<!-- start wp-tags-to-technorati 0.9 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/dashboard' rel='tag' target='_blank'>dashboard</a>, <a class='technorati-link' href='http://technorati.com/tag/Dashcode' rel='tag' target='_blank'>Dashcode</a>, <a class='technorati-link' href='http://technorati.com/tag/widget' rel='tag' target='_blank'>widget</a></p>

<!-- end wp-tags-to-technorati -->
<img src="http://feeds.feedburner.com/~r/MacDeveloperTips/~4/285331959" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/dashcode/dashcode-2-beta.html/feed</wfw:commentRss>
		<feedburner:origLink>http://MacDeveloperTips.com/dashcode/dashcode-2-beta.html</feedburner:origLink></item>
		<item>
		<title>Converting Images Types</title>
		<link>http://feeds.feedburner.com/~r/MacDeveloperTips/~3/284600406/converting-images-types.html</link>
		<comments>http://MacDeveloperTips.com/tools-utilities/converting-images-types.html#comments</comments>
		<pubDate>Tue, 06 May 2008 12:03:38 +0000</pubDate>
		<dc:creator>john</dc:creator>
		
		<category><![CDATA[Tools/Utilities]]></category>

		<category><![CDATA[convert images]]></category>

		<category><![CDATA[preview]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/tools-utilities/converting-images-types.html</guid>
		<description><![CDATA[I continue to find the Preview application to be a handy little tool. It&#8217;s not that Preview supports an enormous feature set for working with images, as much as each time over the last few months that I&#8217;ve look to the Previewer to help me out,  it did.
The first time this came about I [...]]]></description>
			<content:encoded><![CDATA[<p>I continue to find the Preview application to be a handy little tool. It&#8217;s not that Preview supports an enormous feature set for working with images, as much as each time over the last few months that I&#8217;ve look to the Previewer to help me out,  it did.</p>
<p>The first time this came about I simply needed to resize an image to post on this blog - from the Tools menu, click Adjust Size and save the file, that&#8217;s it, done (and of course it can preserve the aspect ratio). My most recent encounter was when I needed to convert a file type from JPG to GIF. Again, a few clicks and it&#8217;s done - open an image, from the file menu choose the Save As option and from the dialog box select the image type. The figure below shows the supported file types; notice you can even save an image as a PDF.</p>
<p><img src="http://macdevelopertips.com/wp-content/uploads/2008/05/convert-img.png" height="227" width="164" /></p>
<p>By no means a full-fledged image editing program, and never intended to be, Previewer is still much more than its name suggests.</p>

<!-- start wp-tags-to-technorati 0.9 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/convert+images' rel='tag' target='_blank'>convert images</a>, <a class='technorati-link' href='http://technorati.com/tag/preview' rel='tag' target='_blank'>preview</a></p>

<!-- end wp-tags-to-technorati -->
<img src="http://feeds.feedburner.com/~r/MacDeveloperTips/~4/284600406" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/tools-utilities/converting-images-types.html/feed</wfw:commentRss>
		<feedburner:origLink>http://MacDeveloperTips.com/tools-utilities/converting-images-types.html</feedburner:origLink></item>
		<item>
		<title>Google App Engine, Free Preview</title>
		<link>http://feeds.feedburner.com/~r/MacDeveloperTips/~3/283942779/google-app-engine-free-preview.html</link>
		<comments>http://MacDeveloperTips.com/web/google-app-engine-free-preview.html#comments</comments>
		<pubDate>Mon, 05 May 2008 12:12:08 +0000</pubDate>
		<dc:creator>john</dc:creator>
		
		<category><![CDATA[Web]]></category>

		<category><![CDATA[google-app-engine]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/web/google-app-engine-free-preview.html</guid>
		<description><![CDATA[Google App Engine provides an opportunity to leverage Google&#8217;s infrastructure for server side web applications. The platform is built on a Python runtime, includes persistent storage as well as the capability to integrate with existing Google applications (think Google Maps, Gmail&#8230;).
The App Engine SDK is an open source project that is hosted on Google code, [...]]]></description>
			<content:encoded><![CDATA[<p>Google App Engine provides an opportunity to leverage Google&#8217;s infrastructure for server side web applications. The platform is built on a Python runtime, includes persistent storage as well as the capability to integrate with existing Google applications (think Google Maps, Gmail&#8230;).</p>
<p>The App Engine SDK is an open source project that is hosted on Google code, you can can access the project <a href="http://code.google.com/p/googleappengine/" target="_blank">here</a>. A download of the SDK is available for Mac <a href="http://code.google.com/appengine/downloads.html" target="_blank">here</a>.</p>
<p>The App Engine SDK includes a web-server application that provides a means to emulate the App Engine services from within a local development environment. Once deployed, applications can be hosted on the appspot.com domain, or your own domain.</p>
<p>The video below is a good introduction to Google App Engine from a recent CampFire One event:</p>
<p><object width="425" height="355">
<param name="movie" value="http://www.youtube.com/v/3Ztr-HhWX1c&#038;hl=en"></param>
<param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/3Ztr-HhWX1c&#038;hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
<p>One of the more intriguing aspects to services like the Google App Engine is that you focus on the application, not the hosting/scaling. Should you build a killer app, your focus still lies on the application itself, not on how to massively scale (which would be a good problem to have). From the <a href="http://appengine.google.com/" target="_blank">App Engine homepage</a></p>
<blockquote><p>This is a PREVIEW RELEASE of Google App Engine. For now, account registrations are limited to the first 10,000 developers, and applications are restricted to the free account limits.</p></blockquote>
<p>Hurry and give it a go&#8230;</p>

<!-- start wp-tags-to-technorati 0.9 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/google-app-engine' rel='tag' target='_blank'>google-app-engine</a>, <a class='technorati-link' href='http://technorati.com/tag/Python' rel='tag' target='_blank'>Python</a></p>

<!-- end wp-tags-to-technorati -->
<img src="http://feeds.feedburner.com/~r/MacDeveloperTips/~4/283942779" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/web/google-app-engine-free-preview.html/feed</wfw:commentRss>
		<feedburner:origLink>http://MacDeveloperTips.com/web/google-app-engine-free-preview.html</feedburner:origLink></item>
		<item>
		<title>Changing an Application Icon</title>
		<link>http://feeds.feedburner.com/~r/MacDeveloperTips/~3/282069778/changing-an-application-icon.html</link>
		<comments>http://MacDeveloperTips.com/system/changing-an-application-icon.html#comments</comments>
		<pubDate>Fri, 02 May 2008 12:03:50 +0000</pubDate>
		<dc:creator>john</dc:creator>
		
		<category><![CDATA[System]]></category>

		<category><![CDATA[icon]]></category>

		<category><![CDATA[screencast]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/system/changing-an-application-icon.html</guid>
		<description><![CDATA[Screencast on how to change an application icon on Mac OS. X]]></description>
			<content:encoded><![CDATA[<p>One of the defining concepts of working on a Mac is that things (usually) work just as you think they should. This is the culmination of good design translated into working code. The short video that follows is an example demonstrating how easy and intuitive it is to change the icon for an application. Believe it or not, it&#8217;s as simple as copy/paste.</p>
<p><a href="javascript:lynkVideoPop(719,'1209684113');" class="lynkvp"><img src="http://macdevelopertips.com/wp-content/uploads/2008/05/change-icon.png" /></a></p>
<p>This is a great trick to have up your sleeve when working with development tools that create a default icon, for example the Script Editor. With this approach you can quickly change an icon to reflect that something visually represents what the application does. And to help, do a quick search on Google for <font color="#800000"><em>Mac OS X icons</em></font> and you&#8217;ll be amused for hours&#8230;</p>

<!-- start wp-tags-to-technorati 0.9 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/icon' rel='tag' target='_blank'>icon</a>, <a class='technorati-link' href='http://technorati.com/tag/screencast' rel='tag' target='_blank'>screencast</a></p>

<!-- end wp-tags-to-technorati -->
<img src="http://feeds.feedburner.com/~r/MacDeveloperTips/~4/282069778" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/system/changing-an-application-icon.html/feed</wfw:commentRss>
		<feedburner:origLink>http://MacDeveloperTips.com/system/changing-an-application-icon.html</feedburner:origLink></item>
		<item>
		<title>Toggle Finder Hidden File Status</title>
		<link>http://feeds.feedburner.com/~r/MacDeveloperTips/~3/281280617/toggle-finder-hidden-file-status.html</link>
		<comments>http://MacDeveloperTips.com/applescript/toggle-finder-hidden-file-status.html#comments</comments>
		<pubDate>Thu, 01 May 2008 06:09:14 +0000</pubDate>
		<dc:creator>john</dc:creator>
		
		<category><![CDATA[AppleScript]]></category>

		<category><![CDATA[finder]]></category>

		<category><![CDATA[hidden files]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/applescript/toggle-finder-hidden-file-status.html</guid>
		<description><![CDATA[AppleScript code to toggle whether or not Finder on Mac OS X shows hidden files.]]></description>
			<content:encoded><![CDATA[<p>For some reason I prefer to have system files (hidden by default) shown in Finder (must be the Unix in my system from grad school). With that said, there are times when it would be nice to have these same files out of sight when working with a cluttered folder. After having thought many times about writing a short script to toggle hidden files on/off, I finally took a few minutes to crank out the code below:</p>
<p><img src="http://macdevelopertips.com/images/script-editor.png" alt="Script Editor" height="32" width="32" /> <a href="applescript://com.apple.scripteditor?action=new&amp;script=----------------------------------------%0A--%20%20MacDeveloperTips.com%0A--%20%20Toggle%20Finder%20hidden%20file%20status%0A----------------------------------------%0Atry%0A%20%20--%20Get%20current%20value%0A%20%20set%20toggle%20to%20do%20shell%20script%20%22defaults%20read%20com.apple.finder%20AppleShowAllFiles%22%0A%20%20%0A%20%20--%20Toggle%20it%0A%20%20if%20toggle%20%3D%20%22ON%22%20then%0A%20%20%20%20do%20shell%20script%20%22defaults%20write%20com.apple.finder%20AppleShowAllFiles%20OFF%22%0A%20%20else%0A%20%20%20%20do%20shell%20script%20%22defaults%20write%20com.apple.finder%20AppleShowAllFiles%20ON%22%0A%20%20end%20if%0A%20%20%0A%20%20--%20Restart%20Finder%0A%20%20tell%20application%20%22Finder%22%20to%20quit%0A%20%20delay%200.5%20--%20If%20you%20have%20problems%2C%20you%20can%20tweak%20the%20delay%0A%20%20tell%20application%20%22Finder%22%20to%20launch%0Aon%20error%0A%20%20display%20dialog%20%22Unable%20to%20toggle%20bit%20status.%22%20buttons%20%7B%22Better%20luck%20next%20time%22%7D%20with%20icon%20caution%20with%20title%20%22Error%22%0Aend%20try%0A" alt="Script Editor">Click to paste code into the Script Editor</a></p>
<pre>
----------------------------------------
--  MacDeveloperTips.com
--  Toggle Finder hidden file status
----------------------------------------
try
  -- Get current value
  set toggle to do shell script "defaults read com.apple.finder AppleShowAllFiles"

  -- Toggle it
  if toggle = "ON" then
    do shell script "defaults write com.apple.finder AppleShowAllFiles OFF"
  else
    do shell script "defaults write com.apple.finder AppleShowAllFiles ON"
  end if

  -- Restart Finder
  tell application "Finder" to quit
  delay 0.5 -- If you have problems, you can tweak the delay
  tell application "Finder" to launch
on error
  display dialog "Unable to toggle bit status." buttons {"Better luck next time"}
           with icon caution with title "Error"
end try</pre>
<p>Notice the reference to <font color="#800000"><em>delay</em></font> - if you have problems with the scripting not running properly, you can experiment with a longer delay. There is minimal error handling, essentially just trapping errors and displaying the message below:</p>
<p><img src="http://macdevelopertips.com/wp-content/uploads/2008/04/thanks.png" height="115" width="361" /></p>
<p>I prefer to save AppleScript code as an application, create an icon that serves as a reminder of what the script does, and drag/drop the application onto the Finder toolbar. You can see a screenshot below what my toolbar looks like (the icon for this script is the blue &amp; white Finder image).</p>
<p><img src="http://macdevelopertips.com/wp-content/uploads/2008/04/finder-change-status.png" height="263" width="486" /></p>
<p>And speaking of icons, in an upcoming tip I&#8217;ll show you how easy it is to change an application icon on a Mac.</p>

<!-- start wp-tags-to-technorati 0.9 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/AppleScript' rel='tag' target='_blank'>AppleScript</a>, <a class='technorati-link' href='http://technorati.com/tag/finder' rel='tag' target='_blank'>finder</a>, <a class='technorati-link' href='http://technorati.com/tag/hidden+files' rel='tag' target='_blank'>hidden files</a></p>

<!-- end wp-tags-to-technorati -->
<img src="http://feeds.feedburner.com/~r/MacDeveloperTips/~4/281280617" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/applescript/toggle-finder-hidden-file-status.html/feed</wfw:commentRss>
		<feedburner:origLink>http://MacDeveloperTips.com/applescript/toggle-finder-hidden-file-status.html</feedburner:origLink></item>
		<item>
		<title>NetBeans, Java, AppleScript and iTunes - Part 2</title>
		<link>http://feeds.feedburner.com/~r/MacDeveloperTips/~3/280067794/netbeans-java-applescript-and-itunes-part-2.html</link>
		<comments>http://MacDeveloperTips.com/java/netbeans-java-applescript-and-itunes-part-2.html#comments</comments>
		<pubDate>Tue, 29 Apr 2008 12:03:45 +0000</pubDate>
		<dc:creator>john</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[AppleScript]]></category>

		<category><![CDATA[Cocoa]]></category>

		<category><![CDATA[netbeans]]></category>

		<category><![CDATA[screencast]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/java/netbeans-java-applescript-and-itunes-part-2.html</guid>
		<description><![CDATA[Learn how to interact with iTunes using AppleScript and Java.]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://macdevelopertips.com/java/netbeans-java-applescript-and-itunes-part-1.html" target="_blank">part 1 of this series</a> I demonstrated how to create a short Java application in NetBeans that communicated, using AppleScript, to the Mac apple event system. The application was a no thrills look into how to invoke the TextEdit application. Despite the brevity of the application it provided the foundation for this next tip, which will build on the ideas to create something a little more salient, as in, something that you might actually find yourself using.</p>
<p>The gist of the application is to instruct iTunes to play a random song, move to the next song, pause, etc. I&#8217;ll show one use of the application by wrapping the code into a bash script that allows you to invoke the program (and all commands) from within a terminal. Watch the video that follows for all the details&#8230;</p>
<p><a href="javascript:lynkVideoPop(719,'1209472338');" class="lynkvp"><img src="http://macdevelopertips.com/wp-content/uploads/images/NetBeans-Tips-Intro-Click-Here.png" /></a></p>
<p>This application is all of about 80 lines, including the bash script. Sometimes a little creative thinking and a few lines of code are all that&#8217;s needed to write an intriguing (and hopefully useful) application.</p>
<hr color="#00008b" size="1" /><img src="/images/blank.gif" border="0" height="1" />The music in the video is Led Zeppelin and the song: Moby Dick. <a href="http://www.amazon.com/gp/product/B000002J03?ie=UTF8&amp;tag=macdevelopertips-20&amp;link_code=as3&amp;camp=211189&amp;creative=373489&amp;creativeASIN=B000002J03" target="_blank">Led Zeppelin at Amazon</a><br />
<img src="/images/blank.gif" border="0" height="3" /><br />
<img src="http://www.assoc-amazon.com/e/ir?t=macdevelopertips-20&amp;l=as2&amp;o=1&amp;a=B000002J03" style="border: medium none  ! important; margin: 0px ! important" border="0" height="1" width="1" /><br />
<img src="/images/blank.gif" border="0" height="3" /></p>

<!-- start wp-tags-to-technorati 0.9 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/AppleScript' rel='tag' target='_blank'>AppleScript</a>, <a class='technorati-link' href='http://technorati.com/tag/Cocoa' rel='tag' target='_blank'>Cocoa</a>, <a class='technorati-link' href='http://technorati.com/tag/Java' rel='tag' target='_blank'>Java</a>, <a class='technorati-link' href='http://technorati.com/tag/netbeans' rel='tag' target='_blank'>netbeans</a>, <a class='technorati-link' href='http://technorati.com/tag/screencast' rel='tag' target='_blank'>screencast</a></p>

<!-- end wp-tags-to-technorati -->
<img src="http://feeds.feedburner.com/~r/MacDeveloperTips/~4/280067794" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/java/netbeans-java-applescript-and-itunes-part-2.html/feed</wfw:commentRss>
		<feedburner:origLink>http://MacDeveloperTips.com/java/netbeans-java-applescript-and-itunes-part-2.html</feedburner:origLink></item>
		<item>
		<title>Multiple Monitors, Moving Menu Bar</title>
		<link>http://feeds.feedburner.com/~r/MacDeveloperTips/~3/279375203/multiple-monitors-specifying-menu-location.html</link>
		<comments>http://MacDeveloperTips.com/system/multiple-monitors-specifying-menu-location.html#comments</comments>
		<pubDate>Mon, 28 Apr 2008 13:02:01 +0000</pubDate>
		<dc:creator>john</dc:creator>
		
		<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/system/multiple-monitors-specifying-menu-location.html</guid>
		<description><![CDATA[ Working with multiple monitors is a must when doing any serious coding work. Code on one side, output on the other. No more swapping applications from the foreground to background.
Mac OS X make working with multiple monitors  a snap: plugin in the secondary monitor, open System Preferences, click on Displays, click on the [...]]]></description>
			<content:encoded><![CDATA[<p> Working with multiple monitors is a must when doing any serious coding work. Code on one side, output on the other. No more swapping applications from the foreground to background.</p>
<p>Mac OS X make working with multiple monitors  a snap: plugin in the secondary monitor, open System Preferences, click on Displays, click on the Arrangement tab and arrange the displays by dragging and dropping. That&#8217;s it. In the figure below the larger box is the secondary monitor (larger view area) and the smaller is my laptop.</p>
<p><img src="http://MacDeveloperTips.com/wp-content/uploads/2008/04/prefs1.png" /></p>
<p>There is one default setting that I want to mention here that hopefully will save you some time. When you set up an additional monitor the menu bar stays on the original display. Depending on your arrangement, this may be no worry. In my case I wanted the secondary monitor to be the primary display. When working on an application in what is now my primary display,  it&#8217;s anything but intuitive to move the mouse back over to the laptop display to click a menu item.</p>
<p>I spent some time searching for a tip, trick or hack to fix this little problem, to no avail. I went back into the system settings any number of times looking for a preference setting. I even did a search for a Mac <a href="http://macdevelopertips.com/category/defaults" target="_blank">Defaults</a> option to specify where the menu should land. Again, no luck.</p>
<p>Here&#8217;s the punch line, the fix was so obvious, it wasn&#8217;t obvious. If you look closely at the figure above, notice the second line in the description area&#8230;&#8221;<font color="#003300"><em>To relocate the menu bar, drag it to a different display.</em></font>&#8221; Heh, was that there the whole time&#8230;??</p>
<p>So here&#8217;s the tip: to move the menu bar simply drag-n-drop as you prefer.</p>
<p><img src="http://MacDeveloperTips.com/wp-content/uploads/2008/04/prefs2.png" /></p>
<p>Okay, so here&#8217;s where I have a question for you. I recently upgraded to Leopard (10.5), and I&#8217;m curious if this feature existed on Tiger (10.4)?  Essentially I&#8217;m looking for an excuse as to  why I didn&#8217;t see the obvious solution to my question, right in front of me. Maybe you can help me out here :)</p>

<!-- start wp-tags-to-technorati 0.9 -->

<!-- end wp-tags-to-technorati -->
<img src="http://feeds.feedburner.com/~r/MacDeveloperTips/~4/279375203" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/system/multiple-monitors-specifying-menu-location.html/feed</wfw:commentRss>
		<feedburner:origLink>http://MacDeveloperTips.com/system/multiple-monitors-specifying-menu-location.html</feedburner:origLink></item>
		<item>
		<title>MacFUSE</title>
		<link>http://feeds.feedburner.com/~r/MacDeveloperTips/~3/277570137/macfuse.html</link>
		<comments>http://MacDeveloperTips.com/system/macfuse.html#comments</comments>
		<pubDate>Fri, 25 Apr 2008 11:35:04 +0000</pubDate>
		<dc:creator>john</dc:creator>
		
		<category><![CDATA[System]]></category>

		<category><![CDATA[MacFUSE]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/system/macfuse.html</guid>
		<description><![CDATA[MacFUSE is an open source project that simplifies the process of adding a file system to Mac OS X. If you&#8217;ve ever had an inclination to create a file system, or thought that a file system like &#8220;interface&#8221; would be an intuitive approach to solving a problem,  yet, upon delving into what it takes [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/macfuse/" target="_blank">MacFUSE</a> is an open source project that simplifies the process of adding a file system to Mac OS X. If you&#8217;ve ever had an inclination to create a file system, or thought that a file system like &#8220;interface&#8221; would be an intuitive approach to solving a problem,  yet, <img src="http://macdevelopertips.com/wp-content/uploads/2008/04/MacFUSE.jpg" align="left" height="117" width="105" />upon delving into what it takes to create a kernel extension, you opted to rethink your idea (or at least the approach) here&#8217;s where MacFUSE comes in, effectively offering an API to implement a file system.</p>
<p><a href="http://fuse.sourceforge.net/" target="_blank">FUSE</a> (file system in user space) was born and bred as a Linux tool. <span id="intelliTxt">MacFUSE is a port of FUSE to the Mac by <a href="http://osxbook.com/" target="_blank">Amit Singh</a>. From the highest level, there are two key aspects to FUSE. First and foremost (without it you have nothing) the dynamically loadable kernel extension. This is where all the hard work (aka magic) takes place. The second aspect is the API, not unlike any other API you&#8217;ve worked with, the FUSE library offers an interface to communicate with the kernel extension. Using calls such as read, open and write, working with your own file system on FUSE becomes a rather trivial undertaking.</span></p>
<p>Following are a few examples of application using MacFUSE:</p>
<ul>
<li><a href="http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SPOTLIGHTFS" target="_blank">SpotlightFS</a>: an application that dynamically generates smart folders from Spotlight queries</li>
<li><a href="http://fuse.sourceforge.net/sshfs.html" target="_blank">SSH FileSystem</a>: file system client based on the SSH</li>
</ul>
<p>To learn more about MacFUSE, you can watch <a href="http://video.google.com/videoplay?docid=3138515991250095768" target="_blank">this video</a> of Amit reviewing his MacWorld 2007 presentation.</p>

<!-- start wp-tags-to-technorati 0.9 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/MacFUSE' rel='tag' target='_blank'>MacFUSE</a></p>

<!-- end wp-tags-to-technorati -->
<img src="http://feeds.feedburner.com/~r/MacDeveloperTips/~4/277570137" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/system/macfuse.html/feed</wfw:commentRss>
		<feedburner:origLink>http://MacDeveloperTips.com/system/macfuse.html</feedburner:origLink></item>
	</channel>
</rss>
