<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>.::output &gt;&gt; /dev/null::. : Category development, everything about development</title>
    <link>/category/development.rss</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>where otherwise good ideas go to waste</description>
    <item>
      <title>Making Objective-C Land More Habitable</title>
      <description>&lt;p&gt;
Over these past few months, I have been working on a long-term class project using OS X technologies in both Objective-C and &lt;a href="http://developer.apple.com/safari/library/documentation/AppleApplications/Conceptual/SafariJSProgTopics/Tasks/ObjCFromJavaScript.html"&gt;Javascript&lt;/a&gt;. Overall, the experience was pretty good (except for the Javascript part) -- and I suspect much easier compared to having to use Java. Using Java would require us to hunt down various libraries and then filter through them since there are probably 10++ different libraries for each thing that we need to do. So using OS X was a good choice.
&lt;/p&gt;

&lt;p&gt;
However, there are a few tools that I wished I had known earlier....
&lt;/p&gt;

&lt;h2&gt;GHUnit&lt;/h2&gt;
&lt;p&gt;
Unit testing using Cocoa is pretty complicated. In fact, it's unnecessarily more complicated than Java, Ruby or Smalltalk. It's &lt;em&gt;only&lt;/em&gt; less complicated than unit testing C++ (which doesn't say much)! There are &lt;strong&gt;two&lt;/strong&gt; things that particularly irk me:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Not seeing green/red!&lt;/strong&gt; - You have to actually &lt;strong&gt;read&lt;/strong&gt; the text in the build log to see which of your tests pass and fail. This is completely ridiculous - it's so easy to miss a failing test case because of this. Anyone who has used the &lt;a href="http://en.wikipedia.org/wiki/XUnit"&gt;Xunit&lt;/a&gt; testing framework family is accustomed to seeing &lt;span style="background: green; color: white;"&gt;green&lt;/span&gt; for passing tests and &lt;span style="background: red; color: white;"&gt;red&lt;/span&gt; for failing tests.

&lt;br/&gt;
&lt;div style="text-align:center;"&gt;
&lt;a href="http://developer.apple.com/tools/unittest.html"&gt;
&lt;img src="http://developer.apple.com/tools/images/BuildWindow.jpg" alt="A Failed Test Logged in the Xcode Build Results Window" border="0" width="50%" /&gt;&lt;/a&gt;
&lt;br/&gt;
&lt;small&gt;A Failed Test Logged in the Xcode Build Results Window&lt;/small&gt;
&lt;/div&gt;
&lt;br/&gt;
&lt;/li&gt;

&lt;li&gt;&lt;strong&gt;Not being able to debug your unit tests&lt;/strong&gt; - You have to perform some boilerplate &lt;a href="http://chanson.livejournal.com/120740.html"&gt;steps&lt;/a&gt; on your own. Such steps should be automated for you!&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
Fortunately, &lt;a href="http://rel.me/2009/02/21/unit-testing-for-mac-os-x-and-iphone-ghunit/"&gt;GHUNit&lt;/a&gt; comes along. And at least solves those &lt;strong&gt;two&lt;/strong&gt; problems. It has become my choice for unit testing in Cocoa and all my future projects will use it. It's released under a very liberal open source &lt;a href="http://github.com/gabriel/gh-unit/blob/master/LICENSE"&gt;license&lt;/a&gt; so using it in your own project shouldn't be a problem. Apple and the Xcode team should integrate this directly into Xcode.
&lt;/p&gt;

&lt;div style="text-align:center;"&gt;
&lt;a href="http://bytebucket.org/vazexqi/healthmonitor/wiki/Images/GHUnitTest.png" title="View 'Create an External Build System project' on Flickr.com"&gt;
&lt;img src="http://bytebucket.org/vazexqi/healthmonitor/wiki/Images/GHUnitTest.png" alt="GHUnit in action" border="0" width="50%" /&gt;&lt;/a&gt;
&lt;br/&gt;
&lt;small&gt;GHUnit in action&lt;/small&gt;
&lt;/div&gt;

&lt;h2&gt;F-Script&lt;/h2&gt;
&lt;p&gt;
The cocoa libraries are nice. But sometimes the documentation can be a bit confusing. So, the best way to find out what a method or class does it to write some code for it and try it out. But honestly, would you like writing a small program each time to try a method or class out?
&lt;/p&gt;

&lt;p&gt;
That's when you need &lt;a href="http://www.fscript.org/"&gt;F-Script&lt;/a&gt; which allows you to call run Objective-C like you would run a scripting language. Need to find out how that NSString method behaves? Just type in into the F-Script REPL workspace. You can even play around with &lt;a href="http://www.fscript.org/documentation/LearnFScriptIn20Minutes/index.htm"&gt;Core Image&lt;/a&gt; easily in the F-Script workspace! 
&lt;/p&gt;
&lt;div style="text-align:center;"&gt;
&lt;a href="http://www.fscript.org/images/screenshots/shell.jpg"&gt;
&lt;img src="http://www.fscript.org/images/screenshots/shell.jpg" alt="GHUnit in action" border="0" width="50%" /&gt;&lt;/a&gt;
&lt;br/&gt;
&lt;small&gt;F-Script shell in action&lt;/small&gt;
&lt;/div&gt;

&lt;p&gt;
But wait! F-Script has even more to offer. Using &lt;a href="http://pmougin.wordpress.com/2009/08/29/f-script-anywhere-on-snowy/"&gt;F-Script &lt;em&gt;Anywhere&lt;/em&gt;&lt;/a&gt; allows you to inject the F-Script environment into any Cocoa application. That way you can quickly figure out and play around with other people's application!
&lt;/p&gt;

&lt;p&gt;
The only thing you need to do is spend about 20 minutes learning the F-Script syntax which is very similar to Smalltalk's - so it only took me about 5 minutes.
&lt;/p&gt;

&lt;h2&gt;Clang Static Analyzer&lt;/h2&gt;
&lt;p&gt;
One area where Java really shines is the abundance of high-quality tools for static analysis. Using these tools allow you to avoid a lot of silly mistakes before you even compile or run your Java code.
&lt;/p&gt;

&lt;p&gt;
Previously, Objective-C was definitely lacking in this area. However, the &lt;a href="http://clang-analyzer.llvm.org/"&gt;Clang Static Analyzer&lt;/a&gt; hopes to change that. In fact, if you are using the latest version of Xcode under Snow Leopard, it should be &lt;a href="http://developer.apple.com/mac/library/featuredarticles/StaticAnalysis/index.html"&gt;integrated&lt;/a&gt; already. Here's the static analyzer in action:
&lt;/p&gt;

&lt;div style="text-align:center;"&gt;
&lt;a href="http://developer.apple.com/mac/library/featuredarticles/StaticAnalysis/index.html"&gt;
&lt;img src="http://developer.apple.com/mac/library/featuredarticles/StaticAnalysis/Art/uninitialized.jpg" alt="GHUnit in action" border="0" width="50%" /&gt;&lt;/a&gt;
&lt;br/&gt;
&lt;small&gt;Uninitialized Variable Error&lt;/small&gt;
&lt;/div&gt;

&lt;p&gt;
For our particular project, we needed to use OS X Leopard so followed &lt;a href="http://clang-analyzer.llvm.org/scan-build.html"&gt;these&lt;/a&gt; steps to get the static analyzer to work. Even though it took a few more steps, the extra trouble is worth it since it catches a lot of garbage collection issues that we might have missed otherwise.
&lt;/p&gt;

&lt;p&gt;
The Clang Static Analyzer is based on the &lt;a href="http://llvm.org/"&gt;LLVM&lt;/a&gt; compiler infrastructure developed here the University of Illinois at Urbana-Champaign.
&lt;/p&gt;

&lt;h2&gt;BWToolkit&lt;/h2&gt;

&lt;p&gt;
Interface Builder is awesome. It definitely beats any other interface builder that I have tried. However, it can be too &lt;em&gt;basic&lt;/em&gt; at times. It works very well, if you are doing a simple UI. But it lacks the palettes for some of the more advanced (but pretty commonplace) UI that you see in Mail.app, iCal.app, etc.
&lt;/p&gt;

&lt;p&gt;
That's when &lt;a href="http://www.brandonwalkin.com/blog/2008/11/13/introducing-bwtoolkit/"&gt;BWToolkit&lt;/a&gt; comes in. It offers a plethora of different palettes which makes designing your UI extremely easy. And you can use all of them using drag-and-drop from Interface Builder.
&lt;/p&gt;

&lt;div style="text-align:center;"&gt;
&lt;a href="http://brandonwalkin.com/blog/images/transparent3.png"&gt;
&lt;img src="http://brandonwalkin.com/blog/images/transparent3.png" alt="BWToolkit" border="0" width="50%" /&gt;&lt;/a&gt;
&lt;br/&gt;
&lt;small&gt;BWToolkit's suite of controls for HUD windows&lt;/small&gt;
&lt;/div&gt;

&lt;p&gt;
It's released under the liberal BSD license so you don't need to worry about using it for your projects. GHUnit itself uses it and that's actually how I discovered this wonderful toolkit.
&lt;/p&gt;

&lt;hr /&gt;

Overall, OS X has a lot to offer in both &lt;a href="http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/OSX_Technology_Overview/About/About.html"&gt;libraries&lt;/a&gt; and &lt;a href="http://developer.apple.com/tools/"&gt;tools&lt;/a&gt;. And when it falls short, some other developer out there is usually passionate enough to create and share their tools with you. It just takes &lt;em&gt;too&lt;/em&gt; long sometimes to find those tools. So hopefully, this list will be useful to some other aspiring OS X developer.

</description>
      <pubDate>Thu, 17 Dec 2009 13:58:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:66f7eb28-cf7c-4c20-89c1-133e6d3f2ce1</guid>
      <comments>http://blog.vazexqi.com/2009/12/17/making-objective-c-land-more-habitable#comments</comments>
      <category>development</category>
      <category>software</category>
      <category>clang</category>
      <category>bwtoolkit</category>
      <category>script</category>
      <category>f</category>
      <category>ghunit</category>
      <category>osx</category>
      <category>c</category>
      <category>objective</category>
      <category>cocoa</category>
      <trackback:ping>http://blog.vazexqi.com/trackbacks?article_id=316</trackback:ping>
      <link>http://blog.vazexqi.com/2009/12/17/making-objective-c-land-more-habitable</link>
    </item>
    <item>
      <title>Modifying plugin.xml of Existing Eclipse plugins</title>
      <description>&lt;p&gt;
I have been taking a deeper look at &lt;a href="http://mercurial.selenic.com/wiki/"&gt;Mercurial&lt;/a&gt; for some of my projects. And I was interested in looking at its source code. I usually do a lot of Java development and have gotten used to all the nifty navigation features that Eclipse/NetBeans/IntelliJ have to offer such as "Jump to Declaration", "Open Type Herarchy", etc. So I wanted to find a good IDE for going through the Mercurial source code, which is written in Python. Apparently, there isn't a de-facto IDE for Python. But &lt;a href="http://pydev.org/"&gt;PyDev&lt;/a&gt; comes close.
&lt;/p&gt;

&lt;p&gt;
Unfortunately &#8211; I am not sure whether this was intentional or not &#8211; the keyboard shortcuts for PyDev aren't very platform friendly. Instead of the default modifier key (Ctrl on Windows/Linux and &amp;#8984; on Mac) the developers have hardcoded the modifier to Ctrl for all platforms. So to invoke the I would have to use Ctrl + Shift + T instead of &amp;#8984; + Shift + T.
&lt;/p&gt;

&lt;p&gt;
So how do we change the keybindings? Well, there is an extension point in the Eclipse plugin architecture for specifying the keybindings. Take a look at &lt;a href="http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_bindings.html"&gt;org.eclipse.ui.bindings&lt;/a&gt; And those keybindings are stored as plain text in a plugin.xml file. For PyDev, it would be in the &lt;em&gt;plugins&lt;/em&gt; folder of your Eclipse installation. In my case, it was under eclipse-galileo/plugins/org.python.pydev_1.5.0.1251989166/plugin.xml
&lt;/p&gt;

&lt;p&gt;
So we can edit the plugin.xml file by looking for the 
&lt;pre&gt;
      ...
      &amp;lt;key
            sequence="Ctrl+Shift+T"
            contextId="org.python.pydev.ui.editor.scope"
            commandId="org.python.pydev.editor.actions.pyShowBrowser"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"&amp;gt;
      &amp;lt;/key&amp;gt;
      ...
&lt;/pre&gt;

and changing the Ctrl to M1 which stands for the default modifier key on your platform i.e. 

&lt;pre&gt;
      ...
      &amp;lt;key
            sequence="M1+Shift+T"
            contextId="org.python.pydev.ui.editor.scope"
            commandId="org.python.pydev.editor.actions.pyShowBrowser"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"&amp;gt;
      &amp;lt;/key&gt;
      ...
&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
Unfortunately, we are not done. And it took me some time to figure out the problem. Apparently, Eclipse doesn't read the plugin.xml every time. Instead, it caches a version of it somewhere. So even if we modify the plugin.xml, Eclipse might not know about it.
&lt;/p&gt;

&lt;p&gt;
What we  have to do is to &lt;em&gt;tell&lt;/em&gt; Eclipse to clean its cache. And we can do that by using the  &lt;code&gt;-clean&lt;/code&gt; option in its eclipse.ini file. On the Mac, this file in located in Eclipse.app/Contents/MacOS/eclipse.ini (you need to right-click on the Eclipse application and select "Show Package Contents").
&lt;/p&gt;

&lt;p&gt;
Change the first line so that it read something like this:
&lt;pre&gt;
-clean
-startup
../../../plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
...
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
Now when Eclipse starts up, it will clean its cache and read the newly modified plugin.xml file. Once we are done with this step, we should remove the &lt;code&gt;-clean&lt;/code&gt; option since this causes Eclipse to start up slower. And &lt;strong&gt;who&lt;/strong&gt; would want Eclipse to start up any slower than it already does?!
&lt;/p&gt;

&lt;p&gt;
And this is what the keybindings look like after the changes:
&lt;/p&gt;

&lt;a href="/files/pydev.png" title="PyDev with Mac-friendly Keybindings"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="/files/pydev.png" alt="PyDev with Mac-friendly Keybindings" border="0" width="375" height="340" /&gt;&lt;/div&gt;&lt;/a&gt;


</description>
      <pubDate>Sun, 11 Oct 2009 17:10:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:0356602b-aac2-4353-b231-bace4e60698f</guid>
      <comments>http://blog.vazexqi.com/2009/10/11/modifying-plugin-xml-of-existing-eclipse-plugins#comments</comments>
      <category>development</category>
      <category>eclipse</category>
      <category>keybindings</category>
      <category>pydev</category>
      <category>plugin.xml</category>
      <category>eclipse</category>
      <enclosure length="108857" url="http://blog.vazexqi.com/files/pydev.png" type="image/png"/>
      <link>http://blog.vazexqi.com/2009/10/11/modifying-plugin-xml-of-existing-eclipse-plugins</link>
    </item>
    <item>
      <title>Hacking Lua (in Xcode)</title>
      <description>&lt;p&gt;
I have always been fascinated by &lt;a href="http://en.wikipedia.org/wiki/Comparison_of_application_virtual_machines"&gt;application virtual machines&lt;/a&gt;. And I have been trying to find a simple but well-documented one to work on for fun. There is a proliferation of Javascript VMs out there but they are pretty big (V8 is the latest kid on the block and it's about 100 000 lines of C++, not my favorite language) and aren't as well documented.
&lt;/p&gt;

&lt;p&gt;
There are some smaller ones like &lt;a href="http://code.macournoyer.com/tinyrb/"&gt;tinyrb&lt;/a&gt; and &lt;a href="http://www.tinypy.org/"&gt;tinypy&lt;/a&gt; but the goal of such projects aren't really clear. I am not sure how much of Ruby/Python they are trying to support. They are great for hacking on if you have some experience with VMs already and can contribute to the design/implementation. But otherwise, it can be pretty hard to comprehend what is going on.
&lt;/p&gt;

&lt;p&gt;
Both tinyrb and tinypy did mention that they were trying to emulate the Lua VM. So I decided to check it out. The Lua VM (like the &lt;a href="http://www.parrot.org/"&gt;Parrot VM&lt;/a&gt;) is a register-based VM, which is pretty unusual since most VMs are stack-based. Its use of registers instead of a stack makes it more fascinating to study.
&lt;/p&gt;

&lt;p&gt;
And I like what I have seen so far. There is good documentation on &lt;em&gt;multiple&lt;/em&gt; levels: the language itself, the architecture of the VM and plenty of examples. Also, the code is in C which is less messy than C++. The Makefile is simple and isn't using any cryptic tricks. And Lua itself seems like a simple language to learn.
&lt;/p&gt;

&lt;p&gt;
So my plan is to dive into the source for Lua and then see what can be done to improve tinyrb. But first, I need to set up an environment to develop in.
&lt;/p&gt;

&lt;p&gt;
I could certainly continue to use vim/TextMate, but I have been using Xcode more because I am doing some iPhone development and have gotten use to some of its features. And I like its built-in debugger which saves me from having to interact with gdb directly for the common tasks. In fact, I am not sure if there are &lt;em&gt;better&lt;/em&gt; C/C++ IDEs for OS X. The Eclipse CDT project is the closest that I can think of but I haven't used it much.
&lt;/p&gt;


&lt;p&gt;
So here are my steps for doing this: from getting the source into Xcode and also starting a debugging session. I am using the All-in-one look for Xcode so your UI might look different.
&lt;/p&gt;

&lt;p&gt;
Grab the source for Lua-5.1.4 from &lt;a href="http://www.lua.org/ftp/lua-5.1.4.tar.gz"&gt;http://www.lua.org/ftp/lua-5.1.4.tar.gz&lt;/a&gt;. Unarchive it. For this article, I will be unarchiving it in ~/Xcode.
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3282596714" title="View 'Create an External Build System project' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://farm4.static.flickr.com/3602/3282596714_e4bea7e203.jpg" alt="Create an External Build System project" border="0" width="500" height="372" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
Fire up Xcode and create a new External Build System project. I called my project Lua. You can put the project wherever you want. It doesn't need to be in the same directory where you unarchived the Lua source code since we will be &lt;em&gt;referencing&lt;/em&gt; the source files anyway. 
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3281775589" title="View 'Add the existing Lua files' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://farm4.static.flickr.com/3289/3281775589_e28284b40e.jpg" alt="Add the existing Lua files" border="0" width="500" height="363" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
Right-click on the project and add the &lt;em&gt;entire&lt;/em&gt; directory where you unarchived the Lua source code. In my case it would be ~/Xcode/lua-5.1.4.
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3282596760" title="View 'After adding the files' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://static.flickr.com/3426/3282596760_5cd1fca875.jpg" alt="After adding the files" border="0" width="" height="" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
This is what it looks like after adding all the files.
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3281775761" title="View 'Make changes to the Makefile for OS X' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://static.flickr.com/3248/3281775761_3d00ee18bf.jpg" alt="Make changes to the Makefile for OS X" border="0" width="" height="" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
Next, we need to edit &lt;strong&gt;two&lt;/strong&gt; of the Makefiles. First, we need to edit the top level Makefile in ~/Xcode/lua-5.1.4. Change &lt;strong&gt;line 8&lt;/strong&gt; to PLAT= macosx since we are targeting the OS X platform. Then, we need to make changes to the Makefile in ~/Xcode/lua-5.1.4/src. Change &lt;strong&gt;line 17&lt;/strong&gt; to MYCFLAGS+= (we want the + symbol). Change &lt;strong&gt;line 108&lt;/strong&gt; to 	$(MAKE) all MYCFLAGS+=-DLUA_USE_LINUX MYLIBS="-lreadline" (again, we want the + symbol). In fact, by default, it should have the + symbol so that we can easily accumulate our own settings. I suspect that this is a careless omission in the Makefile for Lua.
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3281775837" title="View 'Changing the parameters of the Lua target' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://static.flickr.com/3156/3281775837_ebc0be8f0d.jpg" alt="Changing the parameters of the Lua target" border="0" width="" height="" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
We need to make some changes to the Target configuration for our Project. So navigate to the Lua target in your Groups &amp;amp; Files (it's the left navigation pane). And double-click the Lua target. Then edit it so that it resembles the image above. Notice the line that says "Settings show Debug" near the top of the window; we are changing the settings for Debug (and not Release).
&lt;/p&gt;

&lt;p&gt;
You need to change the directory to the location where you unarchived the Lua source so that it can find the top-level Makefile.
&lt;/p&gt;

&lt;p&gt;
Then you need to add a new build setting, MYCFLAGS so that we can pass the -g flag (for debug) to the compiler. Without this flag, we cannot debug our program effectively with the debugger (it doesn't have all the necessary debugging information).
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3281775787" title="View 'The result of the build (for debug)' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://static.flickr.com/3586/3281775787_05edcafb11.jpg" alt="The result of the build (for debug)" border="0" width="" height="" /&gt;&lt;/div&gt;&lt;/a&gt;
 
&lt;p&gt;
Now we can build our project by going to Build &amp;gt; Build. And notice that we are building for the Debug configuration i.e. on the menu item at the top it says 10.5 | Debug | i386. The settings that we made for our Lua target are reflected in the output of the build e.g. gcc -O2 -Wall -g .... (the -g flag that we specified in the settings).
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3281775925" title="View 'Executing Lua in the command line' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://static.flickr.com/3411/3281775925_52caa58b17.jpg" alt="Executing Lua in the command line" border="0" width="" height="" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
Now that the project builds, we can proceed to debug it (or rather we just want to step through its execution in the debugger to find out how it works). The image above shows how we would run that executable (notice that we are passing some arguments to it). We want mimic this and run the program in the debugger.&lt;/p&gt;


&lt;a href="http://www.flickr.com/photos/37092324@N00/3281775649" title="View 'Create a new executable that you can launch from Xcode' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://farm4.static.flickr.com/3568/3281775649_5c9532ee50.jpg" alt="Create a new executable that you can launch from Xcode" border="0" width="500" height="375" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
So we create a new Custom Executable. We call it Lua.
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3281775899" title="View 'Parameters for Lua custom executable' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://static.flickr.com/3659/3281775899_4a60fdbe58.jpg" alt="Parameters for Lua custom executable" border="0" width="" height="" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
In the dialog that pops-up, remember to specify the location of the lua executable (you will only have it after you have built the project).
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3281775869" title="View 'Don't load symbols lazily' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://static.flickr.com/3501/3281775869_58ff456e07.jpg" alt="Don't load symbols lazily" border="0" width="" height="" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
Before we can debug the lua executable, there is one more setting that we have to perform: change the way debugging symbols are loaded. So, open up the preferences for Xcode, and switch to the debugging tab. Ensure that the "Load symbols lazily" is &lt;strong&gt;unchecked&lt;/strong&gt;.
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3281775609" title="View 'Build and Debug your program' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://farm4.static.flickr.com/3373/3281775609_29b58f2147.jpg" alt="Build and Debug your program" border="0" width="500" height="375" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
Now we need to set a breakpoint. Notice in the image above that I have set one on line 378 in the lua.c (Xcode/lua-5.1.4/src/lua.c) file. After that we can invoke the debugger from the Build &amp;gt; Build and Debug menu.
&lt;/p&gt;

&lt;a href="http://www.flickr.com/photos/37092324@N00/3282597014" title="View 'Debugger in action' on Flickr.com"&gt;&lt;div style="text-align:center;"&gt;&lt;img src="http://static.flickr.com/3662/3282597014_dbb8e2e57d.jpg" alt="Debugger in action" border="0" width="" height="" /&gt;&lt;/div&gt;&lt;/a&gt;

&lt;p&gt;
And finally we have our debugger in action.
&lt;/p&gt;

&lt;p&gt;
The steps above are applicable for any other external project that you need to work on (sans the modifications to the Makefiles since that is Lua-specific).
&lt;/p&gt;

</description>
      <pubDate>Sun, 15 Feb 2009 13:03:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:ed0e3918-6584-4863-9c3b-98398f9e624b</guid>
      <comments>http://blog.vazexqi.com/2009/02/15/hacking-lua-in-xcode#comments</comments>
      <category>development</category>
      <category>software</category>
      <link>http://blog.vazexqi.com/2009/02/15/hacking-lua-in-xcode</link>
    </item>
    <item>
      <title>Session restore (sort of) in Eclipse with Mylyn</title>
      <description>&lt;p&gt;
&lt;small&gt;This was something that I really wanted to blog about for a long time...&lt;/small&gt;
&lt;/p&gt;

&lt;p&gt;
Last year I wanted to know a way to save &lt;em&gt;sessions&lt;/em&gt; in Eclipse like I could for Firefox. For instance, Firefox allows you to save the open tabs and windows into a new session and restore that session in the future. That way if you ever need to recall a set of tabs for reference, they can be easily activated by restoring the saved session.  
&lt;/p&gt;

&lt;p&gt;
In fact, any decent, editor or IDE should the option to save sessions. Heck, &lt;a href="http://www.vim.org/tips/tip.php?tip_id=1037"&gt;Vim&lt;/a&gt; and &lt;a href="http://www.phys.ufl.edu/docs/emacs/emacs_423.html"&gt;Emacs&lt;/a&gt; have this feature out-of-the-box. Sessions are really useful when you have to work on groups of related files at the same time but don't want to have to remember which they are.
&lt;/p&gt;

&lt;p&gt;
So why was there apparently no way to do this in Eclipse? Initially, I thought that &lt;a href="http://wbeaton.blogspot.com/2005/11/leanin-on-working-sets.html"&gt;Working Sets&lt;/a&gt; might be the solution. However, they only allowed you to &lt;strong&gt;group&lt;/strong&gt; files into sets. They don't actually remember the editors that are opened and what state you were in. So Working Sets were not even a poor man's implementation of sessions.
&lt;/p&gt;

&lt;p&gt;
Then epiphany struck! We could use the &lt;a href="http://www.eclipse.org/mylyn/"&gt;Mylyn&lt;/a&gt; plug-in to accomplish this. In fact, as you shall see, Mylyn can do even better than just saving sessions - it infers them automatically based on what you are doing! Mylyn comes installed standard now on Eclipse 3.3 and higher. In fact, the Mylyn view is even shown by default; it's not activated though. 
&lt;/p&gt;

&lt;p&gt;
Anyone who does not use sessions has a) an incredible memory, b) an inhumane ability to do context switching between tasks AND c) the luxury of not having to close his IDE ever. &lt;strong&gt;Or&lt;/strong&gt; the developer just doesn't know that such an excellent tool exists out there...
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.flickr.com/photos/37092324@N00/2237337520" title="View 'The Mylyn View' on Flickr.com"&gt;&lt;img src="http://farm3.static.flickr.com/2200/2237337520_8904796f46.jpg" alt="The Mylyn View" border="0" width="500" height="377" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;strong&gt;This is Mylyn&lt;/strong&gt;
&lt;br /&gt;
&lt;small&gt;I have readjusted my perspective a bit so that everything can fit nicely in a 800x600 window. The picture above shows the Mylyn view with some sample local tasks.&lt;/small&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.flickr.com/photos/37092324@N00/2236546165" title="View 'Activate a previous context' on Flickr.com"&gt;&lt;img src="http://farm3.static.flickr.com/2001/2236546165_8f5ef58a29.jpg" alt="Activate a previous context" border="0" width="500" height="377" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;strong&gt;Activating a previous session&lt;/strong&gt;
&lt;br /&gt;
&lt;small&gt;I am activating a previous session. By default, Mylyn automatically remembers the last context that you were in before closing the editor and will restore that.&lt;/small&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.flickr.com/photos/37092324@N00/2237337558" title="View 'The editors from a previous context are restored' on Flickr.com"&gt;&lt;img src="http://farm3.static.flickr.com/2395/2237337558_23cfccea58.jpg" alt="The editors from a previous context are restored" border="0" width="500" height="377" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;strong&gt;Previous session restored&lt;/strong&gt;
&lt;br /&gt;
&lt;small&gt;You can see that Mylyn remembers the files that were opened in that session and has restored them in the editors. *The current active task (see the Task List view) has a blue bullet next to it. In the Package Explorer view, you can even see the other files that I might have referred to in a previous session but did not open in any editor.&lt;/small&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.flickr.com/photos/37092324@N00/2236546213" title="View 'Creating a new local task' on Flickr.com"&gt;&lt;img src="http://farm3.static.flickr.com/2259/2236546213_7e8d634ab3.jpg" alt="Creating a new local task" border="0" width="500" height="377" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;strong&gt;Creating a new local task (context)&lt;/strong&gt;
&lt;br /&gt;
&lt;small&gt;Mylyn allows you to create local task for your own use. With the proper server, you can also create sharable tasks in a Bugzilla or JIRA repository. That way, you can share the same session with yourself when you are &lt;strong&gt;working on a different machine&lt;/strong&gt; or &lt;strong&gt;with your other teammates&lt;/strong&gt; so that they can take a look at the same things that you are looking at.&lt;/small&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.flickr.com/photos/37092324@N00/2237337616" title="View 'Editing a local task' on Flickr.com"&gt;&lt;img src="http://farm3.static.flickr.com/2278/2237337616_bbd0aa050d.jpg" alt="Editing a local task" border="0" width="500" height="377" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;strong&gt;Editing a local task (context)&lt;/strong&gt;
&lt;br /&gt;
&lt;small&gt;You can easily associate other metadata with each task. In fact, Mylyn was originally created to be a task-oriented system. It allows you to split your work into little tasks to help you focus.&lt;/small&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.flickr.com/photos/37092324@N00/2236546269" title="View 'Reveal all files or focus on active task' on Flickr.com"&gt;&lt;img src="http://farm3.static.flickr.com/2264/2236546269_f67d511b41.jpg" alt="Reveal all files or focus on active task" border="0" width="500" height="377" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;strong&gt;Deciding to show everything or just the active task&lt;/strong&gt;
&lt;br /&gt;
&lt;small&gt;You can easily switch between showing &lt;em&gt;all&lt;/em&gt; the files in the Package Explorer or focusing on the active task by clicking on the Mylyn button.&lt;/small&gt;
&lt;/p&gt;

&lt;p&gt;
Mylyn has a &lt;strong&gt;whole&lt;/strong&gt; bunch of other features. Some of the interesting ones include:
&lt;ul&gt;
&lt;li&gt;
The ability to share a context with different tasks. You can clone the current context and &lt;em&gt;paste&lt;/em&gt; it into a different task.
&lt;/li&gt;
&lt;li&gt;
It cleverly &lt;em&gt;remembers&lt;/em&gt; what editors and files that you have accessed and stores those into its session.
&lt;/li&gt;
&lt;li&gt;
It intelligently &lt;em&gt;forgets&lt;/em&gt; editors and files that you have not looked at for extended periods.
&lt;/li&gt;
&lt;li&gt;
You are always in control - you can override the behavior easily and promote/demote certain files from sessions.
&lt;/li&gt;
&lt;li&gt;
It records how long you spent on each task so that you can actually report that figure with certainty.
&lt;/li&gt;
&lt;li&gt;
It's well integrated with different perspective and views in Eclipse. And it is constantly being improved upon.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
Mylyn is great for helping you focus on your programming tasks. It stays out of your way for the most part but is easily accessible when you need it. Once you start using it, you really wished that every IDE out there (including the venerable IntelliJ) supported it.
&lt;/p&gt;

</description>
      <pubDate>Sat, 02 Feb 2008 14:59:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:3c465763-b2bd-4166-904a-1e6142a2661a</guid>
      <comments>http://blog.vazexqi.com/2008/02/02/session-restore-sort-of-in-eclipse-with-mylyn#comments</comments>
      <category>development</category>
      <category>eclipse</category>
      <category>sessions</category>
      <category>mylyn</category>
      <category>eclipse</category>
      <link>http://blog.vazexqi.com/2008/02/02/session-restore-sort-of-in-eclipse-with-mylyn</link>
    </item>
    <item>
      <title>Why tools can make it a pleasure to learn a new framework</title>
      <description>&lt;p&gt;
I was reading the book &lt;a href="http://www.manning.com/walls3/"&gt;&lt;em&gt;Spring In Action&lt;/em&gt;&lt;/a&gt; in my attempt to learn about Spring. More importantly, I needed to know enough to be able to incorporate refactoring support for it as part of my project.
&lt;/p&gt;

&lt;p&gt;
Unfortunately, the book had some typos which were actually technical errors. And this was just in Chapter 1! If you are trying to learn something for the first time and there are typos, you might not be able to detect it. And this can lead to hours of frustration....
&lt;/p&gt;

&lt;p&gt;
Fortunately, IntelliJ has support Spring. And it detects the errors for you! So even if the technical reviewers did not detect the error, at least your IDE (a good one) can do it for you and save you time.
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.flickr.com/photos/37092324@N00/2194909419" title="View 'Error detection' on Flickr.com"&gt;&lt;img src="http://farm3.static.flickr.com/2123/2194909419_8460951860.jpg" alt="Error detection" border="0" width="500" height="139" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;small&gt;IntelliJ 7 has support for Spring. In this case, it detected that something was wrong with the xml configuration file.&lt;/small&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.flickr.com/photos/37092324@N00/2194909447" title="View 'Error correction' on Flickr.com"&gt;&lt;img src="http://farm3.static.flickr.com/2322/2194909447_ff7f3207c4.jpg" alt="Error correction" border="0" width="412" height="179" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;small&gt;It even offers the ability to correct the error!&lt;/small&gt;
&lt;/p&gt;

&lt;p&gt;
I wonder if the error in the book could have been detected had the reviewers use a better tool. Or at least attempt to run it using some automated tool.
&lt;/p&gt;

</description>
      <pubDate>Tue, 15 Jan 2008 11:23:08 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:12163c69-0d05-47cb-96a4-577157a8af5f</guid>
      <comments>http://blog.vazexqi.com/2008/01/15/why-tools-can-make-it-a-pleasure-to-learn-a-new-framework#comments</comments>
      <category>software</category>
      <category>development</category>
      <link>http://blog.vazexqi.com/2008/01/15/why-tools-can-make-it-a-pleasure-to-learn-a-new-framework</link>
    </item>
    <item>
      <title>Convention Preserving Refactorings</title>
      <description>&lt;p&gt;&lt;a href="http://www.artima.com/weblogs/viewpost.jsp?thread=217080"&gt;Refactoring Dynamic Code&lt;/a&gt;:
&lt;/p&gt;

&lt;blockquote cite="http://www.artima.com/weblogs/viewpost.jsp?thread=217080" title="Refactoring Dynamic Code"&gt; "These tools, along with the relatively small amount of Ruby code required to implement the desired features, made life easy during the first few iterations. With each new feature, however, the amount of refactoring required to keep the codebase clean increased. Although Rails' adherence to the DRY principle helped reduce duplication, each refactoring had to change numerous code artifacts. Some of the changes, admittedly, were needed to keep the code in line with Rails' convention-over-configuration philosophy.
&lt;br /&gt;
Renaming an entity class, for instance, requires renaming the corresponding database tables, including other columns and indexes referencing the model's table, renaming the model class, changing the corresponding controller, helper classes, and every reference to the entity class in the views, as well as renaming the directory containing the view classes and templates. And, of course, you have to similarly rename the associated tests and all references to the model, controller, and views in the tests and fixtures."
&lt;/blockquote&gt;

&lt;p&gt;
One of the advantages of being under Prof. Ralph Johnson is that we are &lt;em&gt;indoctrinated&lt;/em&gt; to think of programming as a series of program transformation. From the humble HelloWorld program (just think of when you are reediting the program to add some comments or change what gets printed out to the console) to more complex programs out there, almost everything can be viewed as a series of transformations.
&lt;/p&gt;

&lt;p&gt;
&lt;em&gt;Refactoring&lt;/em&gt; is as a form of program transformation. Refactoring is a process where you restructure your code without affecting its observable behavior -- where behavior is defined pretty loosely. Why would anyone want to do something like this? If you have never done refactoring before this might seem like a worthless task. After all, if you aren't modifying the behavior of the program, you aren't adding new features to it. And features are what the customer cares about, right?&lt;sup&gt;1&lt;/sup&gt;
&lt;/p&gt;

&lt;p&gt;
Well, turns out that you refactor to make your code easier to understand. Code that is easier to understand is also easier to modify. So essentially, refactoring helps prepare your program for the next feature, and the next feature, and the next feature... that you want to add; making those features easier to add.
&lt;/p&gt;

&lt;p&gt;
Certain refactorings can now be automated through an intelligent IDE. And IDEs have generally done a very good job of it -- until you being to cross the traditional language barrier. For instance, look at Rails. Rails is a framework that relies on Ruby, erb, Javascript, SQL, etc. When you perform a refactoring on your Ruby code does that refactoring percolated correctly through the entire program? If you rename a method in your Ruby code, will it change the name of the method to the new one everywhere that it was called before? Would it also be able to change the method call inside the erb file?
&lt;/p&gt;

&lt;p&gt;
Furthermore, because Rails relies on the &lt;em&gt;convention-over-configuration&lt;/em&gt; idea, it is desirable that your refactoring preserves those conventions as well. So now, your refactoring tool not only needs to know Ruby but it must be configured to understand the Rails framework itself! Renaming your Rails model should also make the appropriate changes to the controller and your erb file just because the framework expects them to be related &lt;em&gt;by name&lt;/em&gt; in a predetermined manner. Failing to do so would actually cause your program to fail.&lt;/p&gt;

&lt;p&gt;
If another framework comes along, your tool has to be &lt;em&gt;taught&lt;/em&gt; to function for that framework too. And a programmer might choose to use numerous frameworks together. How would you ensure that the refactoring tool would work for any combination of frameworks?
&lt;/p&gt;

&lt;p&gt;
The point of this post is to illustrate the &lt;strong&gt;need&lt;/strong&gt; for multi-language refactoring support. We can think of complex frameworks as basically an extension of the language itself. Frameworks have their own set of conventions to be followed. Following those conventions is essential for a framework such as Rails. For other frameworks, following those conventions would be desirable to make the code easier to reason about.
&lt;/p&gt;

&lt;p&gt;
So the main challenge is how to capture those rules that a framework specifies so that our refactoring tool can understand them and make the appropriate changes toward the entire code base. 
&lt;/p&gt;

&lt;hr /&gt;
&lt;small&gt;
&lt;sup&gt;1&lt;/sup&gt; You can actually think about adding features as another form of program transformation but it is not really viewed as a refactoring since adding a feature is not behavior preserving.
&lt;/small&gt;

</description>
      <pubDate>Wed, 17 Oct 2007 18:55:10 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:0d0ad097-0630-4460-80d3-4f097e32e9d7</guid>
      <comments>http://blog.vazexqi.com/2007/10/17/convention-preserving-refactorings#comments</comments>
      <category>software engineering</category>
      <category>college stuff</category>
      <category>development</category>
      <link>http://blog.vazexqi.com/2007/10/17/convention-preserving-refactorings</link>
    </item>
    <item>
      <title>Metrics and Code Coverage in Eclipse 3.3 Europa</title>
      <description>&lt;p&gt;
This is actually something that I spent two days on trying to get to work properly. There were a couple of variables that made this harder than necessary: the documentation on getting the latest version of &lt;a href="http://www.eclipse.org/photran/" title="Photran - An Integrated Development Environment for Fortran"&gt;Photran&lt;/a&gt; to compile was a bit out-dated (we need the latest version of the CDT from HEAD for the tests to run) and the fact that we are switching to Eclipse 3.3 which might not work well with all the plug-ins out there.
&lt;/p&gt;

&lt;p&gt;The plan was to run some metrics and code coverage measurements on the Photran code base. Using the data that we gathered we could evaluate sections of code that needed refactoring and/or testing. We could only use free tools since we wanted the students to be able to run them on their own computers. Naturally, if we did not have this &lt;em&gt;major&lt;/em&gt; restriction we would have chosen some better commercial tools.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://eclipse-metrics.sourceforge.net/" title="Eclipse Metrics Plugin - State Of Flow"&gt;State of Flow Metrics&lt;/a&gt; was the first one I tried but it does not do a good job. The UI and visual feedback were so bad that I did not even know if it was working. So, I ran the tool on a smaller project; it completed the analysis. However the information it provides is not presented intuitively. Instead it adds a little icon on the left margin of the editor that does nothing more than indicate that it had analyzed that method. Then the data is presented in the &lt;em&gt;Problems&lt;/em&gt; view along with all the other errors and warnings. For small projects, this is fine but for larger ones with 100s (or 1000s like the CDT) of warnings, you &lt;strong&gt;cannot&lt;/strong&gt; even determine which are warnings from the metrics tool (vs warnings from the Java compiler). So this is pretty much &lt;strong&gt;useless&lt;/strong&gt; for large projects or workspaces with 1000s of warnings. It has an export feature that is supposed to export the data to HTML and CSV forms but it refuses to complete for me.
&lt;/p&gt;

&lt;p&gt;The second &lt;a href="http://metrics.sourceforge.net/" title="Metrics 1.3.6"&gt;metrics&lt;/a&gt; plug-in I tested was much better. It had failed to work the first time I used it because it was not able to access the data that it had collected from the analysis. However, after upgrading to the latest version of Eclipse 3.3 (Version: 3.3.1 Build id: M20070921-1145) this problem vanished. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://metrics.sourceforge.net/view.gif" width="400" height="218" /&gt;
&lt;br /&gt;
&lt;small&gt;Metrics view using the Metrics Eclipse plug-in&lt;/small&gt;	
&lt;/p&gt;

&lt;p&gt;
So, now we needed a code coverage tool or more specifically one that could analyze the tests that have been written for Photran. This is &lt;em&gt;slightly&lt;/em&gt; more tricky. We need code coverage tools that can measure coverage on &lt;strong&gt;JUnit plug-in tests&lt;/strong&gt; (vs the normal JUnit tests). JUnit plug-in tests must &lt;a href="http://dev.eclipse.org/newslists/news.eclipse.tptp/msg02546.html" title="[news.eclipse.tptp] Junit headless plug-in testing code coverage?"&gt;launch&lt;/a&gt; an instance of Eclipse to successfully execute to completion. So a majority of the test coverage tools mentioned &lt;a href="http://java-source.net/open-source/code-coverage" title="Open Source Code Coverage Tools in Java"&gt;here&lt;/a&gt; cannot do a decent job.
&lt;/p&gt;

&lt;p&gt;
For instance, in Photran, if you just ran the normal JUnit tests there are only 125 such tests vs 1566 if you run the JUnit plug-in tests. So the coverage is going to be low for the former execution.
&lt;/p&gt;

&lt;p&gt;
There was only one free tool that I could find that offered support for measuring JUnit plug-in tests: &lt;a href="http://www.eclemma.org/" title="EclEmma - Java Code Coverage for Eclipse"&gt;EclEmma&lt;/a&gt;. The first time I installed EclEmma it corrupted my entire workspace and I had to restore everything from the repository. I installed EclEmma again today on the latest version of Eclipse 3.3 and I &lt;em&gt;think&lt;/em&gt; I know the proper way to invoke it so that it will not corrupt the workspace: always create two different run configurations and never mix them. So, when running the Photran, you should always create 2 configurations &amp;mdash; one that EclEmma will run and one that normal Eclipse will execute without coverage. And the workspace should also always be cleaned after running EclEmma.
&lt;/p&gt;

&lt;p&gt;
	&lt;img src="http://www.eclemma.org/images/screen.png" width="450" height="352"/&gt;
	&lt;br /&gt;
	&lt;small&gt;EclEmma code coverage in action. &lt;/small&gt;
&lt;/p&gt;

&lt;p&gt;
I believe that the Eclipse update fixed something to make EclEmma work properly on Mac OS X. Yesterday, there was no clean separation of an EclEmma run-time from a normal run-time. In fact, both of them were always merged in the same dialog. This could be why the workspace was being corrupted since EclEmma's instrumentation was replacing the normal ones.&lt;/p&gt;

&lt;p&gt;
Bottom line, if you want to a good metrics and code coverage tool, go with the Metrics and EclEmma plug-ins.	 Of course, if you can afford it, go for a commercial tool like &lt;a href="http://www.atlassian.com/software/clover/" title="Atlassian Clover &amp;mdash; Code Coverage Analysis"&gt;Clover&lt;/a&gt;.
&lt;/p&gt;

</description>
      <pubDate>Sun, 30 Sep 2007 16:50:44 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:6dd8229b-02cb-4e42-90e2-44bcaba90cb1</guid>
      <comments>http://blog.vazexqi.com/2007/09/30/metrics-and-code-coverage-in-eclipse-3-3-europa#comments</comments>
      <category>eclipse</category>
      <category>development</category>
      <link>http://blog.vazexqi.com/2007/09/30/metrics-and-code-coverage-in-eclipse-3-3-europa</link>
    </item>
    <item>
      <title>Setup Struts project in Eclipse - more choices than necessary</title>
      <description>&lt;p&gt;
One would expect that that given the popularity of Eclipse that there would be an easy way to setup Struts with it. However, this does not seem to be the case. There are various resources on how to use some non-standard Eclipse installation (EasyEclipse, MyEclipse) or some outdated plug-in (StrutsConsole, EasyStruts). But it is really hard to find one on how to use a standard Eclipse installation. The definition of what is a standard Eclipse installation is &lt;b&gt;debatable&lt;/b&gt; since there are just so &lt;i&gt;many&lt;/i&gt; different combinations of it. 
&lt;/p&gt;

&lt;p&gt;
In fact, here is a list:
&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/library/os-ecstruts/"&gt;Developing Struts with Easy Struts for Eclipse&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.laliluna.de/first-steps-using-struts-tutorial.html"&gt;First Struts Tutorial using Eclipse, MyEclipse&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.laliluna.de/first-steps-using-struts-tutorial.html"&gt;How to setup a basic Struts project using Eclipse IDE&lt;/a&gt; - this one actually comes pretty close to what I need but it is outdated.&lt;/li&gt;
	
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
However, in my case, I would like just like to use a simple installation that just enables me to launch my Struts application from within Eclipse. I don't really need any of the more complicated features. If I needed those features, I would be using IntelliJ which has great integration with Struts (and almost everything else that you usually use Java with e.g. Hibernate, Spring, etc)  built-in. 
&lt;/p&gt;

&lt;p&gt;
Fortunately, I found &lt;a href="http://www.mail-archive.com/user@struts.apache.org/msg63546.html"&gt;this thread&lt;/a&gt; after some searching. The instructions are a bit terse but you can definitely follow along with some trial and error. Just make sure that you have one of the supported servers installed. In my case, I was using the &lt;a href="http://tomcat.apache.org/"&gt;Apache Tomcat&lt;/a&gt; server but there are adapters for other servers as well. Also, make sure that you follow (or to be more specific, &lt;i&gt;obey&lt;/i&gt;) the folder structure imposed. It's a pretty conventional and there should not be a reason to not put things in their recommended folders.
&lt;/p&gt;

&lt;p&gt;
All that is required is to have the Web Tools Platform (&lt;a href="http://www.eclipse.org/webtools/main.php"&gt;WTP&lt;/a&gt;) plug-in installed. My past experience with installing the Web Tools Platform had me downloading a whole bunch of required plug-ins before it could work. Needless to say, it was not a pleasant experience. So I was happy to see that they have released all-in-one package for the WTP project &lt;a href="http://download.eclipse.org/webtools/downloads/drops/R2.0/R-2.0-200706260303/"&gt;here&lt;/a&gt;. This is definitely a time-saver. The WTP is a comprehensive project that is maturing toward the usability and stability that one associates with the Eclipse Java Development Tools (&lt;a href="http://www.eclipse.org/jdt/"&gt;JDT&lt;/a&gt;).
&lt;/p&gt;

&lt;p&gt;
Now that everything is working - after much time-wasting - I believe that I have reconfirmed my view that having too many choices is not always good! It's really annoying when all you are trying to do is get some prototype up quickly and you are not able to do that because you have to make a decision between product A, B or C. Sure you can go ahead and read the comparisons and user reviews but most of it is not going to make that much sense to you if you have never used similar products before. And the reason you have never used them before is because you are just beginning to create your first prototype!
&lt;/p&gt;

&lt;p&gt;
I find the situation of having too many choices to be really prevalent in the Java world. I am not against having different choices but I know that when I am just beginning to use some new tool, I would really like everything bundled together so that it just works out of the box! I don't want to select product AA only to be told that before I can use product AA I need to install &lt;i&gt;either&lt;/i&gt; product A.1 or product A.2! Just give me a working combination that I can quickly use to see if my prototype can even work in the first place!
&lt;/p&gt;

&lt;p&gt;
And don't get me started on the XML configuration files that are necessary before you can begin running that Java application....
&lt;/p&gt;

</description>
      <pubDate>Fri, 27 Jul 2007 15:26:56 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:932104e5-d59c-45ad-b71c-9448981e35eb</guid>
      <comments>http://blog.vazexqi.com/2007/07/27/setup-struts-project-in-eclipse-more-choices-than-necessary#comments</comments>
      <category>development</category>
      <category>software</category>
      <category>eclipse</category>
      <link>http://blog.vazexqi.com/2007/07/27/setup-struts-project-in-eclipse-more-choices-than-necessary</link>
    </item>
    <item>
      <title>Setup Struts project in Eclipse - more choices than necessary</title>
      <description>&lt;p&gt;
One would expect that that given the popularity of Eclipse that there would be an easy way to setup Struts with it. However, this does not seem to be the case. There are various resources on how to use some non-standard Eclipse installation (EasyEclipse, MyEclipse) or some outdated plug-in (StrutsConsole, EasyStruts). But it is really hard to find one on how to use a standard Eclipse installation. The definition of what is a standard Eclipse installation is &lt;b&gt;debatable&lt;/b&gt; since there are just so &lt;i&gt;many&lt;/i&gt; different combinations of it. 
&lt;/p&gt;

&lt;p&gt;
In fact, here is a list:
&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/library/os-ecstruts/"&gt;Developing Struts with Easy Struts for Eclipse&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.laliluna.de/first-steps-using-struts-tutorial.html"&gt;First Struts Tutorial using Eclipse, MyEclipse&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.laliluna.de/first-steps-using-struts-tutorial.html"&gt;How to setup a basic Struts project using Eclipse IDE&lt;/a&gt; - this one actually comes pretty close to what I need but it is outdated.&lt;/li&gt;
	
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
However, in my case, I would like just like to use a simple installation that just enables me to launch my Struts application from within Eclipse. I don't really need any of the more complicated features. If I needed those features, I would be using IntelliJ which has great integration with Struts (and almost everything else that you usually use Java with e.g. Hibernate, Spring, etc)  built-in. 
&lt;/p&gt;

&lt;p&gt;
Fortunately, I found &lt;a href="http://www.mail-archive.com/user@struts.apache.org/msg63546.html"&gt;this thread&lt;/a&gt; after some searching. The instructions are a bit terse but you can definitely follow along with some trial and error. Just make sure that you have one of the supported servers installed. In my case, I was using the &lt;a href="http://tomcat.apache.org/"&gt;Apache Tomcat&lt;/a&gt; server but there are adapters for other servers as well. Also, make sure that you follow (or to be more specific, &lt;i&gt;obey&lt;/i&gt;) the folder structure imposed. It's a pretty conventional and there should not be a reason to not put things in their recommended folders.
&lt;/p&gt;

&lt;p&gt;
All that is required is to have the Web Tools Platform (&lt;a href="http://www.eclipse.org/webtools/main.php"&gt;WTP&lt;/a&gt;) plug-in installed. My past experience with installing the Web Tools Platform had me downloading a whole bunch of required plug-ins before it could work. Needless to say, it was not a pleasant experience. So I was happy to see that they have released all-in-one package for the WTP project &lt;a href="http://download.eclipse.org/webtools/downloads/drops/R2.0/R-2.0-200706260303/"&gt;here&lt;/a&gt;. This is definitely a time-saver. The WTP is a comprehensive project that is maturing toward the usability and stability that one associates with the Eclipse Java Development Tools (&lt;a href="http://www.eclipse.org/jdt/"&gt;JDT&lt;/a&gt;).
&lt;/p&gt;

&lt;p&gt;
Now that everything is working - after much time-wasting - I believe that I have reconfirmed my view that having too many choices is not always good! It's really annoying when all you are trying to do is get some prototype up quickly and you are not able to do that because you have to make a decision between product A, B or C. Sure you can go ahead and read the comparisons and user reviews but most of it is not going to make that much sense to you if you have never used similar products before. And the reason you have never used them before is because you are just beginning to create your first prototype!
&lt;/p&gt;

&lt;p&gt;
I find the situation of having too many choices to be really prevalent in the Java world. I am not against having different choices but I know that when I am just beginning to use some new tool, I would really like everything bundled together so that it just works out of the box! I don't want to select product AA only to be told that before I can use product AA I need to install &lt;i&gt;either&lt;/i&gt; product A.1 or product A.2! Just give me a working combination that I can quickly use to see if my prototype can even work in the first place!
&lt;/p&gt;

&lt;p&gt;
And don't get me started on the XML configuration files that are necessary before you can begin running that Java application....
&lt;/p&gt;

</description>
      <pubDate>Fri, 27 Jul 2007 15:26:56 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:932104e5-d59c-45ad-b71c-9448981e35eb</guid>
      <comments>http://blog.vazexqi.com/2007/07/27/setup-struts-project-in-eclipse-more-choices-than-necessary#comments</comments>
      <category>development</category>
      <category>software</category>
      <category>eclipse</category>
      <link>http://blog.vazexqi.com/2007/07/27/setup-struts-project-in-eclipse-more-choices-than-necessary</link>
    </item>
    <item>
      <title>flickrPreviewR</title>
      <description>&lt;p&gt;
For the past couple of days I have been creating an application that I think I would use. And maybe some other people might find it useful too (possibly as an example for doing things in RubyCocoa). For the lack of a better name, I decided to call it flickrPreviewR and hopefully I would not be sued.
&lt;/p&gt;

&lt;img src="http://farm2.static.flickr.com/1091/826036668_f527242991.jpg" alt="flickrPreviewR"/&gt;

&lt;br /&gt;
&lt;small&gt;flickrPreviewR screen. It even has the typical flickr logo design from &lt;a href="http://flickr.nosv.org/"&gt;flickrlogomakr&lt;/a&gt;. The line to the right is the the side of a window that apparently shifted a bit to my other screen and included in the image capture.&lt;/small&gt;

&lt;p&gt;
It all started when Flock released a new version of their browser sometime last week. I downloaded it since I was eager to see what the &lt;i&gt;perpetually-in-beta&lt;/i&gt; browser has created this time. This time I was really disappointed. The only reason for my using Flock was its integration with Flickr. I just like to quickly browse photos without having to use Flickr's interface. Unfortunately, this new version of Flock really left a sour taste in my mouth. Its interface is &lt;i&gt;hideous&lt;/i&gt; and the newly revamped Flickr integration seems buggy and &lt;b&gt;really slow&lt;/b&gt;. What does it need to do that requires that much computation power? It just needs to fetch the damn photos damnit!
&lt;/p&gt;

&lt;p&gt;
Anyway, this provided the motivation and gave me another reason to play with RubyCocoa. The last time I dabbled with RubyCocoa, I created a version of the RaiseMan application from the book &lt;i&gt;Cocoa Programming for Mac OS X&lt;/i&gt; with bindings. Since then, RubyCocoa has had additional changes and I was curious whether it is now easier to develop programs for it. My conclusion: nothing much has changed in terms of the cosmetics of language (there are underlying changes for optimizations, etc), but overall there was nothing new to pick up.
&lt;/p&gt;

&lt;p&gt;
For the backend of this application, I relied on &lt;a href="http://rubyforge.org/projects/rflickr/"&gt;rflickr&lt;/a&gt;, the Ruby API kit for accessing flickr. I needed to make some slight changes to the code to accommodate some changes in the flicrk API. rflickr source is bunbled as part of the source code. I did want to not rely on it being a gem since I am not sure how RubyCocoa handles gems and I did not want to add a dependency for the gem; so I just bundled it. flickrPreviewR is under the Creative Commons Attributions License. This might violate the rflickr license and if it does, then let me know and I will see what I can do.
&lt;/p&gt;

&lt;p&gt;
You can find the set of images on my &lt;a href="http://www.flickr.com/search/?w=37092324%40N00&amp;amp;q=flickrpreviewr&amp;amp;m=tags"&gt;flickr account&lt;/a&gt;. I do not have a pro account so I cannot create a set for it. You should read the description of each photo if you are planning on using this. As usual, use this at your own risk. I am doing this as a personal application that I would use and as the developer, I am aware of its limitations and I do not push them while using the application.
&lt;/p&gt;

&lt;p&gt;
One very important limitation that I need to stress is the inability for it to update itself.
&lt;/p&gt;

&lt;blockquote&gt;
There is a weird quirk with using threads in RubyCocoa and NSNotifications. I have not figured out how to get the view to refresh once all the images have been downloaded. Right now, there is the VERY cumbersome need to click on ANOTHER favorite or photoset to force a refresh. The best way to see if the photos have finished loading is to view the progress bar at the drawer.
&lt;br /&gt;
&lt;br /&gt;
THIS NEEDS TO BE FIXED once I figure out how.
&lt;/blockquote&gt;

&lt;p&gt;
Here are some things that I picked up while doing this:
&lt;ul&gt;
	&lt;li&gt;Interface Builder is a great tool for quickly laying out the interface. I cannot imagine how I would have done this with some other GUI toolkit. Even with my familiarity with Java, it would taken much longer just to get all the pieces aligned properly.&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.cocoadev.com/"&gt;CocoaDev&lt;/a&gt; is &lt;b&gt;the&lt;/b&gt; site for almost all the questions that you can have on how to do things in Cocoa. Without CocoaDev, it would have taken me a longer time to get things done.&lt;/li&gt;
	&lt;li&gt;&lt;i&gt;Cocoa Programming for Mac OS X&lt;/i&gt; is a decent reference book once you know your way around how certain things in Cocoa work. That still does not make it a good book to start learning Cocoa programming.&lt;/li&gt;
	&lt;li&gt;You can save yourself great pains if you make all your classes subclasses of OSX::NSObject explicitly instead of normal Ruby classes. This will save you trouble when you get weird behavior and crashes. Like me, you might want to use normal Ruby classes sometimes because YAML works well with the regular Ruby classes. In that case, make sure that your class is being used as simple data structure with simple functions that do not rely on any of the Cocoa libraries.&lt;/li&gt;
	&lt;li&gt;Threading is hard to do with RubyCocoa and there is little reference on what works and what does not.&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.rubynoob.com/articles/2006/8/21/how-to-download-files-with-a-ruby-script"&gt;Downloading images&lt;/a&gt; with Ruby net/http library did not work for me. The image will always end up corrupted. Thus, I had to rely on curl to download the images.&lt;/li&gt;
	&lt;li&gt;WebKit is an excellent piece of work. I used it as the primary backend for displaying the images. To intercept the handlers, I made each preview image be a link an imaginary 'flickr://' protocol. I then overwrote &lt;code&gt;webView_decidePolicyForNavigationAction_request_frame_decisionListener&lt;/code&gt; to intercept the call and perform the appropriate actions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
For those who are interested, the source code is &lt;a href="http://blog.vazexqi.com/files/flickrPreviewR.zip"&gt;here&lt;/a&gt;. I did not package it as a stand-alone application because I am not &lt;i&gt;sure&lt;/i&gt; what you actually need to run this application. You probably need RubyCocoa and the Ruby 1.8.5. So for simplicity, I just provided the project folder for XCode. If you can build it then you can probably run it.
&lt;/p&gt;

</description>
      <pubDate>Mon, 16 Jul 2007 10:02:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:7501cb71-6006-45ef-8339-e8f24c876eb5</guid>
      <comments>http://blog.vazexqi.com/2007/07/16/flickrpreviewr#comments</comments>
      <category>development</category>
      <category>ruby</category>
      <category>flickr</category>
      <category>rubycocoa</category>
      <category>flickrpreviewR</category>
      <link>http://blog.vazexqi.com/2007/07/16/flickrpreviewr</link>
    </item>
  </channel>
</rss>
