<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><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: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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Performant Design</title>
	
	<link>http://www.performantdesign.com</link>
	<description />
	<lastBuildDate>Tue, 12 Jan 2010 20:30:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/PerformantDesign" /><feedburner:info uri="performantdesign" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Creating Demo Videos of iPhone Apps</title>
		<link>http://feedproxy.google.com/~r/PerformantDesign/~3/lIk6eKfJagE/</link>
		<comments>http://www.performantdesign.com/2010/01/12/creating-demo-videos-of-iphone-apps/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 20:26:56 +0000</pubDate>
		<dc:creator>Aaron Kardell</dc:creator>
				<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.performantdesign.com/?p=188</guid>
		<description><![CDATA[Mobile Orchard, the #1 iPhone Developer News site, published a couple articles I wrote detailing how to create demo videos of iPhone apps:

Five Tips for Producing a Demo Video for Your iPhone App
Simulating Native Apps In iPhone Simulator For Better Demo Videos

Enjoy!
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mobileorchard.com/">Mobile Orchard</a>, the #1 iPhone Developer News site, published a couple articles I wrote detailing how to create demo videos of iPhone apps:</p>
<ul>
<li><a href="http://www.mobileorchard.com/five-tips-for-producing-a-demo-video-for-your-iphone-app/">Five Tips for Producing a Demo Video for Your iPhone App</a></li>
<li><a href="http://www.mobileorchard.com/simulating-native-apps-in-iphone-simulator-for-better-demo-videos/">Simulating Native Apps In iPhone Simulator For Better Demo Videos</a></li>
</ul>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.performantdesign.com/2010/01/12/creating-demo-videos-of-iphone-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.performantdesign.com/2010/01/12/creating-demo-videos-of-iphone-apps/</feedburner:origLink></item>
		<item>
		<title>cocoasudo: A graphical Cocoa based alternative to sudo</title>
		<link>http://feedproxy.google.com/~r/PerformantDesign/~3/HPN21JRio_M/</link>
		<comments>http://www.performantdesign.com/2009/10/26/cocoasudo-a-graphical-cocoa-based-alternative-to-sudo/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 22:52:56 +0000</pubDate>
		<dc:creator>Aaron Kardell</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Objective C]]></category>

		<guid isPermaLink="false">http://www.performantdesign.com/?p=164</guid>
		<description><![CDATA[Sudo is &#8220;a program for some Unix and Unix-like computer operating systems that allows users to run programs with the security privileges of another user (normally the superuser, a.k.a. root).&#8221; (Wikipedia reference).  It works great for command line applications &#8211; especially for running them from a terminal prompt, or as part of a shell [...]]]></description>
			<content:encoded><![CDATA[<p>Sudo is &#8220;a program for some Unix and Unix-like computer operating systems that allows users to run programs with the security privileges of another user (normally the superuser, a.k.a. root).&#8221; (<a href="http://en.wikipedia.org/wiki/Sudo">Wikipedia reference</a>).  It works great for command line applications &#8211; especially for running them from a terminal prompt, or as part of a shell utility.</p>
<p>For Mac OS X Cocoa-based apps, there is analagous ability to sudo provided via the <a href="http://developer.apple.com/documentation/Security/Reference/authorization_ref/authorization_ref.pdf">Authorization Services API</a>.  Use of the API allows you to prompt the user for their username and password requesting the ability to escalate privileges.</p>
<div id="attachment_167" class="wp-caption center" style="width: 360px"><img src="http://www.performantdesign.com/wp-content/uploads/2009/10/Authorization-Services-Dialog.png" alt="System Preferences app's use of Authorization Services API" title="Authorization Services Example Dialog" width="350" height="200" class="size-full wp-image-167" /><p class="wp-caption-text">System Preferences app's use of Authorization Services API</p></div>
<p>The Authorization Services API is a bit complicated.  All the more so if you&#8217;re not writing a Cocoa app in Objective C.  For example, maybe you&#8217;re using a scripting language, or you&#8217;re writing your GUI in Java / Swing for cross-platform use.</p>
<p>For that case, I&#8217;ve written a small utility that I&#8217;ve dubbed cocoasudo.  Use cocoasudo in much the same way you&#8217;d use sudo.  However, instead of users being prompted for their password in a Terminal window, they&#8217;ll get a dialog prompt via the Authorization Services API.</p>
<p>Usage:</p>
<pre class="brush: bash;">
cocoasudo [--icon=/path/to/icon.icns] [&quot;--prompt=This prompt will be displayed to users.&quot;] command-to-launch [command-arguments...]
</pre>
<p>Both the &#8211;icon and &#8211;prompt parameters are optional and may be omitted.</p>
<p>Download the source on <a href="http://github.com/performantdesign/cocoasudo/tree/master">Github</a>, or via your git client:</p>
<pre class="brush: bash;">
git clone git://github.com/performantdesign/cocoasudo.git
</pre>
<p>Or, if you don&#8217;t have Xcode, or don&#8217;t want to compile from source, you can <a href="http://github.com/performantdesign/cocoasudo/blob/master/build/Release/cocoasudo">download the cocoasudo binary directly here</a>.</p>
<p>cocoasudo is Apache-licensed, so you can mostly use it as you see fit.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.performantdesign.com/2009/10/26/cocoasudo-a-graphical-cocoa-based-alternative-to-sudo/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.performantdesign.com/2009/10/26/cocoasudo-a-graphical-cocoa-based-alternative-to-sudo/</feedburner:origLink></item>
		<item>
		<title>Tell iPhone Devs – Pick Up The Phone!</title>
		<link>http://feedproxy.google.com/~r/PerformantDesign/~3/Ke3Fr1mO9Lc/</link>
		<comments>http://www.performantdesign.com/2009/09/16/tell-iphone-devs-pick-up-the-phone/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 11:01:26 +0000</pubDate>
		<dc:creator>Aaron Kardell</dc:creator>
				<category><![CDATA[iGarageSale]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iTunes]]></category>
		<category><![CDATA[New and Noteworthy]]></category>

		<guid isPermaLink="false">http://www.performantdesign.com/?p=146</guid>
		<description><![CDATA[At 8:45 Monday night, I received a call from an unrecognized number with a 408 area code. As a general habit I do not answer unrecognized calls in the evening. The iPhone said the number originated from Palo Alto, but I didn&#8217;t think much of it. 30 seconds later I received another call from the [...]]]></description>
			<content:encoded><![CDATA[<p>At 8:45 Monday night, I received a call from an unrecognized number with a 408 area code. As a general habit I do not answer unrecognized calls in the evening. The iPhone said the number originated from Palo Alto, but I didn&#8217;t think much of it. 30 seconds later I received another call from the same number. Still didn&#8217;t answer.</p>
<p>Soon, my iPhone indicated I had a message: &#8220;Aaron, hi my name is ____, I&#8217;m calling from Apple. Would you call me back as soon as you get this message, please? It&#8217;s regarding a very timely marketing opportunity. 408-xxx-xxxx. Thanks very much. Speak with you soon. Bye-bye.&#8221;</p>
<p>At this point, my jaw dropped. This is exactly the kind of call I had been hoping for, but realistically I never expected to get. Standing out in the App Store is difficult, and this could be a big opportunity for the <a href="http://www.igaragesaleapp.com/">iGarageSale</a> app.</p>
<p>It was late in the evening and I was at home hanging out with my son. I quickly scrambled to get him a toy to occupy him for a couple minutes, and then I returned the call. The gentleman at Apple indicated that they were interested in featuring <a href="http://www.igaragesaleapp.com/">iGarageSale</a> in iTunes and that they really like the app. However, they wanted me to change a bit of the description first.</p>
<p>Purchasers of iGarageSale receive a free MP3 download of &#8220;Holding On&#8221; by the independent artist, Mr. J. Medeiros. This is the song featured as background music in the <a href="http://www.youtube.com/watch?v=sdBtcS11DZE">demo video for iGarageSale</a>. Apple was fine with purchasers getting a free copy of the song as this is something that had been legally agreed to with the artist, but they wanted me to remove that fact from the description of the app in iTunes. They wanted people to buy the app for its own merits, not in the hopes of a free bundled MP3. I assume this is also to avoid potential confusion and complaints directly to Apple later, which is understandable. Since they didn&#8217;t require me to take away the freebie &#8211; just the promotion of it in the iTunes description, I said I&#8217;d make the change immediately.</p>
<p>The Apple representative asked how sales of the app were going and I said &#8220;OK, but not where I&#8217;d like them to be. Certainly having the app featured in iTunes will help!&#8221; He responded saying &#8220;Well, we&#8217;re not promising anything.&#8221; Then he chuckled and said, &#8220;But you might want to check the App Store tomorrow.&#8221;</p>
<p>Three hours later (around midnight), I saw this on the front page of the App Store section in iTunes:</p>
<p><img src="http://www.performantdesign.com/wp-content/uploads/2009/09/iGarageSale-New-And-Noteworthy.png" alt="iGarageSale - New And Noteworthy in iTunes" title="iGarageSale - New And Noteworthy in iTunes" width="562" height="255" class="alignnone size-full wp-image-147" /></p>
<p>Naturally, I was pretty stoked to see this.</p>
<p>Yesterday was the first full day the app was featured in the <a href="http://bit.ly/IsSQ9">New and Noteworthy section of iTunes</a>. So, what kind of difference does it make to be featured?</p>
<p><img src="http://www.performantdesign.com/wp-content/uploads/2009/09/iGarageSale-Sales1.png" alt="iGarageSale Revenue Graph" title="iGarageSale Revenue Graph" width="550" height="343" class="alignnone size-full wp-image-151" /></p>
<p>Other peaks on the graph cover things like the first weekend of the release, an ad campaign the following week, pricing promotions, and the introduction of a Lite app. However, all of those events pale in comparison to being featured in the App Store.</p>
<p>So, in conclusion &#8211; if you&#8217;ve released an iPhone app and you get a call from a 408 number, I suggest you answer!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.performantdesign.com/2009/09/16/tell-iphone-devs-pick-up-the-phone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.performantdesign.com/2009/09/16/tell-iphone-devs-pick-up-the-phone/</feedburner:origLink></item>
		<item>
		<title>s3-bash – No newline the secret key file</title>
		<link>http://feedproxy.google.com/~r/PerformantDesign/~3/KQgcfg7MzGA/</link>
		<comments>http://www.performantdesign.com/2009/09/14/s3-bash-no-newline-the-secret-key-file/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 05:02:37 +0000</pubDate>
		<dc:creator>Aaron Kardell</dc:creator>
				<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[Amazon Web Services]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.performantdesign.com/?p=143</guid>
		<description><![CDATA[If you use the s3-bash utilities with Amazon&#8217;s S3 service, you&#8217;ll find that one of the parameters asks for a file that contains the secret key. There&#8217;s important thing to note about this file &#8211; it must contain just the secret key without a newline. To check this, listing the file with ls -l should [...]]]></description>
			<content:encoded><![CDATA[<p>If you use the <a href="http://code.google.com/p/s3-bash/">s3-bash</a> utilities with Amazon&#8217;s S3 service, you&#8217;ll find that one of the parameters asks for a file that contains the secret key. There&#8217;s important thing to note about this file &#8211; it must contain just the secret key without a newline. To check this, listing the file with ls -l should show that the file is 40 bytes. If it&#8217;s 41, you&#8217;ve got a newline and it won&#8217;t work. If you don&#8217;t have a text editor handy that will do this for you, you can use the following command to output your secret key to a file without the newline:</p>
<pre class="brush: bash;">
echo SECRET_KEY_HERE|tr -d '\n' &gt; secret-key-file
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.performantdesign.com/2009/09/14/s3-bash-no-newline-the-secret-key-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.performantdesign.com/2009/09/14/s3-bash-no-newline-the-secret-key-file/</feedburner:origLink></item>
		<item>
		<title>Facebook iPhone Session Proxy in PHP (FBSession getSessionProxy)</title>
		<link>http://feedproxy.google.com/~r/PerformantDesign/~3/Kh76e-2ub9Q/</link>
		<comments>http://www.performantdesign.com/2009/09/03/facebook-iphone-session-proxy-in-php-fbsession-getsessionproxy/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 04:27:29 +0000</pubDate>
		<dc:creator>Aaron Kardell</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Facebook Connect]]></category>
		<category><![CDATA[FBConnect]]></category>
		<category><![CDATA[getSessionProxy]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://www.performantdesign.com/?p=138</guid>
		<description><![CDATA[If your iPhone app incorporates the Facebook Connect for iPhone library, one of the first things you will do is instantiate an FBSession object. Developers are given two choices for this according to the wiki:

session = [FBSession sessionForApplication:myApiKey secret:myAppSecret delegate:self];

or:

session = [FBSession sessionForApplication:myApiKey getSessionProxy:myURL delegate:self];

The first option is quick to implement, and an OK option [...]]]></description>
			<content:encoded><![CDATA[<p>If your iPhone app incorporates the Facebook Connect for iPhone library, one of the first things you will do is instantiate an FBSession object. Developers are given <a href="http://wiki.developers.facebook.com/index.php/Facebook_Connect_for_iPhone#Working_with_Sessions">two choices for this according to the wiki</a>:</p>
<pre class="brush: plain;">
session = [FBSession sessionForApplication:myApiKey secret:myAppSecret delegate:self];
</pre>
<p>or:</p>
<pre class="brush: plain;">
session = [FBSession sessionForApplication:myApiKey getSessionProxy:myURL delegate:self];
</pre>
<p>The first option is quick to implement, and an OK option for initial testing. However, it is inherently insecure as it requires you to release your Facebook application&#8217;s secret key embedded in your code.</p>
<p>Unfortunately, implementing the second option isn&#8217;t straightforward.<span id="more-138"></span> The wiki implies that you need to provide a proxy URL and that needs to be a thin wrapper for facebook.auth.getSession.</p>
<p>If you are using the standard PHP client libraries that Facebook provides, you may already be familiar with the auth_getSession function. auth_getSession abstracts things a bit and returns an associative array, while you need to provide the underlying XML. If you dig into the code a bit, you might notice that auth_getSession calls off to the call_method function, which in turn calls off to the post_request function. My initial thought (which others also had) was to try a solution like this:</p>
<pre class="brush: php;">
$params = array('auth_token' =&gt; $_GET['auth_token'],
               'generate_session_secret' =&gt; TRUE);
$xml = $facebook-&gt;api_client-&gt;post_request('facebook.auth.getSession', $params);
header('Content-Type: text/xml;charset=utf-8');
echo $xml;
</pre>
<p>Unfortunately, this solution produces an &#8220;Invalid parameter&#8221; failure error from Facebook.</p>
<p>After digging further, it became apparent that the post_request function was adding an empty session_key parameter to the request. Facebook&#8217;s servers throw up an &#8220;Invalid parameter&#8221; failure error because it assumes if you are calling facebook.auth.getSession to get a session key, you shouldn&#8217;t be providing a session_key parameter (even if it is blank).</p>
<p>There&#8217;s no easy way around this with the client libraries, so I stripped the client library down to a thin wrapper that you can use as a session proxy. Just put this script on your server and point the getSessionProxy: parameter in your iPhone app to the URL where your script is hosted. Don&#8217;t forget to add in your Facebook app&#8217;s API key and secret token.</p>
<pre class="brush: php;">
&lt;?php
// Replace with your Facebook application's API Key and App Secret below
$appapikey = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
$appsecret = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb';

// Adapted heavily from Facebook client libraries...

$post = array('method' =&gt; 'facebook.auth.getSession',
              'api_key' =&gt; $appapikey,
              'v' =&gt; '1.0',
              'auth_token' =&gt; $_GET['auth_token'],
              'generate_session_secret' =&gt; 1/*TRUE*/);

$post['sig'] = generate_sig($post, $appsecret);

$post_params = array();
foreach ($post as $key =&gt; &amp;$val) {
  $post_params[] = $key.'='.urlencode($val);
}
$post_string = implode('&amp;', $post_params);

header('Content-Type: text/xml;charset=utf-8');
echo post('http://api.facebook.com/restserver.php', $post_string);

function post($url, $post_string) {
  if (function_exists('curl_init')) {
    $useragent = 'Facebook API PHP5 Client 1.1 (curl) ' . phpversion();
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    $result = curl_exec($ch);
    curl_close($ch);
  }
  else {
    $user_agent = 'Facebook API PHP5 Client 1.1 (non-curl) ' . phpversion();
    $context =
      array('http' =&gt;
              array('method' =&gt; 'POST',
                    'user_agent' =&gt; $user_agent,
                    'header' =&gt; &quot;Content-Type: application/x-www-form-urlencoded\r\n&quot; .
                                'Content-Length: ' . strlen($post_string),
                    'content' =&gt; $post_string));
    $context_id = stream_context_create($context);
    $sock = fopen($url, 'r', false, $context_id);

    $result = '';
    if ($sock) {
      while (!feof($sock)) {
        $result .= fgets($sock, 4096);
      }
      fclose($sock);
    }
  }
  return $result;
}

function generate_sig($params_array, $secret) {
  $str = '';

  ksort($params_array);
  // Note: make sure that the signature parameter is not already included in
  //       $params_array.
  foreach ($params_array as $k=&gt;$v) {
    $str .= &quot;$k=$v&quot;;
  }
  $str .= $secret;

  return md5($str);
}
</pre>
<p>If you want a version of this in Python instead, check out this <a href="http://www.shuningbian.net/2009/05/facebook-python-authentication-gateway.php">Facebook python authentication gateway</a> post. I haven&#8217;t tested it, but it did provide some insight and inspiration for the PHP script above.</p>
<p>UPDATE: Fixed line 47 based on Nils&#8217; comment. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.performantdesign.com/2009/09/03/facebook-iphone-session-proxy-in-php-fbsession-getsessionproxy/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://www.performantdesign.com/2009/09/03/facebook-iphone-session-proxy-in-php-fbsession-getsessionproxy/</feedburner:origLink></item>
		<item>
		<title>scrollIntoView, but only if out of view</title>
		<link>http://feedproxy.google.com/~r/PerformantDesign/~3/3F55aclfdzk/</link>
		<comments>http://www.performantdesign.com/2009/08/26/scrollintoview-but-only-if-out-of-view/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 15:05:43 +0000</pubDate>
		<dc:creator>Aaron Kardell</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.performantdesign.com/blog/?p=3</guid>
		<description><![CDATA[On browsers such as Firefox, the scrollIntoView function silently returns without action if the element in question is already on the screen.  However, in IE6, and perhaps other browsers, it causes the screen to scroll even if it is already in view.  To workaround this, and only call the scrollIntoView function if the [...]]]></description>
			<content:encoded><![CDATA[<p>On browsers such as Firefox, the scrollIntoView function silently returns without action if the element in question is already on the screen.  However, in IE6, and perhaps other browsers, it causes the screen to scroll even if it is already in view.  To workaround this, and only call the scrollIntoView function if the element in question is out of view, I wrote the following helper method &#8212; scrollIntoViewIfOutOfView.</p>
<p><span id="more-3"></span></p>
<pre class="brush: jscript;">
function scrollIntoViewIfOutOfView(el) {
  var topOfPage = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
  var heightOfPage = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
  var elY = 0;
  var elH = 0;
  if (document.layers) { // NS4
    elY = el.y;
    elH = el.height;
  }
  else {
    for(var p=el; p&amp;&amp;p.tagName!='BODY'; p=p.offsetParent){
      elY += p.offsetTop;
    }
    elH = el.offsetHeight;
  }
  if ((topOfPage + heightOfPage) &lt; (elY + elH)) {
    el.scrollIntoView(false);
  }
  else if (elY &lt; topOfPage) {
    el.scrollIntoView(true);
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.performantdesign.com/2009/08/26/scrollintoview-but-only-if-out-of-view/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.performantdesign.com/2009/08/26/scrollintoview-but-only-if-out-of-view/</feedburner:origLink></item>
		<item>
		<title>find | xargs grep: hack of the day</title>
		<link>http://feedproxy.google.com/~r/PerformantDesign/~3/fxZkA88kpMc/</link>
		<comments>http://www.performantdesign.com/2007/09/05/find-xargs-grep-hack-of-the-day/#comments</comments>
		<pubDate>Wed, 05 Sep 2007 21:08:33 +0000</pubDate>
		<dc:creator>Aaron Kardell</dc:creator>
				<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.performantdesign.com/blog/2007/09/05/find-xargs-grep-hack-of-the-day/</guid>
		<description><![CDATA[Even with today&#8217;s modern IDE&#8217;s and plethora of search tools (Spotlight, etc.), I still find myself occasionally dropping to a bash shell to look for something in an unknown file.  In the past, I was a bit frustrated that my combination of find &#124; xargs grep would bomb out on any files or directories [...]]]></description>
			<content:encoded><![CDATA[<p>Even with today&#8217;s modern IDE&#8217;s and plethora of search tools (Spotlight, etc.), I still find myself occasionally dropping to a bash shell to look for something in an unknown file.  In the past, I was a bit frustrated that my combination of find | xargs grep would bomb out on any files or directories that included a space.  Today it dawned on me that there&#8217;s a simple workaround for this&#8230;  Prefix and postfix each file with a quote via sed.  The following example recipe will find the text textIAmSearchingFor in any .java file in the current tree.</p>
<p><span id="more-21"></span></p>
<pre class="brush: bash;">
find . -name &quot;*.java&quot; | sed 's/^/&quot;/' | sed 's/$/&quot;/' | xargs grep &quot;textIAmSearchingFor&quot; | less
</pre>
<p>UPDATE: As Nicholas points out in the comments below, there&#8217;s an easier more efficient way to do this:</p>
<pre class="brush: bash;">
find . -iname &quot;*.java&quot; -print0 | xargs -0 grep -i &quot;SearchString&quot; | less
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.performantdesign.com/2007/09/05/find-xargs-grep-hack-of-the-day/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.performantdesign.com/2007/09/05/find-xargs-grep-hack-of-the-day/</feedburner:origLink></item>
		<item>
		<title>Yahoo! Pipes, PHP, and web services</title>
		<link>http://feedproxy.google.com/~r/PerformantDesign/~3/nb0aen08BmE/</link>
		<comments>http://www.performantdesign.com/2007/09/01/yahoo-pipes-php-and-web-services/#comments</comments>
		<pubDate>Sat, 01 Sep 2007 23:22:35 +0000</pubDate>
		<dc:creator>Aaron Kardell</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.performantdesign.com/blog/2007/09/01/yahoo-pipes-php-and-web-services/</guid>
		<description><![CDATA[I&#8217;ve finally taken the time to play around with Yahoo Pipes.  I&#8217;ll probably do a few posts over the next couple of days on my findings, but I&#8217;ll get started with the basics on how to write a json web service in PHP that can be called from Pipes.  The capability to call [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally taken the time to play around with Yahoo Pipes.  I&#8217;ll probably do a few posts over the next couple of days on my findings, but I&#8217;ll get started with the basics on how to write a json web service in PHP that can be called from Pipes.  The capability to call a web service from Pipes is a <a target="_blank" href="http://blog.pipes.yahoo.com/2007/08/13/power-your-own-module/">recently added addition</a> by Yahoo that could prove to be very powerful.</p>
<p>There&#8217;s a good post and recipe for getting started over at <a target="_blank" href="http://labs.echoditto.com/pipes-and-php">echoditto labs</a>.  Unfortunately, my web host had two things that made this recipe a non-starter.  First, they don&#8217;t allow compiling C++ extensions for PHP, as is required by the <a target="_blank" href="http://pecl.php.net/package/json">JSON PECL package</a>.  Second, they have PHP&#8217;s annoying little magic_quotes_gpc setting turned on.</p>
<p>Here&#8217;s a little recipe that may help you get started.  You&#8217;ll need to first download the <a target="_blank" href="http://pear.php.net/pepr/pepr-proposal-show.php?id=198">Services_JSON library</a> &#8212; a proposed addition to PEAR that encodes and decodes JSON.  The recipe below assumes that you use <em>items</em> as the input for the &#8220;Path to item list&#8221; prompt in Pipes.  The recipe is simple and straightforward.  It is the moral equivalent of <a target="_blank" href="http://blog.pipes.yahoo.com/examples/example.03.html">Yahoo&#8217;s Java example</a> &#8212; it simply appends &#8221; (This text was added by the external Web Service)&#8221; to the title of each item in the feed.  It provides one additional bit of functionality that may help you get started.  It logs the decoded input value to pipes-log.txt.  This will help give you an idea of what your input is.</p>
<p><span id="more-20"></span></p>
<pre class="brush: php;">
&lt;?php
require_once 'JSON.php';

$json = new Services_JSON();

$value = $json-&gt;decode((get_magic_quotes_gpc() == 1) ? stripslashes($_POST['data']) : $_POST['data']);

$log_h = fopen(&quot;pipes-log.txt&quot;, &quot;a&quot;);
fwrite($log_h, &quot;Input Value: &quot; . print_r($value, true) . &quot;\n&quot;);
fclose($log_h);

for ($i=0; $iitems); $i++) {
  $value-&gt;items[$i]-&gt;title = $value-&gt;items[$i]-&gt;title . &quot; (This text was added by the external Web Service)&quot;;
}

$output = $json-&gt;encode($value);

header('Content-Type: application/json');
print($output);
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.performantdesign.com/2007/09/01/yahoo-pipes-php-and-web-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.performantdesign.com/2007/09/01/yahoo-pipes-php-and-web-services/</feedburner:origLink></item>
		<item>
		<title>Pipe your current results in less to a file</title>
		<link>http://feedproxy.google.com/~r/PerformantDesign/~3/QKgMCjq-xAo/</link>
		<comments>http://www.performantdesign.com/2007/08/29/pipe-your-current-results-in-less-to-a-file/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 04:35:58 +0000</pubDate>
		<dc:creator>Aaron Kardell</dc:creator>
				<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.performantdesign.com/blog/2007/08/29/pipe-your-current-results-in-less-to-a-file/</guid>
		<description><![CDATA[If you&#8217;re ever faced with having piped a long-running process into less, and then you suddenly realize you want to save those results, and don&#8217;t want to run that long-running process again, here&#8217;s a quick trick to pipe your current results out to a file:
1G (go to the first line)
&#124;$cat &#8211; > file.txt (pipe everything [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re ever faced with having piped a long-running process into <font face="Courier New">less</font>, and then you suddenly realize you want to save those results, and don&#8217;t want to run that long-running process again, here&#8217;s a quick trick to pipe your current results out to a file:</p>
<p><font face="Courier New">1G</font> (go to the first line)<br />
<font face="Courier New">|$cat &#8211; > file.txt</font> (pipe everything to the end of the file to file.txt)</p>
<p>PS &#8211; Please comment if you&#8217;ve found an easier means to this end.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.performantdesign.com/2007/08/29/pipe-your-current-results-in-less-to-a-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.performantdesign.com/2007/08/29/pipe-your-current-results-in-less-to-a-file/</feedburner:origLink></item>
		<item>
		<title>Simple Method for Tuning SQL Server</title>
		<link>http://feedproxy.google.com/~r/PerformantDesign/~3/_aGczpeGHSQ/</link>
		<comments>http://www.performantdesign.com/2007/01/26/simple-method-for-tuning-sql-server/#comments</comments>
		<pubDate>Sat, 27 Jan 2007 05:39:15 +0000</pubDate>
		<dc:creator>Aaron Kardell</dc:creator>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.performantdesign.com/blog/?p=5</guid>
		<description><![CDATA[I have written the following script and have found it to be a rather effective, minimally invasive, and low-tech way to track down troublesome SQL statements when tuning my apps for SQL Server.  I&#8217;ll usually set it up as a SQL Server Agent job to run once per minute.  It logs all currently [...]]]></description>
			<content:encoded><![CDATA[<p>I have written the following script and have found it to be a rather effective, minimally invasive, and low-tech way to track down troublesome SQL statements when tuning my apps for SQL Server.  I&#8217;ll usually set it up as a SQL Server Agent job to run once per minute.  It logs all currently running SQL statements to the SQLLog table, for analysis at a later date.  (Note that the job must be run as the sa user, or another user with sysadmin privileges in order for the fn_get_sql function to work.) The thing I like about this technique is that it seems to get a good cross-section of both long-running statements, and statements that may be short in duration, but are run often.  I&#8217;ll then do a count on statements to see where to focus my tuning efforts.  Enjoy!</p>
<p><span id="more-5"></span></p>
<pre class="brush: sql;">
-- SQLLog SQL Server Agent Job
-- Copyright (c) 2007 PerformantDesign.com

IF OBJECT_ID('SQLLog','U') IS NULL
CREATE TABLE SQLLog (sql_time datetime, sql_text varchar(8000))

DECLARE proc_cursor CURSOR FOR select sql_handle from [master].[dbo].[sysprocesses] where sql_handle &lt;&gt; 0x0000000000000000000000000000000000000000
OPEN proc_cursor
DECLARE @handle binary(20)
FETCH NEXT FROM proc_cursor INTO @handle
WHILE (@@FETCH_STATUS &lt;&gt; -1)
BEGIN
IF (@@FETCH_STATUS &lt;&gt; -2)
BEGIN
INSERT INTO SQLLog (sql_time, sql_text) SELECT getdate(), s.text FROM ::fn_get_sql(@handle) s
END
FETCH NEXT FROM proc_cursor INTO @handle
END
CLOSE proc_cursor
DEALLOCATE proc_cursor
</pre>
<pre class="brush: sql;">
SELECT COUNT(*) AS count, sql_text FROM SQLLog GROUP BY sql_text ORDER BY 1 DESC
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.performantdesign.com/2007/01/26/simple-method-for-tuning-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.performantdesign.com/2007/01/26/simple-method-for-tuning-sql-server/</feedburner:origLink></item>
	</channel>
</rss>
