<?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>Zen and the Art of Programming &#187; Mac</title>
	<atom:link href="http://programmingzen.com/category/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmingzen.com</link>
	<description>By Antonio Cangiano, Software Engineer &#38; Technical Evangelist at IBM</description>
	<lastBuildDate>Wed, 21 Jul 2010 22:12:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Would you use a Mac mini as your development machine?</title>
		<link>http://programmingzen.com/2010/06/17/would-you-use-a-mac-mini-as-your-development-machine/</link>
		<comments>http://programmingzen.com/2010/06/17/would-you-use-a-mac-mini-as-your-development-machine/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 11:23:53 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Cocoa and Objective-C]]></category>
		<category><![CDATA[Industry News]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[iPhone OS Development]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1196</guid>
		<description><![CDATA[Apple just released a brand new, gorgeous looking Mac mini. This major upgrade brings us two different models: a desktop one and a server version (priced at $699 and $999, respectively). Equipped with a HDMI port, the desktop edition of the Mac mini makes for a perfect Home Theater PC. It&#8217;s small and stylish, and [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><img src="http://antoniocangiano.com/wp-content/uploads/2010/06/macmini.png" alt="MacMini Image" /></p>
<p>Apple just released a brand new, gorgeous looking <a href="http://www.apple.com/macmini/">Mac mini</a>. This major upgrade brings us two different models: a desktop one and a server version (priced at $699 and $999, respectively).
</p>
<p>Equipped with a HDMI port, the desktop edition of the Mac mini makes for a perfect Home Theater PC. It&#8217;s small and stylish, and as such is a great fit in your living room. Most of the reviews I&#8217;ve read focus on its use as a highly capable HTPC (despite its lack of a Blu-Ray drive).
</p>
<p>However, I see the new Mac Mini in a different light. At $700 it is far too expensive for a HTPC, yet it&#8217;s ideal as an entry-level machine for web, Mac, and iOS development (it&#8217;s almost as cheap as a Hackintosh, minus the headache).</p>
<p>Mac Minis will do the job and be more than capable thanks to their adequate, albeit not spectacular, hardware specs. If my MacBook Pro were to die today, I would definitely consider purchasing one for development purposes. Would you?</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2010/06/17/would-you-use-a-mac-mini-as-your-development-machine/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Benchmarking MacRuby 0.6</title>
		<link>http://programmingzen.com/2010/05/16/benchmarking-macruby-0-6/</link>
		<comments>http://programmingzen.com/2010/05/16/benchmarking-macruby-0-6/#comments</comments>
		<pubDate>Sun, 16 May 2010 07:53:35 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby Benchmark Suite]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1168</guid>
		<description><![CDATA[Recently MacRuby 0.6 was released. The development team put a lot of emphasis on improving compatibility with Ruby 1.9, and the viability of MacRuby as a tool for developing Mac OS X applications. Focus on these aspects took precedence over performance, but I was still curious to see how well it performed when compared to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently MacRuby 0.6 was released. The development team put a lot of emphasis on improving compatibility with Ruby 1.9, and the viability of MacRuby as a tool for developing Mac OS X applications. Focus on these aspects took precedence over performance, but I was still curious to see how well it performed when compared to Ruby 1.8.7 and Ruby 1.9, respectively.</p>
<p>This article showcases the results of a small Ruby shootout for Mac. I plan to publish a Windows one by next week, and then a week or two after that, a complete Linux shootout that will have many more implementations. Grab <a href="http://feeds2.feedburner.com/ZenAndTheArtOfRubyProgramming">my feed</a> or <a href="http://eepurl.com/xDb7">join the newsletter</a> to avoid missing upcoming shootout posts.</p>
<p><strong>The setup</strong></p>
<p>The tests are a large subset of the <a href="http://github.com/acangiano/ruby-benchmark-suite">Ruby Benchmark Suite</a>. Each test was run 10 times, five to detect the best execution time, and five to detect the minimal memory consumption. All of the tests were run on Mac OS X 10.6.3, on my MacBook Pro 2.66 GHz Intel Core 2 Duo, 4 GB 1067 MHz DDR3 RAM, 320 GB 7200 rpm disk.</p>
<p>Stable implementations tested:</p>
<ul>
<li>MacRuby 0.6</li>
<li>Ruby 1.8.7</li>
<li>Ruby 1.9.1</li>
</ul>
<p><strong>Disclaimer</strong></p>
<p>Synthetic benchmarks cannot predict how fast your programs will be with one implementation or another. They provide an (entertaining) educated guess, but <strong>you shouldn&#8217;t draw overly definitive conclusions from them</strong>. Furthermore, the Ruby Benchmark Suite has many tests that don&#8217;t provide much insight when it comes to comparing implementations. They are there for legacy reasons and will probably be removed in the future. For the time being, <strong>take them with a grain of salt</strong>.</p>
<p><strong>The results</strong></p>
<p>Without further hesitation, here are the execution times for the tests (divided in A-L, M-Z). Timeouts indicate that the execution of a single run took more than 60 seconds and had to be interrupted. Bold values indicate the best performance for each test.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://antoniocangiano.com/wp-content/uploads/2010/05/timeal1.png" alt="Time table A-L" /></p>
<p style="text-align: center;"><img class="aligncenter" src="http://antoniocangiano.com/wp-content/uploads/2010/05/timemz.png" alt="Time table M-Z" /></p>
<p>And here is the estimated memory usage:</p>
<p style="text-align: center;"><img class="aligncenter" src="http://antoniocangiano.com/wp-content/uploads/2010/05/spaceal.png" alt="Memory table A-L" /></p>
<p style="text-align: center;"><img class="aligncenter" src="http://antoniocangiano.com/wp-content/uploads/2010/05/spacemz.png" alt="Memory table M-Z" /></p>
<p><strong>Conclusions</strong></p>
<p>MacRuby 0.6 is faster than Ruby 1.9.1 at times, but it can also be significantly slower. Overall, as things stand now, its performance appears to be between that of Ruby 1.9.1 and Ruby 1.8.7, with several outliers and a greater variance compared to those two implementations. Memory wise, MacRuby appears to be significantly more &#8220;memory hungry&#8221; than the other implementations (even though this wasn&#8217;t all that much of a surprise to me).</p>
<p>I&#8217;m interested in seeing how future releases that will be focused more on performance will affect these preliminary results. For the time being however, don&#8217;t let this outcome discourage you from using MacRuby 0.6, which is the first release that&#8217;s considered stable for Mac OS X development.</p>
<p>Download: <a href="http://antoniocangiano.com/wp-content/uploads/2010/05/time-memory.zip">CSV Files</a></p>
<p>PS: If you are looking for a fun and easy way to get started with MacRuby, check out <a href="http://thinkcode.tv/catalog/introduction-macruby/">ThinkCode.TV&#8217;s screencast</a> on the subject.</p>
<p><strong>Update (July 3, 2010)</strong>: The following box plot compares the various implementations for the tests for which all the implementations were successful. Only times for the largest successful input number were used in those tests where multiple input numbers were tested.</p>
<p align="center"><img src="http://programmingzen.com/wp-content/uploads/2010/05/mac_shootout.png" alt="Mac Shootout Boxplot" /></p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2010/05/16/benchmarking-macruby-0-6/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>My kingdom for an iPad</title>
		<link>http://programmingzen.com/2010/04/02/my-kingdom-for-an-ipad/</link>
		<comments>http://programmingzen.com/2010/04/02/my-kingdom-for-an-ipad/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 16:41:12 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Industry News]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1136</guid>
		<description><![CDATA[Tomorrow the iPad goes on sale in the States. Announced in January, the iPad sits squarely between a laptop and an iPod Touch. Large lines are expected to form in front of Apple Stores across America; ants scurrying to grab their crumbs. What is uncertain is whether this release is going to be much ado [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://antoniocangiano.com/wp-content/uploads/2010/04/ipad.png" alt="iPad" align="right" />Tomorrow the <a href="http://www.apple.com/ipad/">iPad</a> goes on sale in the States. Announced in January, the iPad sits squarely between a laptop and an iPod Touch. Large lines are expected to form in front of Apple Stores across America; ants scurrying to grab their crumbs.</p>
<p>What is uncertain is whether this release is going to be much ado about nothing or more an event that will revolutionize the computer market.</p>
<p>Among the iPad shortcomings are the following:</p>
<ul>
<li>A somewhat embarrassing name;</li>
<li>Lack of Flash support;</li>
<li>Inability to multitask (exception made for some Apple built-in apps);</li>
<li>Software restrictions due to <span class="caps">DRM</span>;</li>
<li>Lack of webcam;</li>
<li>Lack of <span class="caps">USB</span> ports;</li>
<li>Not as portable as an iPod, iPhone or a tablets a la <a href="http://www.amazon.com/exec/obidos/ASIN/B002OB49SW/zenruby-20/ref=nosim/">Nokia N900</a>;</li>
<li>Not ideal for long typing sessions, due to a virtual keyboard (even though an external keyboard can be purchased as an optional accessory).</li>
</ul>
<p>Your first impression might be that we are dealing with a flop like the Apple TV or similar niche products that are popular with Apple fans, but lack the transformational power and impact on society that have been shown by the iPod or the iPhone.</p>
<p>Much of the iPad&#8217;s criticism comes from a fundamental misunderstanding of the target use of this product. Those who consider the iPad a replacement for their laptop will no doubt be disappointed by the performance and restrictions of this device.</p>
<p>One also needs to take into consideration the iPad&#8217;s target audience. Many assumed that the target audience was primarily composed of geeky early adopters, programmers, and more in general, people with a technical mindset.</p>
<p>Far from telling my readers that they shouldn&#8217;t indulge in the prohibited pleasure of possessing an iPad, it seems clear to me that the Gaussian function has its maximum elsewhere, amongst students, casual users, and the general public, who want a device from which to check their email, surf, and play from their couch, kitchen or local coffee shop. A computing device that is small enough to carry in a purse, but large enough (with its 9.7&quot; diagonal) to easily display websites and applications, without causing one to squint their eyes.</p>
<p>Seen in this light, the iPad has a solid reason for being, despite all of its limitations. Imagine a computer that is accessible and easy to use, and doesn&#8217;t require IT support from your nephew to fix (or remove a virus). In other words, a portable device that simply works. It only does a few things, but it does them in a manner that provides a pleasant experience to the average user.</p>
<p>The iPad&#8217;s field of application isn&#8217;t very restricted either. It can be seen as a portable console for casual gaming, a digital frame to show photos set to a soundtrack, or a quick presentation tool at a small business meeting. It&#8217;s a multimedia tool for listening to music and watching videos and lectures. Finally, the iPad is also a magazine and ebook reader. Some may rightfully argue that the e-ink technology is easier on the eyes for extensive reading, but the iPad has a vibrant color screen, and is able to display complex PDFs as well as ePub books sold directly from the brand new iBookstore.</p>
<p>The design, as is customary for products designed by <a href="http://en.wikipedia.org/wiki/Jonathan_Ive">Jonatahn Ive</a>, is minimalistic, sleek and easy on the eyes. Starting at $499 (as shown in the figure below), the price point is rather competitive, so as to be able to reach a wide, international audience.</p>
<p align="center"><img src="http://antoniocangiano.com/wp-content/uploads/2010/04/ipad-prices.png" alt="iPod prices" /></p>
<p>All things considered, it&#8217;s easy to imagine that the iPad will be a commercial success with the potential to transform how millions of consumers approach the Internet, gaming and book reading. This is far from certain, but I suspect that the iPad will be the iPod of the laptop world.</p>
<p>My suspicion is further supported by the ecosystem that surrounds this form of lightweight computing. Teachers will love the possibilities that such a device opens up, where students can now have a more interactive and multimedia-driven experience (particularly if ad hoc applications are created for this).</p>
<p>Book and magazine publishers already love the idea of selling books through the iBookstore, a refuge from the totalitarian price policies imposed by Amazon. This could in turn, really increase publishers&#8217; investment in the digital world.</p>
<p>Programmers will be able to explore new ideas and create applications that are specifically tailored to the iPad user interface and user experience. The many advantages, and few disadvantages, of this approach are well known thanks to the iPod Touch and iPhone experience.</p>
<p>While restrictions are obviously limiting, they can also foster creativity. Among a sea of silly gag applications, there were also truly innovative apps designed for the iPhone. I would expect nothing less from applications developed using the same tools and distributed through the same channels, but targeted to a device that has much larger screen and processing capabilities.</p>
<p>Personally, I don&#8217;t know if I will purchase an iPad or not, after all I spend far too many hours in front of a traditional laptop already. But I clearly see a brilliant future for this new Apple product, despite its limitations and the closed approach to hardware and software that has become typical of Cupertino&#8217;s company.</p>
<p>What about you, are you headed to the Apple Store?</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2010/04/02/my-kingdom-for-an-ipad/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Getting MacRuby&#8217;s compiler to work</title>
		<link>http://programmingzen.com/2009/10/08/getting-macrubys-compiler-to-work/</link>
		<comments>http://programmingzen.com/2009/10/08/getting-macrubys-compiler-to-work/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 20:45:13 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1107</guid>
		<description><![CDATA[There is major news in Rubyland today. MacRuby&#8217;s team just released their fist beta of version 0.5 (an experimental, still incomplete version of Ruby), which brings JIT, removal of the dreaded GIL (Global Interpreter Lock), native threads, GCD (Grand Central Dispatch) for multicore computing, and a whole new set of features found in the release [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://antoniocangiano.com/wp-content/uploads/2009/10/macruby_logo.png" align="right" alt="MacRuby's logo" />There is major news in Rubyland today. MacRuby&#8217;s team just released their fist beta of version 0.5 (an experimental, still incomplete version of Ruby), which brings JIT, removal of the dreaded GIL (Global Interpreter Lock), native threads, GCD (Grand Central Dispatch) for multicore computing, and a whole new set of features found in <a href="http://www.macruby.org/blog/2009/10/07/macruby05b1.html">the release announcement</a> to the table.</p>
<p>The most important new feature is the presence of a compiler. That&#8217;s right, thanks to this release, Ruby code can now become highly optimized executable code. How awesome is that? I can sense that you&#8217;re pumped by this news, so why not head over to MacRuby.com and <a href="http://www.macruby.org/downloads.html">download the installation file</a> for yourself? After you&#8217;ve done that, the next thing you&#8217;re going to want to do is run a small test like the following:</p>
<div class="highlight">
<pre><span class="nv">$ </span>macrubyc world_domination.rb -o world_domination
<span class="s1">Can&#39;t locate program `llc&#39;</span>
</pre>
</div>
<p>Oh noes! llc is a tool that ships with the LLVM (upon which MacRuby is built), however it&#8217;s not included with MacRuby&#8217;s installer (it will be in the future). But fear not my friends, there is a solution:</p>
<div class="highlight">
<pre><span class="nv">$ </span>svn co -r 82747 https://llvm.org/svn/llvm-project/llvm/trunk llvm-trunk
<span class="nv">$ </span><span class="nb">cd </span>llvm-trunk
<span class="nv">$ </span>./configure
<span class="nv">$ UNIVERSAL</span><span class="o">=</span>1 <span class="nv">UNIVERSAL_ARCH</span><span class="o">=</span><span class="s2">&quot;i386 x86_64&quot;</span> <span class="nv">ENABLE_OPTIMIZED</span><span class="o">=</span>1 make -j2
<span class="nv">$ </span>sudo env <span class="nv">UNIVERSAL</span><span class="o">=</span>1 <span class="nv">UNIVERSAL_ARCH</span><span class="o">=</span><span class="s2">&quot;i386 x86_64&quot;</span> <span class="nv">ENABLE_OPTIMIZED</span><span class="o">=</span>1 make install
</pre>
</div>
<p>If your machine does not have 2 cores, remove the -j2 option from the fourth line or adjust the number accordingly.</p>
<p>The compilation phase may take a couple of centuries, depending on your machine&#8217;s speed, but it should eventually build the LLVM. <img src='http://programmingzen.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  llc will be placed in your PATH, and you&#8217;ll finally be able to compile Ruby code and obtain an executable to help you carry out your world domination plans.</p>
<div class="highlight">
<pre><span class="nv">$ </span>macrubyc world_domination.rb -o world_domination
<span class="nv">$ </span>./world_domination
MUAHAHAHAHA!
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/10/08/getting-macrubys-compiler-to-work/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Installing the Ruby driver for DB2 on Mac OS X Snow Leopard</title>
		<link>http://programmingzen.com/2009/09/03/installing-the-ruby-driver-for-db2-on-mac-os-x-snow-leopard/</link>
		<comments>http://programmingzen.com/2009/09/03/installing-the-ruby-driver-for-db2-on-mac-os-x-snow-leopard/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 19:23:35 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1097</guid>
		<description><![CDATA[Now that Mac OS X 10.6 is out, it&#8217;s time to leave the world of 32 bit computing behind. The pre-installed Ruby interpreter will run in 64 bit mode by default, so you may need to pay attention when installing some C-based gems. The ibm_db Ruby gem for DB2 can easily be installed or updated [...]]]></description>
			<content:encoded><![CDATA[<p>Now that Mac OS X 10.6 is out, it&#8217;s time to leave the world of 32 bit computing behind. The pre-installed Ruby interpreter will run in 64 bit mode by default, so you may need to pay attention when installing some C-based gems. The ibm_db Ruby gem for DB2 can easily be installed or updated to the latest available version by following these simple steps:</p>
<div class="highlight">
<pre><span class="nv">$ </span>sudo -s
<span class="nv">$ </span><span class="nb">export </span><span class="nv">IBM_DB_LIB</span><span class="o">=</span>/Users/&lt;username&gt;/sqllib/lib64
<span class="nv">$ </span><span class="nb">export </span><span class="nv">IBM_DB_INCLUDE</span><span class="o">=</span>/Users/&lt;username&gt;/sqllib/include
<span class="nv">$ </span><span class="nb">export </span><span class="nv">ARCHFLAGS</span><span class="o">=</span><span class="s2">&quot;-arch x86_64&quot;</span>
<span class="nv">$ </span>gem install ibm_db
</pre>
</div>
<p>You can verify that the installation was successful my running the following:</p>
<div class="highlight">
<pre><span class="nv">$</span> <span class="n">irb</span>
<span class="o">&gt;&gt;</span> <span class="nb">require</span> <span class="s1">&#39;ibm_db.bundle&#39;</span>
<span class="o">=&gt;</span> <span class="kp">true</span>
</pre>
</div>
<p>Please let me know if you encounter any issues, I&#8217;d be glad to help you.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/09/03/installing-the-ruby-driver-for-db2-on-mac-os-x-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DB2 on Mac OS X Snow Leopard</title>
		<link>http://programmingzen.com/2009/08/28/db2-on-mac-os-x-snow-leopard/</link>
		<comments>http://programmingzen.com/2009/08/28/db2-on-mac-os-x-snow-leopard/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 18:29:32 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1089</guid>
		<description><![CDATA[Earlier today I headed over to the local Apple Store to purchase a copy of Snow Leopard, the newest version of Apple&#8217;s operating system. There was a decent line up, as I expected. Not the kind of line up you&#8217;d encounter with the launch of a new iPhone, but it was fairly busy for a [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier today I headed over to the local Apple Store to purchase a copy of <a href="http://www.apple.com/macosx/">Snow Leopard</a>, the newest version of Apple&#8217;s operating system. There was a decent line up, as I expected. Not the kind of line up you&#8217;d encounter with the launch of a new iPhone, but it was fairly busy for a Friday morning. When I arrived, I took my place at the end of the queue where rumors were swirling around about the store having sold out of single copies of Snow Leopard in its first hour. Luckily, that was just a rumor as I suspected, and they still had a few copies left. So I got my copy for $39.99 (CND) including taxes and left.</p>
<p>The installation was pretty much automatic and took roughly an hour. No versions to select from, no serial numbers to insert, no online activations, and a price that &#8220;keeps honest people honest&#8221;. Yes, it&#8217;s just an update, but <a href="http://www.amazon.com/gp/product/B001AMHWP8?ie=UTF8&#038;tag=zenruby-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B001AMHWP8">$25 (US)</a> for an improved operating system is definitely a fair price. Microsoft are you listening? My first impression is that Snow Leopard is a very polished version of Leopard and it&#8217;s darn fast. Well done Apple.</p>
<p>DB2 users may be wondering if it is safe to install this version of Mac OS X 10.6 or if their existing installation will go awry. I&#8217;m happy to report that <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&#038;S_TACT=ACDB201">DB2 Express-C 9.5 FixPack 2</a> for Mac works fine on Snow Leopard. Both pre-existing installations and brand new installations of DB2 work properly, I can attest to that. So install away my friends!</p>
<p align="center"><img src="http://antoniocangiano.com/wp-content/uploads/2009/08/db2-snow-leopard.png" alt="Installing DB2 on Snow Leopard" /></p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/08/28/db2-on-mac-os-x-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Apple &#8220;Genius&#8221;</title>
		<link>http://programmingzen.com/2009/06/26/apple-genius/</link>
		<comments>http://programmingzen.com/2009/06/26/apple-genius/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 21:42:05 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=831</guid>
		<description><![CDATA[Recently I sold my old, damaged MacBook Pro on eBay, and in doing so I claimed that there was a chance that it could be repaired (by Apple) for free. But how, you may be wondering, could I make such a bold claim? Was it all a strategy to over-sell my broken laptop? Not in [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I sold my old, damaged MacBook Pro on eBay, and in doing so I claimed that there was a chance that it could be repaired (by Apple) for free. But how, you may be wondering, could I make such a bold claim? Was it all a strategy to over-sell my broken laptop? Not in the least. Back when I first found out about <a href="http://support.apple.com/kb/TS2377">this Apple&#8217;s KB article</a>, the contents of which appeared as though they would entitle me to a free repair, I headed straight to the Apple Store at the Fairview Mall in Toronto. I&#8217;d had a fairly positive customer care experience there just a week before, and I was rather optimistic that they&#8217;d repair it for me.</p>
<p>After I arrived at the Genius bar, I had to wait for quite a while before having the displeasure of dealing with an uncooperative &#8220;genius&#8221;, a young guy whose unfriendly attitude far outweighed any technical know-how he may have had. He immediately denied any knowledge of video issues on MacBook Pros from 2007 and only agreed to check my laptop after I&#8217;d showed him a printout of the knowledge base issue mentioned above. He essentially humored me in a rather reluctant way, and after a very short while told me that my laptop didn&#8217;t qualify for the free repair. Annoyed by this guy&#8217;s lack of care regarding my problem, I left the store.</p>
<p>Around the time when this situation arose, I had already visited the Genius Bar several times regarding various matters and was feeling a bit tired of dealing with a broken laptop. Ultimately I gave up on my old MacBook Pro (my first Mac ever) and when it was economically possible, I purchased a replacement laptop. Though my old MacBook Pro had cost me time and money, I felt that its tale was done and over with once I brought my new laptop home. That is until the day I decided that someone else could get more use out it than I was (as it was just sitting unused in my office), and that I could get a few bucks by selling it on Ebay. The old Mac&#8217;s auction wrapped up with a selling price of $578. It was bought by a fellow from Ontario, who was a very pleasant person to deal with.</p>
<p>If fact he was so kind that he sent me a follow-up regarding his own attempt to get the laptop fixed. Here&#8217;s what he wrote:</p>
<blockquote><p>Just a quick update. The testing on the Macbook Pro was conducted this week, and found to conform to the warranty exception Apple identifies with the nVidia chip problem. A replacement is being installed now, but likely won&#8217;t be ready until next week. While you&#8217;re probably more content to wash your hands of the whole matter, I&#8217;d seriously consider a complaint against the apple store you took it to, and more specifically against the &#8220;genius&#8221; who served you, given he was clearly no genius at all, and likely cost you significantly in time and money as a result. Hope you&#8217;re having a good day.</p></blockquote>
<p>I am genuinely happy for the guy. He took a risk by buying a broken laptop from me, trusted my story to be true (as it was!), and ended up scoring a working laptop that&#8217;s (now) worth far more than what he paid for it. His bet paid off and I wish him all the best.</p>
<p>The truth of the matter is that, as he says, I&#8217;m glad to &#8220;wash my hands of the whole matter&#8221;. At this point there is little Apple would do, even if I made a fuss about it (which I&#8217;m not going to, of course). Next time I walk by that particular Apple store, I may have a word with the manager (regarding the Genius I&#8217;d dealt with), but that&#8217;s about it.</p>
<p>The moral of the story is not that Apple&#8217;s customer care sucks or rocks. Apple Genii are just people, some are very good, others exceptionally bad, and most of them are somewhere in between. The take-home lesson for me here was that when dealing with Apple, if you get turned down by one store, you shouldn&#8217;t stop there! Take the time to visit a couple more and to persue the matter as far as you can.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/06/26/apple-genius/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Selling my old MacBook Pro</title>
		<link>http://programmingzen.com/2009/06/16/selling-my-old-macbook-pro/</link>
		<comments>http://programmingzen.com/2009/06/16/selling-my-old-macbook-pro/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 21:29:30 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=819</guid>
		<description><![CDATA[A few days ago I placed my old MacBook Pro up for auction on Ebay, with a starting price of $200 and no reserve. While the auction has generated interest, so far there has been only one bidder. The auction ends in a little over two days. If you are interested, please read the description [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago <a href="http://cgi.ebay.ca/ws/eBayISAPI.dll?ViewItem&#038;item=250444078811">I placed my old MacBook Pro up for auction</a> on Ebay, with a starting price of $200 and no reserve. While the auction has generated interest, so far there has been only one bidder. The auction ends in a little over two days. If you are interested, please read the description carefully and then bid with confidence. Despite being damaged, a laptop like this is still worth a few hundreds dollars due the sheer amount of working parts in it (CPU, memory, hard-drive, LCD matte screen, new battery, MagSafe adapter, remote control which works with new models too, etc&#8230;). It could be used as an extra Mac in your arsenal if utilized through Remote Desktop or repaired. There is also a chance that it could be repaired for free by Apple (though of course I cannot guarantee this point).</p>
<div align="center"><a href="http://cgi.ebay.ca/ws/eBayISAPI.dll?ViewItem&#038;item=250444078811"><img src="http://antoniocangiano.com/images/ebay/MacBookPro/listing.png" alt="Ebay Listing" title="Click to bid" border="0" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/06/16/selling-my-old-macbook-pro/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Do Androids Count Electric Sheep with DB2 or MySQL?</title>
		<link>http://programmingzen.com/2009/06/05/do-androids-count-electric-sheep-with-db2-or-mysql/</link>
		<comments>http://programmingzen.com/2009/06/05/do-androids-count-electric-sheep-with-db2-or-mysql/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 18:04:51 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=800</guid>
		<description><![CDATA[Counting rows is an ubiquitous operation on the web, so much so that it&#8217;s often overused. Regardless of misuse, there is no denying that the performance of counting operations has an impact on most applications. In this post I&#8217;ll discuss my findings about the performance of DB2 9.5 and MySQL 5.1 regarding counting records. For [...]]]></description>
			<content:encoded><![CDATA[<p>Counting rows is an ubiquitous operation on the web, so much so that it&#8217;s often overused. Regardless of misuse, there is no denying that the performance of counting operations has an impact on most applications. In this post I&#8217;ll discuss my findings about the performance of DB2 9.5 and MySQL 5.1 regarding counting records.</p>
<p>For those of you who are not into science fiction, let me clarify that the odd title of this post is a tongue-in-cheek reference to the great novel, <em><a href="http://en.wikipedia.org/wiki/Do_Androids_Dream_of_Electric_Sheep%3F">Do Androids Dream of Electric Sheep?</a></em>.</p>
<p>I connected to the database, created the table, imported the data and benchmarked counting operations using ActiveRecord in a standalone script. Here is the code I used:</p>
<div class="highlight">
<pre><span class="c1">#!/usr/bin/env ruby</span>
<span class="nb">require</span> <span class="s2">&quot;rubygems&quot;</span>
<span class="nb">require</span> <span class="s2">&quot;active_record&quot;</span>
<span class="nb">require</span> <span class="s1">&#39;benchmark&#39;</span>

<span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Base</span><span class="o">.</span><span class="n">establish_connection</span><span class="p">(</span>
  <span class="ss">:adapter</span>  <span class="o">=&gt;</span> <span class="ss">:mysql</span><span class="p">,</span>
  <span class="ss">:username</span> <span class="o">=&gt;</span> <span class="s2">&quot;myuser&quot;</span><span class="p">,</span>
  <span class="ss">:password</span> <span class="o">=&gt;</span> <span class="s2">&quot;mypass&quot;</span><span class="p">,</span>
  <span class="ss">:database</span> <span class="o">=&gt;</span> <span class="s2">&quot;mydb&quot;</span><span class="p">)</span>

<span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Schema</span><span class="o">.</span><span class="n">define</span> <span class="k">do</span>
  <span class="n">create_table</span> <span class="ss">:people</span><span class="p">,</span> <span class="ss">:force</span> <span class="o">=&gt;</span> <span class="kp">true</span> <span class="k">do</span> <span class="o">|</span><span class="n">t</span><span class="o">|</span>
    <span class="n">t</span><span class="o">.</span><span class="n">string</span> <span class="ss">:name</span><span class="p">,</span> <span class="ss">:null</span> <span class="o">=&gt;</span> <span class="kp">false</span>
    <span class="n">t</span><span class="o">.</span><span class="n">string</span> <span class="ss">:fbid</span><span class="p">,</span> <span class="ss">:null</span> <span class="o">=&gt;</span> <span class="kp">false</span>
    <span class="n">t</span><span class="o">.</span><span class="n">string</span> <span class="ss">:gender</span>
    <span class="n">t</span><span class="o">.</span><span class="n">string</span> <span class="ss">:profession</span>
  <span class="k">end</span>
<span class="k">end</span>

<span class="k">class</span> <span class="nc">Person</span> <span class="o">&lt;</span> <span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Base</span>
<span class="k">end</span>

<span class="c1"># This can be sped up by performing an import instead</span>
<span class="no">Person</span><span class="o">.</span><span class="n">transaction</span> <span class="k">do</span>
  <span class="no">File</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="s2">&quot;person.tsv&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">each_line</span> <span class="k">do</span> <span class="o">|</span><span class="n">line</span><span class="o">|</span>
    <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="sr">/\t/</span><span class="p">)</span>
    <span class="nb">p</span> <span class="o">=</span> <span class="no">Person</span><span class="o">.</span><span class="n">new</span>
    <span class="nb">p</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">line</span><span class="o">[</span><span class="mi">0</span><span class="o">]</span>
    <span class="nb">p</span><span class="o">.</span><span class="n">fbid</span> <span class="o">=</span> <span class="n">line</span><span class="o">[</span><span class="mi">1</span><span class="o">]</span>
    <span class="nb">p</span><span class="o">.</span><span class="n">gender</span> <span class="o">=</span> <span class="n">line</span><span class="o">[</span><span class="mi">6</span><span class="o">]</span>
    <span class="nb">p</span><span class="o">.</span><span class="n">profession</span> <span class="o">=</span> <span class="n">line</span><span class="o">[</span><span class="mi">17</span><span class="o">]</span>
    <span class="nb">p</span><span class="o">.</span><span class="n">save!</span>
  <span class="k">end</span>
<span class="k">end</span>

<span class="n">n</span> <span class="o">=</span> <span class="mi">100</span>
<span class="no">Benchmark</span><span class="o">.</span><span class="n">bm</span><span class="p">(</span><span class="mi">26</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">x</span><span class="o">|</span>
  <span class="n">x</span><span class="o">.</span><span class="n">report</span><span class="p">(</span><span class="s2">&quot;Count all:&quot;</span><span class="p">)</span> <span class="p">{</span> <span class="n">n</span><span class="o">.</span><span class="n">times</span> <span class="p">{</span> <span class="no">Person</span><span class="o">.</span><span class="n">count</span> <span class="p">}</span> <span class="p">}</span>
  <span class="n">x</span><span class="o">.</span><span class="n">report</span><span class="p">(</span><span class="s2">&quot;Count profession:&quot;</span><span class="p">)</span> <span class="p">{</span> <span class="n">n</span><span class="o">.</span><span class="n">times</span> <span class="p">{</span> <span class="no">Person</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="ss">:profession</span><span class="p">)</span> <span class="p">}</span> <span class="p">}</span>

  <span class="n">x</span><span class="o">.</span><span class="n">report</span><span class="p">(</span><span class="s2">&quot;Count females:&quot;</span><span class="p">)</span> <span class="k">do</span>
    <span class="n">n</span><span class="o">.</span><span class="n">times</span> <span class="p">{</span> <span class="no">Person</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="ss">:conditions</span> <span class="o">=&gt;</span> <span class="s2">&quot;gender = &#39;Female&#39;&quot;</span><span class="p">)</span> <span class="p">}</span>
  <span class="k">end</span>

  <span class="n">x</span><span class="o">.</span><span class="n">report</span><span class="p">(</span><span class="s2">&quot;Count males w/ profession:&quot;</span><span class="p">)</span> <span class="k">do</span>
    <span class="n">n</span><span class="o">.</span><span class="n">times</span> <span class="p">{</span> <span class="no">Person</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="ss">:profession</span><span class="p">,</span> <span class="ss">:conditions</span> <span class="o">=&gt;</span> <span class="s2">&quot;gender = &#39;Male&#39;&quot;</span><span class="p">)</span> <span class="p">}</span>
  <span class="k">end</span>
<span class="k">end</span>
</pre>
</div>
<p>Please note that importing records in a huge transaction containing hundreds of thousands of INSERT operations is far from the most efficient way to import. Massive imports of data using the load/import facilities provided by each database is the way to go (also see the <a href="http://rubyforge.org/projects/arext/">ar-extensions plugin</a>). The lengthy import wasn&#8217;t benchmarked here though, so it isn&#8217;t determinant for this article.</p>
<p><a href="http://download.freebase.com/datadumps/2009-03-23/browse/people.tar.bz2">people.tsv</a> is a 92.7 MB tab separated values file that contains 875,857 records from the <a href="http://www.freebase.com/">Freebase project</a> (in my file I removed the header line, leaving only records).</p>
<p>For those who are not familiar with ActiveRecord, the queries executed behind the scenes are (in order):</p>
<div class="highlight">
<pre><span class="k">SELECT</span> <span class="k">count</span><span class="p">(</span><span class="o">*</span><span class="p">)</span> <span class="k">AS</span> <span class="n">count_all</span> <span class="k">FROM</span> <span class="n">people</span>

<span class="k">SELECT</span> <span class="k">count</span><span class="p">(</span><span class="n">people</span><span class="p">.</span><span class="n">profession</span><span class="p">)</span> <span class="k">AS</span> <span class="n">count_profession</span> <span class="k">FROM</span> <span class="n">people</span>

<span class="k">SELECT</span> <span class="k">count</span><span class="p">(</span><span class="o">*</span><span class="p">)</span> <span class="k">AS</span> <span class="n">count_all</span> <span class="k">FROM</span> <span class="n">people</span> <span class="k">WHERE</span> <span class="p">(</span><span class="n">gender</span> <span class="o">=</span> <span class="s1">&#39;Female&#39;</span><span class="p">)</span>

<span class="k">SELECT</span> <span class="k">count</span><span class="p">(</span><span class="n">people</span><span class="p">.</span><span class="n">profession</span><span class="p">)</span> <span class="k">AS</span> <span class="n">count_profession</span> <span class="k">FROM</span> <span class="n">people</span> <span class="k">WHERE</span> <span class="p">(</span><span class="n">gender</span> <span class="o">=</span> <span class="s1">&#39;Male&#39;</span><span class="p">)</span>
</pre>
</div>
<p>While the table definition (for MySQL) is:</p>
<div class="highlight">
<pre><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="o">`</span><span class="n">people</span><span class="o">`</span> <span class="p">(</span>
	<span class="o">`</span><span class="n">id</span><span class="o">`</span> <span class="nb">int</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span> <span class="k">DEFAULT</span> <span class="k">NULL</span> <span class="n">auto_increment</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
	<span class="o">`</span><span class="n">name</span><span class="o">`</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">)</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">,</span>
	<span class="o">`</span><span class="n">fbid</span><span class="o">`</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">)</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">,</span>
	<span class="o">`</span><span class="n">gender</span><span class="o">`</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">),</span>
	<span class="o">`</span><span class="n">profession</span><span class="o">`</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">)</span>
<span class="p">)</span> <span class="n">ENGINE</span><span class="o">=</span><span class="n">InnoDB</span>
</pre>
</div>
<p>As easily verified by enabling logging with:</p>
<div class="highlight">
<pre><span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Base</span><span class="o">.</span><span class="n">logger</span> <span class="o">=</span> <span class="no">Logger</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="no">STDOUT</span><span class="p">)</span>
</pre>
</div>
<p>Without much further ado, here are the times I obtained on my last generation MacBook Pro 2.66 GHz with 4 GB DDR3 RAM, and 320 GB @ 7200 rpm hard disk, running Mac OS X Leopard:</p>
<div class="highlight">
<pre>
MySQL:

  Count all:                  42.467522
  Count profession:           52.130935
  Count females:              54.575469
  Count males w/ profession:  64.046631

DB2:

  Count all:                  5.818485
  Count profession:           7.714391
  Count females:              8.556377
  Count males w/ profession:  9.656739
</pre>
</div>
<p>Or in graph form:</p>
<p align="center">
  <img src="/images/count-performance.png" alt="COUNT performance graph" />
</p>
<p>That&#8217;s an impressive difference. To be exact, in this example DB2 was between 6 and 7 times faster than MySQL. In the case of COUNT(*), DB2 counted almost a million records in 58 milliseconds, or in about <a href="http://www58.wolframalpha.com/input/?i=0.058s">the blink of an eye</a> according to Wolfram Alpha.</p>
<p>For those who are skeptical, please note that DB2 was not manually fine-tuned in any way. The client codepage was set to 1252 to allow Greek letters, and the log size was increased to permit such a huge transaction during the import. That&#8217;s it, no optimizations were attempted. This is <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&#038;S_TACT=ACDB201">DB2 Express-C</a> out of the box. It looks like smart androids count electric sheep with DB2 after all. <img src='http://programmingzen.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
<p>The advantages of DB2 over MySQL when dealing with a massive volume of traffic are well known (and not limited to performance either), but DB2 can dramatically improve performance even for your average web application. And DB2 9.7, which will be released this month, increases the performance and the ability to self-tune itself to the available resources and required workload even further. If you&#8217;d like to try DB2 Express-C for yourself, you can <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&#038;S_TACT=ACDB201">download it here</a>. It doesn&#8217;t cost you a dime to obtain and can be used for development, testing and production absolutely free of charge.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/06/05/do-androids-count-electric-sheep-with-db2-or-mysql/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>TextMate bundle for DB2</title>
		<link>http://programmingzen.com/2009/05/22/textmate-bundle-for-db2/</link>
		<comments>http://programmingzen.com/2009/05/22/textmate-bundle-for-db2/#comments</comments>
		<pubDate>Fri, 22 May 2009 20:39:12 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=781</guid>
		<description><![CDATA[Before leaving on a recent business trip to Italy I begun working on a TextMate bundle for DB2. Here I&#8217;ll introduce it in the hope that it will interest some TextMate and DB2 users. Installation There are two simple prerequisites for using this bundle: 1) Install DB2 as a regular user (not root); 2) Source [...]]]></description>
			<content:encoded><![CDATA[<p>Before leaving on a recent business trip to Italy I begun working on a <a href="http://github.com/acangiano/db2-textmate-bundle/tree/master">TextMate bundle for DB2</a>. Here I&#8217;ll introduce it in the hope that it will interest some TextMate and DB2 users.</p>
<p><strong>Installation</strong></p>
<p>There are two simple prerequisites for using this bundle: 1) <a href="http://antoniocangiano.com/2009/04/27/screencast-on-how-to-install-db2-express-c-on-mac-os-x/">Install DB2</a> as a regular user (not root); 2) Source the db2profile by, for example, adding <code>. ~/sqllib/db2profile</code> to your shell profile (e.g., in <code>~/.profile</code>). Both of these will ensure that your user is able to issue DB2 commands.</p>
<p>To install the bundle, you can run the following (assuming you have git installed):</p>
<div class="highlight">
<pre>sudo mkdir -p /Library/Application<span class="se">\ </span>Support/TextMate/Bundles
<span class="nb">cd</span> /Library/Application<span class="se">\ </span>Support/TextMate/Bundles
git clone git://github.com/acangiano/db2-textmate-bundle.git <span class="s2">&quot;DB2.tmbundle&quot;</span>
</pre>
</div>
<p>Alternatively, you can <a href="http://antoniocangiano.com/files/DB2.tmbundle.zip">download this file</a>, unzip it and then double click on the DB2.tmbundle that was extracted. Of course, the previous method has the advantage of being able to easily update the bundle through <code>git pull</code>.</p>
<p>If TextMate is running while you executed the previous step, you may want to also execute the following line:</p>
<div class="highlight">
<pre>osascript -e <span class="s1">&#39;tell app &quot;TextMate&quot; to reload bundles&#39;</span>
</pre>
</div>
<p></p>
<p>This is equivalent to selecting Bundles ? Bundle Editor ? Reload Bundles from within TextMate.</p>
<p><strong>Using the bundle</strong></p>
<p>If you followed the instructions above, at this point you should see a DB2 menu under Bundles:</p>
<div align="center"><img src="http://antoniocangiano.com/images/bundles-db2.png" alt="DB2 Bundle for Textmate" /></div>
<p></p>
<p>TextMate is a text editor, and as such it expects you to have an open document, in order to execute commands from this bundle. The good news is that an empty, untitled, open by default window will suffice.</p>
<p>As you can see from the image above, you can start the DB2 server, stop it, run an arbitrary query or DB2 command and open up the Information Center for DB2 9.5 in your browser. Below the separating line there are also two submenus, Database and Tables.</p>
<p>Let&#8217;s consider Database first:</p>
<div align="center"><img src="http://antoniocangiano.com/images/database-db2.png" alt="The Database submenu" /></div>
<p></p>
<p>Within the Database menu we can connect to a database (this step is required before being able to query a database), disconnect, create a database, drop it, and create the SAMPLE database that ships with DB2 so you can get some practice.</p>
<p>Likewise, while it&#8217;s at a very early stage of development, we have the Tables submenu:</p>
<div align="center"><img src="http://antoniocangiano.com/images/table-db2.png" alt="The Tables submenu" /></div>
<p></p>
<p>So far we can list the tables within the database we are currently connected to, and drop an existing table.</p>
<p>You can use the Shift-Command-D combination to bring up a convenient contextual menu of the most common tasks, while you are within a document (unless you are editing an HTML file, in which case that combination brings up Safari):</p>
<div align="center"><img src="http://antoniocangiano.com/images/menu-db2.png" alt="DB2's menu" /></div>
<p></p>
<p>The result of each command executed is flashed to the user in the form of an informative tooltip:</p>
<div align="center"><img src="http://antoniocangiano.com/images/tooltip-db2.png" alt="The output of DB2START as a tooltip" /></div>
<p></p>
<p><strong>Conclusion</strong></p>
<p>The aim of this bundle is to provide a more convenient way to work with DB2 without having to switch between your coding editor and the command line. It&#8217;s admittedly just a &#8220;seed&#8221;, a very early effort, but I sincerely hope that even at this stage it can be useful to some people. Being an open source project that&#8217;s released under the MIT license, you are free to contribute to it and more than welcome to <a href="http://github.com/acangiano/db2-textmate-bundle/tree/master">fork it on Github</a> as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/05/22/textmate-bundle-for-db2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
