<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2818563203095046890</id><updated>2012-02-23T13:05:20.967-08:00</updated><title type='text'>Dean's Technical Scratchpad</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>52</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-6711886046177946479</id><published>2011-12-23T13:35:00.000-08:00</published><updated>2012-01-25T10:43:53.488-08:00</updated><title type='text'>Getting started with Grails (again)</title><content type='html'>Well, it's been a while since I had looked at Grails.  In addition to being busy and not having a need for it, I was worried about Grails' future given Spring Roo's existence.  However, I am no longer worried (for now).  Grails 2.0.0 RC3 is now available and it seems that VMWare is committing itself to both Grails and Roo with the acknowledgement that they provide solutions for different audiences.&lt;p&gt;I have been updating this post to keep the information in one place so it has grown substantially.  It should be a great reference for anyone who is new to Grails and looking to create a site from scratch.&lt;h3&gt;Installation&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;&lt;a href='http://www.springsource.com/landing/best-development-tool-enterprise-java'&gt;Download SpringSource Tool Suite 2.8.1&lt;/a&gt; if you haven't already done so.  It's free!  I've found that the embedded vFabric tc Server works better on Linux than on Mac OS.  Not sure why...&lt;li&gt;&lt;a href='http://www.grails.org/STS+Integration'&gt;Install Groovy, Grails&lt;/a&gt;, and make sure you have JDK 1.6&lt;/ol&gt;&lt;h3&gt;Getting Started&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Follow &lt;a href='http://www.vogella.de/articles/Grails/article.html'&gt;this beginners' tutorial&lt;/a&gt;.  It's easy to follow and is relevant.  In particular, I like how he introduces BootStrap.groovy, which is a way to pre-populate your data between recompiles&lt;li&gt;&lt;a href='http://www.ibm.com/developerworks/java/library/j-grails01158/'&gt;This is another beginners' tutorial&lt;/a&gt; but it's wordier and harder to follow if you have little patience&lt;li&gt;When learning how to do unit testing, simply remember that the tests automatically generated for you will fail.  You need to edit populateValidParams() with at least one valid record.  Also, &lt;a href='http://grails.org/doc/1.0.x/guide/9.%20Testing.html'&gt;this page&lt;/a&gt; is a concise tutorial on unit and integration testing &lt;li&gt;If you are interested in using HAML, you need to install the plugin for each Grails project.  Simply type, "grails install-plugin haml".  Here is some &lt;a href='http://grails.org/plugin/haml'&gt;more information&lt;/a&gt;.  If your page is normally called "list.gsp", your HAML file should be named "list.haml".&lt;li&gt;Here is an &lt;a href='http://html2haml.heroku.com/'&gt;HTML to HAML converter&lt;/a&gt;.  It works well but there may be a few bugs.  I found it doesn't handle the "page import" statement or ternary operators well.&lt;li&gt;All things Groovy... Ever seen a &lt;a href='http://groovy.codehaus.org/Closures'&gt;closure&lt;/a&gt;?  Did you know that Groovy has a full &lt;a href='http://groovy.codehaus.org/gapi/index.html'&gt;API doc&lt;/a&gt;?  Also, there are a few &lt;a href='http://groovy.codehaus.org/Differences+from+Java'&gt;differences&lt;/a&gt; between Groovy and Java but not many.&lt;/ol&gt;&lt;h3&gt;Rich Internet Application&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;A great way to incorporate user security (login/logout/authentication) is by using the &lt;a href='http://blog.springsource.org/2010/08/11/simplified-spring-security-with-grails/'&gt;Grails plugin for Spring Security&lt;/a&gt;.  I chose to create my own User class by extending the SecUser class and Static URL rules.&lt;li&gt;When you want to extend your controller output to provide XML or JSON (say you're building an API...) then &lt;a href='http://fbflex.wordpress.com/2008/05/15/rest-service-xml-output-in-grails-via-content-negotiation/'&gt;this is a great tutorial&lt;/a&gt;.  To test your controller, use curl:&lt;pre&gt;curl -v -L http://localhost:8080/Grails1/user/show/1.json&lt;/pre&gt;&lt;li&gt;As of Grails 2.0.0, the default JavaScript library is jQuery, not Prototype.  This is a good &lt;a href='http://alexduan.com/2011/02/17/grails-jquery-and-ajax/'&gt;tutorial&lt;/a&gt; on using AJAX with Grails and &lt;a href='http://stackoverflow.com/questions/6031442/ajax-is-not-defined-grails-jquery-plugin'&gt;this post&lt;/a&gt; suggests the correct way to configure jQuery for Grails 2.0.0&lt;/ol&gt;&lt;h3&gt;Servers&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Heroku is a great way to setup a development server, and if your needs are limited, then it's free!  To get started with Heroku, follow &lt;a href='http://devcenter.heroku.com/articles/quickstart'&gt;these setup directions&lt;/a&gt;.  To deploy a Grails application, use the &lt;a href='http://blog.heroku.com/archives/2011/12/15/grails/'&gt;Grails Heroku plugin&lt;/a&gt;.  I discovered that, for these instructions to work, you should initialize your Grails app using the command line, not by creating a "New" &gt; "Grails Project" in STS. There is a supplemental instruction &lt;a href='http://devcenter.heroku.com/articles/grails#set_up_the_database'&gt;here&lt;/a&gt; to configure your Grails app to use a Postgres database.&lt;li&gt;To publish your app to Heroku, you will need to use &lt;a href='http://git-scm.com/'&gt;Git&lt;/a&gt;.  I highly recommend Git in any case as a cheaper alternative to Perforce, SVN, and CVS.  There &lt;i&gt;is&lt;/i&gt; a &lt;a href='http://gitref.org/'&gt;learning curve&lt;/a&gt; but it is available out of the box if you have installed SpringSource ToolSuite (STS) on Ubuntu and there is a lot of good documentation.  Here is a &lt;a href='http://schacon.github.com/git/gittutorial.html'&gt;tutorial&lt;/a&gt; and a &lt;a href='http://schacon.github.com/git/everyday.html'&gt;quick reference&lt;/a&gt;.  An added bonus is that STS comes pre-installed with &lt;a href='http://wiki.eclipse.org/EGit/User_Guide'&gt;EGit&lt;/a&gt; -- the Git plugin for Eclipse.&lt;li&gt;Heroku's signature database service is PostgreSQL.  If you want to test your Grails application locally using the same database, this is a &lt;a href='https://help.ubuntu.com/8.04/serverguide/C/postgresql.html'&gt;great beginner's tutorial&lt;/a&gt; to install and set up a Postgres server on your Ubuntu machine.&lt;li&gt;If you want to use MySQL, install a local server using &lt;pre&gt;mysql-client-core-5.1&lt;/pre&gt;Be certain to provide a root password because &lt;a href='https://help.ubuntu.com/community/MySqlWorkBench'&gt;MySQL Workbench&lt;/a&gt; does not permit blank passwords.  This post describes how to &lt;a href='http://www.redtoad.ca/ataylor/2011/06/getting-started-with-grails-and-mysql/'&gt;set up MySQL with your Grails app&lt;/a&gt; and this post describes how to use the &lt;a href='http://www.cleardb.com/blog/entry?id=heroku/add-on/tutorial'&gt;ClearDB addon&lt;/a&gt;.  Follow &lt;a href='http://stackoverflow.com/questions/8996019/configuring-grails-application-to-use-cleardb-mysql-on-heroku/8996282#8996282'&gt;these instructions&lt;/a&gt; for your DataSource.groovy&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-6711886046177946479?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/6711886046177946479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/12/getting-started-with-grails-again.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6711886046177946479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6711886046177946479'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/12/getting-started-with-grails-again.html' title='Getting started with Grails (again)'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-9149583176493893984</id><published>2011-11-24T14:32:00.001-08:00</published><updated>2011-11-24T14:36:39.513-08:00</updated><title type='text'>Android: java.lang.IllegalStateException: Target host must not be null, or set in parameters.</title><content type='html'>I must admit that I spent more than 20 minutes on this issue.  Oddly enough, this exception does not occur when launching a Widget for the first time -- it only happens after you remove the widget then restore it.  That is why I'm a little perplexed as to why it happens in some cases but not in others.  Anyhow, &lt;a href="http://blog.donnfelker.com/2010/04/29/android-odd-error-in-defaulthttpclient/"&gt;this post&lt;/a&gt; describes the problem and the resolution accurately.  After reading this blog, the issue went away in, oh... 30 seconds.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-9149583176493893984?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/9149583176493893984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/11/android-javalangillegalstateexception.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/9149583176493893984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/9149583176493893984'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/11/android-javalangillegalstateexception.html' title='Android: java.lang.IllegalStateException: Target host must not be null, or set in parameters.'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-1811020018704379426</id><published>2011-11-21T13:05:00.000-08:00</published><updated>2011-11-21T13:05:20.696-08:00</updated><title type='text'>Android: INSTALL_FAILED_ALREADY_EXISTS</title><content type='html'>This was a vexing issue with a simple solution.  Basically, I attempted to install an APK on a real device and received, "".  Since I had never installed it previously, I was perplexed, but I tried renaming the APK, using "adb uninstall", all without success.&lt;br /&gt;&lt;br /&gt;Then, &lt;a href="http://stackoverflow.com/questions/4449540/failure-install-failed-already-exists-when-i-tried-to-update-my-applcation"&gt;this solution&lt;/a&gt; simply suggested that you install over the previous installation (as absurd as that sounds).  Fortunately, it worked like a charm.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-1811020018704379426?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/1811020018704379426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/11/android-installfailedalreadyexists.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1811020018704379426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1811020018704379426'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/11/android-installfailedalreadyexists.html' title='Android: INSTALL_FAILED_ALREADY_EXISTS'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-8821782436565809796</id><published>2011-10-12T17:41:00.000-07:00</published><updated>2011-10-12T17:41:13.740-07:00</updated><title type='text'>Using Pointers to Pointers for Linked Lists</title><content type='html'>I was reading up on Linked Lists and came across a &lt;a href="http://c-faq.com/~scs/cclass/int/sx8.html"&gt;great description&lt;/a&gt; on the meaning of Pointers to Pointers.  As pointers and I have a love/hate relationship, I found this post very insightful and easy to understand.  In the code I wrote to create and print a Linked List, I found it necessary to use a Pointer to a Pointer because the pointer to the "head" node of a singly linked list needs to be defined (and accessible) by the main() routine.&lt;br /&gt;&lt;pre&gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;typedef struct Node {&lt;br /&gt;    int value;&lt;br /&gt;    struct Node *next;&lt;br /&gt;    struct Node *prev;&lt;br /&gt;} NodeType;&lt;br /&gt;&lt;br /&gt;void addNode(struct Node **head, int value);&lt;br /&gt;void printList(char *listName, struct Node *head);&lt;br /&gt;&lt;br /&gt;int main() {&lt;br /&gt;    NodeType *head;&lt;br /&gt;    head = (struct Node*)NULL;&lt;br /&gt;&lt;br /&gt;    addNode(&amp;head, 1);&lt;br /&gt;    addNode(&amp;head, 10);&lt;br /&gt;&lt;br /&gt;    printList("myList", head);&lt;br /&gt;&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void addNode(struct Node **head, int value) {&lt;br /&gt;    NodeType *temp;&lt;br /&gt;    NodeType *cur;&lt;br /&gt;&lt;br /&gt;    temp = (NodeType*)malloc(sizeof(NodeType));&lt;br /&gt;    temp-&gt;next = NULL;&lt;br /&gt;    temp-&gt;prev = NULL;&lt;br /&gt;    if(*head == NULL) {&lt;br /&gt;        *head = temp;&lt;br /&gt;        temp-&gt;value = value;&lt;br /&gt;    } else {&lt;br /&gt;        for(cur = *head; cur-&gt;next != NULL; cur = cur-&gt;next);&lt;br /&gt;        cur-&gt;next = temp;&lt;br /&gt;        temp-&gt;prev = cur;&lt;br /&gt;        temp-&gt;value = value;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void printList(char *listName, struct Node *head) {&lt;br /&gt;    NodeType *temp;&lt;br /&gt;    cout &lt;&lt; listName &lt;&lt; endl;&lt;br /&gt;    for(temp = head; temp != NULL; temp = temp-&gt;next) {&lt;br /&gt;        cout &lt;&lt; temp-&gt;value &lt;&lt; endl;&lt;br /&gt;    }&lt;br /&gt;    cout &lt;&lt; "End" &lt;&lt; endl;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-8821782436565809796?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/8821782436565809796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/10/using-pointers-to-pointers-for-linked.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8821782436565809796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8821782436565809796'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/10/using-pointers-to-pointers-for-linked.html' title='Using Pointers to Pointers for Linked Lists'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-7958742702701457327</id><published>2011-08-15T16:00:00.000-07:00</published><updated>2011-08-15T16:00:25.867-07:00</updated><title type='text'>Mac OS - Opening a new browser window from within a WebKit WebView</title><content type='html'>If you Google "createWebViewWithRequest", "WebView open new window", "decidePolicyForNewWindowAction" or check out the Apple Developer Documentation on &lt;a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/DisplayWebContent/Tasks/MultipleWindows.html"&gt;Opening Multiple Windows&lt;/a&gt; using WebKit, there is a lot of chatter on the difficulty of getting such a supposedly simple thing to occur.&lt;br /&gt;&lt;br /&gt;The objective is this: You programmatically create a WebView and load standard HTML/JavaScript/CSS into it.  You want to click on a link in your WebView which launches a new browser window to any URL of your choosing.&lt;br /&gt;&lt;br /&gt;Amazingly, I haven't seen a single post that gave a simple answer to such a simple question...&lt;br /&gt;&lt;br /&gt;Here it is in a nutshell:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;No, you don't need to specify the WebPolicyDelegate as follows:&lt;pre&gt;@interface MyIAppDelegate : NSObject &amp;lt;NSApplicationDelegate, WebPolicyDelegate&amp;gt; {&lt;/pre&gt;Some delegate are assumed and don't need to be declared.  In fact, you get a compiler error if you try&lt;br /&gt;&lt;li&gt;Create your WebView in IB, add this line to MyAppDelegate:&lt;pre&gt;@property (assign) IBOutlet WebView *webView;&lt;/pre&gt;and "connect" the IBAction to IB&lt;br /&gt;&lt;li&gt;In applicationDidFinishLaunching:, add this line:&lt;pre&gt;[webView setPolicyDelegate:self];&lt;/pre&gt;&lt;li&gt;Add this delegate method:&lt;pre&gt;- (void)webView:(WebView *)webView decidePolicyForNewWindowAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request newFrameName:(NSString *)frameName decisionListener:(id &lt; WebPolicyDecisionListener &gt;)listener {&lt;br /&gt;    [[NSWorkspace sharedWorkspace] openURL:[request URL]];&lt;br /&gt;}&lt;/pre&gt;&lt;li&gt;In the HTML file, make sure your anchor tags contain 'target="_blank"'.  For example:&lt;pre&gt;&amp;lt;a href="http://www.google.com/" target="_blank"&amp;gt;click on this link&amp;lt;/a&amp;gt;&lt;/pre&gt;&lt;/ul&gt;You should be able to compile, click on a link in your WebView, and have it launch a new browser window to Google.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-7958742702701457327?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/7958742702701457327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/08/mac-os-opening-new-browser-window-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/7958742702701457327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/7958742702701457327'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/08/mac-os-opening-new-browser-window-from.html' title='Mac OS - Opening a new browser window from within a WebKit WebView'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-7140478214123238728</id><published>2011-06-21T17:15:00.000-07:00</published><updated>2011-06-21T17:18:50.429-07:00</updated><title type='text'>C++ static variables</title><content type='html'>&lt;a href='http://weblogs.asp.net/whaggard/archive/2004/11/05/252685.aspx'&gt;This blog&lt;/a&gt; says it so well, that I'll just link to it.  As an extension, if you define your own type, the rule also applies to your typedef.  For example,&lt;br /&gt;&lt;pre&gt;typedef map&lt;string, string&gt; ConfigType;&lt;br /&gt;ConfigType HelperUtils::config;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-7140478214123238728?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/7140478214123238728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/06/c-static-variables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/7140478214123238728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/7140478214123238728'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/06/c-static-variables.html' title='C++ static variables'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-5428819325306253248</id><published>2011-06-09T17:34:00.000-07:00</published><updated>2011-06-09T17:34:37.787-07:00</updated><title type='text'>Log4cpp</title><content type='html'>It is hard to find documentation for a Log4j-like utility for C++.  &lt;a href='http://joysofprogramming.com/log4cpp-tutorial/'&gt;Here is a good resource&lt;/a&gt;.  I'll update this post with further comments on the utility (and especially portability) of this library.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-5428819325306253248?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/5428819325306253248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/06/log4cpp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5428819325306253248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5428819325306253248'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/06/log4cpp.html' title='Log4cpp'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-1487387629657498804</id><published>2011-05-24T13:58:00.000-07:00</published><updated>2011-05-24T13:58:58.358-07:00</updated><title type='text'>Eclipse - Widget disposed too early</title><content type='html'>I'm using Ubuntu 10 (64-bit) and just installed Eclipse for C/C++.  The first time I tried to start the application, it threw this error (plus a whole stack dump):&lt;br /&gt;&lt;pre&gt;Widget disposed too early&lt;br /&gt;&lt;/pre&gt;&lt;a href='http://mxcode.com/2010/09/widget-disposed-too-early-with-eclipse-ubuntu1004/'&gt;This blog&lt;/a&gt; is the first resource that actually worked.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-1487387629657498804?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/1487387629657498804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/05/eclipse-widget-disposed-too-early.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1487387629657498804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1487387629657498804'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/05/eclipse-widget-disposed-too-early.html' title='Eclipse - Widget disposed too early'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-2016300046128510945</id><published>2011-05-18T10:04:00.000-07:00</published><updated>2011-05-18T10:04:18.812-07:00</updated><title type='text'>Android: updateAppWidget couldn't find any view, using error view</title><content type='html'>This was a vexing error that, according to all documentation and The Google, should not have been thrown.  After a day of change code around, I stumbled on &lt;a href='http://androidforums.com/application-development/276107-widget-background.html'&gt;this post&lt;/a&gt;.  The moral of the story is that you cannot change a button image; you can only change something defined in your layout XML as a &amp;lt;ImageView&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-2016300046128510945?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/2016300046128510945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/05/android-updateappwidget-couldnt-find.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2016300046128510945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2016300046128510945'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/05/android-updateappwidget-couldnt-find.html' title='Android: updateAppWidget couldn&apos;t find any view, using error view'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-5854413511807677109</id><published>2011-05-11T11:38:00.000-07:00</published><updated>2011-05-11T11:38:10.133-07:00</updated><title type='text'>JSON-RPC from Android</title><content type='html'>There is a dearth of utilities on the Internetz that describe how to make a JSON-RPC 2.0 call from an Android device to a server somewhere.  Attempts to create handy classes and posts on StackOverflow never quite seemed to do the trick.  So... here it is.  No fanfare.&lt;br /&gt;&lt;br /&gt;Suppose you want to send this JSON string using HTTP using Content-type: application/json&lt;br /&gt;&lt;pre&gt;{"jsonrpc":"2.0","method":"myMethod","params":[{"first":"A","second":"B"}],"id":"0"}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;What makes this different from a regular HTTP call is the presence of an attachment and the Content-type: application/json designation.  Here is the POST method:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; public HttpResponse doPost() throws JSONException, ClientProtocolException, IOException {&lt;br /&gt;  HttpClient client = new DefaultHttpClient();&lt;br /&gt;  &lt;br /&gt;  JSONObject json = createMethodCall("myMethod", createMethodParams());&lt;br /&gt;  Log.d(LOGTAG, json.toString());&lt;br /&gt;    &lt;br /&gt;  HttpResponse response = client.execute(createRequest(json));&lt;br /&gt;  return response;&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I use the org.json libaries to construct my JSON object because the toString() method produces syntactically-correct JSON with no effort on my part:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; public JSONObject createMethodCall(String method, JSONArray params) throws JSONException {&lt;br /&gt;  JSONObject json = new JSONObject();&lt;br /&gt;  &lt;br /&gt;  json.put("jsonrpc", "2.0");&lt;br /&gt;  json.put("id", "0");   // we don't really use this so value is always zero&lt;br /&gt;  json.put("method", method);&lt;br /&gt;  json.put("params", params);&lt;br /&gt;&lt;br /&gt;  return json;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public JSONArray createMethodParams() throws JSONException {&lt;br /&gt;  JSONArray params = new JSONArray();&lt;br /&gt;  &lt;br /&gt;  // Default params that appear in all method calls&lt;br /&gt;  params.put(new JSONObject().put("first", "A"));&lt;br /&gt;  params.put(new JSONObject().put("second", "B"));&lt;br /&gt;  &lt;br /&gt;  // To add custom parameters, add to the return value rather than here, or this method becomes messy&lt;br /&gt;  return params;&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The final trick is that HttpEntity is the Java object for MIME attachments.  Therefore, attaching the JSON string as a StringEntity and declaring the content type as "application/json" is required for the server to recognize it as a valid JSON-RPC call.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; public HttpPost createRequest (JSONObject json) throws UnsupportedEncodingException {&lt;br /&gt;  HttpPost request = new HttpPost(this.server + this.url);&lt;br /&gt;&lt;br /&gt;  StringEntity entity = new StringEntity(json.toString());&lt;br /&gt;  request.setEntity(entity);&lt;br /&gt;  request.setHeader("Accept", "application/json");&lt;br /&gt;  request.setHeader("Content-type", "application/json");&lt;br /&gt;  &lt;br /&gt;  return request;&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I suppose I could have gotten fancy and created a library that packages JSON-RPC more cleanly, but I chose to organize it as a collection of convenience methods.  Here is the call from the parent code:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; RemoteCall remote = new RemoteCall();&lt;br /&gt; String response = null;&lt;br /&gt; try {&lt;br /&gt;  response = remote.doPost();&lt;br /&gt; } catch (Exception e) {&lt;br /&gt;  e.printStackTrace();&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-5854413511807677109?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/5854413511807677109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/05/json-rpc-from-android.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5854413511807677109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5854413511807677109'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/05/json-rpc-from-android.html' title='JSON-RPC from Android'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-8183368648515731915</id><published>2011-05-09T10:39:00.000-07:00</published><updated>2011-05-09T10:39:55.688-07:00</updated><title type='text'>Toggling Eclipse auto-suggest</title><content type='html'>The LogCat issue I described the other day caused a secondary problem: the auto-suggest feature in Eclipse was disabled!  Well, to be fair I think I received a pop-up message about it, but who reads those anyway?  So I accepted the message, and sadly, auto-suggest was gone.  &lt;br /&gt;&lt;br /&gt;To get it back, go to:  Preferences &gt; Java &gt; Editor &gt; Content Assist &gt; Advanced.  Make sure "Java Proposals" are enabled.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-8183368648515731915?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/8183368648515731915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/05/toggling-eclipse-auto-suggest.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8183368648515731915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8183368648515731915'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/05/toggling-eclipse-auto-suggest.html' title='Toggling Eclipse auto-suggest'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-5698493812897610850</id><published>2011-05-06T13:05:00.000-07:00</published><updated>2011-05-06T13:05:58.598-07:00</updated><title type='text'>LogCat output is empty</title><content type='html'>I am using SpringSource Tool Suite which is a souped-up version of Eclipse (it comes with all kinds of plugins pre-installed as well as embedded servlet engines).  The Android SDK comes with Log4J packaged, and the log output is shown in a window known as "LogCat".  If this view isn't currently open, go to: Window &gt; Show View &gt; Other... &gt; Android &gt; LogCat&lt;br /&gt;&lt;br /&gt;So.... For a few days, LogCat was producing output as expected.  Then, it just went silent.  Even restarting STS didn't bring back my beautiful logs.  It turns out, whether coincidentally or otherwise, the &lt;a href='http://www.eclipse.org/mylyn/'&gt;MyLyn&lt;/a&gt; plugin causes some interaction as postulated in &lt;a href='http://code.google.com/p/android/issues/detail?id=1808'&gt;this post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I did verify, on Mac OS X, that removing all JARs beginning with "org.eclipse.mylyn" causes LogCat to resume normally.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-5698493812897610850?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/5698493812897610850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/05/logcat-output-is-empty.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5698493812897610850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5698493812897610850'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/05/logcat-output-is-empty.html' title='LogCat output is empty'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-6985931044668774072</id><published>2011-05-05T09:56:00.000-07:00</published><updated>2011-05-05T09:56:58.201-07:00</updated><title type='text'>Finding a Maven Repository</title><content type='html'>When you define a dependency in pom.xml, you are telling your compiler where to go get JARs from in the Maven archive.  This way, you don't need to maintain your libraries and if they are updated, you simply change the version number in your pom.xml file.&lt;br /&gt;&lt;br /&gt;If you know what dependency you need, for example, Apache Commons/IO, browse to a Maven mirror such as:&lt;br /&gt;&lt;pre&gt;http://mirrors.ibiblio.org/pub/mirrors/maven2/&lt;br /&gt;&lt;/pre&gt;when you navigate down to:&lt;br /&gt;&lt;pre&gt;http://mirrors.ibiblio.org/pub/mirrors/maven2/commons-io/commons-io/&lt;br /&gt;&lt;/pre&gt;The first and second directories represent the Group ID and the Artifact ID.  For example:&lt;br /&gt;&lt;pre&gt;        &amp;lt;dependency&amp;gt;&lt;br /&gt;            &amp;lt;groupId&amp;gt;commons-io&amp;lt;/groupId&amp;gt;&lt;br /&gt;            &amp;lt;artifactId&amp;gt;commons-io&amp;lt;/artifactId&amp;gt;&lt;br /&gt;            &amp;lt;version&amp;gt;2.0.1&amp;lt;/version&amp;gt;&lt;br /&gt;        &amp;lt;/dependency&amp;gt;&lt;br /&gt;&lt;/pre&gt;In the above example, the reuse of "commons-io" makes it unclear, but the canonical form is:&lt;br /&gt;&lt;pre&gt;http://mirrors.ibiblio.org/pub/mirrors/maven2/groupId/artifactId/&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-6985931044668774072?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/6985931044668774072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/05/finding-maven-repository.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6985931044668774072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6985931044668774072'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/05/finding-maven-repository.html' title='Finding a Maven Repository'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-8873091678881085218</id><published>2011-04-27T14:37:00.000-07:00</published><updated>2011-04-27T14:37:05.079-07:00</updated><title type='text'>Creating a JSON-RPC service using Maven, Eclipse, and Tomcat</title><content type='html'>Oddly, there are very few resources for creating JSON-RPC services implemented using Java.  JSON-RPC is a nice way for heterogeneous servers to communicate using a lightweight protocol.  Because of the hierarchical nature of JSON plus its readiness for easy conversion to native domain objects, one would expect it to be a POJO by now.&lt;br /&gt;&lt;br /&gt;However, that is not the case, and implementation requires download of third-party libraries such as &lt;a href='http://code.google.com/p/jsonrpc4j/'&gt;jsonrpc4j&lt;/a&gt;.  The site suggests that you create a Maven project to link to their JARs, write a couple of classes, and you magically have a JSON-RPC service.  I beg to differ.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Setup&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;First, you need to create a Maven project, which is a macro available in SpringSource Tool Suite.  Select File &amp;gt; New &amp;gt; Project... &amp;gt; Maven Project.  Most importantly, you get a pom.xml and a /src/main directory with this macro.  The &lt;a href='http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html'&gt;Apache Web site&lt;/a&gt; specifies that directories in a Maven project are specified by convention.  Therefore, to conform to Maven convention, you need to add a java/ directory under /src/main.&lt;br /&gt;&lt;br /&gt;If you are a newbie to Spring, simply following the instructions in the site are not enough.  In addition, you must add:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;    &amp;lt;servlet&amp;gt;&lt;br /&gt;        &amp;lt;servlet-name&amp;gt;remoting&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;        &amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;        &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;    &amp;lt;/servlet&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;        &amp;lt;servlet-name&amp;gt;remoting&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;        &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;    &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;to your web.xml.  In addition, the XML file containing the properties should be named remoting-servlet.xml.  Again, this is according to Spring convention.  &lt;br /&gt;&lt;br /&gt;You will need to add the following line to your interface:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;import com.googlecode.jsonrpc4j.JsonRpcParamName;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;and you may need to fiddle with pom.xml a little bit (I had to force Maven to use Java 1.6).  In the meantime, Eclipse will likely display syntax errors but you may need to ignore them.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Compiling&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The first time you attempt to compile using Maven, you should create a Run Configuration.  To get the Base Directory, Browse the Workspace and select the project name.  Under Goals, enter "eclipse:eclipse".  Run the project once.  If it succeeds, the only thing you've done is to force Eclipse to load the JARs declared in pom.xml.  The syntax checker should be accurate from this point on.&lt;br /&gt;&lt;br /&gt;Change the Goals to "clean install".  As long as you don't declare new JARs, you should not need to change your Run Configuration again.  Select this configuration to build your WAR file.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Deploying&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Assuming you have a Tomcat instance available to you (I installed one on Ubuntu using "sudo apt-get install tomcat6").  Copy the WAR file to /var/lib/tomcat6/webapps/.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Testing&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Because this is a JSON-RPC service, the most appropriate way to test is to use the following cURL command:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;curl -v http://localhost:8080/projname/myServlet -d @test.json&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;where test.json may look like:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;{&lt;br /&gt; "jsonrpc": "2.0",&lt;br /&gt; "method": "createUser",&lt;br /&gt; "params":[&lt;br /&gt;  {"firstName": "Dean"}&lt;br /&gt; ],&lt;br /&gt; "id": "0"&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;If it works, you are supposed to get a JSON response back, representing the deserialized Java object.&lt;br /&gt;&lt;br /&gt;However, it didn't work for me.  Yet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-8873091678881085218?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/8873091678881085218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/04/creating-json-rpc-service-using-maven.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8873091678881085218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8873091678881085218'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/04/creating-json-rpc-service-using-maven.html' title='Creating a JSON-RPC service using Maven, Eclipse, and Tomcat'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-6800024118192635719</id><published>2011-02-12T11:56:00.000-08:00</published><updated>2011-02-12T11:56:35.157-08:00</updated><title type='text'>Access denied for user 'root'@'client machine name' (using password: YES)</title><content type='html'>I encounter this error frequently both at work and on the occasional home project.  While attempting to connect to a MySQL server using say, MySQL Workbench, I get the following:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Access denied for user 'root'@'client machine name' (using password: YES)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To resolve this, there are three specific things you need to do.  Please keep in mind that I'm a developer so please refer to a sys admin for more sophisticated solutions.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Make sure MySQL is listening for incoming connections and that port 3306 is open&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Grant (remote) user privileges to your MySQL server&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;I'm using Ubuntu 10.10 (64-bit).  I installed MySQL using &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;sudo apt-get install mysql-server mysql-client&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and tested the installation using &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;mysql -u root -p&lt;br /&gt;show databases;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In MySQL Workbench (I have 5.2.31 for Mac OS X), create a "New Connection" to "Start Querying", and provide the connection credentials (IP address of the MySQL server, username "root", and root password.  You will likely see the error message described by the title of this blog. &lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Make sure MySQL is listening for incoming connections and that port 3306 is open&lt;/h2&gt;Perform steps 1 through 4 as described in &lt;a href="http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html"&gt;this blog&lt;/a&gt;.  I found that step 5 isn't necessary if you're just playing around and want to administer your own instance using the tools in Workbench. &amp;nbsp;Also, steps 6 and 7 aren't necessary because the default Ubuntu installation allows connections on all ports by default (!!!)&lt;br /&gt;&lt;br /&gt;A simple test from your client computer is:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;telnet [server ip address] 3306&lt;/pre&gt;&lt;br /&gt;You should see something meaningful but cryptic. &amp;nbsp;If you see "connection refused", then you will need to do step 6 above because it means the port has been disallowed by default (or your sys admin).&lt;br /&gt;&lt;h2&gt;Grant (remote) user privileges to your MySQL server&lt;/h2&gt;Execute the following SQL query: &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-6800024118192635719?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/6800024118192635719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2011/02/access-denied-for-user-rootclient.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6800024118192635719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6800024118192635719'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2011/02/access-denied-for-user-rootclient.html' title='Access denied for user &apos;root&apos;@&apos;client machine name&apos; (using password: YES)'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-1017122639582410419</id><published>2010-12-19T17:05:00.000-08:00</published><updated>2010-12-19T17:05:07.238-08:00</updated><title type='text'>Using Cisco VPN on Snow Leopard</title><content type='html'>This is a &lt;a href="http://erbmicha.com/2009/09/07/how-to-cisco-vpn-with-snow-leopard-via-pcf-file/"&gt;great blog&lt;/a&gt; on setting up your VPN (Cisco IPsec only) on your Snow Leopard machine.  Crazy, but neither Mac OS nor Cisco appear to have a supported standalone client.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-1017122639582410419?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/1017122639582410419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2010/12/using-cisco-vpn-on-snow-leopard.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1017122639582410419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1017122639582410419'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2010/12/using-cisco-vpn-on-snow-leopard.html' title='Using Cisco VPN on Snow Leopard'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-8535627555286865235</id><published>2010-11-04T13:09:00.000-07:00</published><updated>2010-11-04T13:09:24.645-07:00</updated><title type='text'>Synchronizing Tables in a MySQL Cluster</title><content type='html'>I created a table in a MySQL cluster but did not fully understand the way a Master-Master configuration operates. &amp;nbsp;I still don't. &amp;nbsp;However, it didn't take long to determine that I needed to create the table in each node of the cluster only to find out that data doesn't get synchronized automatically. &amp;nbsp;Grr.&lt;br /&gt;&lt;br /&gt;A friendly DBA informed me that I needed to do this when creating the table:&lt;br /&gt;&lt;pre&gt;create table tbl_name (i INT) ENGINE=NDBCLUSTER;&lt;br /&gt;&lt;/pre&gt;which specifies that this table is to be managed by the cluster.  If the table has already been created (as was my case), this can be added after-the-fact:&lt;br /&gt;&lt;pre&gt;ALTER TABLE tbl_name  ENGINE=NDBCLUSTER; FLUSH TABLES; &lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-8535627555286865235?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/8535627555286865235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2010/11/synchronizing-tables-in-mysql-cluster.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8535627555286865235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8535627555286865235'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2010/11/synchronizing-tables-in-mysql-cluster.html' title='Synchronizing Tables in a MySQL Cluster'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-4060143114331202853</id><published>2010-05-10T09:15:00.000-07:00</published><updated>2010-05-10T09:15:39.436-07:00</updated><title type='text'>Snow Leopard and VMWare Fusion 3</title><content type='html'>This past weekend I installed both, thinking, "hey, upgrades are better, right?" &amp;nbsp;I did, however, find two crippling problems. &amp;nbsp;The first pertains to Fusion 3. &amp;nbsp;When you start it up, it is slower than molasses, and the reason is that Spotlight is told to search your virtual machines. &amp;nbsp;In theory, it should do this once then be happy but reports have it that it reoccurs each time you start Fusion. &amp;nbsp;The solution is nicely stated in &lt;a href="http://communities.vmware.com/message/1431959"&gt;this post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The second is that the Cisco VPN client doesn't work anymore. &amp;nbsp;This is because the current version of the client (4.9.x?...) is not 64-bit capable and it dies upon startup. &amp;nbsp;The solution is to use the built-in VPN client in Snow Leopard but I've heard the connection can be flaky.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-4060143114331202853?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/4060143114331202853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2010/05/snow-leopard-and-vmware-fusion-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4060143114331202853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4060143114331202853'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2010/05/snow-leopard-and-vmware-fusion-3.html' title='Snow Leopard and VMWare Fusion 3'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-4116131802070012987</id><published>2010-01-21T15:18:00.000-08:00</published><updated>2010-01-21T15:18:05.805-08:00</updated><title type='text'>Configuring Eclipse to use GWT within a Grails project</title><content type='html'>One nice thing about Eclipse is that it sets up your environments, compile macros and build paths for you when you do, say, File &amp;gt; New &amp;gt; Grails Project.  GWT has a similar setup that works just as well and in exactly the same way.  However, I'm merging Grails and GWT functionality and want the benefits of code completion, etc.&lt;br /&gt;&lt;br /&gt;As mentioned in a previous blog entry, however, the merging of GWT and Grails is not very straightforward and is subject to some idiosyncrasies, including the need to execute Grails commands from a terminal and &lt;b&gt;not&lt;/b&gt; from within Eclipse.&amp;nbsp; For some reason, installing GWT plugins from within Eclipse does not work (my theory has to do with environment variables but I just gave up on it and went with the sure-fire way).&lt;br /&gt;&lt;br /&gt;The net effect is that GWT auto-suggest doesn't work.&amp;nbsp; Nor does auto-creation of import statements.&amp;nbsp; Bleh.&amp;nbsp; I found that you can get the former to work fine by right-clicking on the Project name in Package Explorer, then Google &amp;gt; Web Toolkit Settings...&amp;nbsp; You get the following screen:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_jBHIEiYAYSc/S1jgJvw-tTI/AAAAAAAAABo/APipYjwWMPA/s1600-h/Screenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_jBHIEiYAYSc/S1jgJvw-tTI/AAAAAAAAABo/APipYjwWMPA/s320/Screenshot.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Check "Use Google Web Toolkit" then auto-complete (at least) will work.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-4116131802070012987?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/4116131802070012987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2010/01/configuring-eclipse-to-use-gwt-within.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4116131802070012987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4116131802070012987'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2010/01/configuring-eclipse-to-use-gwt-within.html' title='Configuring Eclipse to use GWT within a Grails project'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_jBHIEiYAYSc/S1jgJvw-tTI/AAAAAAAAABo/APipYjwWMPA/s72-c/Screenshot.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-4458436873675344910</id><published>2010-01-19T11:40:00.000-08:00</published><updated>2010-01-19T16:54:02.237-08:00</updated><title type='text'>GWT vs. Grails</title><content type='html'>Both &lt;a href="http://code.google.com/webtoolkit/"&gt;Google Web Toolkit (GWT)&lt;/a&gt; and &lt;a href="http://www.grails.org/"&gt;Grails&lt;/a&gt; have been in the public domain for about two years now.  I admit that my knowledge of, and experience with, both is very recent.  When I started to investigate each technology I was very excited about the possibilities, namely:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Groovy and Grails provides the rapid-prototyping inherent with "convention-over-configuration"&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Grails, being a Java framework, fits perfectly with legacy or yet-to-be-introduced Java technologies&lt;br /&gt;&lt;/li&gt;&lt;li&gt;GWT provides the tools for developing Rich Internet [client] Applications (&lt;a href="http://en.wikipedia.org/wiki/Rich_Internet_application"&gt;RIA&lt;/a&gt;)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;GWT, being based on Java, is Google's version of "write-once-run-on-any-browser"&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;After having spent merely a week on each technology, what follows in this entry is my interpretation and reaction of the above claims and discovery of the "buts..." hidden in the cracks. &lt;br /&gt;First, I found all of the above claims to be true.  Second, while both have client-side and server-side capabilities, Grails is the clear winner on the server side while GWT is a marginal winner on the client side.  Third, if you want to use GWT and Grails together, the process can be cumbersome but it does work.  Let me explain. &lt;br /&gt;Grails: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;The &lt;a href="http://en.wikipedia.org/wiki/Object-relational_mapping"&gt;Object-Relational Mapping&lt;/a&gt;, which is based on Hibernate, is absolutely fantastic.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Scaffolding is even better than &lt;a href="http://rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt; IMO because you can combine scaffolding with custom code.  If anyone reading this can tell me otherwise about RoR, please feel free to comment politely.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Many operations, such as returning a list of objects in JSON format are one or two lines of code.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The generated controllers and views are still heavy on the "client-request/server-response" paradigm.  A developer wanting to employ AJAX to develop a RIA still needs to install third-party JavaScript libraries and write framework code.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The suggested MVC structure doesn't [easily] encourage digressing from the Domain Class structure.  For example, you're encouraged to edit a Task on the Task/edit page.  However, RIA's are trending towards multi-faceted documents (think iGoogle home page) where a user interacts with diverse information on a single page.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;GWT: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;Creating Web pages by writing Java and compiling for all supported browsers brings RIA GUI creation to the Java purist and reduces testing overhead.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Developing a simple, self-contained (i.e., client-only) UI is easy and fun.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The Same Origin Policy (SOP) makes rapid development virtually impossible unless you try any of these methods:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Compile your GWT application then copy to the Application server running your database services.  If you do a lot of write-test-write-test, this simply is not a solution.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Go through a complex procedure to "get around" the SOP, which only works for GETs.  If you want to test UPDATE or INSERT you still need to find a better way.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Develop a complete set of servlets to mimic your backend services.&lt;/li&gt;&lt;li&gt;Use the GWT plug-in for Grails&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;While very powerful indeed, writing AJAX calls using GWT is far more complex than simply writing them in JavaScript.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;You can probably sense the theme:  Grails is easier to get up and running, but lacks sophisticated UI tools.  GWT can do really neat things on the client side if you're willing to invest the time.  Mixing the two is possible using the "&lt;a href="http://www.grails.org/GWT+Plugin"&gt;official&lt;/a&gt;" way to integrate the two. &lt;br /&gt;&lt;p/&gt;&lt;i&gt;The caveat is that the GWT plug-in for Grails appears to be buggy if you compile and invoke from within Eclipse.&amp;nbsp; That means you should keep a terminal open for "grails run-app", a terminal for "grails run-gwt-client", and Eclipse.&lt;/i&gt;&lt;br /&gt;&lt;p/&gt;Any other method doesn't really work very well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-4458436873675344910?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/4458436873675344910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2010/01/gwt-vs-grails.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4458436873675344910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4458436873675344910'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2010/01/gwt-vs-grails.html' title='GWT vs. Grails'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-5683571263591532110</id><published>2010-01-18T11:29:00.000-08:00</published><updated>2010-01-18T11:29:21.933-08:00</updated><title type='text'>Grails unable to create or alter a SQL table</title><content type='html'>To get to the point, the lesson learned here is, "be careful how you name your fields".  When Grails updates the table schema due to changes you make in the Domain class, Grails returns this cryptic message:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Running Grails application..&lt;br /&gt;2010-01-18 11:19:59,779 [main] ERROR hbm2ddl.SchemaExport  - Unsuccessful: create table stock (id bigint not null auto_increment, version bigint not null, change float not null, price float not null, symbol varchar(255) not null, primary key (id))&lt;br /&gt;2010-01-18 11:19:59,780 [main] ERROR hbm2ddl.SchemaExport  - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'change float not null, price float not null, symbol varchar(255) not null, prima' at line 1&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Obtaining the exact SQL can be tricky, but the cause was in how I named the table columns.  When I changed "change" to "changePerc" and "price" to "priceDollars" everything worked.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-5683571263591532110?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/5683571263591532110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2010/01/grails-unable-to-create-or-alter-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5683571263591532110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5683571263591532110'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2010/01/grails-unable-to-create-or-alter-sql.html' title='Grails unable to create or alter a SQL table'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-3919521437921047395</id><published>2010-01-12T10:23:00.000-08:00</published><updated>2010-01-12T10:23:20.401-08:00</updated><title type='text'>Get MIME types to work in Grails</title><content type='html'>A powerful aspect of Grails is that you can instruct the server to return data in any number of formats declaratively.  For example, when implementing AJAX, you might choose to return XML or JSON to the JavaScript callback function.&lt;br /&gt;&lt;br /&gt;This would work fine except Grails, by default, disables this feature, always returning HTML.  To fix this, edit:  grails-app/conf/Config.groovy  and change the "grails.mime.use.accept.header" value to "true".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-3919521437921047395?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/3919521437921047395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2010/01/get-mime-types-to-work-in-grails.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/3919521437921047395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/3919521437921047395'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2010/01/get-mime-types-to-work-in-grails.html' title='Get MIME types to work in Grails'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-2999355476144586797</id><published>2010-01-05T15:01:00.000-08:00</published><updated>2010-01-21T14:32:57.089-08:00</updated><title type='text'>Grails Cheat Sheet</title><content type='html'>Happy New Year!  After a couple weeks of over-doing eating and vegetating, I dropped my mother off at the airport this morning and am jumping back into Grails.  Unfortunately, um... I forgot most of what I picked up in December.  To help me out, I'm creating a cheat sheet.  So I will probably be editing this post to keep the information in one place.&lt;br /&gt;&lt;br /&gt;Keystrokes (case sensitive):&lt;br /&gt;&lt;ul&gt;&lt;li&gt;ctrl-alt-G =&gt; open the Grails command line from within Eclipse&lt;br /&gt;&lt;li&gt;ctrl-space =&gt; auto-suggest&lt;br /&gt;&lt;/ul&gt;Commands &lt;ul&gt;&lt;li&gt;compile =&gt; (re)compiles the Grails Application&lt;br /&gt;&lt;li&gt;run-app =&gt; compiles then executes the current Grails project (development)&lt;br /&gt;&lt;li&gt;create-domain-class [class] =&gt; create a domain object (lower-case, singular)&lt;br /&gt;&lt;li&gt;create-controller [controller] =&gt; create a controller (lower-case, singular)&lt;br /&gt;&lt;li&gt;generate-all [Class] =&gt; generate default controller and view for the domain object&lt;br /&gt;&lt;li&gt;install-templates =&gt; generates the scaffolding templates for customization&lt;br /&gt;&lt;li&gt;install-plugin gwt =&gt; readies your application for &lt;a href="http://www.grails.org/plugin/gwt"&gt;use with GWT&lt;/a&gt; (or any other plugin like Hibernate)&lt;br /&gt;&lt;li&gt;create-service [class] =&gt; creates a service for the class (lower-case)&lt;br /&gt;&lt;li&gt;create-gwt-module &lt;module&gt; =&gt; creates a GWT EntryPoint application&lt;br /&gt;&lt;li&gt;create-get-page &lt;path/page&gt; &lt;module&gt; =&gt; creates an HTML/GSP page to associate with the module EntryPoint&lt;br /&gt;&lt;li&gt;run-gwt-client =&gt; opens the GWT client manager and starts the Hosted Mode browser&lt;br /&gt;&lt;li&gt;compile-gwt-modules =&gt; (re)compiles GWT code.  Required if you want to refresh the browser with new GWT functionality&lt;br /&gt;&lt;/ul&gt;Tutorials &lt;ul&gt;&lt;li&gt;&lt;a href="https://www.ibm.com/developerworks/java/library/j-grails02128/"&gt;Using MySQL with Grails&lt;/a&gt; (listing 13)&lt;br /&gt;&lt;li&gt;&lt;a href="http://docs.codehaus.org/display/GRAILS/GWT+Plugin"&gt;Using GWT and Grails together&lt;/a&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/derjanandhisblog/wiki/GWTGrailsTutorial"&gt;Grails and GWT example tutorial&lt;/a&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-2999355476144586797?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/2999355476144586797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2010/01/grails-cheat-sheet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2999355476144586797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2999355476144586797'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2010/01/grails-cheat-sheet.html' title='Grails Cheat Sheet'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-8714269927530213866</id><published>2009-12-22T15:48:00.000-08:00</published><updated>2009-12-22T15:48:26.877-08:00</updated><title type='text'>Grails "pluginManager" error</title><content type='html'>STS has the cool feature where it dynamically recompiles your Grails application when it senses that you've made code changes.  This can have an unexpected side effect.  If you get an obscure message like the following:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Error creating bean with name 'pluginManager' defined in ServletContext...&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Basically it seems related to a mismatch between the domain objects and the database schema.  This is different from GORM and Object-Relational Impedance Mismatch... it is simply an unstable condition that might occur with the right combination of changes.  &lt;br /&gt;&lt;br /&gt;Unfortunately, I can only suggest saving and testing often, and if you see this message, try commenting out the "static hasMany" command in your domain object until it goes away.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-8714269927530213866?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/8714269927530213866/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/12/grails-pluginmanager-error.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8714269927530213866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8714269927530213866'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/12/grails-pluginmanager-error.html' title='Grails &quot;pluginManager&quot; error'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-6840745013854806273</id><published>2009-12-22T12:42:00.000-08:00</published><updated>2009-12-22T12:42:40.125-08:00</updated><title type='text'>Investigating and installing Grails</title><content type='html'>Based on a recommendation (and some newly acquired knowledge), I'm in the process of investigating Grails and perhaps GWT.  This post, and likely the next few posts, will chronicle the installation, setup, and initial experience.&lt;br /&gt;&lt;br /&gt;To install Grails, go to the &lt;a href="http://www.grails.org"&gt;Grails Home Page&lt;/a&gt; and download the latest version.  Go to the &lt;a href="http://www.grails.org/Documentation"&gt;Documentation&lt;/a&gt; page and follow the installation instructions.  I am using a Debian-based Linux so I extracted Grails into /usr/share/grails and added GRAILS_HOME to my .bashrc.  Testing Grails worked without any issue.  My current version is 1.1.2.&lt;br /&gt;&lt;br /&gt;It then occurred to me that I would really like to implement Grails from within Eclipse and to explore my options for Eclipse add-ons or integration.  I chose to use SpringSource Tool Suite (STS).&lt;br /&gt;&lt;br /&gt;For the most part, you'll follow the instructions on &lt;a href="http://www.grails.org/STS+Integration"&gt;this page&lt;/a&gt; except &lt;a href="http://www.springsource.com/products/eclipse-downloads"&gt;STS-go here instead&lt;/a&gt; to download STS.  Click on the appropriate OS link to the right of the Downloads section then follow the instructions at the bottom of that same page.  &lt;i&gt;Note: You may want to invoke the installer using "sudo" if you plan to install in a location like /usr/share.  However, when asked to launch STS at the end, say "no" and launch STS explicitly.  The executable is /usr/share/springsource/sts-2.3.0.RELEASE/STS&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Once you have STS installed, go back to &lt;a href="http://www.grails.org/STS+Integration"&gt;this page&lt;/a&gt; and follow the instructions to install the Groovy and Grails plug-ins.  &lt;i&gt;Note: If you installed STS as "sudo" in the previous step, you may want to invoke STS using "sudo" to install the plug-ins.  Before I did this, it hung at about 67% for no apparent reason.  For example, execute "sudo /usr/share/springsource/sts-2.3.0.RELEASE/STS" from a shell and use that session to install the plug-ins.&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-6840745013854806273?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/6840745013854806273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/12/investigating-and-installing-grails.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6840745013854806273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6840745013854806273'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/12/investigating-and-installing-grails.html' title='Investigating and installing Grails'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-5219276895364139212</id><published>2009-11-18T12:03:00.000-08:00</published><updated>2009-11-18T12:03:43.491-08:00</updated><title type='text'>Use Basic Types for Web Services</title><content type='html'>Today I encountered the following error message:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;org.apache.axis2.databinding.ADBException: Any type element type has not been given&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;I have defined my Web Service code as follows:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;public ArrayList&lt;String&gt; ListNamesService();&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;When you generate the WSDL using wsdl2java, it creates a data type called, "anyType", which is WSDL's way of saying you'll be passing through an Object (of some indeterminate type).  This generates the above runtime error.&lt;br /&gt;&lt;br /&gt;The solution is to do this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;public String[] ListNamesService();&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;which may seem archaic given the Java Collections classes, but at least an array of Strings is compatible across all platforms (which is a great benefit).  So, aside from getting the error messages to go away, use basic types for Web Services.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-5219276895364139212?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/5219276895364139212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/11/use-basic-types-for-web-services.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5219276895364139212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5219276895364139212'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/11/use-basic-types-for-web-services.html' title='Use Basic Types for Web Services'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-4652650053643605737</id><published>2009-11-17T13:17:00.000-08:00</published><updated>2009-11-17T13:17:58.790-08:00</updated><title type='text'>It's the CLASSPATH, stupid!</title><content type='html'>I've been tearing my hair out for the past two days struggling with the Apache Axis2 Web Services engine.  After having had figured out how to integrate Axis2 with Tomcat (see prior blog), the next step involved writing a client to access the Web Service, then integrating that functionality into a servlet.&lt;br /&gt;&lt;br /&gt;First off, follow this &lt;a href="http://wso2.org/library/95"&gt;tutorial&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Following are my tips for getting it done the &lt;b&gt;easy&lt;/b&gt; way.  Note, I'm sure server administrators will cringe when they see some of my solutions but I'm only looking to prove out the code.  This is a development setup on my home computer. 'nuff said.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Create a separate project for your Web App (UI, servlets), each Web Service, and each prototype Client code.&lt;br /&gt;&lt;li&gt;Getting the Web Service to work is easy:  follow steps 1 through 4 of the tutorial.&lt;br /&gt;&lt;li&gt;When going through step 5 (generating Java code from the WSDL), set the destination directory to your Client project /src directory.  Note: the generated package name is "org.apache.ws.axis2".  At first I thought this was a bug and it was the single biggest source of my headaches.&lt;br /&gt;&lt;li&gt;In the client project, make 100% certain you've added &lt;b&gt;every-single-jar&lt;/b&gt; in $AXIS_HOME/lib to your project CLASSPATH (Project &gt; Properties &gt; Libraries &gt; Add External JARs...).  If the Eclipse auto-compiler stops complaining about your imports, you're good to go.&lt;br /&gt;&lt;li&gt;Compile your Client project.  Note, in the tutorial, you run your test program at this point and it "just works".  That's BS because they took a serious shortcut by putting the Client code in the same package as the Stub code.  In real applications, you won't have that luxury.  Package the resulting classes using "jar cvf MyJar.jar org".  You will need to be in the /bin directory of your client project for this to work correctly.&lt;br /&gt;&lt;li&gt;At this point, you &lt;i&gt;can&lt;/i&gt; compile and run your servlet, but you'll get a run-time error.  This is because the Tomcat servlet runtime does not have the same CLASSPATH as what you've configured in Eclipse.  &lt;b&gt;This is the key point that took me days to discover&lt;/b&gt;&lt;br /&gt;&lt;li&gt;Copy that JAR file to $TOMCAT_HOME/lib (yes, you heard correctly... just do it... it works)&lt;br /&gt;&lt;li&gt;Copy all JAR files in $AXIS_HOME/lib to $TOMCAT_HOME/lib (sacrilege!).  If it makes you feel better, make a copy of the $TOMCAT_HOME/lib directory before making any changes.&lt;br /&gt;&lt;/ol&gt;Instead of steps 7 and 8, you can modify the CLASSPATH of the Tomcat servlet runtime.  However, I don't know how to do that and was pretty burnt out of the topic by the time I'd figured out the workaround...&lt;br /&gt;&lt;br /&gt;It should "just work" now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-4652650053643605737?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/4652650053643605737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/11/its-classpath-stupid.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4652650053643605737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4652650053643605737'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/11/its-classpath-stupid.html' title='It&apos;s the CLASSPATH, stupid!'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-856159657632113180</id><published>2009-11-08T12:31:00.000-08:00</published><updated>2009-11-08T12:31:26.366-08:00</updated><title type='text'>No Targets Available for the Android SDK</title><content type='html'>The Android SDK uses an integer to identify the minimum SDK version for which your application is compiled.  Without it, older versions of the Android OS could attempt to launch a program written for a newer version of Android and it might not be pretty.&lt;br /&gt;&lt;br /&gt;When you first install the Android SDK (version 2.0 pre-release) and the Eclipse ADT, then attempt to create a new Android Project, you might see this warning: "Error: Target id is not valid. Use 'android list targets' to get the target ids".  Following this instruction leads you to find that no target SDKs have been installed.&lt;br /&gt;&lt;br /&gt;I believe Googled has packaged the 2.0 release to be an upgrade to the 1.6 release.  However, they don't make that notion clear one way or the other.  My solution?  Skip it, go to the &lt;a href="http://developer.android.com/sdk/1.6_r1/index.html"&gt;SDK v1.6 download page&lt;/a&gt; and get that instead.  This becomes really obvious if you examine the size of the tarballs (2.0 = 24Mb, 1.6 = 573Mb).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-856159657632113180?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/856159657632113180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/11/no-targets-available-for-android-sdk.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/856159657632113180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/856159657632113180'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/11/no-targets-available-for-android-sdk.html' title='No Targets Available for the Android SDK'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-8411470467741393231</id><published>2009-11-05T13:19:00.000-08:00</published><updated>2009-11-05T13:19:59.631-08:00</updated><title type='text'>Getting Apache Axis2 to work from within a Tomcat servlet engine</title><content type='html'>I generally prefer to have my application services hosted from a single source.  It seems like overkill to have an Apache server (port 80) a Tomcat servlet engine (port 8080), and an Axis2 Web Services server (also on port 8080).  What's even crazier is that all three servers come from the Apache Foundation yet getting them to cooperate can be much more troublesome than you'd expect.&lt;br /&gt;&lt;br /&gt;I successfully installed Axis2 using &lt;a href="http://ws.apache.org/axis2/1_5/installationguide.html"&gt;these instructions&lt;/a&gt;, which worked well up to and including "Building a Standalone Server".  The one caveat being that you need to remember to stop Tomcat:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sudo /etc/init.d/tomcat6 stop&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;because the Axis2 server is configured to run on port 8080 by default.  You could change the port by editing $AXIS2_HOME/conf/axis2.xml... but the instructions don't tell you that.  I figured it out on my own.&lt;br /&gt;&lt;br /&gt;Moving on... so now I want to run the Axis2 Web Services engine within my servlet context.  In other words, I want Tomcat to delegate WS calls to Axis2.  The instruction for doing this is to copy the axis2.war file into the webapps directory of Tomcat.  Here's the kicker:  &lt;b&gt;There are TWO webapps directories!&lt;/b&gt;  One is located in TOMCAT_HOME (which, on Ubuntu is /usr/share/tomcat6) and the other is located in TOMCAT_BASE (which is /var/lib/tomcat6).  &lt;i&gt;The latter is the correct location btw&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;If this worked correctly, Tomcat will expand the axis2.war file into a directory structure starting with TOMCAT_BASE/webapps/axis2/.&lt;br /&gt;&lt;br /&gt;At this point, the above instruction set said I supposed to see the Axis page magically via Tomcat but what I saw was an HTTP 500 error indicating something about permissions.  After some Googling, I found &lt;a href="http://old.nabble.com/deploying-axis2-on-Tomcat6-permissions-problem-td21468450.html#a21468450"&gt;this forum&lt;/a&gt;, the final post contained the solution to the last roadblock: to disable TOMCAT6_SECURITY. &lt;br /&gt;&lt;br /&gt;It now works, and you get the Axis2 "Happiness Page" as originally indicated in the instructions.  Barf.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-8411470467741393231?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/8411470467741393231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/11/getting-apache-axis2-to-work-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8411470467741393231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8411470467741393231'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/11/getting-apache-axis2-to-work-from.html' title='Getting Apache Axis2 to work from within a Tomcat servlet engine'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-5827623417502086102</id><published>2009-09-16T14:47:00.000-07:00</published><updated>2009-09-16T14:50:00.676-07:00</updated><title type='text'>Gem install errors</title><content type='html'>When installing gems, sometimes you get the following message:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;dean@Dean-Ubuntu:~$ sudo gem install mongrel&lt;br /&gt;Building native extensions.  This could take a while...&lt;br /&gt;ERROR:  Error installing mongrel:&lt;br /&gt; ERROR: Failed to build gem native extension.&lt;br /&gt;&lt;br /&gt;/usr/bin/ruby1.8 extconf.rb install mongrel&lt;br /&gt;extconf.rb:8:in `require': no such file to load -- mkmf (LoadError)&lt;br /&gt; from extconf.rb:8&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The quick answer is:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sudo apt-get install ruby-dev&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;I guess ruby-dev contains the native headers that the finished product "just Ruby..." doesn't have.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-5827623417502086102?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/5827623417502086102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/09/gem-install-errors.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5827623417502086102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5827623417502086102'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/09/gem-install-errors.html' title='Gem install errors'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-8885966971172501447</id><published>2009-09-16T14:38:00.000-07:00</published><updated>2009-09-16T14:41:27.235-07:00</updated><title type='text'>Installing Rails on Ubuntu</title><content type='html'>After install Rails using apt-get, I received the following message:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;dean@Dean-Ubuntu:~$ rails -v&lt;br /&gt;getopt: invalid option -- 'v'&lt;br /&gt;Terminating...&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;This is definitely unusual and not the way rails works on my Mac.  I found &lt;a href="http://blog.paddyonline.in/category/ubuntu/"&gt;this blog&lt;/a&gt; post, which describes a perfect method for getting rid of the problem.  Basically, it seems that it is preferable to install rails using gem, not using apt-get.  Go figure...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-8885966971172501447?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/8885966971172501447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/09/installing-rails-on-ubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8885966971172501447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8885966971172501447'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/09/installing-rails-on-ubuntu.html' title='Installing Rails on Ubuntu'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-9204892059628829648</id><published>2009-09-16T12:07:00.001-07:00</published><updated>2009-09-16T12:19:17.591-07:00</updated><title type='text'>Installing PostgreSQL</title><content type='html'>On a Debian Linux distribution such as Ubuntu, you can install postgresql (and a graphical administration tool) by using:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sudo apt-get install postgresql pgadmin3&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;and it merrily does its thing.  It even starts the server for you.  However, the default installation of PostgreSQL creates the root user "postgres" with no password.  Furthermore, PGAdminIII requires that you enter at least one character in the password field or it complains.  Doh!&lt;br /&gt;&lt;br /&gt;After having experienced this twice (once in Mac OS X and once in Ubuntu Linux) I thought I'd jot this down for generations of administrators to come.  Essentially, &lt;a href="http://ubuntuforums.org/showthread.php?t=611338"&gt;this post&lt;/a&gt; gives the best description of what to do:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Edit the pg_hba.conf file.  The post gives the most useful information: the directory in which this file is located!  (/etc/postgres...)&lt;br /&gt;&lt;li&gt;Instead of "md5", other posters say to change it to "trust".  If you're running a dev system like me, "trust" is supposed to have fewer auth checks&lt;br /&gt;&lt;li&gt;To get the config changes to stick, restart using "/etc/init.d/postgresql-8.3 restart&lt;br /&gt;&lt;li&gt;To change the password, use "psql -U postgres".  The master database is the default.  psql should be in /usr/bin, which should be in your path&lt;br /&gt;&lt;li&gt;The semi-colon in the blog is important.  You should get the response, "ALTER ROLE" if it worked properly&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;Trying to open PGAdminIII again, I was able to give it a non-blank password, which made it really happy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-9204892059628829648?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/9204892059628829648/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/09/installing-postgresql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/9204892059628829648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/9204892059628829648'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/09/installing-postgresql.html' title='Installing PostgreSQL'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-2565471400939750834</id><published>2009-08-04T11:35:00.000-07:00</published><updated>2009-08-04T11:36:58.269-07:00</updated><title type='text'>vi cheatsheet</title><content type='html'>I try to avoid "vi", but sometimes it really is the most convenient editor to use when you're in an xterm window.  So here's a &lt;a href="http://www.lagmonster.org/docs/vi.html"&gt;cheatsheet&lt;/a&gt; I found on the Web.  There might be better, but this seems good enough for now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-2565471400939750834?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/2565471400939750834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/08/vi-cheatsheet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2565471400939750834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2565471400939750834'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/08/vi-cheatsheet.html' title='vi cheatsheet'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-1885934186922653205</id><published>2009-07-30T10:42:00.001-07:00</published><updated>2009-07-30T14:06:13.130-07:00</updated><title type='text'>"The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again"</title><content type='html'>I encountered this problem before but apparently forgot to write a blog on the topic.  So... after having re-searched Google and re-lived the pain, here is the short story...&lt;br /&gt;&lt;br /&gt;This message appears under the following situations:  You don't have MySQL 5.0.77, you don't have Rails 2.2.2, and you did not build the Gem: mysql-2.7.  There are a number of posts on this topic, most of which take you absolutely nowhere.  Just do the following (in order, and assuming you are running Mac OS 10.5.x):&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Install MySQL 5.0.77.  To check your current version, type: 'mysql --version'&lt;br /&gt;&lt;li&gt;Switch to your administrator user account using: 'su - Admin' (or whatever the admin account name is)&lt;br /&gt;&lt;li&gt;Verify that the following line exists in .bash_profile: 'export GEM_HOME="/usr/lib/ruby/gems/1.8"&lt;br /&gt;&lt;li&gt;Verify that the following lines exist in .gemrc: 'gempath:' and '  - /usr/lib/ruby/gems/1.8'&lt;br /&gt;&lt;li&gt;Type the following set of commands:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;cd /usr/lib/ruby/gems&lt;br /&gt;&lt;li&gt;sudo chmod 777 1.8&lt;br /&gt;&lt;li&gt;cd 1.8&lt;br /&gt;&lt;li&gt;sudo chmod 777 gems&lt;br /&gt;&lt;li&gt;sudo chmod 777 cache&lt;br /&gt;&lt;li&gt;sudo chmod 777 specifications&lt;br /&gt;&lt;li&gt;sudo chmod 777 doc&lt;br /&gt;&lt;li&gt;cd ..&lt;br /&gt;&lt;li&gt;gem install -v=2.2.2 rails&lt;br /&gt;&lt;li&gt;gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;The chmods are there because in Mac OS, the "Admin" user is different from the "root" user.  Because they might have different GEM_HOME environments, it is easier to just make sure the Admin user paths are set properly and execute gem installs as Admin.  Trying to enforce gem install paths on the root user is bothersome, to say the least.&lt;br /&gt;&lt;br /&gt;If you don't upgrade Rails to 2.2.2, you get an error message when you try to use 'mongrel_rails start'.&lt;br /&gt;&lt;br /&gt;If you don't upgrade the mysql gem you get the error in the title of this blog entry&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Important note:&lt;/b&gt; At this time, 'mongrel_rails start' should work but if 'rake db:create' still shows the error, copy the mysql-2.7 gem directory to /Library/Ruby/Gems/1.8/gems/.  This indicates that the Web server is pointing to a different gem directory and I haven't figure out yet how to change that.&lt;br /&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-1885934186922653205?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/1885934186922653205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/07/bundled-mysqlrb-driver-has-been-removed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1885934186922653205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1885934186922653205'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/07/bundled-mysqlrb-driver-has-been-removed.html' title='&quot;The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again&quot;'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-5409008495096511848</id><published>2009-07-08T13:31:00.000-07:00</published><updated>2009-07-08T13:40:37.656-07:00</updated><title type='text'>Compiling ffmpeg and ffplay</title><content type='html'>Wow, this topic can go on and on...  Let me see if I can distill it to the very essentials.&lt;br /&gt;&lt;br /&gt;First, to code in C or C++ effectively, get &lt;a href="http://www.eclipse.org/downloads/"&gt;Eclipse for C/C++ Developers&lt;/a&gt;.  That said, you don't need Eclipse for the rest of this blog entry.&lt;br /&gt;&lt;br /&gt;Download these three things:  &lt;a href="http://sourceforge.net/projects/lame/files/"&gt;LAME&lt;/a&gt;, &lt;a href="http://www.libsdl.org/download-1.2.php"&gt;SDL&lt;/a&gt;, and &lt;a href="http://ffmpeg.org/download.html"&gt;FFmpeg&lt;/a&gt;.   You may have trouble downloading LAME as the SourceForge server seems to be unreliable.  Compile them &lt;b&gt;in that exact order&lt;/b&gt; (this is very important).  Use the instructions &lt;a href="http://stephenjungels.com/jungels.net/articles/ffmpeg-howto.html"&gt;here&lt;/a&gt; as well as the instructions included in the downloads.  I'm distilling days of effort into a single paragraph so I'll update this entry or add a new one if I try this again...&lt;br /&gt;&lt;br /&gt;When you're done, a successful adventure will mean you can invoke the ffmpeg transcoder as well as the sample ffplay by entering them as a Unix command.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-5409008495096511848?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/5409008495096511848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/07/compiling-ffmpeg-and-ffplay.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5409008495096511848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5409008495096511848'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/07/compiling-ffmpeg-and-ffplay.html' title='Compiling ffmpeg and ffplay'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-5112548577757635729</id><published>2009-05-29T11:56:00.000-07:00</published><updated>2009-05-29T12:02:15.494-07:00</updated><title type='text'>Creating a UIBarButtonItem programmatically</title><content type='html'>This counts as one of those things that I'll want to do again in the future but will have to re-research it by poring through old code or Googling (yet again).  Sometimes for brevity, it isn't ideal to have a View Controller *and* a XIB for every little thing you want to present.  The XIB is an extra file and the symbolic links to the controller can be a pain to maintain.  To create your own action button (say, in the upper-right corner), use the following code:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;- (void)viewDidLoad {&lt;br /&gt; UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];&lt;br /&gt; UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:@"Load Colors"];&lt;br /&gt; [navBar pushNavigationItem:navItem animated:NO];&lt;br /&gt; UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:@"Edit"&lt;br /&gt;  style:UIBarButtonItemStyleBordered&lt;br /&gt;   target:self&lt;br /&gt;   action:@selector(toggleEdit:)];&lt;br /&gt; navItem.rightBarButtonItem = editButton;&lt;br /&gt; &lt;br /&gt; [self.view addSubview:navBar];&lt;br /&gt;&lt;br /&gt; [editButton release];&lt;br /&gt; [navItem release];&lt;br /&gt; [navBar release]; &lt;br /&gt; [super viewDidLoad];&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-5112548577757635729?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/5112548577757635729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/05/creating-uibarbuttonitem.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5112548577757635729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5112548577757635729'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/05/creating-uibarbuttonitem.html' title='Creating a UIBarButtonItem programmatically'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-3262482550234420264</id><published>2009-05-28T14:35:00.000-07:00</published><updated>2009-05-28T14:49:18.183-07:00</updated><title type='text'>Using @class and #import</title><content type='html'>The iPhone SDK contains two directives that use can use to declare other classes in your project.  They are:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;@class YourClassName;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#import "YourClassName.h"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The differences between the two are not clearly explained (in anything I've read) but the impact is very substantial.  While many writers dismiss these as interchangeable, &lt;b&gt;they are not&lt;/b&gt;!  This might be a situational example, but this is how I use those directives.&lt;br /&gt;&lt;br /&gt;First, use @class only in the header file.  This notifies the compiler that you are instantiating variables for use.  For example:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;@class YourClassName;&lt;br /&gt;@interface TheCurrentClass {&lt;br /&gt;  YourClassName *instanceVar;&lt;br /&gt;}&lt;br /&gt;@property (nonatomic, retain) YourClassName *instanceVar;&lt;br /&gt;@end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;While you get a nice way to define your class instance, the @class directive does not provide any of the underlying methods and variables available to that class.  To access anything meaningful in your instance, you must use #import in your implementation.  For example:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#import "TheCurrentClass.h"&lt;br /&gt;#import "YourClassName.h"&lt;br /&gt;@implementation TheCurrentClass&lt;br /&gt;@synthesize instanceVar;&lt;br /&gt;-(void)viewDidLoad {&lt;br /&gt;  YourClassName *tempInstance = [[YourClassName alloc] init];&lt;br /&gt;  self.instanceVar = tempInstance;&lt;br /&gt;  [tempInstance release];&lt;br /&gt;&lt;br /&gt;  [self.instanceVar someMethod:value];&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Again, this is situational, and the actual code will vary depending on your need, but the point is that the #import gives you access to "someMethod:".  If you don't use #import in this case, you will get the error I referred to in the previous post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-3262482550234420264?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/3262482550234420264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/05/using-class-and-import.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/3262482550234420264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/3262482550234420264'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/05/using-class-and-import.html' title='Using @class and #import'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-1730502817125026843</id><published>2009-05-28T10:12:00.000-07:00</published><updated>2009-05-28T10:19:47.502-07:00</updated><title type='text'>Unable to find instance method in another class</title><content type='html'>I'm refactoring my code because I need a better understanding of retain/release of static variables, but that will be another post...&lt;br /&gt;&lt;br /&gt;I decided to implement a trick I learned *after* I started ColorMatcher, which was to instantiate between classes using "@class" (as opposed to "#import").  A new compiler warning appeared:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;warning: no '-setDialType' method found&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I'm not sure about the reasons just yet, but when you see that warning, use #import instead.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-1730502817125026843?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/1730502817125026843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/05/unable-to-find-instance-method-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1730502817125026843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1730502817125026843'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/05/unable-to-find-instance-method-in.html' title='Unable to find instance method in another class'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-3731038451109914302</id><published>2009-05-27T10:03:00.000-07:00</published><updated>2009-05-27T10:10:31.561-07:00</updated><title type='text'>Determining the dimensions of a text string before display</title><content type='html'>With 2D graphical rendering, such as Apple's Quartz SDK, you occasionally want to display text.  However, the text position is something you do manually and could change, depending on circumstances (for example, if the text is centered on the screen).  The short answer, is &lt;a href="http://stackoverflow.com/questions/913470/iphone-sdk-how-do-you-measure-the-width-and-height-of-a-string-using-quartz"&gt;this is how you do it&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The big epiphany for me was that I was trying too hard to stick purely with Core Graphics and shying away from Objective-C.  However, Apple has taken pains to ensure that, even though the syntax and nomenclature is somewhat of a mish-mash, they do interoperate nicely.  Here is an example of my final code:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-(void)drawText:(CGContextRef)context text:(NSString*)text color:(UIColor*)color {&lt;br /&gt; UIFont *font = [UIFont systemFontOfSize:24.0];&lt;br /&gt; CGSize size = [text sizeWithFont:font];&lt;br /&gt; CGPoint center = CGPointMake(160.0, 100.0);&lt;br /&gt; CGPoint origin = CGPointMake(center.x - (size.width / 2.0), center.y - (size.height / 2.0));&lt;br /&gt; CGContextSetFillColorWithColor(context, color.CGColor);&lt;br /&gt; [text drawAtPoint:origin withFont:font];&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;It took way too long to get this code.  I hope it doesn't happen again... *sigh*&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-3731038451109914302?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/3731038451109914302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/05/determining-dimensions-of-text-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/3731038451109914302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/3731038451109914302'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/05/determining-dimensions-of-text-string.html' title='Determining the dimensions of a text string before display'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-6204725730995170005</id><published>2009-05-26T17:01:00.000-07:00</published><updated>2009-05-26T17:05:02.018-07:00</updated><title type='text'>Converting a NSString to a char array</title><content type='html'>I spent the better part of today wrestling with &lt;a href="http://stackoverflow.com/questions/912983/iphone-sdk-nsstring-to-c-char-array-crashes-on-second-invoke-to-drawrect"&gt;this problem&lt;/a&gt;.  In fact, I'm the poster of that question.  The short of it is that I have have a lot to learn about the retain/release cycle of Cocoa variables.  What's weird is that I could swear I was re-initializing the variable each cycle but who am I to argue against a working solution?  I'll figure out the root cause someday...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-6204725730995170005?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/6204725730995170005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/05/converting-nsstring-to-char-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6204725730995170005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6204725730995170005'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/05/converting-nsstring-to-char-array.html' title='Converting a NSString to a char array'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-5260554505478592743</id><published>2009-05-13T11:25:00.000-07:00</published><updated>2009-05-13T11:28:59.916-07:00</updated><title type='text'>Re-initializing a View</title><content type='html'>When switching between multiple views using a UITabBarController, by default the view is only initialized the very first time (viewDidLoad).  If a state changes that impacts a view the second time you visit it, the appropriate method to overload is:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(void)viewWillAppear:(bool)animated;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-5260554505478592743?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/5260554505478592743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/05/re-initializing-view.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5260554505478592743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/5260554505478592743'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/05/re-initializing-view.html' title='Re-initializing a View'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-1145977476121590537</id><published>2009-05-12T18:28:00.001-07:00</published><updated>2009-05-12T18:37:52.946-07:00</updated><title type='text'>Accessing the Root Controller from a sub view</title><content type='html'>One of the harder concepts to grasp (as someone who is new to Cocoa and the iPhone SDK) is how to navigate through the class and object hierarchy.  Sometimes you feel like a rat in a maze with dead-ends every which way.  In one example I wanted to do something seemingly simple:  programmatically change from one tab (in a UITabView) to another, as if the user had done so themselves.&lt;br /&gt;&lt;br /&gt;Surprisingly, this was a difficult problem to Google because the questions and answers never aligned to match my specific needs.  In an unusual burst of insight, combined with some clues from Apple documentation and user posts, I came up with the following technique.&lt;br /&gt;&lt;br /&gt;First, in the AppDelegate @interface (the main class), there is the line:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;UITabBarController *rootController;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Next, in one of my subview controller interfaces, I have:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ColorMatcherAppDelegate *app;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;which provides a pointer from a minor class to the main class.  Next, I add the following to the @implementation of that same class:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;app = [[UIApplication sharedApplication] delegate];&lt;br /&gt;app.rootController.selectedIndex = 0;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;When all is said and done, it only involves a few lines of code, but they sure were hard to find!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-1145977476121590537?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/1145977476121590537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/05/accessing-root-controller-from-sub-view.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1145977476121590537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1145977476121590537'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/05/accessing-root-controller-from-sub-view.html' title='Accessing the Root Controller from a sub view'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-7693886832359884199</id><published>2009-04-30T11:05:00.000-07:00</published><updated>2009-04-30T11:15:32.355-07:00</updated><title type='text'>The UIView class and the View XIB</title><content type='html'>One of the harder concepts to absorb when first learning the iPhone SDK is the "directionality" and control flow of UIView objects and UIViewController objects.  Both can be created using the Interface Builder and both can be created entirely from code.  I can't possibly go into all of that right now, but let's just say that if you stick to one technique or another, you'll "get it" pretty quickly but you won't be able to solve all the problems that arise.&lt;br /&gt;&lt;br /&gt;One such problem is when you need to programmatically change a View (such as, refreshing 2D graphics using Quartz) but you also want a XIB for that view, making it easier to embed standard controls.  I found a great answer to this question at this &lt;a href="http://stackoverflow.com/questions/398806/custom-drawing-with-xib-file-present"&gt;Web site&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In short, you create both a custom View (derived from UIView) then you point the XIB's View's Identity to that custom class.  When you refresh graphics using drawRect(), it refreshes right onto the View you created with Interface Builder.  Refer to the above link for code samples.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-7693886832359884199?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/7693886832359884199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/04/uiview-class-and-view-xib.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/7693886832359884199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/7693886832359884199'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/04/uiview-class-and-view-xib.html' title='The UIView class and the View XIB'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-6850189214319933024</id><published>2009-04-27T15:50:00.000-07:00</published><updated>2009-04-27T15:54:29.660-07:00</updated><title type='text'>Forgetting Regular Expressions</title><content type='html'>It has been quite some time since I've used Regular Expressions.  I've never been such an expert that I could make code practically wash dishes using just one line, but I used to be able to do some pretty cool tricks with minimal coding effort.  &lt;br /&gt;&lt;br /&gt;Coming to the rescue is &lt;a href="http://www.rubular.com/"&gt;Rubular&lt;/a&gt;: "A Ruby Regular Expression Editor".  This is a very handy Web-based tool that allows you to enter an expression and to provide a sample string.  It's all coming back to me...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-6850189214319933024?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/6850189214319933024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/04/forgetting-regular-expressions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6850189214319933024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/6850189214319933024'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/04/forgetting-regular-expressions.html' title='Forgetting Regular Expressions'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-1083874283440534518</id><published>2009-04-24T11:59:00.000-07:00</published><updated>2009-04-24T12:07:39.773-07:00</updated><title type='text'>Redirecting a database update using Rails</title><content type='html'>I learned a handy trick today.  &lt;br /&gt;&lt;br /&gt;Rails contains a convenience method that allows you to redirect page requests (or submissions) called "redirect_to".  Rails also contains a submission method called "PUT" in addition to the "GET" and "POST" supported by HTTP.  &lt;br /&gt;&lt;br /&gt;When you want to update a record in the database, the technique for doing so is to establish that the submission type of the update method is a "PUT".  However, if you want to create a delegate method in between the submission and the actual deed, you need to "POST" to your delegate method then have that method send it's redirection using "PUT".  &lt;br /&gt;&lt;br /&gt;This is *not obvious* and the solution is best explained by &lt;a href="http://stackoverflow.com/questions/670250/how-do-can-you-make-redirectto-use-a-different-http-request"&gt;this blog&lt;/a&gt;.  I've tried it and it works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-1083874283440534518?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/1083874283440534518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/04/redirecting-database-update-using-rails.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1083874283440534518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/1083874283440534518'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/04/redirecting-database-update-using-rails.html' title='Redirecting a database update using Rails'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-4411181149233197965</id><published>2009-04-21T18:01:00.000-07:00</published><updated>2009-04-21T18:06:45.579-07:00</updated><title type='text'>Using Rails scaffolding</title><content type='html'>A handy tool that comes with Rails is its ability to create fully functional, dynamic Web sites based on the database schema.  Knowing that there are standard CRUD operations, scaffolding creates the controllers and helper code you need to make a site work (without all the branding and AJAX, of course...)&lt;br /&gt;&lt;br /&gt;A problem I experienced was this error message: &lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;The name 'TasksHelper' is either already used in your application or reserved by Ruby on Rails.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A little Googling revealed that this is a "bug" that appeared in recent Rails releases (I'm currently using v2.2).  Here is a link to the &lt;a href="http://www.ruby-forum.com/topic/167667"&gt;most useful post I found&lt;/a&gt;.  Pay particular attention to the poster who says to rename the helper files.  It's kludgy but better than creating all that code manually.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-4411181149233197965?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/4411181149233197965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/04/using-rails-scaffolding.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4411181149233197965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4411181149233197965'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/04/using-rails-scaffolding.html' title='Using Rails scaffolding'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-8401608693516011027</id><published>2009-04-07T15:32:00.000-07:00</published><updated>2009-04-07T15:44:45.776-07:00</updated><title type='text'>Kudos to Apple</title><content type='html'>Sometimes things just click... and it's really nice when they do.  I needed to set up my MacPro (Leopard) as a development machine running Ruby on Rails and MySQL.  At first I estimated 2 to 4 hours.&lt;br /&gt;&lt;br /&gt;I had already installed MySQL plus a GUI front end called CocoaMySQL &lt;i&gt;(Note that Google has since purchased CocoaMySQL and renamed its successors to &lt;a href="http://www.sequelpro.com//"&gt;SequelPro&lt;/a&gt;.  This is good news for Mac heads like me because it shows a growing commitment to both MySQL and Macs.)&lt;/i&gt; so I wasn't worried about that.&lt;br /&gt;&lt;br /&gt;I guess I didn't read the release notes too carefully, but Ruby and Rails are both pre-installed on Leopard.  I opened a terminal window and typed "ruby --version" and "rails --version" and got the expected responses.&lt;br /&gt;&lt;br /&gt;Auto-generating a Rails project seems to point ActiveRecord to the SQLite database engine, but editing the database.yml file is a simple thing to correct.&lt;br /&gt;&lt;br /&gt;That was it!  Even a developer environment using a local Web server "just worked"!  I think the whole process took me less than 20 minutes and that's because I spent most of that time incredulous at how easy it was... Kudos to Apple.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-8401608693516011027?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/8401608693516011027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/04/kudos-to-apple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8401608693516011027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/8401608693516011027'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/04/kudos-to-apple.html' title='Kudos to Apple'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-7304298759188084391</id><published>2009-04-07T15:03:00.000-07:00</published><updated>2009-04-07T15:30:19.110-07:00</updated><title type='text'>Using Delegates in Objective-C</title><content type='html'>I was following a tutorial on implementing UIPickerViews.  For those who have seen or used an iPhone, it's the control that looks like a collection of spinning wheels.  The approach Apple takes with the implementation of that particular control is that you must specify a Delegate and a Datasource for the control to function properly.  In code, it looks like this:&lt;br /&gt;&lt;pre&gt;@interface MyController : UIViewController &amp;lt;UIPickerViewDelegate, UIPickerViewDataSource&amp;gt; { ... } @end&lt;/pre&gt;&lt;br /&gt;The tutorial continued to walk me through NIB creation and, most importantly, connecting the NIB objects to the class.  Spoiler alert: What I'm writing about is that I failed to realize three important concepts:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;the delegate and datasource declarations were standard components of the framework,&lt;br /&gt;&lt;li&gt;those declarations provide a clue to the NIB that you can "control-drag" to specify the delegate class, &lt;br /&gt;&lt;li&gt;you must "override" certain methods to guarantee that the code compiles properly&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;When I was running through the tutorial, I was under the preconception that the delegate class the authors were referring to was a *custom* class so I was already behind the 8-ball on point #1.  I got point #2 easily enough but then failed to understand where the methods in point #3 came from.  This is definitely one of those "you had to have been there" moments.  I'm sure you're yawning by now...&lt;br /&gt;&lt;br /&gt;Suffice it to say that I found my answer when I looked up &lt;a href="http://developer.apple.com/iphone/library/documentation/iPhone/Reference/UIPickerViewDataSource_Protocol/Introduction/Introduction.html"&gt;UIPickerViewDataSource&lt;/a&gt; and UIPickerDelegate in the Apple documentation.  The instance methods described should be overridden with custom treatment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-7304298759188084391?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/7304298759188084391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/04/using-delegates-in-objective-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/7304298759188084391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/7304298759188084391'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/04/using-delegates-in-objective-c.html' title='Using Delegates in Objective-C'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-2150138977195784395</id><published>2009-04-03T14:41:00.001-07:00</published><updated>2009-04-03T14:46:14.408-07:00</updated><title type='text'>"Privatizing" your WHOIS record</title><content type='html'>When you register a domain for your own personal use, you are asked to provide your home address, phone number, and email address.  Unless you have a valid yet anonymous identity most of us would choose to use our (truthful) personal information.&lt;br /&gt;&lt;br /&gt;This is problematic because the WHOIS database can be scrubbed for such information and used for telemarketing purposes... or worse.  Many domain hosting sites allow you to anonymize your information (for a fee) which is my recommended course of action.&lt;br /&gt;&lt;br /&gt;When transferring a domain, however, be sure that you turn this off.  Otherwise, the transfer authentication emails go to some bogus email address and restarting the process can be more effort than the initial transfer request.  I have learned this from experience... I'll keep you posted.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-2150138977195784395?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/2150138977195784395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/04/privatizing-your-whois-record.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2150138977195784395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2150138977195784395'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/04/privatizing-your-whois-record.html' title='&quot;Privatizing&quot; your WHOIS record'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-2614021562729306550</id><published>2009-04-03T14:03:00.000-07:00</published><updated>2009-04-03T14:31:40.812-07:00</updated><title type='text'>Free UML modeler for the Mac -- ArgoUML</title><content type='html'>For those of us who are "Windows-challenged", being Mac users, there are few alternatives to Microsoft's Visio.  Two very good open-source applications are &lt;a href="http://staruml.sourceforge.net/en/"&gt;StarUML&lt;/a&gt; and &lt;a href="http://argouml.tigris.org/"&gt;ArgoUML&lt;/a&gt;.  The former, however, is not available for the Mac.  Too bad.  For you Windows users looking for UML depiction that is superior to Visio, I encourage you to check it out because it actually is a pretty good tool.&lt;br /&gt;&lt;br /&gt;For those of you who are Enterprise-minded (e.g., you have the budget or you need Visio-compatibility) you may want to check out &lt;a href="http://www.conceptdraw.com/en/"&gt;ConceptDraw&lt;/a&gt;.  I haven't used it, but it appears to be more fully featured than ArgoUML and therefore very similar to Visio, which is targeted to a larger audience than just those interested in UML.&lt;br /&gt;&lt;br /&gt;I've used ArgoUML for 2 hours now to create Class Diagrams.  I have only experienced a couple of annoyances so far but those were not deal killers given the (did I say free?) price.&lt;br /&gt;&lt;br /&gt;First, annotation tools are too basic.  If there is a way to create a generic arrow (as opposed to an Association) I couldn't find it.  With a growing trend towards MVC you'd think there would be a way to incorporate visual elements into a Class Diagram.  For example, you can't insert a picture (screenshot, icon, etc.)&lt;br /&gt;&lt;br /&gt;Second, there is no copy/paste functionality... for anything!  If you have 5 similar Operations, forget about copying, pasting, and editing the differences.  You have to create each one.  This is most annoying with annotations.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-2614021562729306550?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/2614021562729306550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/04/free-uml-modeler-for-mac-argouml.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2614021562729306550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2614021562729306550'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/04/free-uml-modeler-for-mac-argouml.html' title='Free UML modeler for the Mac -- ArgoUML'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-2719857647030590776</id><published>2009-04-03T11:00:00.000-07:00</published><updated>2009-04-03T11:03:22.273-07:00</updated><title type='text'>GDB: Program Loaded.</title><content type='html'>This is the cryptic error I see when I forget to create a connection between a NIB object (say, a UIView object) and the associated class.  This was difficult to track down because the application compiles and runs, but the moment you interact with the interface, it goes into a locked state with this (very uninformative) message.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-2719857647030590776?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/2719857647030590776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/04/gdb-program-loaded.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2719857647030590776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/2719857647030590776'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/04/gdb-program-loaded.html' title='GDB: Program Loaded.'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2818563203095046890.post-4320302521285571508</id><published>2009-04-03T10:20:00.000-07:00</published><updated>2009-04-03T10:50:24.697-07:00</updated><title type='text'>Transferring Domains</title><content type='html'>Increased awareness of the value, and advantages, of &lt;a href="http://blog.davewrites.com/index.php/2009/03/16/meda-message-and-personal-branding"&gt;personal branding&lt;/a&gt; has led many to create their own Web sites.  It is easiest to use MySpace or Facebook but I'm a little more old school and decided to have my own domain and to create my own Web pages.  Once that choice is out of the way, the question becomes, "how do I my manage my domain?"&lt;br /&gt;&lt;br /&gt;I originally created a domain for a friend using &lt;a href="http://smallbusiness.yahoo.com/?s_fptrough=ysb_acq_smallbiz_20081001"&gt;Yahoo's Business&lt;/a&gt; services.  However, I quickly discovered that the Yahoo Web site is a labyrinth that requires a good memory or strategic use of bookmarks.  Heaven help you if you lose the bookmark.  While I give credit to Yahoo for being a leader with such types of offerings, their Web site is horribly outdated and is not prone to revisions or improvements once deployed to the public.&lt;br /&gt;&lt;br /&gt;I next created my own domain using old, yet trustworthy, &lt;a href="https://www.networksolutions.com/"&gt;Network Solutions&lt;/a&gt;.  I hearken from the old days when NS didn't offer hosted Web sites or e-commerce solutions so one can imagine my surprise when I discovered that I can not only manage multiple domains using NS but that they satisfy *most* of my Internet needs.  I created an e-commerce solution for another friend and became familiar with their interface and shopping cart tools.  While the NS administrative site could use some polish, it's organized and easy to navigate.  Kudos.&lt;br /&gt;&lt;br /&gt;Transferring my domain managed by Yahoo to Network Solutions was a piece of cake.  In the NS Web site, in a menu off the home page, is Transfer Domain Names.  You enter one or more names and provide an "authorization code".  To get that code, open your Yahoo Domain Control Panel and click on "View your authorization code".  The resulting page includes instructions for transferring the domain as well as the authorization code you'll need.  You pay $19 for the honor but when all is said and done, your domain will be in NS's much-easier-to-use domain management interface.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2818563203095046890-4320302521285571508?l=techblog.deanebesu.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techblog.deanebesu.com/feeds/4320302521285571508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techblog.deanebesu.com/2009/04/transferring-domains.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4320302521285571508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2818563203095046890/posts/default/4320302521285571508'/><link rel='alternate' type='text/html' href='http://techblog.deanebesu.com/2009/04/transferring-domains.html' title='Transferring Domains'/><author><name>Dean</name><uri>http://www.blogger.com/profile/05380865831371232007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_jBHIEiYAYSc/SG0-JtYJ25I/AAAAAAAAAAM/0FSjR-M-79c/S220/DSC00157.JPG'/></author><thr:total>0</thr:total></entry></feed>
