<?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>Ted Naleid &#187; Uncategorized</title>
	<atom:link href="http://naleid.com/blog/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://naleid.com/blog</link>
	<description>Groovy, Grails and OS X tips and tricks</description>
	<lastBuildDate>Wed, 16 May 2012 00:54:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>big &#8211; A Quick Shell/AppleScript/LaunchBar Script to Shout Results</title>
		<link>http://naleid.com/blog/2011/05/17/big-a-quick-shellapplescriptlaunchbar-script-to-shout-results/</link>
		<comments>http://naleid.com/blog/2011/05/17/big-a-quick-shellapplescriptlaunchbar-script-to-shout-results/#comments</comments>
		<pubDate>Wed, 18 May 2011 03:47:17 +0000</pubDate>
		<dc:creator>tednaleid</dc:creator>
				<category><![CDATA[osx]]></category>
		<category><![CDATA[shortcut]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://naleid.com/blog/?p=361</guid>
		<description><![CDATA[I threw together a quick shell script, called big that leverages AppleScript and LaunchBar to display results in a huge font. Often, when I&#8217;m demoing something, the results of what I&#8217;m doing don&#8217;t really jump out at my audience. If I really want to get a point across to someone it&#8217;s nice to be able [...]]]></description>
			<content:encoded><![CDATA[<p>I threw together a quick shell script, called <code>big</code> that leverages AppleScript and <a href="http://www.obdev.at/products/launchbar/index.html" onclick="pageTracker._trackPageview('/outgoing/www.obdev.at/products/launchbar/index.html?referer=');">LaunchBar</a> to display results in a huge font.</p>
<p>Often, when I&#8217;m demoing something, the results of what I&#8217;m doing don&#8217;t really jump out at my audience. </p>
<p><a href="http://naleid.com/blog/wp-content/uploads/2011/05/terminal_result.png"><img src="http://naleid.com/blog/wp-content/uploads/2011/05/terminal_result.png" alt="" title="terminal_result" width="690" height="226" class="aligncenter size-full wp-image-365" /></a></p>
<p>If I really want to get a point across to someone it&#8217;s nice to be able to do it in a really big, clear font.    Just up arrow/ctrl-p to get the last command and append &#8220;<code>| big</code>&#8221; to get this:</p>
<p><a href="http://naleid.com/blog/wp-content/uploads/2011/05/big_result.png"><img src="http://naleid.com/blog/wp-content/uploads/2011/05/big_result.png" alt="" title="big_result" width="1068" height="454" class="alignleft size-full wp-image-366" /></a></p>
<p>This script takes the results of anything you pipe to it and sends it to LaunchBar to display in a really big font.  It get smaller the more text that you send to it, but starts at a ~200pt font.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /bin/bash</span>
&nbsp;
<span style="color: #007800;">TMP_FILE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">mktemp</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>big.XXXXXX<span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> - <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> <span style="color: #660033;">-20</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$TMP_FILE</span>
&nbsp;
osascript <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOF
tell application &quot;LaunchBar&quot;
    display in large type (do shell script(&quot;cat $TMP_FILE&quot;))
end tell
EOF</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$TMP_FILE</span></pre></div></div>

<p>It uses the <code>head</code> command to take only the first 20 lines, in case you&#8217;re trying to display something HUGE (which can kill LaunchBar if you feed it too much).  Adjust the head command appropriately to cap <code>big</code> to more/less output.</p>
]]></content:encoded>
			<wfw:commentRss>http://naleid.com/blog/2011/05/17/big-a-quick-shellapplescriptlaunchbar-script-to-shout-results/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vim Movement Shortcuts Wallpaper</title>
		<link>http://naleid.com/blog/2010/10/04/vim-movement-shortcuts-wallpaper/</link>
		<comments>http://naleid.com/blog/2010/10/04/vim-movement-shortcuts-wallpaper/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 01:42:54 +0000</pubDate>
		<dc:creator>tednaleid</dc:creator>
				<category><![CDATA[command line]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[shortcut]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://naleid.com/blog/?p=216</guid>
		<description><![CDATA[I&#8217;ve recently moved back to vim (actually MacVim) after a 5 year hiatus using TextMate. A big part of that move was inspired by Steve Losh&#8217;s recent post Coming Home to Vim which has a number of really great tips. I&#8217;ve cribbed many of them and have my .vimrc / .vim dotfiles checked into a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently moved back to vim (actually MacVim) after a 5 year hiatus using TextMate.  A big part of that move was inspired by Steve Losh&#8217;s recent post <a href="http://stevelosh.com/blog/2010/09/coming-home-to-vim/" onclick="pageTracker._trackPageview('/outgoing/stevelosh.com/blog/2010/09/coming-home-to-vim/?referer=');">Coming Home to Vim</a> which has a number of really great tips.</p>
<p>I&#8217;ve cribbed many of them and have my <a href="http://bitbucket.org/tednaleid/vimrc" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/vimrc?referer=');">.vimrc / .vim</a> dotfiles checked into a public bitbucket repo.</p>
<p>There have been some big changes in the last 5 years since I&#8217;ve been away from vim (or else I just didn&#8217;t know what the hell I was doing, which is also possible).  The addition of <a href="http://github.com/tpope/vim-pathogen" onclick="pageTracker._trackPageview('/outgoing/github.com/tpope/vim-pathogen?referer=');">pathogen</a> for plugin management makes configuration much easier.  All plugins are completely contained in their own directory.  You can try something out and if it doesn&#8217;t work, just delete the plugin&#8217;s directory to uninstall it.</p>
<p><a href="http://www.vim.org/scripts/script.php?script_id=1658" onclick="pageTracker._trackPageview('/outgoing/www.vim.org/scripts/script.php?script_id=1658&amp;referer=');">NerdTree</a> is nice, but <a href="http://peepcode.com/products/peepopen" onclick="pageTracker._trackPageview('/outgoing/peepcode.com/products/peepopen?referer=');">PeepOpen</a>&#8216;s integration with MacVim for finding/opening files beats TextMate&#8217;s cmd-T hands down.</p>
<p>I tend to be a hands-on, visual learner, so I looked around for a nice wallpaper to help me learn and retain the panoply of vim movement commands, but all I was able to find were simple lists of commands, so I decided to whip my own version up.</p>
<p>It shows all of the default movement commands, each command is placed relative to the center of the image and are ordered based on how far your cursor will likely travel.   All of these are active in vim&#8217;s &#8220;normal&#8221; mode (though I believe most if not all of them will also work in &#8220;visual&#8221; mode.</p>
<p>I also find it useful to set my MacVim window to be slightly transparent so that I can see the shortcuts through the window if I need to.  In MacVim 7.3 you need to turn on the Advanced->&#8221;Use experimental renderer&#8221; option.  Then you can &#8220;:set transp=20&#8243; to make it 20% transparent (which feels right to me, but you might want to move it up/down depending on your preferences).</p>
<p>You can <a href="http://bitbucket.org/tednaleid/vim-shortcut-wallpaper/raw/tip/vim-shortcuts.png" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/vim-shortcut-wallpaper/raw/tip/vim-shortcuts.png?referer=');">download the full size (1900&#215;1200)</a> (or <a href="http://bitbucket.org/tednaleid/vim-shortcut-wallpaper/raw/tip/vim-shortcuts2560x1600.png" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/vim-shortcut-wallpaper/raw/tip/vim-shortcuts2560x1600.png?referer=');">2560&#215;1600</a>) image for yourself.</p>
<p><a href="http://bitbucket.org/tednaleid/vim-shortcut-wallpaper/raw/tip/vim-shortcuts.png" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/vim-shortcut-wallpaper/raw/tip/vim-shortcuts.png?referer=');"><img src="http://bitbucket.org/tednaleid/vim-shortcut-wallpaper/raw/tip/vim-shortcuts.png" alt="Vim Shortcuts Wallpaper" height="600"/></a></p>
<p>I&#8217;ve also got the original OmniGraffle file that I used to create it <a href="http://bitbucket.org/tednaleid/vim-shortcut-wallpaper/src" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/vim-shortcut-wallpaper/src?referer=');">checked in to a BitBucket repo</a> if anyone feels like remixing it or adding their own shortcuts or customizations to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://naleid.com/blog/2010/10/04/vim-movement-shortcuts-wallpaper/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>Grails Jasypt Encryption Plugin presentation at Groovy Users of Minnesota</title>
		<link>http://naleid.com/blog/2010/08/11/grails-jasypt-encryption-plugin-presentation-at-groovy-users-of-minnesota/</link>
		<comments>http://naleid.com/blog/2010/08/11/grails-jasypt-encryption-plugin-presentation-at-groovy-users-of-minnesota/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 03:55:57 +0000</pubDate>
		<dc:creator>tednaleid</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://naleid.com/blog/?p=200</guid>
		<description><![CDATA[Last night I gave a presentation to the Groovy Users of Minnesota (GUM) group on the Grails Jasypt Encryption Plugin. It was well received and I was happy with the number of people that showed up on a hot summer night. Grails Jasypt Encryption Plugin A pdf of the presentation as well as the sample [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I gave a presentation to the <a href="http://groups.google.com/group/groovymn" onclick="pageTracker._trackPageview('/outgoing/groups.google.com/group/groovymn?referer=');">Groovy Users of Minnesota (GUM)</a> group on the <a href="http://bitbucket.org/tednaleid/grails-jasypt" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/grails-jasypt?referer=');">Grails Jasypt Encryption Plugin</a>.  It was well received and I was happy with the number of people that showed up on a hot summer night.</p>
<div style="width:425px" id="__ss_4948927"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/tednaleid/grails-jasypt-encryption-plugin" title="Grails Jasypt Encryption Plugin" onclick="pageTracker._trackPageview('/outgoing/www.slideshare.net/tednaleid/grails-jasypt-encryption-plugin?referer=');">Grails Jasypt Encryption Plugin</a></strong><object id="__sse4948927" width="850" height="710"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=grailsjasyptencryption-100811163043-phpapp01&#038;stripped_title=grails-jasypt-encryption-plugin" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse4948927" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=grailsjasyptencryption-100811163043-phpapp01&#038;stripped_title=grails-jasypt-encryption-plugin" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="850" height="710"></embed></object></div>
<p>A <a href="http://bitbucket.org/tednaleid/grails-jasypt-presentation/raw/tip/grails_jasypt_encryption.pdf" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/grails-jasypt-presentation/raw/tip/grails_jasypt_encryption.pdf?referer=');">pdf of the presentation</a> as well as the sample source code that I used during the presentation can be found <a href="http://bitbucket.org/tednaleid/grails-jasypt-presentation" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/grails-jasypt-presentation?referer=');">on bitbucket</a>.</p>
<p>Thanks to everyone who showed up, GUM is a great group to present to, lots of good questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://naleid.com/blog/2010/08/11/grails-jasypt-encryption-plugin-presentation-at-groovy-users-of-minnesota/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Grails build-test-data 1.1 released with new buildLazy functionality</title>
		<link>http://naleid.com/blog/2010/04/04/grails-build-test-data-1-1-released-with-new-buildlazy-functionality/</link>
		<comments>http://naleid.com/blog/2010/04/04/grails-build-test-data-1-1-released-with-new-buildlazy-functionality/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 19:13:44 +0000</pubDate>
		<dc:creator>tednaleid</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://naleid.com/blog/?p=178</guid>
		<description><![CDATA[Version 1.1 of the build-test-data plugin has just been released. It adds a new buildLazy method that will only create a new object graph if it can&#8217;t find an existing object that matches the build criteria specified. Example: def a = new Author&#40;firstName: &#34;Ray&#34;, lastName: &#34;Bradbury&#34;&#41; a.save&#40;&#41; assert 1 == Author.count&#40;&#41; &#160; // Author table [...]]]></description>
			<content:encoded><![CDATA[<p>Version 1.1 of the <a href="http://bitbucket.org/tednaleid/grails-test-data/wiki/Home" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/grails-test-data/wiki/Home?referer=');">build-test-data plugin</a> has just been released.</p>
<p>It adds a new buildLazy method that will only create a new object graph if it can&#8217;t find an existing object that matches the build criteria specified.</p>
<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">def</span> a <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Author<span style="color: #66cc66;">&#40;</span>firstName: <span style="color: #ff0000;">&quot;Ray&quot;</span>, lastName: <span style="color: #ff0000;">&quot;Bradbury&quot;</span><span style="color: #66cc66;">&#41;</span>
    a.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">assert</span> <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">==</span> Author.<span style="color: #663399;">count</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// Author table already has Ray Bradbury in it, finds existing record</span>
    <span style="color: #000000; font-weight: bold;">def</span> bradbury <span style="color: #66cc66;">=</span> Author.<span style="color: #006600;">buildLazy</span><span style="color: #66cc66;">&#40;</span>lastName: <span style="color: #ff0000;">&quot;Bradbury&quot;</span><span style="color: #66cc66;">&#41;</span>  
    <span style="color: #000000; font-weight: bold;">assert</span> <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">==</span> Author.<span style="color: #663399;">count</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">assert</span> bradbury.<span style="color: #006600;">firstName</span> <span style="color: #66cc66;">==</span> <span style="color: #ff0000;">&quot;Ray&quot;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">def</span> newAuthor <span style="color: #66cc66;">=</span> Author.<span style="color: #006600;">buildLazy</span><span style="color: #66cc66;">&#40;</span>lastName: <span style="color: #ff0000;">&quot;Moore&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">assert</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">==</span> Author.<span style="color: #663399;">count</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">// creates a new record, no existing &quot;Moore&quot; author previously</span></pre></div></div>

<p>I find this particularly useful for building testing data in the grails console.  It allows me to do some quick setup of new objects and then concentrate on creating the code that I actually want to try out.  Without buildLazy, I was always commenting out my creation code so that multiple executions of the test script didn&#8217;t create multiple copies of the same data (and potentially hit unique constraints issues that I had to screw around with).  </p>
<p>Now, I no longer need to worry about commenting out the creation code after running it the first time.</p>
<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">def</span> u <span style="color: #66cc66;">=</span> User.<span style="color: #006600;">buildLazy</span><span style="color: #66cc66;">&#40;</span>ssn: <span style="color: #ff0000;">&quot;123-456-7890&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">// User.ssn has unique constraint</span>
u.<span style="color: #006600;">foo</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
u.<span style="color: #006600;">bar</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
u.<span style="color: #006600;">baz</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Before buildLazy I&#8217;d need to comment out the user creation and replace it with a user.findBySsn.  Now buildLazy does the creation and later finding for me.  I can concentrate on making foo/bar/baz do what I want them to (the reason I opened the console in the first place).</p>
]]></content:encoded>
			<wfw:commentRss>http://naleid.com/blog/2010/04/04/grails-build-test-data-1-1-released-with-new-buildlazy-functionality/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Updated grails autocomplete script for zsh</title>
		<link>http://naleid.com/blog/2010/03/02/updated-grails-autocomplete-script-for-zsh/</link>
		<comments>http://naleid.com/blog/2010/03/02/updated-grails-autocomplete-script-for-zsh/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 04:22:28 +0000</pubDate>
		<dc:creator>tednaleid</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://naleid.com/blog/?p=166</guid>
		<description><![CDATA[A couple of years ago, I created a grails auto-completion script for bash and zsh. Since then, I&#8217;ve completely abandoned bash, in favor of zsh (which I consider to be the superior shell) and I&#8217;d been getting annoyed at a few issues in the last grails autocomplete script. I finally got motivated to make some [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of years ago, I created a <a href="http://naleid.com/blog/2008/03/25/autocomplete-grails-script-names-in-bashzsh/">grails auto-completion script for bash and zsh</a>.  </p>
<p>Since then, I&#8217;ve completely abandoned bash, <a href="http://naleid.com/blog/2009/05/13/shared-zshrc-file/">in favor of zsh</a> (which I consider to be the superior shell) and I&#8217;d been getting annoyed at a few issues in the last grails autocomplete script.</p>
<p>I finally got motivated <a href="http://bitbucket.org/tednaleid/shared-zshrc/src/tip/zshrc_grails_compinstall" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/shared-zshrc/src/tip/zshrc_grails_compinstall?referer=');">to make some enhancements to it</a>.  Including support for grails 1.2 plugin scripts (1.2 moved the plugins into the ~/.grails directory), and support for test class name autocompletion (very useful for <code>grails test-app</code>).</p>
<p>To get it working (assuming you&#8217;re using zsh), you can either add the contents of <a href="http://bitbucket.org/tednaleid/shared-zshrc/src/tip/zshrc_grails_compinstall" onclick="pageTracker._trackPageview('/outgoing/bitbucket.org/tednaleid/shared-zshrc/src/tip/zshrc_grails_compinstall?referer=');">my zshrc_grails_compinstall</a> to your .zshrc file, or you can switch over to using <a href="http://naleid.com/blog/2009/05/13/shared-zshrc-file/">my full zshrc setup</a>, which has a number of nice features that I&#8217;ve collected over the years.  I&#8217;ll also continue to update this as I think of new tricks.</p>
<p>After getting it installed, just type &#8220;grails&#8221; followed by a space and then hit tab.  It will show you a list of all of the potential grails scripts for the application that you&#8217;re in.  It&#8217;s aware of the version of the current app, as well as it&#8217;s application name based on the contents of application.properties, and also will include any scripts for the plugins you have installed in that app in <code>~/.grails/GRAILS_VERSION/projects/APP_NAME/plugins</code>  (in addition to the scripts in <code>./scripts</code>, <code>$GRAILS_HOME/scripts</code> and <code>~/.grails/scripts</code>).</p>
<p>After you choose your script (such as <code>grails test-app</code> hit space again and it will show you all of the test classes, with the full package for the class, under your test directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://naleid.com/blog/2010/03/02/updated-grails-autocomplete-script-for-zsh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using iWork Numbers.app AppleScript to Sum Columns For All Tables on a Sheet</title>
		<link>http://naleid.com/blog/2010/02/07/using-iwork-numbers-applescript-to-sum-columns-for-all-tables-on-a-sheet/</link>
		<comments>http://naleid.com/blog/2010/02/07/using-iwork-numbers-applescript-to-sum-columns-for-all-tables-on-a-sheet/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 04:45:08 +0000</pubDate>
		<dc:creator>tednaleid</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://naleid.com/blog/?p=157</guid>
		<description><![CDATA[Overall, I&#8217;m pretty happy with Numbers.app (part of Apple&#8217;s iWork suite) as a replacement for Excel. It&#8217;s considerably cheaper and has lots of user interface tweaks to make it more pleasant to work with. One of these changes is that each sheet can actually have multiple tables on it, and these can be arranged independently [...]]]></description>
			<content:encoded><![CDATA[<p>Overall, I&#8217;m pretty happy with Numbers.app (part of Apple&#8217;s iWork suite) as a replacement for Excel.  It&#8217;s considerably cheaper and has lots of user interface tweaks to make it more pleasant to work with.</p>
<p>One of these changes is that each sheet can actually have multiple tables on it, and these can be arranged independently on the same page.  This prevents the problem that happens in excel where you have multiple sets of data you want to see at the same time, but the cell/row sizing for one set of data affects the data in the other set that happens to be on the same row.</p>
<p>I&#8217;ve been leveraging this for a one-off personal project and I had a need to sum up all of the data in the 2nd column on all of the tables within a particular sheet.</p>
<p>This brought me to <a href="http://developer.apple.com/mac/library/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/mac/library/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html?referer=');">AppleScript</a>, Apple&#8217;s scripting language that&#8217;s used to drive applications.<br />
<span id="more-157"></span><br />
You can write scripts in the AppleScript editor (found in /Applications/Utilities).  In there, you can look up the commands and objects that a particular program makes available by going to File->Open Dictionary and then finding the application that you want to script.</p>
<p>I&#8217;ve done a little work in AppleScript in the past, but always recoil from it when I&#8217;m done.  It&#8217;s so damn wordy in what appears to be an attempt to make it more &#8220;friendly&#8221; when it really just makes it harder to remember the right syntax to get something done.  It probably just has <a href="http://www.youtube.com/watch?v=dCud8H7z7vU" onclick="pageTracker._trackPageview('/outgoing/www.youtube.com/watch?v=dCud8H7z7vU&amp;referer=');">&#8220;too many notes&#8221;.</a></p>
<p>Regardless, here&#8217;s the script that I came up with to sum up all of the values in the 2nd column (Column B) for all of the tables on the currently active sheet and then insert the result onto the 2nd column of a table named &#8220;Totals&#8221; (which must previously exist).</p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Numbers&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">document</span> <span style="color: #000000;">1</span>
		<span style="color: #ff0033; font-weight: bold;">set</span> total <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">0</span>
		<span style="color: #ff0033; font-weight: bold;">set</span> totalTable <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">0</span>
		<span style="color: #ff0033; font-weight: bold;">tell</span> sheet <span style="color: #000000;">1</span>
			<span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> j <span style="color: #ff0033; font-weight: bold;">from</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">count</span> <span style="color: #ff0033; font-weight: bold;">of</span> tables<span style="color: #000000;">&#41;</span>
				<span style="color: #ff0033; font-weight: bold;">try</span>
					<span style="color: #ff0033; font-weight: bold;">tell</span> table j
						<span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">name</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">not</span> <span style="color: #ff0033;">equal</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Totals&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
							<span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> k <span style="color: #ff0033; font-weight: bold;">from</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">count</span> <span style="color: #ff0033; font-weight: bold;">of</span> rows
								<span style="color: #ff0033; font-weight: bold;">set</span> total <span style="color: #ff0033; font-weight: bold;">to</span> total <span style="color: #000000;">+</span> <span style="color: #000000;">&#40;</span>value <span style="color: #ff0033; font-weight: bold;">of</span> cell <span style="color: #000000;">2</span> <span style="color: #ff0033; font-weight: bold;">of</span> row k<span style="color: #000000;">&#41;</span>
							<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
						<span style="color: #ff0033; font-weight: bold;">else</span>
							<span style="color: #ff0033; font-weight: bold;">set</span> totalTable <span style="color: #ff0033; font-weight: bold;">to</span> j
						<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
					<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
				<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span>
			<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
			<span style="color: #ff0033; font-weight: bold;">tell</span> table totalTable
				<span style="color: #0066ff;">display dialog</span> <span style="color: #009900;">&quot;total = &quot;</span> <span style="color: #000000;">&amp;</span> total <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; total table = &quot;</span> <span style="color: #000000;">&amp;</span> totalTable
				<span style="color: #ff0033; font-weight: bold;">set</span> value <span style="color: #ff0033; font-weight: bold;">of</span> cell <span style="color: #000000;">2</span> <span style="color: #ff0033; font-weight: bold;">of</span> row <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">to</span> total
			<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></pre></div></div>

<p>I needed this ability as the number of tables on this sheet will change quite frequently depending on what I&#8217;m doing with it, and the values in the 2nd column of each of these tables will also get frequently modified and I need to easily know the sum across all of the tables.</p>
<p>To actually execute the script within Numbers.app, there are a couple of ways to do it.  It doesn&#8217;t appear that Numbers has it&#8217;s own script directory (normally, it would be under ~/Library/Application Support/iWork/Numbers/Scripts), but you can add it to your own User Scripts directory at ~/Library/Scripts.</p>
<p>If you want to access it through your menus, you can enable the global script icon up there by going into the AppleScript Editor preferences.  On the General tab, check the box that says &#8220;Show Script menu in menu bar&#8221;.</p>
<p>If you&#8217;re using LaunchBar or Quicksilver, you can also add this directory to their catalog as a place to search.  Then it&#8217;s as easy as cmd-space and the name of the script to execute it (both apps also allow you to set up keyboard shortcuts too).</p>
<p>In all, it feels hacky, and I&#8217;m sure it could be improved if I actually knew what the hell I was doing in AppleScript, but as I said, it&#8217;s a one-off that I need for a fairly particular problem.</p>
<p>I should probably take a little more time to learn more about AppleScript (or look more closely at a bridge to a language that I find a bit more palatable).  Being able to script the applications that I use can be very useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://naleid.com/blog/2010/02/07/using-iwork-numbers-applescript-to-sum-columns-for-all-tables-on-a-sheet/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Updated wordpress</title>
		<link>http://naleid.com/blog/2009/09/06/updated-wordpress/</link>
		<comments>http://naleid.com/blog/2009/09/06/updated-wordpress/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 15:38:48 +0000</pubDate>
		<dc:creator>tednaleid</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://naleid.com/blog/?p=62</guid>
		<description><![CDATA[I&#8217;ve just switched hosting providers from slicehost to a reserved EC2 instance. I also upgraded from a really old version of wordpress to wordpress 2.8.4. I&#8217;ve been meaning to do this for a while now, but wanting to avoid yesterday&#8217;s worm prompted me to do it this weekend rather than next. Let me know if [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just switched hosting providers from slicehost to a reserved EC2 instance.  I also upgraded from a really old version of wordpress to wordpress 2.8.4.  I&#8217;ve been meaning to do this for a while now, but <a href="http://wordpress.org/development/2009/09/keep-wordpress-secure/" onclick="pageTracker._trackPageview('/outgoing/wordpress.org/development/2009/09/keep-wordpress-secure/?referer=');">wanting to avoid yesterday&#8217;s worm</a> prompted me to do it this weekend rather than next.</p>
<p>Let me know if you see any issues or broken links.</p>
]]></content:encoded>
			<wfw:commentRss>http://naleid.com/blog/2009/09/06/updated-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SelectorGadget makes CSS selectors really simple</title>
		<link>http://naleid.com/blog/2009/02/26/selectorgadget-makes-css-selectors-really-simple/</link>
		<comments>http://naleid.com/blog/2009/02/26/selectorgadget-makes-css-selectors-really-simple/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 04:51:43 +0000</pubDate>
		<dc:creator>tednaleid</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://naleid.com/blog/?p=45</guid>
		<description><![CDATA[Today I&#8217;ve run across a few mentions of SelectorGadget. First when John Resig tweeted about it and now it&#8217;s at the top of Hacker News. It&#8217;s worth all the attention it&#8217;s getting. It makes working with CSS selectors, and especially scraping websites, dead simple. This is the gateway into The kind of information that it [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve run across a few mentions of <a href="http://www.selectorgadget.com/" onclick="pageTracker._trackPageview('/outgoing/www.selectorgadget.com/?referer=');">SelectorGadget</a>.  First when <a href="http://twitter.com/jeresig/status/1255411573" onclick="pageTracker._trackPageview('/outgoing/twitter.com/jeresig/status/1255411573?referer=');">John Resig tweeted about it</a> and now it&#8217;s at <a href="http://news.ycombinator.com/item?id=496350" onclick="pageTracker._trackPageview('/outgoing/news.ycombinator.com/item?id=496350&amp;referer=');">the top of Hacker News</a>.</p>
<p>It&#8217;s worth all the attention it&#8217;s getting.  It makes working with CSS selectors, and especially scraping websites, dead simple.  This is the gateway into</p>
<p>The kind of information that it gives you can be fed into jQuery (or other CSS selector aware API&#8217;s like nokogiri or hpricot for Ruby or beautiful soup for Python) to easily get the right syntax for querying the DOM.</p>
<p>Check out the author&#8217;s screencast on the front page.  He very quickly demonstrates how easy it is to use SelectorGadget to modify the scope of the intended selector.</p>
<p>P.S. if anyone is aware of any Groovy/Java parsers that can take CSS 3 selectors, I&#8217;d love to hear about them.  Some quick googling isn&#8217;t showing anything.</p>
]]></content:encoded>
			<wfw:commentRss>http://naleid.com/blog/2009/02/26/selectorgadget-makes-css-selectors-really-simple/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>StackOverflow.com</title>
		<link>http://naleid.com/blog/2008/09/23/stackoverflowcom/</link>
		<comments>http://naleid.com/blog/2008/09/23/stackoverflowcom/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 04:22:26 +0000</pubDate>
		<dc:creator>tednaleid</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://naleid.com/blog/?p=28</guid>
		<description><![CDATA[I&#8217;m pretty impressed with the community that&#8217;s forming over at StackOverflow.com (Jeff Atwood and Joel Spolksy&#8216;s new developer focused Q&#038;A startup). I just asked a fairly detailed question about working with mercurial. Something that wasn&#8217;t (obviously) covered on the mercurial wiki, through googling, or in the mercurial handbook, and got a quality answer back in [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pretty impressed with the community that&#8217;s forming over at <a href="http://stackoverflow.com" onclick="pageTracker._trackPageview('/outgoing/stackoverflow.com?referer=');">StackOverflow.com</a> (<a href="http://codinghorror.com" onclick="pageTracker._trackPageview('/outgoing/codinghorror.com?referer=');">Jeff Atwood</a> and <a href="http://joelonsoftware.com" onclick="pageTracker._trackPageview('/outgoing/joelonsoftware.com?referer=');">Joel Spolksy</a>&#8216;s new developer focused Q&#038;A startup).</p>
<p>I just asked a <a href="http://stackoverflow.com/questions/125272/using-mercurial-whats-the-easiest-way-to-commit-and-push-a-single-file-while-le" onclick="pageTracker._trackPageview('/outgoing/stackoverflow.com/questions/125272/using-mercurial-whats-the-easiest-way-to-commit-and-push-a-single-file-while-le?referer=');">fairly detailed question</a> about working with <a href="http://www.selenic.com/mercurial/wiki/index.cgi/Mercurial" onclick="pageTracker._trackPageview('/outgoing/www.selenic.com/mercurial/wiki/index.cgi/Mercurial?referer=');">mercurial</a>.  Something that wasn&#8217;t (obviously) covered on the mercurial wiki, through googling, or in the <a href="http://hgbook.red-bean.com/" onclick="pageTracker._trackPageview('/outgoing/hgbook.red-bean.com/?referer=');">mercurial handbook</a>, and got a quality answer back in only 8 minutes.  That&#8217;s fantastic for a general purpose development website and is a great start after only being open for a couple of weeks.</p>
<p>They&#8217;ve started up an interesting reward/karma system over there where they award badges (similar to achievements on Xbox360) for a bunch of different positive behaviors.   A nice little token system that&#8217;s paired with <a href="http://stackoverflow.com/questions/18557/how-does-stackoverflow-work-the-unofficial-faq#119554" onclick="pageTracker._trackPageview('/outgoing/stackoverflow.com/questions/18557/how-does-stackoverflow-work-the-unofficial-faq_119554?referer=');">&#8220;power-ups&#8221;</a> at different point levels.  It&#8217;s easy to get the first few badges with just a little participation on the website, and I can see how certain personality types that are common in engineers would get big rewards out of collecting these.</p>
]]></content:encoded>
			<wfw:commentRss>http://naleid.com/blog/2008/09/23/stackoverflowcom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubiquity &#8211; interesting looking command line for Firefox</title>
		<link>http://naleid.com/blog/2008/08/26/ubiquity-interesting-looking-command-line-for-firefox/</link>
		<comments>http://naleid.com/blog/2008/08/26/ubiquity-interesting-looking-command-line-for-firefox/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 02:24:59 +0000</pubDate>
		<dc:creator>tednaleid</dc:creator>
				<category><![CDATA[command line]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[shortcut]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[quicksilver]]></category>

		<guid isPermaLink="false">http://naleid.com/blog/?p=27</guid>
		<description><![CDATA[Just ran across Ubiquity over on on waxy. It&#8217;s an alpha Firefox plugin that&#8217;s attempting to be a command line for the internet. It reminds me a little of yubnub, but quite a bit more powerful as it&#8217;s available on every page and is context sensitive. Essentially, it has a set of built in commands [...]]]></description>
			<content:encoded><![CDATA[<p>Just ran across <a href="http://www.azarask.in/blog/post/ubiquity-in-depth/" onclick="pageTracker._trackPageview('/outgoing/www.azarask.in/blog/post/ubiquity-in-depth/?referer=');">Ubiquity</a> over on on <a href="http://waxy.org/links/" onclick="pageTracker._trackPageview('/outgoing/waxy.org/links/?referer=');">waxy</a>.  </p>
<p>It&#8217;s an alpha Firefox plugin that&#8217;s attempting to be a command line for the internet.  It reminds me a little of <a href="http://yubnub.org/" onclick="pageTracker._trackPageview('/outgoing/yubnub.org/?referer=');">yubnub</a>, but quite a bit more powerful as it&#8217;s available on every page and is context sensitive.</p>
<p>Essentially, it has a set of built in commands (that you can add to an extend) and it&#8217;s aware of the current browser context, so if you have something highlighted, it can act on that subset of the current page.</p>
<p>Previously, I&#8217;ve been a heavy user of <a href="http://www.mozilla.org/products/firefox/smart-keywords.html" onclick="pageTracker._trackPageview('/outgoing/www.mozilla.org/products/firefox/smart-keywords.html?referer=');">Firefox smart keywords</a>, which allow you to assign aliases to bookmarks and type the aliases in the location bar.  I&#8217;ve created smart keywords that allow me to search wikipedia, amazon, imdb and the dictionary.  Ubiquity has all of these, plus a lot more built-in.</p>
<p>I&#8217;ve only been using it for a little bit, and there are some rough edges, but I think that there is quite a bit of promise here as well and thought that there might be a few other keyboard jockeys out there that would appreciate what Ubiquity is trying to do. </p>
]]></content:encoded>
			<wfw:commentRss>http://naleid.com/blog/2008/08/26/ubiquity-interesting-looking-command-line-for-firefox/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

