<?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-8715968252513255750</id><updated>2011-07-08T11:40:17.840-07:00</updated><category term='grails'/><category term='griffon'/><category term='Motivational'/><category term='gorm'/><category term='personal'/><category term='groovy'/><category term='jsecurity'/><title type='text'>Gabriel Dogaru's Weblog</title><subtitle type='html'>The Weblog</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gdogaru.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://gdogaru.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gabriel Dogaru</name><uri>http://www.blogger.com/profile/09826398866894719948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8715968252513255750.post-2669740966440716026</id><published>2010-02-13T13:58:00.000-08:00</published><updated>2010-02-13T14:07:42.327-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>Groovy way to see if thread execution had errors</title><content type='html'>I had to write a script that did something and for a faster run I decided to use threads.&lt;br /&gt;I needed to start a thread to do some task and then to be able to check that it had finished without an error/exception.&lt;br /&gt;In Java if the code executed in a new thread throws an error, it doesn't matter that much, it just executes the next instruction after thread.join().&lt;br /&gt;Some solutions found on the internet were&lt;br /&gt;&lt;ul&gt;&lt;li&gt;to put all the code inside the thread in a try-catch block and in the catch block populate a map with the thread name and status. Then you could get the status by querying statusMap[threadName]&lt;/li&gt;&lt;li&gt;add a status status field to your class witch is a subclass of Thread. Then you do the same thing as above and in the catch block modify the status to failed (status is successfull in the begining). You get get the status by thread.status&lt;/li&gt;&lt;/ul&gt;Luckily in&amp;nbsp; groovy we have dynamic object behaviour.&lt;br /&gt;So my solution is to add a new field to the Thread class, and use Thread.setDefaultUncaughtExceptionHandler to populate it.&lt;br /&gt;It looks something like&lt;br /&gt;&lt;pre class="brush:groovy"&gt;Thread.metaClass.failed = false&lt;br /&gt;&lt;br /&gt;Thread.setDefaultUncaughtExceptionHandler(&lt;br /&gt;        {t, ex -&amp;gt;&lt;br /&gt;          t.failed = true&lt;br /&gt;        } as Thread.UncaughtExceptionHandler)&lt;br /&gt;&lt;br /&gt;def th= Thread.start {&lt;br /&gt;  println ' in thread 1'&lt;br /&gt;  throw new RuntimeException("thread exception")&lt;br /&gt;  println ' in thread 2'&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;th.join()&lt;br /&gt;&lt;br /&gt;assert th.failed == true&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And now I can see if any exception/error has been thrown. And all the threads I start will have this property.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8715968252513255750-2669740966440716026?l=gdogaru.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdogaru.blogspot.com/feeds/2669740966440716026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gdogaru.blogspot.com/2010/02/groovy-way-to-see-if-thread-execution.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/2669740966440716026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/2669740966440716026'/><link rel='alternate' type='text/html' href='http://gdogaru.blogspot.com/2010/02/groovy-way-to-see-if-thread-execution.html' title='Groovy way to see if thread execution had errors'/><author><name>Gabriel Dogaru</name><uri>http://www.blogger.com/profile/09826398866894719948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8715968252513255750.post-7260157203492487033</id><published>2010-02-04T14:10:00.000-08:00</published><updated>2010-02-04T14:17:01.316-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='personal'/><category scheme='http://www.blogger.com/atom/ns#' term='Motivational'/><title type='text'>Religions with a sense of humor</title><content type='html'>&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;I just love it when a religion has a sense of humor.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Discordianists are my favorite.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Today I came across  The TriPrimality from subgenius:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;The TriPrimality:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;"Bob" is.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;"Bob" becomes.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;"Bob" is not.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Nothing is; Nothing becomes;  Nothing is not.  Thus: Nothing Is Everything.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; Therefore: Everything is "Bob."&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Abracadabra.  &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;"I don't practice what I preach, because I'm not the kind of person I'm preaching to."--Bob&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;You have to admit that is funny.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;And I can't close without mentioning my favorite religious person, Robert Anton Wilson.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;"Spectacles,        testicles, brandy, cigars -- you're all popes! You're all absolutely        infallible. I have the authority to appoint anyone a Discordian Pope,        because I'm a Discordian Pope. The first rule after you become a        Discordian Pope is to excommunicate every Discordian Pope you meet. This        is based on the basic Discordian principle that we Discordians must stick        apart."&amp;nbsp; - RAW&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;so, what can I say ?&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;"Spectacles, testicles, brandy, cigars -- you're all popes! " &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8715968252513255750-7260157203492487033?l=gdogaru.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdogaru.blogspot.com/feeds/7260157203492487033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gdogaru.blogspot.com/2010/02/religions-with-sense-of-humor.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/7260157203492487033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/7260157203492487033'/><link rel='alternate' type='text/html' href='http://gdogaru.blogspot.com/2010/02/religions-with-sense-of-humor.html' title='Religions with a sense of humor'/><author><name>Gabriel Dogaru</name><uri>http://www.blogger.com/profile/09826398866894719948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8715968252513255750.post-3658958201256459847</id><published>2009-12-09T07:57:00.000-08:00</published><updated>2009-12-09T08:09:13.580-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='personal'/><title type='text'>Mohana- the witch of bring-a-thing</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_YmoxgM4T4Uk/Sx_Inkit_tI/AAAAAAAAAOs/-Uj22R38M6U/s1600-h/mohana.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_YmoxgM4T4Uk/Sx_Inkit_tI/AAAAAAAAAOs/-Uj22R38M6U/s200/mohana.png" /&gt;&lt;/a&gt;This week we were asked something to bring a thing for "Bring A Thing", a kind of charity activity at work.&lt;br /&gt;I brought a kind of jack in the box witch. Then I was asked to write a&amp;nbsp; story about it.&lt;br /&gt;I thing it got out pretty well and I wanted to share it with you&lt;br /&gt;To fully understand the story you should watch South Park , listen to some Manowar and live in Romania. It is still funny if you haven't done any of this, but...&lt;br /&gt;&lt;br /&gt;Here it is:&lt;br /&gt;&lt;br /&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;Once upon a time in the land of far  away yet so close you could feel it lived little  Timmy.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;He was a handicapped kid walking  around in his wheel chair and singing Abba all day.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;Timmy’s life was quite boring and  ordinary, except when playing tanki online. He was a true champion  then.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;One day his parents wanted to  surprise Timmy. So they sent little Timmy to leave with aunt whom he had never  seen or heard of, &lt;span style="color: navy;"&gt;&lt;span style="color: navy;"&gt;&lt;a href="http://seconteen13.deviantart.com/art/florgonzola-129049700" title="http://seconteen13.deviantart.com/art/florgonzola-129049700"&gt;Florgonzola&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;Oh boy, finally an adventure,  thought the child.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;And finally he arrived. The weather  was not so nice. It was autumn and raining, but hey, the tickets were cheaper  because it was off-season.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;So T is now with his ugly, quite  stupid aunt. No adventure here, disappointed. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;But wait, there is a forest near by.  So, putting his off-road tires on his wheel chair the boy sets up for a  quest.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;In the middle of the forest there  was an old house, seemed quite deserted.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;The boy rushed in. After an hour he  finally made it in to find an empty poor house.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;“I’ll come at night, there must be a  ghost here, or at least a spider, or a possessed squirrel, or maybe the wind  will blow through the window to make buhuhu”. So the boy went every night, but  still nothing special.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;So the sixth night he arrived at his  aunt home yet again disappointed, with his off-road tires torn apart by the  sharp rocks of reality.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;He entered the house to find  what?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;Flo&lt;span style="color: navy;"&gt;&lt;span style="color: navy;"&gt;r&lt;/span&gt;&lt;/span&gt;gonzola had transformed into an uglier,  stupider witch, making soup out of weed and a bleeding deer  leg.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;“Come in, welcome desert”, she said.  The boy understood that it made sense, it was also the sixth hour and the sixth  minute, almost as much as some presidency lasted in some  countries.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;The boy was now terrified. He  started to cry and swirl around until his tires caught fire. Then he decided to  call his friends.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;So he started his mp3 player and the  “&lt;span style="color: navy;"&gt;&lt;span style="color: navy;"&gt;&lt;a href="http://www.manowar.com/" title="http://www.manowar.com/"&gt;kings of metal&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;” appeared from  their kingdom of steel.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;Using their sharp minds and their  powerful guitars they enslaved the witch. Their music was not so good, but at  least they were loud.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;With her last words she promised  that if she were to live she will only do good and change her name and looks to  more nicer things.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;The kings accepted with their kind  minds. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;Flo&lt;span style="color: navy;"&gt;&lt;span style="color: navy;"&gt;r&lt;/span&gt;&lt;/span&gt;gonzola was baptized under the sign of Odin  all-powerful. Now she is named “MOHANA”. The kings of metal were pleased with  yet another successful mission and the boy was given a steel horse called Pegus  (because Pegas was a bike).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;But she was still punished to live  in a box.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;From time to time she appears from  the box to scare the bad thoughts and the bad enchantments around people,  bringing luck and fortune.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;BTW&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Arial; font-size: x-small;"&gt;&lt;span style="font-family: Arial; font-size: 10pt;"&gt;Did you hear about the witch who was  ashamed of her long black hair? &lt;br /&gt;She always wore long gloves to cover it  up.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&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/8715968252513255750-3658958201256459847?l=gdogaru.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdogaru.blogspot.com/feeds/3658958201256459847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gdogaru.blogspot.com/2009/12/mohana-with-of-bring-thing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/3658958201256459847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/3658958201256459847'/><link rel='alternate' type='text/html' href='http://gdogaru.blogspot.com/2009/12/mohana-with-of-bring-thing.html' title='Mohana- the witch of bring-a-thing'/><author><name>Gabriel Dogaru</name><uri>http://www.blogger.com/profile/09826398866894719948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_YmoxgM4T4Uk/Sx_Inkit_tI/AAAAAAAAAOs/-Uj22R38M6U/s72-c/mohana.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8715968252513255750.post-6564316935318416812</id><published>2009-11-18T12:51:00.000-08:00</published><updated>2009-11-18T13:40:08.229-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gorm'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>Ways to map and query many-to-many in GORM</title><content type='html'>I played with many-to-many relations in grails and found some interesting ways to work with them.&lt;br /&gt;First the domain definitions. &lt;br /&gt;For the purpose of this demo I chose the classic example with books and authors. A book may have many authors and an author may have many books.&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;class Author {&lt;br /&gt;  String name&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Book {&lt;br /&gt;  String name&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;What I consider the silliest way to define your domains I found here &lt;a href="http://www.grails.org/Many-to-Many+Mapping+without+Hibernate+XML"&gt;http://www.grails.org/Many-to-Many+Mapping+without+Hibernate+XML&lt;/a&gt;&lt;br /&gt;They suggest mapping the join table using a domain object and creating the links by hand. &lt;br /&gt;On 'books and authors' it would look like&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;class Book {&lt;br /&gt;  String name&lt;br /&gt;  static hasMany = [ memberships: Membership]&lt;br /&gt;&lt;br /&gt;  List authors() {&lt;br /&gt;    return memberships.collect {it.author}&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  List addToAuthors(Author author) {&lt;br /&gt;    Membership.link(this, author)&lt;br /&gt;    return authors()&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  List removeFromAuthors(Author author) {&lt;br /&gt;    Membership.unlink(this, author)&lt;br /&gt;    return authors()&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Author {&lt;br /&gt;  String name&lt;br /&gt;  static hasMany = [memberships: Membership]&lt;br /&gt;&lt;br /&gt;  List books() {&lt;br /&gt;    return memberships.collect {it.book}&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  List addToBooks(Book book) {&lt;br /&gt;    Membership.link(book, this)&lt;br /&gt;    return books()&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  List removeFromBooks(Book book) {&lt;br /&gt;    Membership.unlink(book, this)&lt;br /&gt;    return books()&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Membership {&lt;br /&gt;  Book book&lt;br /&gt;  Author author&lt;br /&gt;  static Membership link(book, author) {&lt;br /&gt;    def m = Membership.findByBookAndAuthor(book, author)&lt;br /&gt;    if (!m) {&lt;br /&gt;      m = new Membership()&lt;br /&gt;      book?.addToMemberships(m)&lt;br /&gt;      author?.addToMemberships(m)&lt;br /&gt;      m.save()&lt;br /&gt;    }&lt;br /&gt;    return m&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  static void unlink(book, author) {&lt;br /&gt;    def m = Membership.findByBookAndAuthor(book, author)&lt;br /&gt;    if (m) {&lt;br /&gt;      book?.removeFromMemberships(m)&lt;br /&gt;      author?.removeFromMemberships(m)&lt;br /&gt;      m.delete()&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;While this works it doesn't seam very elegant to me.&lt;br /&gt;So, moving on, I found a better way to do it.&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;class Author {&lt;br /&gt;  String name&lt;br /&gt;&lt;br /&gt;  static hasMany = [books:Book]&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Book {&lt;br /&gt;  String name&lt;br /&gt;&lt;br /&gt;  static belongsTo = Author&lt;br /&gt;  static hasMany = [authors: Author]&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This seems the best way. Or you could use hibernate annotations, but I won't treat that.&lt;br /&gt;Now let's see how we can query these.&lt;br /&gt;Let's say I want to get all the books written by an author. &lt;br /&gt;First dynamic finders. This is done in 2 steps:&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;def author = Author.findByName(a_Name)&lt;br /&gt;def books = author ? Book.findAllByAuthor(author) : []&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;With Hql it would look something like:&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;Book.executeQuery("from Book as b join b.authors a where a.name = :name order by b.name", [name: a_Name, max: max, offset: offset])&lt;br /&gt;Book.findAll("from Book as b join b.authors a where a.name = :name order by b.name desc", [name: a_Name, max: max, offset: offset]);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This returns a list of arrays containing book and author&lt;br /&gt;To get only the books use:&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;Book.executeQuery("select b from Book as b join b.authors a where a.name = :name order by b.name", [name: a_Name, max: max, offset: offset])&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Finally, using criteria:&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;def criteria = Book.createCriteria()&lt;br /&gt;    def books = criteria.list {&lt;br /&gt;      authors {&lt;br /&gt;        eq('name', a_Name)&lt;br /&gt;      }&lt;br /&gt;      maxResults(max)&lt;br /&gt;      firstResult(offset)&lt;br /&gt;      order("name", "asc")&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So these are some ways to query many-to-many relations with gorm, also using paging. &lt;br /&gt;Hope it was helpful.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8715968252513255750-6564316935318416812?l=gdogaru.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdogaru.blogspot.com/feeds/6564316935318416812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gdogaru.blogspot.com/2009/11/ways-to-map-and-query-many-to-many-in.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/6564316935318416812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/6564316935318416812'/><link rel='alternate' type='text/html' href='http://gdogaru.blogspot.com/2009/11/ways-to-map-and-query-many-to-many-in.html' title='Ways to map and query many-to-many in GORM'/><author><name>Gabriel Dogaru</name><uri>http://www.blogger.com/profile/09826398866894719948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8715968252513255750.post-1148723843643436586</id><published>2009-11-10T08:31:00.000-08:00</published><updated>2009-11-10T09:07:56.840-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='grails'/><category scheme='http://www.blogger.com/atom/ns#' term='jsecurity'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>JSecurity and active directory in grails</title><content type='html'>This was done as a way to force domain users to log in before using the applications.&lt;br /&gt;The old implementation used the jcifs library with jetty, but after upgrading to glashfish, jcifs started to fail randomly, especially when the application was accessed using IE. &lt;br /&gt;And, after reading on their web site that the httpfilter is no longer supported,  I started looking for free alternatives to Jcifs.&lt;br /&gt;On the JSecurity plugin home it said it works with ldap, but the configuration they gave seemed complicated and I didn't really get it.&lt;br /&gt;On the other hand I found this nice blog entry of how to use java/jndi and active directory. &lt;br /&gt;&lt;a href="http://mhimu.wordpress.com/2009/03/18/active-directory-authentication-using-javajndi/"&gt;http://mhimu.wordpress.com/2009/03/18/active-directory-authentication-using-javajndi/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is how o put them together:&lt;br /&gt;&lt;br /&gt;1. install the jsecurity plugin in your grails app&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;grails install-plugin jsecurity&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2. generate the ldap realm and the auth controller. This comes default with jsecurity.&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;grails create-ldap-realm&lt;br /&gt;grails create-auth-controller &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;3. Create a filter to redirect all the anonymous request to the login.&lt;br /&gt;It might look like this and should be placed in your-app/grails-app/conf&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;public class SecurityADFilters {&lt;br /&gt;&lt;br /&gt;  def filters = {&lt;br /&gt;    loginCheck(controller: '*', action: '*') {&lt;br /&gt;      before = {&lt;br /&gt;         if (controllerName == "auth") return true&lt;br /&gt;        accessControl { true }&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;4. Modify the generated JsecLdapRealm based on the example above. It could look like this. This is a mock, some lines of code can be removed, if you don't need to get info about the user.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;class JsecLdapRealm {&lt;br /&gt;  static authTokenClass = org.jsecurity.authc.UsernamePasswordToken&lt;br /&gt;&lt;br /&gt;  def grailsApplication&lt;br /&gt;&lt;br /&gt;  def authenticate(authToken) {&lt;br /&gt;    log.info "Attempting to authenticate ${authToken.username} in LDAP realm..."&lt;br /&gt;    def username = authToken.username&lt;br /&gt;    def password = new String(authToken.password)&lt;br /&gt;&lt;br /&gt;    // Get LDAP config for application. Use defaults when no config&lt;br /&gt;    // is provided.&lt;br /&gt;    def appConfig = grailsApplication.config&lt;br /&gt;    def ldapHost = appConfig.ldap.ldapHost ?: ["ldap://localhost:389/"]&lt;br /&gt;    def searchBase = appConfig.ldap.searchBase ?: ""&lt;br /&gt;    def domain = appConfig.ldap.domain ?: ""&lt;br /&gt;    def usernameAttribute = appConfig.ldap.username.attribute ?: "uid"&lt;br /&gt;    def skipAuthc = appConfig.ldap.skip.authentication ?: false&lt;br /&gt;    def skipCredChk = appConfig.ldap.skip.credentialsCheck ?: false&lt;br /&gt;    def allowEmptyPass = appConfig.ldap.allowEmptyPasswords != [:] ? appConfig.ldap.allowEmptyPasswords : true&lt;br /&gt;&lt;br /&gt;    // Skip authentication ?&lt;br /&gt;    if (skipAuthc) {&lt;br /&gt;      log.info "Skipping authentication in development mode."&lt;br /&gt;      return username&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // Null username is invalid&lt;br /&gt;    if (username == null) {&lt;br /&gt;      throw new AccountException("Null usernames are not allowed by this realm.")&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // Empty username is invalid&lt;br /&gt;    if (username == "") {&lt;br /&gt;      throw new AccountException("Empty usernames are not allowed by this realm.")&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // Allow empty passwords ?&lt;br /&gt;    if (!allowEmptyPass) {&lt;br /&gt;      // Null password is invalid&lt;br /&gt;      if (password == null) {&lt;br /&gt;        throw new CredentialsException("Null password are not allowed by this realm.")&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      // empty password is invalid&lt;br /&gt;      if (password == "") {&lt;br /&gt;        throw new CredentialsException("Empty passwords are not allowed by this realm.")&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    String[] returnedAtts = ["sn", "givenName", "mail"];&lt;br /&gt;    String searchFilter = "(&amp;(objectClass=user)(sAMAccountName=" + username + "))";&lt;br /&gt;&lt;br /&gt;    //Create the search controls&lt;br /&gt;    SearchControls searchCtls = new SearchControls();&lt;br /&gt;    searchCtls.setReturningAttributes(returnedAtts);&lt;br /&gt;&lt;br /&gt;    //Specify the search scope&lt;br /&gt;    searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);&lt;br /&gt;&lt;br /&gt;    Hashtable env = new Hashtable();&lt;br /&gt;    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");&lt;br /&gt;    env.put(Context.PROVIDER_URL, ldapHost);&lt;br /&gt;    env.put(Context.SECURITY_AUTHENTICATION, "simple");&lt;br /&gt;    env.put(Context.SECURITY_PRINCIPAL, username + "@" + domain);&lt;br /&gt;    env.put(Context.SECURITY_CREDENTIALS, password);&lt;br /&gt;&lt;br /&gt;    LdapContext ctxGC = null;&lt;br /&gt;    try {&lt;br /&gt;      ctxGC = new InitialLdapContext(env, null);&lt;br /&gt;      //Search objects in GC using filters&lt;br /&gt;      NamingEnumeration answer = ctxGC.search(searchBase, searchFilter, searchCtls);&lt;br /&gt;      while (answer.hasMoreElements()) {&lt;br /&gt;        SearchResult sr = (SearchResult) answer.next();&lt;br /&gt;        Attributes attrs = sr.getAttributes();&lt;br /&gt;        Map amap = null;&lt;br /&gt;        if (attrs != null) {&lt;br /&gt;          amap = new HashMap();&lt;br /&gt;          NamingEnumeration ne = attrs.getAll();&lt;br /&gt;          while (ne.hasMore()) {&lt;br /&gt;            Attribute attr = (Attribute) ne.next();&lt;br /&gt;            amap.put(attr.getID(), attr.get());&lt;br /&gt;          }&lt;br /&gt;          ne.close();&lt;br /&gt;        }&lt;br /&gt;        if (amap != null) return username&lt;br /&gt;        else return false&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    catch (NamingException ex) {&lt;br /&gt;      ex.printStackTrace();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;5. Notice that above we are using some properties from appConfig so we shall add them. In grails-app/conf/Config.groovy add&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;// configure the ldap realm&lt;br /&gt;&lt;br /&gt;ldap.domain = 'domain'&lt;br /&gt;ldap.ldapHost = 'ldap://ldaphost'&lt;br /&gt;ldap.searchBase = 'DC=***,DC=***' //or whatever is suitable for you&lt;br /&gt;&lt;br /&gt;ldap.skip.authentication = false&lt;br /&gt;ldap.skip.credentialsCheck = false&lt;br /&gt;ldap.allowEmptyPasswords = false&lt;br /&gt;&lt;br /&gt;//consult your LDAP admin&lt;br /&gt;&lt;br /&gt;jsecurity.authentication.strategy = new org.jsecurity.authc.pam.AtLeastOneSuccessfulModularAuthenticationStrategy()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That is about it. I hope I did not forget anything. &lt;br /&gt;Now every time you access the application you will have to log in using your domain account.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8715968252513255750-1148723843643436586?l=gdogaru.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdogaru.blogspot.com/feeds/1148723843643436586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gdogaru.blogspot.com/2009/11/jsecurity-and-ntlm-in-grails.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/1148723843643436586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/1148723843643436586'/><link rel='alternate' type='text/html' href='http://gdogaru.blogspot.com/2009/11/jsecurity-and-ntlm-in-grails.html' title='JSecurity and active directory in grails'/><author><name>Gabriel Dogaru</name><uri>http://www.blogger.com/profile/09826398866894719948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8715968252513255750.post-7027994103123448108</id><published>2009-11-09T11:46:00.000-08:00</published><updated>2009-11-09T13:40:53.513-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='griffon'/><title type='text'>Alternate way to run/debug Griffon applications from an IDE</title><content type='html'>This is a way I use to to debug my griffon apps since before ide support. I am using this with idea 8, but I think it can be used with every ide.  I think Eclipse  can run griffon apps like this.&lt;br /&gt;I was looking at the new support from IntelliJ and Netbeans and it looks great. But I think the way I am going to describe also has benefits.&lt;br /&gt;&lt;br /&gt;Let's begin from scratch.&lt;br /&gt;So these are the steps:&lt;br /&gt;1. Create an empty project in Idea.&lt;br /&gt;&lt;br /&gt;2. Create your griffon application somewhere on the hard drive.&lt;br /&gt;&lt;pre class="brush:groovy"&gt;&lt;br /&gt;griffon create-app demo1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt; Ok, now we have an empty project and an empty app. &lt;br /&gt;&lt;br /&gt;3. We will add the app in idea as a java module.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_YmoxgM4T4Uk/SviFpTEO-VI/AAAAAAAAANI/fSwgI0aOSJw/s1600-h/javamodule.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 134px;" src="http://2.bp.blogspot.com/_YmoxgM4T4Uk/SviFpTEO-VI/AAAAAAAAANI/fSwgI0aOSJw/s320/javamodule.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5402214697570072914" /&gt;&lt;/a&gt;&lt;br /&gt;On the next screen we choose not to create a source directory. Click next, do not add any facets and finish.&lt;br /&gt;&lt;br /&gt;4.Next we set up the sources folders for our project. It should look like in the picture. The blue folders are sources. The green one are test sources.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_YmoxgM4T4Uk/SviGYA1BScI/AAAAAAAAANQ/sOqvcjpaT7o/s1600-h/sources.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 245px;" src="http://4.bp.blogspot.com/_YmoxgM4T4Uk/SviGYA1BScI/AAAAAAAAANQ/sOqvcjpaT7o/s400/sources.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5402215500128274882" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;5. Let's add the griffon libraries to our module. Basically what I do here is add all the jars from the folders containing jars from %GRIFFON_HOME%. These one are the ones highlighted below&lt;br /&gt;Also add the groovy facet will add the groovy libraries.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_YmoxgM4T4Uk/SviKdobtviI/AAAAAAAAANw/kf3Jg_MOsxg/s1600-h/griffon_libs.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 165px; height: 273px;" src="http://2.bp.blogspot.com/_YmoxgM4T4Uk/SviKdobtviI/AAAAAAAAANw/kf3Jg_MOsxg/s320/griffon_libs.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5402219994705411618" /&gt;&lt;/a&gt;&lt;br /&gt;In the end it should look like this:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_YmoxgM4T4Uk/SviHSjGXyMI/AAAAAAAAANg/3bpJqKOF-R0/s1600-h/dependencies.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 307px;" src="http://4.bp.blogspot.com/_YmoxgM4T4Uk/SviHSjGXyMI/AAAAAAAAANg/3bpJqKOF-R0/s320/dependencies.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5402216505760270530" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;6. Now you should be able to compile your code. The code will be compiled somewhere on the drive, probably in the global path for that project. Find that place and copy application.properties from the module root (application folder) there. In griffon 1.x this was not necessary.&lt;br /&gt;&lt;br /&gt;7. Now we create a run configuration&lt;br /&gt;Create a Run/Debug Configuration of type application.&lt;br /&gt;It should look similar to the one below&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_YmoxgM4T4Uk/SviIi7fyKeI/AAAAAAAAANo/_rk6S1ECvBs/s1600-h/run.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 262px; height: 320px;" src="http://4.bp.blogspot.com/_YmoxgM4T4Uk/SviIi7fyKeI/AAAAAAAAANo/_rk6S1ECvBs/s320/run.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5402217886698842594" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The main thing here is to set &lt;b&gt;griffon.application.SwingApplication&lt;/b&gt; as "Main Class". In griffon 1.x this was &lt;b&gt;griffon.application.SingleFrameApplication&lt;/b&gt;. I guess you can use that too.&lt;br /&gt;&lt;br /&gt;You are done. Now you can run the app from the run button in Idea. Debug works also. And You can also use the wonderful hot swap to recompile your controllers or classes. I think it doesn't work for views.&lt;br /&gt;&lt;br /&gt;If you use the basic idea behind this steps, I guess you can run/debug griffon using any IDE.&lt;br /&gt;&lt;br /&gt;Simple, right ?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8715968252513255750-7027994103123448108?l=gdogaru.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdogaru.blogspot.com/feeds/7027994103123448108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gdogaru.blogspot.com/2009/11/alternate-way-to-rundebug-griffon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/7027994103123448108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/7027994103123448108'/><link rel='alternate' type='text/html' href='http://gdogaru.blogspot.com/2009/11/alternate-way-to-rundebug-griffon.html' title='Alternate way to run/debug Griffon applications from an IDE'/><author><name>Gabriel Dogaru</name><uri>http://www.blogger.com/profile/09826398866894719948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_YmoxgM4T4Uk/SviFpTEO-VI/AAAAAAAAANI/fSwgI0aOSJw/s72-c/javamodule.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8715968252513255750.post-5171551194396924469</id><published>2008-03-12T04:28:00.000-07:00</published><updated>2009-10-18T12:04:51.702-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Motivational'/><title type='text'>Nick Vujicic</title><content type='html'>There are some people that just impress you. I think this is one of them&lt;br /&gt;&lt;br /&gt;&lt;embed src="http://www.metacafe.com/fplayer/974594/nick_vujicic__no_arms__no_legs__no_worries__part_1_of_3.swf" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="345" width="400"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;  &lt;a href="http://www.metacafe.com/watch/974594/nick_vujicic_no_arms_no_legs_no_worries_part_1_of_3/"&gt;Nick Vujicic, No Arms, No Legs, No Worries! Part 1 Of 3 - video powered by Metacafe&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8715968252513255750-5171551194396924469?l=gdogaru.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdogaru.blogspot.com/feeds/5171551194396924469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gdogaru.blogspot.com/2008/03/there-are-some-people-that-just-impress.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/5171551194396924469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8715968252513255750/posts/default/5171551194396924469'/><link rel='alternate' type='text/html' href='http://gdogaru.blogspot.com/2008/03/there-are-some-people-that-just-impress.html' title='Nick Vujicic'/><author><name>Gabriel Dogaru</name><uri>http://www.blogger.com/profile/09826398866894719948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
