<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>groovy &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/groovy/</link>
	<description>Feed of posts on WordPress.com tagged "groovy"</description>
	<pubDate>Tue, 01 Dec 2009 17:49:46 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA["Cyber" Monday, Followed By "Phone Sex" Tuesday and "Light Touching" Wednesday]]></title>
<link>http://freshisback.com/2009/12/01/cyber/</link>
<pubDate>Tue, 01 Dec 2009 06:31:39 +0000</pubDate>
<dc:creator>FRESHisBACK</dc:creator>
<guid>http://freshisback.com/2009/12/01/cyber/</guid>
<description><![CDATA[Back in the early 90s, we were introduced to the magical world of &#8220;cyberspace,&#8221; a place ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:justify;">Back in the early 90s, we were introduced to the magical world of &#8220;cyberspace,&#8221; a place where you could chat with friends, check &#8220;electronic mail,&#8221; and even talk to strangers.  &#8220;Going on cyberspace&#8221; was like copulating with a pack of unicorns &#8212; no one had ever done it before, so everyone wanted to know what it was like:  How does it feel?  How does it work?  How can I get a screechy dial-up modem too?</p>
<p style="text-align:justify;"><a href="http://freshisback.wordpress.com/files/2009/12/cyberspace1.jpg"><img class="alignright size-medium wp-image-2512" style="margin:5px 15px;" title="CYBERSPACE1" src="http://freshisback.wordpress.com/files/2009/12/cyberspace1.jpg?w=300" alt="" width="300" height="232" /></a>But once cyberspace became mainstream, its better half decided that it would take on a whole new meaning.  In the seedy dark corners of AOL chatrooms, &#8220;cyber&#8221; lost its innocence.  With this transformation, thousands of curious 13-year olds were lured into predatory situations with creeps who wanted to &#8220;cyber&#8221;&#8230; Yes, like any rogue prefix-turned-slutty-verb, &#8220;cyber&#8221; became a term of virtual copulation.</p>
<p style="text-align:justify;">So, forgive me for not embracing &#8220;Cyber Monday&#8221; as a new retail holiday.  To me, it&#8217;s as if retailers decided to name a random day &#8220;Boom Boom Tuesday&#8221; or &#8220;Bang Me Wednesday,&#8221; then offer 30% off all items in stock.  Sorry, but that doesn&#8217;t make me want to buy Ginsu knives, even if they&#8217;re <a href="http://www.amazon.com/gp/product/B0006TJ7I6/ref=pd_lpo_k2_dp_sr_1?pf_rd_p=486539851&#38;pf_rd_s=lpo-top-stripe-1&#38;pf_rd_t=201&#38;pf_rd_i=B0006TJ7HM&#38;pf_rd_m=ATVPDKIKX0DER&#38;pf_rd_r=10JX7G49THNY38RM97BK">43% off on Amazon</a>.  In fact, I feel <em>less</em> inclined to shop on Cyber Monday, and <em>more</em> inclined to join shady chatroom discussions about <a href="http://deadspin.com/5414624/grady-sizemore-does-his-bit-to-increase-our-female-readership/gallery/">Grady Sizemore</a>.</p>
<p style="text-align:justify;">I am surprised that conservative watchdog groups haven&#8217;t boycotted &#8220;Cyber Monday&#8221; yet for its underlying sexual innuendo.  Perhaps they&#8217;re too busy snapping up Sarah Palin&#8217;s book on eBay&#8230; or maybe these &#8220;<a href="http://freshisback.com/2009/04/15/teabagging/">teabaggers</a>&#8221; just don&#8217;t get the reference.</p>
<p style="text-align:justify;">In the end, there are so many words in the English language that we&#8217;ve allowed to die an honorable death, like &#8220;beeswax&#8221; and &#8220;cassette tapes&#8221; and &#8220;groovy&#8221; (although this may still be used to describe Hideki Matsui&#8217;s face).  Had it not been for this inane Monday, &#8220;cyber&#8221; would be with them now.  I would like to call for an end to using this word (though, really, it&#8217;s a prefix), and retire &#8220;cyber&#8221; to Cyberia (apologies).  Let&#8217;s just call &#8220;Cyber Monday&#8221; for what it really is: &#8220;Virtual Deals&#8230; Monday.&#8221;</p>
<p style="text-align:justify;"><img class="aligncenter size-full wp-image-2511" title="CYBER1" src="http://freshisback.wordpress.com/files/2009/12/cyber1.jpg" alt="" width="500" height="394" /></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[File monitoring with Groovy, JMX and Vaadin]]></title>
<link>http://ice09.wordpress.com/2009/12/01/file-monitoring-with-groovy-jmx-and-vaadin/</link>
<pubDate>Tue, 01 Dec 2009 00:08:16 +0000</pubDate>
<dc:creator>ice09</dc:creator>
<guid>http://ice09.wordpress.com/2009/12/01/file-monitoring-with-groovy-jmx-and-vaadin/</guid>
<description><![CDATA[Note: The complete sourcecode is available on github here. For just downloading, unzipping and impor]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><b>Note: The complete sourcecode is available on github <a href='http://github.com/Radgon/Collection/'>here</a>. For just downloading, unzipping and importing the project into Eclipse, press <img src="http://ice09.wordpress.com/files/2009/11/download1.png"></img> on the github site (detailed instructions below).</b></p>
<p>Besides the Google Web Toolkit (<a href='http://code.google.com/intl/de-DE/webtoolkit/'>GWT</a>), there is a nice web application framework for Java-only users called <a href='http://vaadin.com/home'>Vaadin</a>.<br />
Out-of-the-box, it has a more polished interface and prettier components than GWT.<br />
I used it in a small application, my experience was very positive, even though I used Vaadin in a non-standard way (periodic asynchronous updating of a component by a infinitely running process), it works very well and there was really good support by the Vaadin team.<br />
Note: This post is not an introduction to Vaadin, I hardly know it myself. A great developer-friendly entry are the <a href='http://demo.vaadin.com/sampler/'>sample applications</a>. For more info, there is a step-by-step tutorial and a book for deeper understanding.</p>
<p><b>Intention</b></p>
<p>Automated testing of a web application is used in a Continuous Integration Environment. Furthermore, load/stress testing of the web application takes place in a Performance Test setting. A process should monitor logfiles in these test environments and report errors in a web-based report.</p>
<p>Technically, a thread must monitor several logfiles, aggregate these errors in a managed component which must be analyzed by a visualizing component (eg. a automatically refreshing table), which must be accessible from several clients.</p>
<p>So, now with technological annotations&#8230;</p>
<p><i>Technically, a thread must monitor several logfiles  (<b>Groovy</b>), aggregate these errors in a managed component (<b>Groovy, JMX</b>) which must be analyzed by a visualizing component (eg. a automatically refreshing table), which must be accessible from several clients (<b>web based, Vaadin</b>).</i></p>
<p>Ok, lets go.</p>
<p><b>The &#8220;server side components&#8221;</b></p>
<p>The server side just consists of a simple Groovy script:</p>
<pre class="brush: groovy;">
import javax.management.remote.*
import javax.management.*
import groovy.jmx.builder.*
import java.rmi.registry.LocateRegistry

class ServerState implements Serializable {
    def list=[]
}
def jmxbean = new ServerState()

Thread.start {
    def jmx = new JmxBuilder()
    def beans = jmx.export {
        bean(name: &#34;jmx.builder:type=ExportedObject&#34;, jmxbean)
    }
    LocateRegistry.createRegistry(9000)
    jmx.connectorServer(port: 9000).start()
}

def worker = { logfile -&#62;
    println &#34;analyzing ${logfile}&#34;
    logfile.withReader { reader -&#62;
        reader.skip(logfile.length())
        while (true) {
            def line = reader.readLine();
            if (!line) {
                Thread.sleep(1000);
            } else {
                def inner = [:]
                inner[&#34;server&#34;] = logfile.name
                inner[&#34;ts&#34;]= new Date().toString()
                inner[&#34;error&#34;] = line
                jmxbean.getList().add(inner)
            }
        }
    }
}

new File(&#34;c:/temp/&#34;).eachFileMatch(~/^log.txt.*/) { file -&#62;
    Thread.start worker.curry(file)
}
</pre>
<p>First, a thread is started that exports the aggregating bean via JMX (it&#8217;s so easy in Groovy).<br />
After calling <b>jmx.connectorServer(port: 9000).start()</b>, the bean is available under the JNDI-Name <b>service:jmx:rmi:///jndi/rmi://localhost:9000/jmxrmi</b> to client processes (using the name <b>jmx.builder:type=ExportedObject</b>).<br />
Afterwards, a worker closure is created. Nothing special in there, just the <b>reader.skip(logfile.length())</b> makes sure the end of the file is used at the beginning (before the monitoring process starts).<br />
The last three lines are quite dense, though. Here, all files matching the pattern (eg, log.txt, log.txt1, log.txt2) are used to create threads which monitor these files. This is easily achieved by using currying, which  is described in detail <a href='http://www.ibm.com/developerworks/java/library/j-pg08235/index.html'>here</a>.<br />
In this case, file is applied and the rest (the partially applicated closure) is submitted to <i>Thread.start</i>, which takes a closure (now with an already defined logfile) as the argument.</p>
<p><b>Tip: Using the Groovy script</b></p>
<p>All information necessary to run Groovy in any environment is stated <a href='http://groovy.codehaus.org/'>here.</a><br />
However, there is a really cool way of testing Groovy scripts without any settings, etc. Just <b>JAVA_HOME</b> must be set correctly.</p>
<ol>
<li>Download Groovy, unzip or install to some directory (eg. <i>c:\dev\groovy</i>)</li>
<li>Set your <b>JAVA_HOME</b> environment variable to your Java installation (eg. <i>set JAVA_HOME=c:\java\jdk1.6.0_17</i>).</li>
<li>Start <i>groovyConsole.exe</i> (in \$GROOVY_HOME\bin). Paste the script there. Run it.</li>
</ol>
<p>Located in GROOVY_HOME\bin: groovyConsole<br />
<img src="http://ice09.wordpress.com/files/2009/11/choosegc.png"></img></p>
<p>groovyConsole in action<br />
<img src="http://ice09.wordpress.com/files/2009/11/groovyconsole.png"></img></p>
<p><b>The &#8220;client side&#8221;</b></p>
<p><i>Testing with jconsole</i></p>
<p>jconsole is included in the Java SDK (JAVA_HOME\bin)<br />
<img src="http://ice09.wordpress.com/files/2009/12/jconsole.png"></img></p>
<p>The JMX-URL is determined by the Groovy script<br />
<img src="http://ice09.wordpress.com/files/2009/12/jmxurl.png"></img></p>
<p>Result of calling the exported operation <i>getList()</i><br />
<img src="http://ice09.wordpress.com/files/2009/12/jconsoleview.png"></img></p>
<p><i>Creating a web app client with Vaadin</i></p>
<ol>
<li>Download <a href='http://vaadin.com/eclipse'>the Vaadin Eclipse plugin</a>.</li>
<li>Download the <a href='http://github.com/Radgon/Collection'>zipped files</a> (click on <img src="http://ice09.wordpress.com/files/2009/11/download1.png"></img>). It&#8217;s subproject <i>Vaadin</i>.</li>
<li>Create new Vaadin project, choose Vaadin jar (cmp. image) &#8211; this post was tested with vaadin-6.2.nightly-20091016-c9216.jar.</li>
<p><img src="http://ice09.wordpress.com/files/2009/11/vaadinproject.png"></img></p>
<li>Delete generated src and Webcontent (!! <b>except WEB-INF/lib</b> !!) directores and copy from downloaded zip.</li>
</ol>
<p><b>Structure and Functioning</b></p>
<p>The JMX-component to connect to Groovy-JMX-server</p>
<pre class="brush: java;">
public class JmxService {

	private JMXServiceURL url;
	private JMXConnector jmxc;
	private MBeanServerConnection mbsc;
	private ObjectName mbeanName;

	private static JmxService INSTANCE;

	private JmxService() {
		try {
			url = new JMXServiceURL(&#34;service:jmx:rmi:///jndi/rmi://localhost:9000/jmxrmi&#34;);
			jmxc = JMXConnectorFactory.connect(url, null);
			mbsc = jmxc.getMBeanServerConnection();
			mbeanName = new ObjectName(&#34;jmx.builder:type=ExportedObject&#34;);
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (MalformedObjectNameException e) {
			e.printStackTrace();
		} catch (NullPointerException e) {
			e.printStackTrace();
		}
	}

	public static JmxService getInstance() {
		if (INSTANCE == null) {
			INSTANCE = new JmxService();
		}
		return INSTANCE;
	}

	public ServerState getServerState() {
		return JMX.newMBeanProxy(mbsc, mbeanName, ServerState.class, true);
	}

}
</pre>
<p>The table with its on-click-listener is created in pure Java</p>
<pre class="brush: java;">
	private Table initTable(final IndexedContainer container) {
		final Table table = new Table();
		table.setContainerDataSource(container);
		table.setWidth(&#34;100%&#34;);
		table.setPageLength(PAGE_LENGTH);
		table.setColumnExpandRatio(&#34;error&#34;, 1);
		table.setSelectable(true);
		final Application self = this;
		table.addListener(new Table.ValueChangeListener() {
			@Override
            public void valueChange(ValueChangeEvent event) {
				Object o = table.getValue();
                if (o != null) {
                	preformattedText = new Label(&#34;Here can be sources&#34;);
                    preformattedText.setContentMode(Label.CONTENT_PREFORMATTED);
                    self.getMainWindow().addComponent(preformattedText);
            	} else {
                    self.getMainWindow().removeComponent(preformattedText);
                }
          	}
        });
		return table;
	}
</pre>
<p>The Refresher&#8221;pattern&#8221; is explained <a href='http://vaadin.com/forum/-/message_boards/message/77099'>here</a>, the sources are in the <a href='http://dev.vaadin.com/browser/incubator/Refresher'> repository</a>. All necessary sources are also included in the github sources to this post.</p>
<p><b>Running the project</b></p>
<p>You can just start the server-side Groovy script (after configuring the file matching loop at the end of the script corresponding to your system). Afterwards, just start the Vaadin project with &#8220;Run on Server&#8221;.<br />
Now, you have to change a monitored file (eg. add a line and save the file). If you have chosen &#8220;Aktualisierung starten&#8221; (ie. start polling for new JMX events) the changed line should appear in the table. You can choose the line (details view is not implemented yet) to display more information. The table scrolls accordingly (the last item is always displayed at the bottom of the table).<br />
The refresh mechanism necessary for polling the JMX state is copied from <a href='http://dev.vaadin.com/browser/incubator/Refresher'>here.</a><br />
<i>Note: for real usage, it would be much better to use <a href='http://java.sun.com/docs/books/tutorial/jmx/index.html'>JMX notification</a> for this use case.</i></p>
<p><img src="http://ice09.wordpress.com/files/2009/12/runningapp1.png"></img></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[scent]]></title>
<link>http://madariaga.wordpress.com/2009/11/30/scent/</link>
<pubDate>Mon, 30 Nov 2009 15:32:53 +0000</pubDate>
<dc:creator>mada</dc:creator>
<guid>http://madariaga.wordpress.com/2009/11/30/scent/</guid>
<description><![CDATA[Lo mejor del día después de dormir acompañado es el perfume que te queda. Y si es en tu cama, el aro]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Lo mejor del día después de dormir acompañado es el perfume que te queda. Y si es en tu cama, el aroma en tu almohada que dura por noches.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Oldie of the week]]></title>
<link>http://hellg.wordpress.com/2009/11/29/oldie-of-the-week-9/</link>
<pubDate>Sun, 29 Nov 2009 12:53:21 +0000</pubDate>
<dc:creator>hellg</dc:creator>
<guid>http://hellg.wordpress.com/2009/11/29/oldie-of-the-week-9/</guid>
<description><![CDATA[back again with another oldie of the week. this time I was very inspired by the jazzy stuff coming f]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img src="http://www.hell-g.com/pic/jazzondrugs.jpg"></p>
<p>back again with another oldie of the week. this time I was very inspired by the jazzy stuff coming from labels like ninjatune, mo-wax and wall of sound records and the allover smooth n relaxed vibes from releases of f.e. luke vibert, amon tobin, funki porcini, clifford gilberto, etc.</p>
<p>one example of my jazzy experiments is the 1998 tune &#8216;allthatjazz&#8217; &#8211; a lush groovy swingtune flavoured with livedrums. I sampled a lot of fragments from old jazz records, like trumpets, trombones, bass, etc. &#8211; enjoy and have a chilled sunday! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.hell-g.com/music/hell g. - allthatjazz.mp3">hell g. &#8211; allthatjazz</a><br />
<span style='text-align:left;display:block;'><p><object type='application/x-shockwave-flash' data='http://wordpress.com/wp-content/plugins/audio-player/player.swf' width='290' height='24' id='audioplayer1'><param name='movie' value='http://wordpress.com/wp-content/plugins/audio-player/player.swf' /><param name='FlashVars' value='&amp;bg=0xf8f8f8&amp;leftbg=0xeeeeee&amp;lefticon=0x666666&amp;rightbg=0xcccccc&amp;rightbghover=0x999999&amp;righticon=0x666666&amp;righticonhover=0xffffff&amp;text=0x666666&amp;slider=0x666666&amp;track=0xFFFFFF&amp;border=0x666666&amp;loader=0x9FFFB8&amp;soundFile=http%3A%2F%2Fwww.hell-g.com%2Fmusic%2Fhell%20g.%20-%20allthatjazz.mp3' /><param name='quality' value='high' /><param name='menu' value='false' /><param name='bgcolor' value='#FFFFFF' /></object></p></span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Groovy - what is?]]></title>
<link>http://vintagerunway.wordpress.com/2009/11/29/groovy-what-is/</link>
<pubDate>Sun, 29 Nov 2009 12:34:18 +0000</pubDate>
<dc:creator>vintagerunway</dc:creator>
<guid>http://vintagerunway.wordpress.com/2009/11/29/groovy-what-is/</guid>
<description><![CDATA[My on-line Etsy store is dedicated to bringing you groovy, glam &amp;  glitz. I thought it would be ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>My on-line Etsy store is dedicated to bringing you groovy, glam &#38;  glitz. I thought it would be fun to focus on what&#8217;s groovy. Here&#8217;s the wikipedia definition&#8230;.</p>
<p><strong>Groovy</strong> is a <a title="Slang" href="http://en.wikipedia.org/wiki/Slang">slang</a> term that gained popular currency during the <a title="1960s" href="http://en.wikipedia.org/wiki/1960s">1960s</a> and <a title="1970s" href="http://en.wikipedia.org/wiki/1970s">1970s</a> and which is often associated with the <a title="Counterculture" href="http://en.wikipedia.org/wiki/Counterculture">counterculture</a> of that era. It is roughly synonymous with words such as excellent, fashionable, or amazing, depending on context. <em>Groovy</em> originated in the <a title="Jazz" href="http://en.wikipedia.org/wiki/Jazz">jazz</a> culture of the <a title="1930s" href="http://en.wikipedia.org/wiki/1930s">1930s</a>, in which it referred to the <a title="Groove (music)" href="http://en.wikipedia.org/wiki/Groove_%28music%29">groove</a> of a piece of music.</p>
<p>Here are some groovy vintage pieces that are fun and available right now for you to enjoy. Click on the pictures to learn more about them or to purchase.</p>
<p><img src="/DOCUME%7E1/SUZANN%7E1/LOCALS%7E1/Temp/moz-screenshot-2.png" alt="" /></p>
<p><a href="http://www.etsy.com/view_listing.php?listing_id=33777881"><img class="alignnone size-medium wp-image-78" title="groovy leather belt" src="http://vintagerunway.wordpress.com/files/2009/11/groovy-1.jpg?w=185" alt="" width="185" height="300" /></a></p>
<p><a href="http://www.etsy.com/view_listing.php?listing_id=35467952&#38;ref=sr_list_13&#38;&#38;ga_search_query=groovy&#38;ga_search_type=vintage&#38;ga_page=&#38;includes[]=tags&#38;includes[]=title"><img class="alignnone size-medium wp-image-79" title="groovy beaded bag with fringe" src="http://vintagerunway.wordpress.com/files/2009/11/groovy-2.jpg?w=243" alt="" width="243" height="300" /></a></p>
<p><a href="http://www.etsy.com/view_listing.php?listing_id=31887575&#38;ref=sr_list_5&#38;&#38;ga_search_query=groovy&#38;ga_search_type=vintage&#38;ga_page=3&#38;includes[]=tags&#38;includes[]=title"><img class="alignnone size-medium wp-image-80" title="groovy  Sonic Earrings" src="http://vintagerunway.wordpress.com/files/2009/11/groovy-3.jpg?w=300" alt="" width="300" height="214" /></a></p>
<p><a href="http://www.etsy.com/view_listing.php?listing_id=35355668&#38;ref=sr_list_17&#38;&#38;ga_search_query=groovy&#38;ga_search_type=vintage&#38;ga_page=4&#38;includes[]=tags&#38;includes[]=title"><img class="alignnone size-medium wp-image-82" title="groovy  Pucci-print op-art mini dress" src="http://vintagerunway.wordpress.com/files/2009/11/groovy-4.jpg?w=292" alt="" width="292" height="300" /></a></p>
<p><a href="http://www.etsy.com/view_listing.php?listing_id=35322969&#38;ref=sr_list_3&#38;&#38;ga_search_query=groovy&#38;ga_search_type=vintage&#38;ga_page=5&#38;includes[]=tags&#38;includes[]=title"><img class="alignnone size-medium wp-image-83" title="groovy Hook n Latch Deco Throw Pillow" src="http://vintagerunway.wordpress.com/files/2009/11/groovy-5.jpg?w=292" alt="" width="292" height="300" /></a></p>
<p><a href="http://www.etsy.com/view_listing.php?listing_id=35061119&#38;ref=sr_list_17&#38;&#38;ga_search_query=groovy&#38;ga_search_type=vintage&#38;ga_page=9&#38;includes[]=tags&#38;includes[]=title"></a><a href="http://www.etsy.com/view_listing.php?listing_id=33395499"><img class="alignnone size-medium wp-image-87" title="groovy 70s maxi dress lime green holiday hostess gown" src="http://vintagerunway.wordpress.com/files/2009/11/groovy-7.jpg?w=185" alt="" width="250" height="404" /></a></p>
<p><a href="http://www.etsy.com/view_listing.php?listing_id=22478109&#38;ref=sr_list_2&#38;&#38;ga_search_query=groovy&#38;ga_search_type=vintage&#38;ga_page=12&#38;includes[]=tags&#38;includes[]=title"><img class="alignnone size-medium wp-image-89" title="groovy 1960s WOODSTOCK Happy Daisy Flower Power Ring " src="http://vintagerunway.wordpress.com/files/2009/11/groovy-8.jpg?w=300" alt="" width="300" height="293" /></a></p>
<p><a href="http://www.etsy.com/view_listing.php?listing_id=27861072&#38;ref=sr_list_11&#38;&#38;ga_search_query=groovy&#38;ga_search_type=vintage&#38;ga_page=12&#38;includes[]=tags&#38;includes[]=title"></a><a href="http://www.etsy.com/view_listing.php?listing_id=35513381&#38;ref=sr_list_6&#38;&#38;ga_search_query=hippie&#38;ga_search_type=vintage&#38;ga_page=2&#38;includes[]=tags&#38;includes[]=title"><img class="alignnone size-medium wp-image-92" title="groovy 70s Slate Gray Oversized Wool Bow Hippie Floppy Brim Hat" src="http://vintagerunway.wordpress.com/files/2009/11/groovy-10.jpg?w=300" alt="" width="300" height="293" /></a><img class="alignnone size-medium wp-image-91" title="groovy vintage Enamel Post Earrings Peace Signs " src="http://vintagerunway.wordpress.com/files/2009/11/groovy-9.jpg?w=300" alt="" width="300" height="293" /></p>
<p><a href="http://vintagerunway.wordpress.com/files/2009/11/groovy-111.pdf"></a><a href="http://www.etsy.com/view_listing.php?listing_id=35501483&#38;ref=sr_list_8&#38;&#38;ga_search_query=hippie&#38;ga_search_type=vintage&#38;ga_page=3&#38;includes[]=tags&#38;includes[]=title"><img class="alignnone size-medium wp-image-95" title="Groovy HIPPIE BOHO ETHNIC LONG FRINGE VEST " src="http://vintagerunway.wordpress.com/files/2009/11/groovy-12.jpg?w=300" alt="" width="300" height="300" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Groovy XML Processing]]></title>
<link>http://justcode.wordpress.com/2009/11/26/groovy-xml-processing/</link>
<pubDate>Thu, 26 Nov 2009 16:15:23 +0000</pubDate>
<dc:creator>Nicola Zannino</dc:creator>
<guid>http://justcode.wordpress.com/2009/11/26/groovy-xml-processing/</guid>
<description><![CDATA[L&#8217;esempio seguente mostra come processare un XML attraverso l&#8217;utilizzo del linguaggio Gr]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>L&#8217;esempio seguente mostra come processare un XML attraverso l&#8217;utilizzo del linguaggio Groovy. L&#8217;obiettivo è leggere un xml , cercare tra tutti gli elementi solo quelli che hanno un attributo valorizzato in un certo modo e infine riscrivere un XML con solo gli elementi trovati.<br />
Ho incluso anche un metodo che fa lo stesso lavoro in java utilizzando l&#8217;api DOM4J , è interessante notare quanto risulti decisamente piu conciso e leggibile il codice scritto in groovy.</p>
<p>E&#8217; bene ricordare che all&#8217;interno di classi scritte in groovy il codice java è interoperabile al 100%. Inoltre classi di servizio scritte in groovy possono essere facilmente iniettate in classi java mediante l&#8217;uso di Spring.</p>
<pre>import groovy.util.XmlSlurper
import groovy.xml.MarkupBuilder

import org.dom4j.Document;
import org.dom4j.Attribute;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.Node;

class XMLService {

	static def XML_SOURCE = '''
                        &#60;root&#62;
                            &#60;item nome="carlo" cognome="bianchi" datadinascita="25/05/1978" /&#62;
                            &#60;item nome="carlo1" cognome="rossi" datadinascita="10/10/1971" /&#62;
                            &#60;item nome="carlo2" cognome="rossi" datadinascita="10/10/1972" /&#62;
                            &#60;item nome="carlo3" cognome="rossi" datadinascita="10/10/1973" /&#62;
                       &#60;/root&#62;
		'''

def parseGroovyXml(xmlSource,attribute,value){

		def root = new XmlSlurper().parseText(xmlSource)
		def result = root.item.findAll { it.@"${attribute}"=="${value}" }
		def writer = new StringWriter()
		def xml = new MarkupBuilder(writer)

		xml.root { result.each { item(it.attributes()) } }

		println writer

	}

public void parseJavaXml(String xmlSource,String attribute,String value){

      Document document = DocumentHelper.parseText(xmlSource);
      List&#60;Node&#62; nodes = document.selectNodes( "//root/item[@"+attribute+"='"+value+"']" );
      StringBuilder xml = new StringBuilder("&#60;root&#62;");

      for (Node n : nodes) {
         Element e = (Element) n;
         xml.append("&#60;item ");
         List&#60;Attribute&#62; list = e.attributes();

            for (Attribute a : list) {
                String name = a.getName();
                String val = a.getValue();
                xml.append(" "+name+"=\"").append(val).append("\"");
            }

       xml.append(" /&#62;");

    }

     xml.append("&#60;/root&#62;");
     System.out.println(xml.toString());
 }

  static void main(args){
	new XMLService().parseGroovyXml(XML_SOURCE,'nome','carlo1')
        new XMLService().parseJavaXml(XML_SOURCE,"nome","carlo1");
  }

}</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Phytologie PhytoPanama Mild Protecting Shampoo]]></title>
<link>http://getupbeauty.wordpress.com/2009/11/26/phytologie-phytopanama-mild-protecting-shampoo/</link>
<pubDate>Thu, 26 Nov 2009 06:00:37 +0000</pubDate>
<dc:creator>astoreproject</dc:creator>
<guid>http://getupbeauty.wordpress.com/2009/11/26/phytologie-phytopanama-mild-protecting-shampoo/</guid>
<description><![CDATA[Phytologie PhytoPanama Mild Protecting Shampoo Reviews Phytologie Phytopanama Mild Protecting Shampo]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href='http://www.amazon.com/Phytologie-PhytoPanama-Mild-Protecting-Shampoo/dp/B00106DZGE?tag=savercheaper-20'><img src="" align="center" border='0'></a><br /><!--more--></p>
<h2>Phytologie PhytoPanama Mild Protecting Shampoo Reviews</h2>
<p>Phytologie Phytopanama Mild Protecting Shampoo</p>
<h3>Phytologie PhytoPanama Mild Protecting Shampoo Features</h3>
<ul>
<li>6.8 oz</li>
<li>with 65% Quillaja decoction</li>
</ul>
<p></p>
<p><b><a href='http://www.amazon.com/Phytologie-PhytoPanama-Mild-Protecting-Shampoo/dp/B00106DZGE?tag=savercheaper-20' rel='nofollow'><font color='red'>Check Price and Read More Details of Phytologie PhytoPanama Mild Protecting Shampoo&#8230;&#62;&#62;</font></a> </b></p>
<h3>Customers Who Viewed This Item Also Viewed</h3>
<ul>
<li><a href='http://www.amazon.com/dp/B0014JY88G?tag=savercheaper-20'>Pureology hydrating Shampoo and Conditioner duo for .95. (max 2 deals p/order)</a></li>
</ul>
<p></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Grails Domains Internationalition]]></title>
<link>http://diknowstech.wordpress.com/2009/11/25/grails-domains-internationalition/</link>
<pubDate>Wed, 25 Nov 2009 11:48:56 +0000</pubDate>
<dc:creator>Dino</dc:creator>
<guid>http://diknowstech.wordpress.com/2009/11/25/grails-domains-internationalition/</guid>
<description><![CDATA[I am currently working at a Project that should be internationalized ( Arabic &#8211; English ).  I ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>I am currently working at a Project that should be internationalized ( Arabic &#8211; English ).  I am still developing it. I needed list of countries to be internationalized and I wanted it to be in the domain constraints (</strong><span style="text-decoration:underline;"><em>inList</em></span><strong>). I may later put the data in the database, but for the time being; I&#8217;m putting the data in the domain class.</strong></p>
<p><strong>Here is what I did</strong></p>
<p><strong>I put the data in the model like this :</strong></p>
<blockquote><p>class Address {</p>
<p>static constraints = {<br />
gpsLng(nullable:true)<br />
gpsLat(nullable:true)<br />
address()<br />
//                area(nullable:true)<br />
city()<br />
state()<br />
country(inList:['afghanistan',<br />
'albania',<br />
'algeria',<br />
'american_samoa',<br />
.<br />
.<br />
.<br />
'zaire',<br />
'zambia'])<br />
dateCreated(nullable:true)<br />
lastUpdated(nullable:true)<br />
}</p>
<p>Date dateCreated<br />
Date lastUpdated</p>
<p>String gpsLng<br />
String gpsLat</p>
<p>String address<br />
//        String area<br />
String city<br />
String state<br />
String country = &#8216;egypt&#8217;</p>
<p>String toString(){<br />
&#8220;$address&#8221;<br />
}<br />
}</p></blockquote>
<p><strong>And at the properties files I did the internationalization like this</strong></p>
<blockquote><p>address.country.afghanistan=Afghanistan<br />
address.country.albania=Albania<br />
address.country.algeria=Algeria<br />
address.country.american_samoa=American Samoa<br />
&#8230;</p></blockquote>
<p><strong>And in the view .. I did this  ( I&#8217;m using </strong><em><span style="text-decoration:underline;">beanField</span></em><strong> plugin too )</strong></p>
<blockquote><p>&#60;bean:select beanName=&#8221;address&#8221; property=&#8221;country&#8221;<br />
name=&#8221;country&#8221; id=&#8221;country&#8221;<br />
from=&#8221;${address.constraints.country.inList}&#8221;  valueMessagePrefix=&#8221;address.country&#8221; value=&#8221;${fieldValue(bean:address,field:&#8217;country&#8217;)}&#8221;   optionValue=&#8221;${message(code:it)}&#8221; /&#62;</p></blockquote>
<p><strong>And this is it ..  The </strong><span style="text-decoration:underline;"><em>valueMessagePrefix</em></span><strong> is used to indicate the prefix to be added to the key in </strong><em><span style="text-decoration:underline;">inList</span></em><strong> list and get the value from the properties files. </strong><em><span style="text-decoration:underline;">optionValue</span></em><strong> is what user see ( Label ).</strong></p>
<p><strong>When the form is submitted, the value in the </strong><em><span style="text-decoration:underline;">inList</span></em><strong> will be passed back to the controller.</strong></p>
<p><em>Hope I was helpful to someone.</em></p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=caf30c58-b960-870b-a6f1-db615cdc57fd" alt="" /></div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[The Groovy Office]]></title>
<link>http://kitschcache.wordpress.com/2009/11/25/the-groovy-office/</link>
<pubDate>Wed, 25 Nov 2009 04:38:37 +0000</pubDate>
<dc:creator>Token Effort</dc:creator>
<guid>http://kitschcache.wordpress.com/2009/11/25/the-groovy-office/</guid>
<description><![CDATA[Carry On Up The CorridorThe 1970s office was swinging.  You were the man if you had a chocolate brow]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><div id="attachment_170" class="wp-caption aligncenter" style="width: 432px"><a href="http://kitschcache.wordpress.com/files/2009/11/secretary1.jpg"><img class="size-full wp-image-170" title="secretary[1]" src="http://kitschcache.wordpress.com/files/2009/11/secretary1.jpg" alt="" width="422" height="485" /></a><p class="wp-caption-text">Carry On Up The Corridor</p></div>The 1970s office was swinging.  You were the <em>man</em> if you had a chocolate brown suit and mutton chops.  That girl on the right is called a &#8217;secretary&#8217;.  An executive needed a secretary back in the seventies because someone had to be there to light his cigarettes, make the tea and laugh politely at his innuendo.  In the 1970s secretaries would use a typewriter – if they weren&#8217;t taking shorthand or dictation (how they laughed!).</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[BTW]]></title>
<link>http://mysweetmusings.wordpress.com/2009/11/23/btw/</link>
<pubDate>Tue, 24 Nov 2009 03:16:18 +0000</pubDate>
<dc:creator>mysweetmusings</dc:creator>
<guid>http://mysweetmusings.wordpress.com/2009/11/23/btw/</guid>
<description><![CDATA[On a good day I have trouble understanding my boss due to the accent.  But now, the boss has taken t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>On a good day I have trouble understanding my boss due to the accent.  But now, the boss has taken to throwing in French words.  Tomorrow I&#8217;ll clear up what may be a misunderstanding. Maybe the boss thinks I know French.</p>
<p>More likely the boss is showing off and successfully putting me in my place.  Whatever place that is.  I already know the boss test me with regard to grammar. That&#8217;s right.  The boss plants grammar mistakes in drafts for me to find and correct.</p>
<p>That&#8217;s why I&#8217;m reading grammar books.</p>
<p>Es o si que es.  (that&#8217;s not French, but the best I can do)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Grails Exchange in December]]></title>
<link>http://richmarr.wordpress.com/2009/11/23/grails-exchange-in-december/</link>
<pubDate>Mon, 23 Nov 2009 17:25:19 +0000</pubDate>
<dc:creator>Richard Marr</dc:creator>
<guid>http://richmarr.wordpress.com/2009/11/23/grails-exchange-in-december/</guid>
<description><![CDATA[It&#8217;s great to see fellow Pixstanaut Tomás Lin talking at the forthcoming Grails Exchange confe]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>It&#8217;s great to see fellow Pixstanaut <a href="http://fbflex.wordpress.com/">Tomás Lin</a> talking at the forthcoming <a href="http://skillsmatter.com/event/java-jee/groovy-grails-exchange-2009/wd-184">Grails Exchange</a> conference in December. He&#8217;ll be talking about building rich GUI apps with Flex and Grails. There are still a few tickets left if you can make it.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[estoy a un paso menos de ser el novio ideal]]></title>
<link>http://madariaga.wordpress.com/2009/11/21/estoy-a-un-paso-menos-de-ser-el-novio-ideal/</link>
<pubDate>Sun, 22 Nov 2009 02:47:09 +0000</pubDate>
<dc:creator>mada</dc:creator>
<guid>http://madariaga.wordpress.com/2009/11/21/estoy-a-un-paso-menos-de-ser-el-novio-ideal/</guid>
<description><![CDATA[Acabo de hacer una sarpada lasagna. Invoco a los testigos (?)]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Acabo de hacer una sarpada lasagna.</p>
<p>Invoco a los testigos (?)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Conversations with Dad.  You remember Dad.]]></title>
<link>http://mysweetmusings.wordpress.com/2009/11/21/conversations-with-dad-you-remember-dad/</link>
<pubDate>Sun, 22 Nov 2009 01:24:06 +0000</pubDate>
<dc:creator>mysweetmusings</dc:creator>
<guid>http://mysweetmusings.wordpress.com/2009/11/21/conversations-with-dad-you-remember-dad/</guid>
<description><![CDATA[Background: Viola is Dad&#8217;s mother. He calls her by first name. Dad: We&#8217;re ging to Viola]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Background: Viola is Dad&#8217;s mother. He calls her by first name.</p>
<p>Dad: We&#8217;re ging to Viola&#8217;s this weekend for a spaghetti dinner. Of course, I&#8217;ll be eating a salad, but I&#8217;m the only one that&#8217;s watching her waistline.</p>
<p>&#8212;&#8212;&#8211;</p>
<p>Dad: Benjamin Franklin and Dolly Parton are two really cool people.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Journal Time]]></title>
<link>http://mysweetmusings.wordpress.com/2009/11/21/journal-time/</link>
<pubDate>Sun, 22 Nov 2009 01:05:15 +0000</pubDate>
<dc:creator>mysweetmusings</dc:creator>
<guid>http://mysweetmusings.wordpress.com/2009/11/21/journal-time/</guid>
<description><![CDATA[I&#8217;ve noticed that most of my journal entries are more like lists rather than narratives.  Blam]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I&#8217;ve noticed that most of my journal entries are more like lists rather than narratives.  Blame it on the booze, the drugs, the milk and cookies, or the genes, it is was it is.  Here are a few such entries for your judgment and ridicule, which usually involves laughter and euphoric feelings.</p>
<p><span style="text-decoration:underline;">Music stuff, don&#8217;t forget</span></p>
<p>&#8220;In My Secret Life&#8221;<br />
Not sure of artist, from L Word</p>
<p>Needfire<br />
Dolly Parton, &#8220;I will Always Love&#8221;</p>
<p>Fresh Air Podcast</p>
<p>Oasis</p>
<p>Jesse Marshon from Montreal writes under name JBM. &#8220;Cleo&#8217;s sung.&#8221; Album Not Even in July.</p>
<p>Bishop Allen &#8220;The Ancient Common Sense of Things.&#8221;</p>
<p>Ginsberg &#8220;Melody&#8221; album is history of Melody Nelson. He&#8217;s a perv and there is some video of him on YouTube. Song is French</p>
<p>Ace of Base, &#8220;I Saw the Sign&#8221;</p>
<p>&#160;</p>
<p><span style="text-decoration:underline;">Words to Know</span></p>
<p>Caduceus (a cardboard caduceus from Germany)   &#8212;Side note: This sentence doesn&#8217;t help me at all.  Why didn&#8217;t I write the definition?  For the record, I do not know this word.</p>
<p>Temerity</p>
<p>Stunning        &#8212;Side note: Word like this, words that are commonly circulated, I like to look these up in different dictionaries. It can often be stunning what history and influence they can be hiding.</p>
<p>Extremely</p>
<p>Slog</p>
<p>&#160;</p>
<p><span style="text-decoration:underline;">What?</span></p>
<p>Foot worship party.</p>
<p>Riding Boots.</p>
<p>Need new bras; nude and black.</p>
<p>Never cared for lingerie. Prefer naked.</p>
<p>Dan Savage.</p>
<p>Need smart satchel or hobo, leather and kiss clasp would be best.</p>
<p>Rain hat.</p>
<p>Rain boots.</p>
<p>Digitaldesire.com</p>
<p>I feel that if I wore a burka people wouldn&#8217;t ask me to make copies for them.</p>
<p>&#8220;Gum in My Hair&#8221;, title for my book.</p>
<p>40-year-old fags.   &#8212; Side note: If you&#8217;re offended by my usage of &#8220;fag&#8221; get over it. Our favorite sex advice columnist and all around good guy, Dan Savage, endorses the casual use of fag.  Similar to how ladies will refer to themselves as sluts or cunts and African-Americans use&#8230;yeah, nope, I can&#8217;t do this one, but y&#8217;all know what I mean.</p>
<p>Boy George, yummy. More about the novel that inspired the play.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[¿Cómo serían los lenguajes de programación si fueran personas?]]></title>
<link>http://paranoialabs.wordpress.com/2009/11/20/%c2%bfcomo-serian-los-lenguajes-de-programacion-si-fueran-personas/</link>
<pubDate>Sat, 21 Nov 2009 00:49:29 +0000</pubDate>
<dc:creator>luizja</dc:creator>
<guid>http://paranoialabs.wordpress.com/2009/11/20/%c2%bfcomo-serian-los-lenguajes-de-programacion-si-fueran-personas/</guid>
<description><![CDATA[Buscando hace un rato en mundogeek un manual de python (el cual recomiendo ampliamente) para crossov]]></description>
<content:encoded><![CDATA[Buscando hace un rato en mundogeek un manual de python (el cual recomiendo ampliamente) para crossov]]></content:encoded>
</item>
<item>
<title><![CDATA[Groovy, Twitter, and Basic Authentication]]></title>
<link>http://kousenit.wordpress.com/2009/11/20/groovy-twitter-and-basic-authentication/</link>
<pubDate>Fri, 20 Nov 2009 20:48:06 +0000</pubDate>
<dc:creator>Ken Kousen</dc:creator>
<guid>http://kousenit.wordpress.com/2009/11/20/groovy-twitter-and-basic-authentication/</guid>
<description><![CDATA[The other day, Scott Davis published an article at developerWorks entitled Practically Groovy:  Swin]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>The other day, Scott Davis published an article at developerWorks entitled <a href="http://www.ibm.com/developerworks/java/library/j-pg11179/index.html">Practically Groovy:  SwingBuilder and the Twitter API, Part 2</a>.  I&#8217;m sure you won&#8217;t be surprised to hear that it&#8217;s a good article.  No surprise there, given Scott&#8217;s excellent reputation and abilities.</p>
<p>As it turned out, though,  I was teaching a Java Web Security class when the article came out and we&#8217;d already discussed mechanisms for doing authentication.  In the article, Scott pointed out that while Twitter prefers OAuth authentication (see <a href="http://apiwiki.twitter.com/Authentication">here</a> for details), they allow for HTTP Basic authentication.</p>
<p>Scott wrote a nice Groovy GUI client, based on Groovy&#8217;s excellent SwingBuilder.  The authentication part looked like this:</p>
<pre class="brush: groovy;">
def authString = &#34;username:password&#34;.getBytes().encodeBase64().toString()
def conn = addr.toURL().openConnection()
conn.setRequestProperty(&#34;Authorization&#34;, &#34;Basic ${authString}&#34;)
</pre>
<p>The process starts with a username and a password and concatenates them together with a colon in the middle.  Then you convert the result into a byte array by calling <code>getBytes()</code>.  Then, as you can see from the <a href="http://groovy.codehaus.org/groovy-jdk/">GroovyDocs</a>, Groovy adds an <code>encodeBase64()</code> method to <code>byte[]</code>.  The return type is a <code>Writable</code>, which is then converted back to a <code>String</code> using the normal <code>toString()</code> method.</p>
<p>Add the word &#8220;Basic&#8221; in front of it and you&#8217;ve got an authorization header that can be used in an HTTP request.</p>
<p>Okay, that&#8217;s cool, and it works, but whoa is that dangerous.  Say I&#8217;m a sniffer on the network.  I see a request go by, and inside it I find:</p>
<pre class="brush: plain;">
Authorization: dXNlcm5hbWU6cGFzc3dvcmQ=
</pre>
<p>We now have a beautiful illustration of the difference between <strong>encoding</strong> and <strong>encrypting</strong>.  Just because this is Base 64 encoded doesn&#8217;t mean it can&#8217;t be read.  All I have to do is write:</p>
<pre class="brush: groovy;">
def (user,pass) = new String(&#34;dXNlcm5hbWU6cGFzc3dvcmQ=&#34;.decodeBase64()).split(':')
</pre>
<p>and lo and behold, I&#8217;ve got the username and password.  This works because Groovy gives the <code>String</code> class a nice, convenient <code>decodeBase64()</code> method, and <code>String</code> has a constructor that takes the resulting byte array as an argument.  I&#8217;m also using the new (as of Groovy 1.6) mechanism that allows me to return two separate values from a method call, so here I return the username and password separately from the <code>split()</code> method.</p>
<p>Of course, the real reason this works is that HTTP basic authentication passes the encoded string in nice, clear text.  No decryption is required.  If this was being transmitted over HTTPS, at least the network would be encrypted, but there&#8217;s no requirement for that.</p>
<p>Yikes.  I&#8217;d guess the Twitter web site itself uses form authentication over HTTPS, but I wonder how many of those client-side Twitter applications are just doing basic authentication like this?</p>
<p>Maybe I should change my Twitter password.</p>
<p>Just for reference, here&#8217;s a complete script showing both encoding and decoding, with some assertions for completeness:</p>
<pre class="brush: groovy;">
def u = 'username'
def p = 'password'
def encoded = &#34;$u:$p&#34;.getBytes().encodeBase64().toString()
println &#34;$u:$p -&#62; $encoded&#34;
assert encoded == 'dXNlcm5hbWU6cGFzc3dvcmQ='
def (user,pass) = new String(encoded.decodeBase64()).split(':')
println &#34;(user,pass) = ($user,$pass)&#34;
assert user == u
assert pass == p
</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Project Euler Problem #102]]></title>
<link>http://keyzero.wordpress.com/2009/11/20/project-euler-problem-102/</link>
<pubDate>Fri, 20 Nov 2009 16:46:00 +0000</pubDate>
<dc:creator>keyzero</dc:creator>
<guid>http://keyzero.wordpress.com/2009/11/20/project-euler-problem-102/</guid>
<description><![CDATA[Read the details of the problem here Summary For how many triangles in the text file does the interi]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://projecteuler.net/index.php?section=problems&#38;id=102" target="_blank">Read the details of the problem here</a></p>
<p><strong>Summary</strong></p>
<p>For how many triangles in the text file does the interior contain the origin?</p>
<p><strong>Solution</strong></p>
<p>This question had me wondering for a while as to what the best approach to take might be. In the end I went for a simple approach that just relied on the fact that the interior angles from any point within a triangle to the vertexes would add up to 360° or 2 * Pi radians. To calculate the angles at the origin I relied on some things I’d learned when I used to write computer games as a hobby.</p>
<p>The <a href="http://en.wikipedia.org/wiki/Dot_product" target="_blank">dot product</a> of two 2D vectors, U and V, is equivalent to the following two formulae:</p>
<p>U•V = U<sub>0</sub>V<sub>0</sub> + U<sub>1</sub>V<sub>1</sub></p>
<p>U•V = &#124;U&#124; * &#124;V&#124; * cos θ</p>
<p>Where &#124;U&#124; is the magnitude of the vector U, i.e. sqrt( U<sub>0</sub>² + U<sub>1</sub>² ) </p>
<p>So this gives: cos θ = ( U<sub>0</sub>V<sub>0</sub> + U<sub>1</sub>V<sub>1</sub> ) / ( &#124;U&#124; * &#124;V&#124; )</p>
<p>The coded solution is then quite trivial and just calculates the angle at the origin subtended by vectors out to the pairs of vertices for each line segment.</p>
<pre>new File(&#34;euler_P102_triangles.txt&#34;).eachLine {
    def (x0, y0, x1, y1, x2, y2) = it.split(&#34;,&#34;)*.toInteger()
    def ( a, b, c ) = [ [ x0, y0 ], [ x1, y1 ], [ x2, y2 ] ]
    def theta = 0.0

    [ [ a, b ], [ a, c ], [ b, c ] ].each {
        def ( u, v ) = it
        def dot = u[0] * v[0] + u[1] * v[1]
        def ul =  Math.sqrt(u[0] * u[0] + u[1] * u[1])
        def vl =  Math.sqrt(v[0] * v[0] + v[1] * v[1])
        theta += Math.acos(dot / (ul * vl))
    }

    if (Math.abs(theta - 2 * Math.PI) &#60; 1E-7) answer++
}</pre>
<p>It ran in 0.96 seconds and wasn’t difficult to write once I’d decided what approach to take! Note the importance of using an epsilon value (1E-7) when comparing floating-point numbers as you can’t rely on an exact equality.</p>
<p>There are probably quicker ways to do this (in fact, I know there are) but this approach was nice &#38; straightforward to code off the top of my head and ran in an acceptable time.</p>
<p><strong>Conclusion</strong></p>
<p>Groovy makes reading a text file and parsing it into appropriate data structures quite simple. It didn’t really make any difference to the rest of the solution apart from perhaps the nice syntax on the &#60;list of sides&#62;.each{} loop as it was mostly just straightforward maths.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Psycho cool t-shirts from Paris]]></title>
<link>http://olachacha.wordpress.com/2009/11/19/psycho-cool-t-shirts-from-paris/</link>
<pubDate>Thu, 19 Nov 2009 13:11:26 +0000</pubDate>
<dc:creator>joankeiter</dc:creator>
<guid>http://olachacha.wordpress.com/2009/11/19/psycho-cool-t-shirts-from-paris/</guid>
<description><![CDATA[Hi everyone. I have a new line of shirts that I’m just presenting. Hope you like them and hope you a]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Hi everyone. I have a new line of shirts that I’m just presenting. Hope you like them and hope you and your friends buy some. Let me know if you want a custom shirt or if you want me to customize one of mine.</p>
<div id="attachment_46" class="wp-caption alignleft" style="width: 470px"><a href="http://www.olachacha.com"><img class="size-full wp-image-46" title="Get it while you can!!" src="http://olachacha.wordpress.com/files/2009/11/left-brain-copy1.jpg" alt="" width="460" height="575" /></a><p class="wp-caption-text">I Left My Brain in San Francisco</p></div>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>My design company:<br />
<a href="http://www.olachacha.com/"><br />
Olachacha.com</a></p>
<p>Support the start up. Buy a shirt. Get the word around to everyone you know.</p>
<p>Love, Joan</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[New Shirts at Olachacha.com]]></title>
<link>http://joankeiter.wordpress.com/2009/11/19/new-shirts-at-olachacha-com/</link>
<pubDate>Thu, 19 Nov 2009 12:46:55 +0000</pubDate>
<dc:creator>joankeiter</dc:creator>
<guid>http://joankeiter.wordpress.com/2009/11/19/new-shirts-at-olachacha-com/</guid>
<description><![CDATA[Hi everyone. I have a new line of shirts that I&#8217;m just presenting. Hope you like them and hope]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Hi everyone. I have a new line of shirts that I&#8217;m just presenting. Hope you like them and hope you and your friends buy some. Let me know if you want a custom shirt or if you want me to customize one of mine.</p>
<p><a href="http://www.olachacha.com"><img class="aligncenter size-full wp-image-38" title="Olachacha . . . I left my brain in San Francisco" src="http://joankeiter.wordpress.com/files/2009/11/left-brain-copy2.jpg" alt="" width="460" height="575" /></a>My design company:<br />
<a href="http://www.olachacha.com"><br />
Olachacha.com</a></p>
<p>Support the start up. Buy a shirt. Get the word around to everyone you know.</p>
<p>Love, Joan</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Groovy – Producing JSON using Groovlet and JSONObject]]></title>
<link>http://companyranjan.wordpress.com/2009/11/19/groovy-%e2%80%93-producing-json-using-groovlet-and-jsonobject-4/</link>
<pubDate>Thu, 19 Nov 2009 08:00:13 +0000</pubDate>
<dc:creator>ranjan</dc:creator>
<guid>http://companyranjan.wordpress.com/2009/11/19/groovy-%e2%80%93-producing-json-using-groovlet-and-jsonobject-4/</guid>
<description><![CDATA[Groovy &ndash; Producing JSON using Groovlet and JSONObject All right I admit I like groovy, because]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div>
<p style="margin-bottom:0;text-align:center;"> <font size="4"><u><b>Groovy &#8211; Producing JSON using Groovlet and JSONObject</b></u></font> </p>
<p style="margin-bottom:0;text-align:center;"> </p>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> <font size="3">All right I admit I like groovy, because it&#8217;s gives you taste of best of both worlds &#8211; all the dynamism of Python and Ruby and still be close to Java.</font> </p>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> </p>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> <font size="3">I was trying to create simple JSON output using Groovlets and JSONObject and this is what I came up with.</font> </p>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> </p>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> <font size="3">In order to use Groovlets use the  <a href="http://www.ibm.com/developerworks/java/library/j-pg03155/">this link</a> to set it up in your favorite IDE.</font> </p>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> <font size="3">And then</font> </p>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> </p>
<ol>
<li>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> <font size="3">Create index.groovy in WEB Folder.</font></p>
</li>
<li>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> <font size="3">Download the source code from  <a href="http://json.org/java">json.org/java</a> site</font></p>
</li>
<li>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> <font size="3">put in your src folder of web project.</font></p>
</li>
<li>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> <font size="3">In your index.groovy put in this code</font></p>
</li>
</ol>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> </p>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> <font size="3">Here&#8217;s the code</font> </p>
<pre style="margin-left:.49in;font-weight:normal;text-align:left;text-decoration:none;">
<font size="3">import org.json.*</font>
import com.ranjan.*;

/***************************************************
*
*       Setting up response content type is important
*       and in best practice.
****************************************************/

response.setContentType("application/json");

def fromMap =
[name:"Frederic Jean",age:32] as JSONObject
def fromList =
["English","French","Spanish"] as JSONArray

def newMap =
[
    world:[
        countries:[
            india:[
                cities:["delhi", "bombay"]
            ],
            america:[
                states:["new york", "chicago"]
            ],
            japan:[
                states:["tokyo","some great japanese city"]
            ]

        ]
    ]
] as JSONObject     // this is what does the trick

// prints the json map
println newMap

The result...
<img border="0" height="160"/>

</pre>
<p style="margin-bottom:0;font-weight:normal;text-decoration:none;text-align:left;"> </p>
<p></div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Project Euler Problem #99]]></title>
<link>http://keyzero.wordpress.com/2009/11/18/project-euler-problem-99/</link>
<pubDate>Wed, 18 Nov 2009 18:22:04 +0000</pubDate>
<dc:creator>keyzero</dc:creator>
<guid>http://keyzero.wordpress.com/2009/11/18/project-euler-problem-99/</guid>
<description><![CDATA[Read the details of the problem here Summary Which base/exponent pair in the file has the greatest n]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://projecteuler.net/index.php?section=problems&#38;id=99" target="_blank">Read the details of the problem here</a></p>
<p><strong>Summary</strong></p>
<p>Which base/exponent pair in the file has the greatest numerical value?</p>
<p><strong>Solution</strong></p>
<p>I took the straightforward approach to this one. As the resulting numbers would be huge it was just a matter of using log10(base) * exp and comparing those values. The coded solution is trivial.</p>
<pre>def ( i, answer, max ) = [ 1, -1, 0.0 ]

new File(&#34;base_exp.txt&#34;).eachLine {
    def ( base, exp ) = it.split(&#34;,&#34;)*.toDouble()
    def log = Math.log10(base) * exp
    if (log &#62; max) ( answer, max ) = [ i, log ]
    i++
}</pre>
<p>It ran in 46 ms and took a very short time to write!</p>
<p><strong>Conclusion</strong></p>
<p>Groovy was a very nice language to use for this. It was very easy to read the file and process the contents. See how the <em>spread-dot</em> operator is used on the list resulting from the <em>split</em> to convert both operands in to Doubles ready for the next step. The only slightly irritating part was that I had to maintain my own record count as there is no <em>eachWithIndex()</em> method available on a File object. I could have treated this differently by reading into a list first but this seemed quicker!</p>
<p>As there was no heavy maths processing performance was fine, it was quick to write and the code intent is clear.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Feeling kind-of groovy]]></title>
<link>http://javajune.wordpress.com/2009/11/18/feeling-kind-of-groovy/</link>
<pubDate>Wed, 18 Nov 2009 14:11:36 +0000</pubDate>
<dc:creator>javajune</dc:creator>
<guid>http://javajune.wordpress.com/2009/11/18/feeling-kind-of-groovy/</guid>
<description><![CDATA[  There&#8217;s nothing like meeting an old friend you haven&#8217;t seen in over 25 years. We were ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div><a href="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg"></a></div>
<div><a href="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg"></a></div>
<div><a href="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg"></a></div>
<div><a href="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg"></a></div>
<div><a href="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg"></a></div>
<div><a href="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg"></a></div>
<div><a href="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg"></a></div>
<div><a href="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg"></a></div>
<div><a href="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg"></a></div>
<p><a href="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg"></p>
<p style="text-align:center;"><img class="size-full wp-image-3017 alignnone" title="IMG_4002 2" src="http://javajune.wordpress.com/files/2009/11/img_4002-2.jpg" alt="" width="491" height="655" /> </p>
<p style="text-align:center;">There&#8217;s nothing like meeting an old friend you haven&#8217;t seen in over 25 years. We were high school buddies that lost touch after graduation. We hugged, we laughed, we shopped it was amazing, just like we picked up where we left off. It&#8217;s funny how we think we&#8217;ve changed so much until we go back in time with a friend and realize that &#8220;hey, I am the same person I was  many years ago but just a little wiser and calmer. &#8221; Before the day was over we both promised to meet again, sometime soon and we will. </p>
<p style="text-align:center;">Last night I got out a few holiday decorations and played around a bit. I love vintage looking bulbs and ornaments like bottle brush trees, mercury bulbs and oh yes I love, love my little blue deer. He is so groovy with his retro good looks and sparkly glitter and he has the tiniest bell around his neck. </p>
<p style="text-align:center;">Some of you had a few questions about the book, &#8220;A Sea of Whispers&#8221;, well this started out as a novel that never got published.  I&#8217;ve now taken the idea in a totally different direction.  Instead of a story about a woman whose life didn&#8217;t turn out as she planned, it became a book of inspiration through images and words. How does a novel become a coffee table book of inspiration, well remember who you&#8217;re talking to, the girl who changes course in mid-stream at the blink of an eye.  Wink, Wink&#8230;   This book is self-published and I hope to sell it in my e-store. I have to say that the quality of this book took me by surprise, it was superb. I was so afraid that the images may turn out too flat or pixellated or that my choice of lay-outs wouldn&#8217;t look just right. But as soon as  I unwrapped it, I feel in love. It feels wonderful in my hands and the images and layouts are exceptional. I made a couple tweaks and added a thing or two and then back to the publishing company it went. It&#8217;s not a cheap book to print but then I couldn&#8217;t except anything but the best quality. As soon as it comes back from the printer I will take some pics and share. I&#8217;ll keep you posted. Writing a book and being published has always been a dream of mine and so I decided to take matters into my own hands and just do it. I can&#8217;t wait to share it with you!</p>
<p style="text-align:center;"> Well I&#8217;m off to get everything ready for my son, who is flying home from Oregon tomorrow. Yeah&#8230;. I hope he&#8217;s home for good. He &#8217;s a bit like his mother with stars in his eyes and wander-lust in his heart. </p>
<p style="text-align:center;">Have a magical Wednesday!!!</p>
<p style="text-align:center;">xo-jj</p>
<p>&#160;</p>
<p></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[out of my league II]]></title>
<link>http://madariaga.wordpress.com/2009/11/17/out-of-my-league-ii/</link>
<pubDate>Tue, 17 Nov 2009 15:20:35 +0000</pubDate>
<dc:creator>mada</dc:creator>
<guid>http://madariaga.wordpress.com/2009/11/17/out-of-my-league-ii/</guid>
<description><![CDATA[El jueves me escapaba temprano de acá un par de horas para ir a felicitar a Mai, Pau y Ani que defen]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>El jueves me escapaba temprano de acá un par de horas para ir a felicitar a Mai, Pau y Ani que defendían la tesis. <span style="color:#999999;">Yo no les dije nada, pero en realidad ya sabía que se iban a sacar un 10.</span> En el momento de reflexión que ocurre cuando estás soltando un huevo en la cabeza de otro es como si la fuerza con que lo arrojás tironeara, efecto pañuelos de colores atados, algunos pensamientos. Pensamientos como <em>uy, mirá cuando me hagan esto a mí, qué copado.. Lo único, imaginate que entre los que me hagan esto a mí estén mis hijos. Eso sería triste. Agh qué baranda que larga el pelo de esta piba&#8230;</em></p>
<p>El aroma a recibida penetra por tu nariz como una pica te atraviesa el paladar y te sale por el polo norte de la cabeza.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Groovy Vibes for $4.95]]></title>
<link>http://yourproductsucks.wordpress.com/2009/11/17/groovy-vibes-for-4-95/</link>
<pubDate>Tue, 17 Nov 2009 03:34:41 +0000</pubDate>
<dc:creator>DollfaceKilla</dc:creator>
<guid>http://yourproductsucks.wordpress.com/2009/11/17/groovy-vibes-for-4-95/</guid>
<description><![CDATA[]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:center;"><img class="aligncenter size-full wp-image-556" title="Groovy vibes" src="http://yourproductsucks.wordpress.com/files/2009/09/groovy-vibes.jpg" alt="Groovy vibes" width="348" height="548" /></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Serializing groovy.util.slurpersupport.NodeChild]]></title>
<link>http://btiernay.wordpress.com/2009/11/13/serializing-groovy-util-slurpersupport-nodechild/</link>
<pubDate>Fri, 13 Nov 2009 16:10:12 +0000</pubDate>
<dc:creator>btiernay</dc:creator>
<guid>http://btiernay.wordpress.com/2009/11/13/serializing-groovy-util-slurpersupport-nodechild/</guid>
<description><![CDATA[Sadly, and annoyingly, groovy.util.slurpersupport.NodeChild doesn&#8217;t have a nice toString() imp]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Sadly, and annoyingly, <a href="http://groovy.codehaus.org/api/groovy/util/slurpersupport/NodeChild.html">groovy.util.slurpersupport.NodeChild</a> doesn&#8217;t have a nice <a href="http://groovy.codehaus.org/api/groovy/util/slurpersupport/GPathResult.html#toString()">toString()</a> implementation when dealing with results obtained from <a href="http://groovy.codehaus.org/api/groovy/util/XmlSlurper.html">groovy.util.XmlSlurper</a>. For convenience, you can add the following meta-method to NodeChild to serialize xml nodes:</p>
<pre class="brush: groovy;">
NodeChild.metaClass.toXmlString = {
	def self = delegate
	new StreamingMarkupBuilder().bind {
		delegate.mkp.xmlDeclaration() // Use this if you want an XML declaration
		delegate.out &#60;&#60; self
	}.toString()
}
</pre>
<p>In grails, you would typically run such code from a thread-safe location such as from within a plugin or inside BootStrap.groovy. Then, in your application you can use:</p>
<pre class="brush: groovy;">
def xml = new XmlSlurper().parseText('&#60;a&#62;b&#60;/a&#62;')
println xml.toXmlString()
</pre>
<p>This is handy when building REST APIs that require both text and node based version of xml, such as an API proxy.</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
