<?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>Peter Friese &#187; Mac</title>
	<atom:link href="http://www.peterfriese.de/category/computer/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peterfriese.de</link>
	<description>mobile / model-driven</description>
	<lastBuildDate>Mon, 14 Nov 2011 16:14:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Using NSPredicate to Filter Data</title>
		<link>http://www.peterfriese.de/using-nspredicate-to-filter-data/</link>
		<comments>http://www.peterfriese.de/using-nspredicate-to-filter-data/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 20:15:36 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[nsarray]]></category>
		<category><![CDATA[nspredicate]]></category>
		<category><![CDATA[predicate]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=725</guid>
		<description><![CDATA[Filtering data is one of the essential tasks in computing. With all the data available today, we need to apply certain limits and constraints to actually make it usable. What use is it to be able to scroll down a list of literally thousands of list items when you really care about one or two [...]]]></description>
			<content:encoded><![CDATA[<p>Filtering data is one of the essential tasks in computing. With all the data available today, we need to apply certain limits and constraints to actually make it usable. What use is it to be able to scroll down a list of literally thousands of list items when you really care about one or two of them? Filtering and searching information make up a significant part of our work day - each time you use Google, you're applying a filter to the huge set of data we call the internet.<br />
<span id="more-725"></span><br />
Even on your local computer, you use services like Spotlight or the search field in your mail application all the time. Apps that lack decent searching and filtering capabilities sometimes are really hard to use, so as developers we should spend some time on thinking how to allow users to filter the data they're dealing with.</p>
<p>In this post, I am going to focus on ways to filter data. We won't be looking at the UI side of things - this is something I'll do in a subsequent blog post.</p>
<h2>Old-skool filtering</h2>
<p>If you look at an arbitrary code base, chances are you'll sooner or later run into a piece of code similar to this one:</p>
<pre class="objc"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSMutableArray.html"><span style="color: #0000ff;">NSMutableArray</span></a> *oldSkoolFiltered = <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSMutableArray.html"><span style="color: #0000ff;">NSMutableArray</span></a> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #0000ff;">for</span> <span style="color: #002200;">&#40;</span>Book *book in bookshelf<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>book.publisher isEqualToString:@<span style="color: #666666;">&quot;Apress&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #002200;">&#91;</span>oldSkoolFiltered addObject:book<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span></pre>
<p>It's a straight-forward approach to filtering an array of items (in this case, we're talking about books) using a rather simple <code>if</code>-statement. Nothing wrong with this, but despite the fact we're using a fairly simple expression here, the code is rather verbose. We can easily imagine what will happen in case we need to use more complicated selection criteria or a combination of filtering criteria.</p>
<h2>Simple filtering with NSPredicate</h2>
<p>Thanks to Cocoa, we can simplify the code by using <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSPredicate_Class/Reference/NSPredicate.html">NSPredicate</a>. <code>NSPredicate</code> is the object representation of an if-statement, or, more formally, a predicate.</p>
<p>Predicates are <a href="http://en.wikipedia.org/wiki/Predicate_(mathematical_logic)">expressions that evaluate to a truth value</a>, i.e. <code>true</code> or <code>false</code>. We can use them to perform validation and filtering. In Cocoa, we can use <code>NSPredicate</code> to evaluate single objects, filter arrays and perform queries against Core Data data sets.</p>
<p>Let's have a look at how our example looks like when using <code>NSPredicate</code>:</p>
<pre class="objc">NSPredicate *predicate =
  <span style="color: #002200;">&#91;</span>NSPredicate predicateWithFormat:@<span style="color: #666666;">&quot;publisher == %@&quot;</span>, @<span style="color: #666666;">&quot;Apress&quot;</span> <span style="color: #002200;">&#93;</span>;
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSArray.html"><span style="color: #0000ff;">NSArray</span></a> *filtered  = <span style="color: #002200;">&#91;</span>bookshelf filteredArrayUsingPredicate:predicate<span style="color: #002200;">&#93;</span>;</pre>
<p>Much shorter and better readable!</p>
<h2>Filtering with Regular Expressions</h2>
<p>Regular Expressions can be used to <a href="http://xkcd.com/208/">solve almost any problem <img src='http://www.peterfriese.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </a> so it's good to know you can use them in <code>NSPredicate</code>s as well. To use regular expressions in your <code>NSPredicate</code>, you need to use the <code>MATCHES</code> operator.</p>
<p>Let's filter all books that are about iPad or iPhone programming:</p>
<pre>
predicate = [NSPredicate predicateWithFormat:@"title MATCHES '.*(iPhone|iPad).*'"];
filtered = [bookshelf filteredArrayUsingPredicate:predicate];
dumpBookshelf(@"Books that contain 'iPad' or 'iPhone' in their title", filtered);
</pre>
<p>You need to obey some rules when using regular expressions in <code>NSPredicate</code>: most importantly, <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Predicates/Articles/pUsing.html#//apple_ref/doc/uid/TP40001794-SW9">you cannot use regular expression metacharacters inside a pattern set</a>.</p>
<h2>Filtering using set operations</h2>
<p>Let's for a moment assume you want to filter all books that have been published by your favorite publishers. Using the <code>IN</code> operator, this is rather simple: first, we need to set up a set containing the publishers we're interested in. Then, we can create the predicate and finally perform the filtering operation:</p>
<pre>NSArray *favoritePublishers = [NSArray arrayWithObjects:@"Apress", @"O'Reilly", nil];
predicate = [NSPredicate predicateWithFormat:@"publisher IN %@", favoritePublishers];
filtered  = [bookshelf filteredArrayUsingPredicate:predicate];
dumpBookshelf(@"Books published by my favorite publishers", filtered);</pre>
<h2>Advanced filtering thanks to KVC goodness</h2>
<p><code>NSPredicate</code> relies on <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/KeyValueCoding.html">key-value coding</a> to achieve its magic. On one hand this means your classes need to be <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/Compliant.html#//apple_ref/doc/uid/20002172-BAJEAIEE">KVC compliant</a> in order to be queried using <code>NSPredicate</code> (at least the attributes you want to query). On the other hand, this allows us to perform some very interesting things with very little lines of code.</p>
<p>Let's for example retrieve a list of books written by authors with the name "Mark":</p>
<pre class="objc">predicate =
  <span style="color: #002200;">&#91;</span>NSPredicate predicateWithFormat:@<span style="color: #666666;">&quot;authors.lastName CONTAINS %@&quot;</span>, @<span style="color: #666666;">&quot;Mark&quot;</span> <span style="color: #002200;">&#93;</span>;
filtered  = <span style="color: #002200;">&#91;</span>bookshelf filteredArrayUsingPredicate:predicate<span style="color: #002200;">&#93;</span>;</pre>
<p>In case we'd want to return the value of one of the aggregate functions, we don't need to use NSPredicate itself, but instead use KVC directly. Let's retrieve the average price of all books on our shelf:</p>
<pre class="objc"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSNumber.html"><span style="color: #0000ff;">NSNumber</span></a> *average = <span style="color: #002200;">&#91;</span>bookshelf valueForKeyPath:@<span style="color: #666666;">&quot;@avg.price&quot;</span><span style="color: #002200;">&#93;</span>;</pre>
<h2>Conclusion</h2>
<p>The Cocoa libraries provide some very powerful abstractions which can make your life and that of the people reading your code much easier. It pays off to know about them, so go ahead and browse the Cocoa documentation and hunt for those gems!</p>
<p>Apple's <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Predicates/predicates.html">NSPredicate programming guide</a> provides an in-depth documentation for <code>NSPredicate</code> containing all the things I didn't cover in this post.</p>
<p><code>NSPredicate</code> also plays an important role when querying data in Core Data, something we will need to have a look at in one of the next blog posts. Stay tuned!</p>
<h2>Code</h2>
<p>The code for this post is available on my github page: <a href="http://github.com/peterfriese/NSPredicateDemo">get forking</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/using-nspredicate-to-filter-data/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Your Windows IDE sucks? Replace it with Your Favorite Editor on the Mac!</title>
		<link>http://www.peterfriese.de/your-windows-ide-sucks-replace-it-with-your-favorite-editor-on-the-mac/</link>
		<comments>http://www.peterfriese.de/your-windows-ide-sucks-replace-it-with-your-favorite-editor-on-the-mac/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 22:11:11 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Samsung]]></category>
		<category><![CDATA[symlink]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[TV]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=643</guid>
		<description><![CDATA[For a current project, I need to use a Windows-based IDE that really sucks. So instead of letting the IDE degrade my productivity, I decided to use some combined Windows/Mac wizardry to solve the problem.The IDE in question is Samsung's TV App SDK. Basically, it's just a Windows-based Visual-Studio look-alike IDE with editor support for [...]]]></description>
			<content:encoded><![CDATA[<p>For a <a href="http://www.samsungsmarttvchallenge.eu/">current project</a>, I need to use a Windows-based IDE that really sucks. So instead of letting the IDE degrade my productivity, I decided to use some combined Windows/Mac wizardry to solve the problem.<span id="more-643"></span>The IDE in question is Samsung's TV App SDK. Basically, it's just a Windows-based Visual-Studio look-alike IDE with editor support for CSS, JavaScript and HTML and an Emulator for Samsung TV kits. Nothing too complicated, really. In fact, the editor is quite OK. </p>
<div id="attachment_647" class="wp-caption alignleft" style="width: 310px"><a class="lightbox"  title ="Samsung TV App SDK" href="http://www.peterfriese.de/wp-content/Samsung-TV-App-SDK.png"><img src="http://www.peterfriese.de/wp-content/Samsung-TV-App-SDK-300x208.png" alt="Samsung TV App SDK" title="Samsung TV App SDK" width="300" height="208" class="size-medium wp-image-647" /></a><p class="wp-caption-text">Samsung TV App SDK</p></div>
<p>The part about it that really sucks is the project management. How come tool vendors still think it's good style in 2010 to place the projects under <em>Program Files\Samsung TV Apps SDK\Apps</em>? There's no way to store your project files in a different location. The project open dialog just won't let you navigate to some other place:</p>
<div id="attachment_642" class="wp-caption alignleft" style="width: 310px"><a class="lightbox"  title ="Samsung TV App SDK Project Management Dialog" href="http://www.peterfriese.de/wp-content/Samsung_TV_App_SDK_ProjectManagement.png"><img src="http://www.peterfriese.de/wp-content/Samsung_TV_App_SDK_ProjectManagement-300x219.png" alt="Samsung TV App SDK Project Management Dialog" title="Samsung TV App SDK Project Management Dialog" width="300" height="219" class="size-medium wp-image-642" /></a><p class="wp-caption-text">Samsung TV App SDK Project Management Dialog</p></div>
<p>So I wanted to be able to edit my files on the Mac (using <a href="http://macromates.com/">TextMate</a>) while still using the good parts of the Samsung TV SDK (i.e., the Emulator).</p>
<p>I'm using VMware Fusion to run Windows 7 and the Samsung SDK (no, there is no version for the Mac). Most virtualization solutions offer a mechanism to share folders between the host and the guest OS. So I quickly set up folder sharing between my Mac and the guest OS, in this case Windows 7.</p>
<p>Now that I can see the project files both on the Mac and on the Windows machine, how can I make sure I can open the project in the Samsung TV SDK IDE? As I mentioned before, there's no way to tell the IDE to open projects form other locations than <em>Program Files\Samsung TV Apps SDK\Apps</em>!</p>
<p>After playing around with some more or less usable folder synchronization utilities, I came up with something most MacOS / Linux users should be familiar with: <a href="http://en.wikipedia.org/wiki/Symbolic_link">symbolic links</a>! While symlinks have been around in Unix-like OSes for ages, they have been rarely known to Windows users for most of the time. However, <a href="http://en.wikipedia.org/wiki/NTFS_symbolic_link">starting with Windows NT</a>, you can create symbolic links, hard links and junctions using a nifty little tool called <em><a href="http://www.howtogeek.com/howto/windows-vista/using-symlinks-in-windows-vista/">mklink</a></em>. Unfortunately, you're not allowed to run <em>mklink</em> if you're not an administrator. Using <em>runas</em> (which is Windows' equivalent of <em>sudo</em>), didn't help as the shared folders weren't visible to the admin user.</p>
<p>To cut a long story short, I found <a href="http://code.google.com/p/symlinker">Symlinker</a>, a UI tool that helps in creating symlinks on Windows. As it is a UI tool, you can run it with administrator privileges (by selecting Run as Admin from the context menu). Using a <a href="http://en.wikipedia.org/wiki/Path_(computing)">UNC</a> path, you can create a <a href="http://en.wikipedia.org/wiki/NTFS_symbolic_link">symlink</a> to a VMware shared folder and place this symlink in the location the Samsung IDE expects it to be.</p>
<p>Finally, I can edit my files on the Mac and run the app in Samsung's Emulator on my hosted Windows machine. And as the files on my Mac are mapped to the hosted Windows machine via a symlink, I do not suffer a synchronization lag - all files are updated instantaneously <img src='http://www.peterfriese.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/your-windows-ide-sucks-replace-it-with-your-favorite-editor-on-the-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running AppleScript from Java</title>
		<link>http://www.peterfriese.de/running-applescript-from-java/</link>
		<comments>http://www.peterfriese.de/running-applescript-from-java/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 19:42:38 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[AppleScript]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=387</guid>
		<description><![CDATA[In my current project, I need to launch an external application and maybe execute some additional commands on this external application. Due to the very nature of the project, the whole system will always be run on Mac OS X. So I thought, "why not use AppleScript"? Turns out using AppleScript to launch applications is [...]]]></description>
			<content:encoded><![CDATA[<p>In my current project, I need to launch an external application and maybe execute some additional commands on this external application. Due to the very nature of the project, the whole system will always be run on Mac OS X. So I thought, "why not use AppleScript"?<span id="more-387"></span><br />
Turns out using AppleScript to launch applications is fairly easy, all you have to do is </p>
<pre>tell application "name of your app" to launch</pre>
<p>If you want to try this from the command line, <em>osascript</em> comes in handy:</p>
<pre>osascript -e 'tell app "iTunes" to launch'</pre>
<p>So far so good. Should be easy to do this from Java, shouldn't it? Turns out it's not so easy at all. Let's try this:</p>
<pre class="java">  <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> launchCmd = <span style="color: #ff0000;">&quot;osascript -e 'tell application <span style="color: #000099; font-weight: bold;">\&quot;</span>iTunes<span style="color: #000099; font-weight: bold;">\&quot;</span> to play'&quot;</span>;
  process = <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ARuntime+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Runtime</span></a>.<span style="color: #006600;">getRuntime</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">exec</span><span style="color: #66cc66;">&#40;</span>launchCmd<span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ABufferedReader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">BufferedReader</span></a> bufferedReader = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ABufferedReader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">BufferedReader</span></a><span style="color: #66cc66;">&#40;</span>
    <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AInputStreamReader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">InputStreamReader</span></a><span style="color: #66cc66;">&#40;</span>process.<span style="color: #006600;">getErrorStream</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>lsString = bufferedReader.<span style="color: #006600;">readLine</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>lsString<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span></pre>
<p>I'm not sure why, but it results in a nasty "<em>0:1: syntax error: A unknown token can't go here. (-2740)</em>" error message.</p>
<p>But there is another signature for Runtime.exec:</p>
<pre class="java">  <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> cmd = <span style="color: #66cc66;">&#123;</span> <span style="color: #ff0000;">&quot;osascript&quot;</span>, <span style="color: #ff0000;">&quot;-e&quot;</span>,	<span style="color: #ff0000;">&quot;tell app <span style="color: #000099; font-weight: bold;">\&quot;</span>iPhone Simulator<span style="color: #000099; font-weight: bold;">\&quot;</span> to launch&quot;</span> <span style="color: #66cc66;">&#125;</span>;
  process = <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ARuntime+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Runtime</span></a>.<span style="color: #006600;">getRuntime</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">exec</span><span style="color: #66cc66;">&#40;</span>cmd<span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ABufferedReader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">BufferedReader</span></a> bufferedReader = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ABufferedReader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">BufferedReader</span></a><span style="color: #66cc66;">&#40;</span>
    <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AInputStreamReader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">InputStreamReader</span></a><span style="color: #66cc66;">&#40;</span>process.<span style="color: #006600;">getErrorStream</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>lsString = bufferedReader.<span style="color: #006600;">readLine</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>lsString<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span></pre>
<p>... and this works out just fine!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/running-applescript-from-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mac in Black: Taking Screenshots with Skitch</title>
		<link>http://www.peterfriese.de/mac-in-black-skitch/</link>
		<comments>http://www.peterfriese.de/mac-in-black-skitch/#comments</comments>
		<pubDate>Sun, 24 May 2009 22:16:11 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Stuff that rocks]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=258</guid>
		<description><![CDATA[Last week, Heiko, Jan and I were talking about blogging about the tools that make our lifes easier on the Mac. "Isn't the Mac supposed to be making your life easier anyway?" you might ask. Well, most things really are easy with a Mac. However, there are some things that cannot be done easily with [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, <a href="http://www.1160pm.net/">Heiko</a>, <a href="http://koehnlein.blogspot.com/">Jan</a> and I were talking about blogging about the tools that make our lifes easier on the Mac. "Isn't the Mac supposed to be making your life easier anyway?" you might ask. Well, most things really are easy with a Mac. However, there are some things that cannot be done easily with a Mac. More often than not, this is due to the fact that Apple tries to hide the complexity of computers from nosy users. Which is fine for beginners - but makes life harder for the pros. Thankfully, there is a vast array of tools out there that fill the gap and make life on a Mac easier.</p>
<p>I am going to try to post one tool recommendation per week - unless I am on vacation or speaking at a conference.</p>
<p>So without further ado, here is the first tool: <a href="http://www.skitch.com/">Skitch</a>!</p>
<p>Skitch is a tool that helps you to create screenshots. I need to create lots of screenshots: for documentation, to explain things to people by mail, and to annotate my bug reports. Of course, Mac OSX has several shortcuts to create screenshots, so what's the deal about Skitch?</p>
<p>First of all, Skitch allows you to view and edit your screenshot: press CMD+SHIFT+5, select the capture area and voilà - Skitch opens a window showing the screenshot just taken:<br />
<a href="http://www.flickr.com/photos/81029262@N00/3560151513" title="View 'Skitch itself' on Flickr.com">
<div style="text-align:center;"><img src="http://farm3.static.flickr.com/2469/3560151513_31ff0b4529.jpg" alt="Skitch itself" border="0" width="500" height="463" /></div>
<p></a></p>
<p>You can now use the tools at the left hand side of the Skitch window to highlight certain areas of the screenshot, which comes on handy if you're filing a bug report for your favorite open source tool.</p>
<p>When you're done with editing, you can either drag the image to another application (using the "drag me" tab at the bottom of the window) or you can post the image to the web. I have set up Skitch to use my Flickr account, so I can use the images in other tools right away (I am writing my blog posts in Mars Edit, which has a great Flickr integration, so I've got a complete tool chain here). Skitch supports a number of file formats (JPG, SVG, PDF, TIF, GIF, BMP and native Skitch), so you can select the desired file format before sending the image to the web or dragging it to another application.</p>
<p>All images are also stored in a local history, so if you need to go back to one of the screenshots you took a while ago, no problem with Skitch.</p>
<p>Skitch really has made my life on my Mac easier because it integrates with other tools (both online and offline) so well and because it eliminates many steps that made dealign with screenshots so cumbersome before.</p>
<p>You can download Skitch beta from <a href="http://www.skitch.com">http://www.skitch.com</a>. You will be asked to sign up, however, both the download and the software will work without registering.</p>
<p>Happy screen shooting <img src='http://www.peterfriese.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/mac-in-black-skitch/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Keyboard shortcuts for Apple Mail</title>
		<link>http://www.peterfriese.de/keyboard-shortcuts-for-apple-mail/</link>
		<comments>http://www.peterfriese.de/keyboard-shortcuts-for-apple-mail/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 23:41:33 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[english]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=178</guid>
		<description><![CDATA[I use Apple Mail on my MacBook Pro, mainly because it has a better integration with Spotlight than Thunderbird. It also has a nicer UI and is easier to configure. However, the keyboard shortcuts are really strange. In case you didn't find out yourself, here are the most important ones: Send message - CMD+SHIFT+D (what [...]]]></description>
			<content:encoded><![CDATA[<p>I use Apple Mail on my MacBook Pro, mainly because it has a better integration with Spotlight than Thunderbird. It also has a nicer UI and is easier to configure.</p>
<p>However, the keyboard shortcuts are really strange. In case you didn't find out yourself, here are the most important ones:</p>
<ul>
<li>Send message - <em>CMD+SHIFT+D</em> (what does the D stand for? <strong>D</strong>eliver?)</li>
<li>Apply rules to selected mails - <em>CMD+ALT+L</em> (L for ru<strong>L</strong>e ???)</li>
<li>Select all messages in a thread - <em>CMD+SHIFT+K</em> (K for sele<strong>K</strong>t ???)</li>
<li>Erase junk mail - <em>CMD+ALT+J</em> (now, this is obvious - J for <strong>J</strong>unk)</li>
</ul>
<p>Apple developers, if you read this, please comment on the deeper meaning behind the shortcuts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/keyboard-shortcuts-for-apple-mail/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CVS on a Mac</title>
		<link>http://www.peterfriese.de/cvs-on-a-mac/</link>
		<comments>http://www.peterfriese.de/cvs-on-a-mac/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 18:52:04 +0000</pubDate>
		<dc:creator>Peter Friese</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[english]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=172</guid>
		<description><![CDATA[In order to be able to work on some of our Xtext / Eclipse related build scripts, I needed to install a CVS command line client on my Mac. Now if you google for "cvs mac", you'll get a large list of result, basically telling you to get the Apple Xcode SDK. While the Xcode [...]]]></description>
			<content:encoded><![CDATA[<p>In order to be able to work on some of our <a href="http://www.xtext.org">Xtext</a> / <a href="http://www.eclipse.org">Eclipse</a> related build scripts, I needed to install a <a href="http://www.nongnu.org/cvs/">CVS</a> command line client on my Mac. Now if you google for "<a href="http://www.google.com/search?hl=en&amp;q=cvs+mac">cvs mac</a>", you'll get a large list of result, basically telling you to get the <a href="http://developer.apple.com/technology/xcode.html">Apple Xcode SDK</a>. While the Xcode SDK is for free, and usually you don't even need to download it from the <a href="http://developer.apple.com/">Apple Developer Connection's website</a> (as you already have it on your Mac install disks as <a href="http://www.lullabot.com/videocast/install_cvs_mac_osx">Lullabot</a> points out), it occurred to me that installing a 1+GB space hog seems to be a bit of an overkill for getting a tiny application.</p>
<p>So I decided to give <a href="http://www.finkproject.org/">Fink</a> a try. Here is what you need to do to get a CVS commandline client on your Mac:</p>
<ol>
<li><a href="http://www.finkproject.org/download/index.php?phpLang=en">Download Fink</a></li>
<li>Install Fink</li>
<li>Copy FinkCommander to your Applications folder</li>
<li>Start FinkCommander</li>
<li>In the search box, type "cvs"<br />
<a title="View 'Fink Commander' on Flickr.com" href="http://www.flickr.com/photos/81029262@N00/3274121893"></p>
<div style="text-align:center;"><img src="http://farm4.static.flickr.com/3513/3274121893_93b22306c0.jpg" border="0" alt="Fink Commander" width="500" height="383" /></div>
<p></a></li>
<li>Click on the "install binary package" button (it's the leftmost, with the blue plus sign)</li>
<li>In the lower pane, you can now watch Fink downloading and installing the CVS package.<br />
<a title="View 'Fink Commander, CVS installed' on Flickr.com" href="http://www.flickr.com/photos/81029262@N00/3274949728"></p>
<div style="text-align:center;"><img src="http://farm4.static.flickr.com/3391/3274949728_0fbd4612b3.jpg" border="0" alt="Fink Commander, CVS installed" width="500" height="383" /></div>
<p></a></li>
<li>Let's see if it works. Open a command line window and type "cvs":<br />
<a title="View 'CVS command line' on Flickr.com" href="http://www.flickr.com/photos/81029262@N00/3274132941"></p>
<div style="text-align:center;"><img src="http://farm4.static.flickr.com/3397/3274132941_36c13ac586.jpg" border="0" alt="CVS command line" width="500" height="379" /></div>
<p></a></li>
<p>Perfect!</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/cvs-on-a-mac/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

