<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Snackycracky Techblog&#187; Snackycracky Blog</title>
	<atom:link href="http://blog.srvme.de/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.srvme.de</link>
	<description></description>
	<lastBuildDate>Mon, 14 Jun 2010 21:33:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>reading a reflexive association in a recursive way for grails and groovy</title>
		<link>http://blog.srvme.de/2009/11/29/reading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy/</link>
		<comments>http://blog.srvme.de/2009/11/29/reading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 16:22:51 +0000</pubDate>
		<dc:creator>nils</dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[multiple menu items]]></category>
		<category><![CDATA[recursive menu items]]></category>
		<category><![CDATA[reflexive menuitems]]></category>
		<category><![CDATA[roles for menu]]></category>

		<guid isPermaLink="false">http://blog.srvme.de/?p=580</guid>
		<description><![CDATA[Imagine you have a Menu with multiple items, those items have multiple items and so on. The Menu Items also depend on a Role a User has in the Application Context like &#8216;ROLE_ADMIN&#8217;, &#8216;ROLE_COOK&#8217;, &#8216;ROLE_SOME&#8217; &#8230; I think the best practice is to save the menu items as a reflexive association in a database table [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine you have a Menu with multiple items, those items have multiple items and so on. The Menu Items also depend on a Role a User has in the Application Context like &#8216;ROLE_ADMIN&#8217;, &#8216;ROLE_COOK&#8217;, &#8216;ROLE_SOME&#8217; &#8230;<br />
I think the best practice is to save the menu items as a reflexive association in a database table like this:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #aaaadd; font-weight: bold;">Long</span> id<span style="color: #66cc66;">;</span>
    <span style="color: #aaaadd; font-weight: bold;">String</span> label<span style="color: #66cc66;">;</span>
    <span style="color: #aaaadd; font-weight: bold;">Boolean</span> topLevel<span style="color: #66cc66;">;</span>
    <span style="color: #aaaadd; font-weight: bold;">Integer</span> position<span style="color: #66cc66;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">static</span> hasMany <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>roles:Role, childs:<span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#93;</span>
    <span style="color: #000000; font-weight: bold;">static</span> belongsTo <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>parent:<span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#93;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">static</span> mapping <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>
        topLevel type:<span style="color: #ff0000;">'true_false'</span>
        childs <span style="color: #663399;">sort</span>:<span style="color: #ff0000;">'position'</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">static</span> constraints <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #aaaadd; font-weight: bold;">String</span> toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000;">&quot;[MenuItem id: ${id}, label: ${label}, pos: ${position}]&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>so lets initialize some dummy menu Items:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">def</span> file <span style="color: #66cc66;">=</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#40;</span>label:<span style="color: #ff0000;">'file'</span>, position:<span style="color: #cc66cc;">1</span>,topLevel:<span style="color: #000000; font-weight: bold;">true</span>,parent:<span style="color: #000000; font-weight: bold;">null</span>, roles:<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span>somerole,cookrole,adminrole<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">def</span> view <span style="color: #66cc66;">=</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#40;</span>label:<span style="color: #ff0000;">'view'</span>, position:<span style="color: #cc66cc;">2</span>,topLevel:<span style="color: #000000; font-weight: bold;">true</span>,parent:<span style="color: #000000; font-weight: bold;">null</span>, roles:<span style="color: #66cc66;">&#91;</span>cookrole,adminrole<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">def</span> help <span style="color: #66cc66;">=</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#40;</span>label:<span style="color: #ff0000;">'help'</span>, position:<span style="color: #cc66cc;">2</span>,topLevel:<span style="color: #000000; font-weight: bold;">true</span>,parent:<span style="color: #000000; font-weight: bold;">null</span>, roles:<span style="color: #66cc66;">&#91;</span>someroleadminrole<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">def</span> logout <span style="color: #66cc66;">=</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#40;</span>label:<span style="color: #ff0000;">'logout'</span>, position:<span style="color: #cc66cc;">2</span>,topLevel:<span style="color: #000000; font-weight: bold;">true</span>,parent:<span style="color: #000000; font-weight: bold;">null</span>, roles:<span style="color: #66cc66;">&#91;</span>somerole,cookrole,adminrole<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span></pre></div></div>

<p>those 4 toplevel MenuItems have different roles assiciated with them, for example the view menu can only be accessed by a user wich has the cookrole or the adminrole. the roles have also the property of a level as a number which is zero for an admin user and one for a role which has less rights than the admin. the algorithm then extracts the hightest role from a user instance.<br />
so lets insert some submenus to the database table:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#40;</span>label:<span style="color: #ff0000;">'save File'</span>, position:<span style="color: #cc66cc;">1</span>,topLevel:<span style="color: #000000; font-weight: bold;">false</span>,parent:file, roles:<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span>somerole,cookrole,adminrole<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#40;</span>label:<span style="color: #ff0000;">'save All Files'</span>, position:<span style="color: #cc66cc;">2</span>,topLevel:<span style="color: #000000; font-weight: bold;">false</span>,parent:file, roles:<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span>somerole,cookrole,adminrole<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">def</span> serivces <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#40;</span>label:<span style="color: #ff0000;">'services'</span>, position:<span style="color: #cc66cc;">3</span>,topLevel:<span style="color: #000000; font-weight: bold;">false</span>,parent:file, roles:<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span>somerole,cookrole,adminrole<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#40;</span>label:<span style="color: #ff0000;">'capture Image'</span>, position:<span style="color: #cc66cc;">1</span>,topLevel:<span style="color: #000000; font-weight: bold;">false</span>,parent:serivces, roles:<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span>somerole,cookrole,adminrole<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span><span style="color: #66cc66;">&#40;</span>label:<span style="color: #ff0000;">'send As Email'</span>, position:<span style="color: #cc66cc;">2</span>,topLevel:<span style="color: #000000; font-weight: bold;">false</span>,parent:serivces, roles:<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span>somerole,adminrole<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span></pre></div></div>

<p>notice that the last menu item (send As Email) is not accessible for the cookrole<br />
We now have a three dimensional menu like this:</p>
<ul>
<li>file
<ul>
<li>save File</li>
<li>save All Files</li>
<li>services
<ul>
<li>capture Image</li>
<li>send As Email</li>
</ul>
</li>
</ul>
</li>
<li>view</li>
<li>help</li>
<li>logout</li>
</ul>
<p>here is the code to render this menu structure in a controller and send it to the view:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> MainController <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">def</span> authenticateService
    <span style="color: #000000; font-weight: bold;">def</span> testUser <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">null</span>
    <span style="color: #000000; font-weight: bold;">def</span> menuItems <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>:<span style="color: #66cc66;">&#93;</span>
&nbsp;
    <span style="color: #993333;">void</span> populateMenuItems<span style="color: #66cc66;">&#40;</span>map,hightestRole<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">//fill the first time with topLevel Items</span>
        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>menuItems.<span style="color: #006600;">isEmpty</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
            map.<span style="color: #663399;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>
                    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>it.<span style="color: #006600;">roles</span>.<span style="color: #CC0099;">contains</span><span style="color: #66cc66;">&#40;</span>hightestRole<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                        menuItems<span style="color: #66cc66;">&#91;</span>it<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>:<span style="color: #66cc66;">&#93;</span>
            <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        menuItems.<span style="color: #663399;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span> mi <span style="color: #66cc66;">-&gt;</span>
&nbsp;
                <span style="color: #aaaadd; font-weight: bold;">MenuItem</span>.<span style="color: #006600;">findAllByParent</span><span style="color: #66cc66;">&#40;</span>mi.<span style="color: #006600;">key</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #663399;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span> subMi <span style="color: #66cc66;">-&gt;</span>
&nbsp;
                        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>subMi.<span style="color: #006600;">roles</span>.<span style="color: #CC0099;">contains</span><span style="color: #66cc66;">&#40;</span>hightestRole<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
                            mi.<span style="color: #006600;">value</span><span style="color: #66cc66;">&#91;</span>subMi<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>:<span style="color: #66cc66;">&#93;</span>
&nbsp;
                            findMore<span style="color: #66cc66;">&#40;</span> mi.<span style="color: #006600;">value</span><span style="color: #66cc66;">&#91;</span>subMi<span style="color: #66cc66;">&#93;</span>,subMi<span style="color: #66cc66;">&#41;</span>
                        <span style="color: #66cc66;">&#125;</span>
                <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
        <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #993333;">void</span> findMore<span style="color: #66cc66;">&#40;</span>mapEntry,mi<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">def</span> moreItems <span style="color: #66cc66;">=</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span>.<span style="color: #006600;">findAllByParent</span><span style="color: #66cc66;">&#40;</span>mi<span style="color: #66cc66;">&#41;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>moreItems.<span style="color: #006600;">isEmpty</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
            moreItems.<span style="color: #663399;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>
                    mapEntry<span style="color: #66cc66;">&#91;</span>it<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>:<span style="color: #66cc66;">&#93;</span>
                    findMore<span style="color: #66cc66;">&#40;</span>mapEntry<span style="color: #66cc66;">&#91;</span>it<span style="color: #66cc66;">&#93;</span>,it<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">//recursive call</span>
            <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">def</span> index <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">def</span> hightestRole <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">null</span>
        <span style="color: #000000; font-weight: bold;">def</span> principal <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span>testUser <span style="color: #66cc66;">!=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">?</span> testUser : authenticateService.<span style="color: #006600;">principal</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        <span style="color: #000000; font-weight: bold;">def</span> itRole
&nbsp;
        principal.<span style="color: #006600;">getAuthorities</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #663399;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
                itRole <span style="color: #66cc66;">=</span> Role.<span style="color: #006600;">findByAuthority</span><span style="color: #66cc66;">&#40;</span>it.<span style="color: #006600;">authority</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
                <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>hightestRole <span style="color: #66cc66;">==</span> <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">||</span> <span style="color: #66cc66;">&#40;</span> hightestRole <span style="color: #66cc66;">!=</span> <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&amp;&amp;</span> itRole.<span style="color: #006600;">level</span> <span style="color: #66cc66;">&lt;</span> hightestRole.<span style="color: #006600;">level</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                    hightestRole <span style="color: #66cc66;">=</span> itRole
&nbsp;
        <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
        populateMenuItems<span style="color: #66cc66;">&#40;</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span>.<span style="color: #006600;">findAllByTopLevel</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #663399;">sort</span>: <span style="color: #ff0000;">'position'</span>, order: <span style="color: #ff0000;">'asc'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>, hightestRole <span style="color: #66cc66;">&#41;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #66cc66;">&#91;</span>
                    highestRole:hightestRole,
                    menuItems:menuItems,
                    user: principal
                <span style="color: #66cc66;">&#93;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>the function populateMenuItems calls the function findMore which calls itself recursively as long as a submenu for some item exists.</p>
<p>here are some integation tests for this:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">def</span> miSaveFile <span style="color: #66cc66;">=</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span>.<span style="color: #006600;">findByLabel</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'save File'</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #000000; font-weight: bold;">def</span> miSendAsEmail <span style="color: #66cc66;">=</span> <span style="color: #aaaadd; font-weight: bold;">MenuItem</span>.<span style="color: #006600;">findByLabel</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'send As Email'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">def</span> user <span style="color: #66cc66;">=</span> User.<span style="color: #663399;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
assertEquals <span style="color: #ff0000;">&quot;bestcook&quot;</span>, user.<span style="color: #006600;">username</span>
&nbsp;
controller.<span style="color: #006600;">testUser</span> <span style="color: #66cc66;">=</span> user<span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">def</span> model <span style="color: #66cc66;">=</span>  controller.<span style="color: #006600;">index</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
assertEquals <span style="color: #ff0000;">&quot;bestcook&quot;</span>, model<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;bestcook&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">?</span>.<span style="color: #006600;">username</span>
assertEquals Role.<span style="color: #006600;">findByAuthority</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;ROLE_COOK&quot;</span><span style="color: #66cc66;">&#41;</span>,model<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;highestRole&quot;</span><span style="color: #66cc66;">&#93;</span>
assertFalse SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>model, miSendAsEmail<span style="color: #66cc66;">&#41;</span>
assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>model, miSaveFile<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>the SearchNestedHash class is explained in my previous article.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d580').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d580" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F&amp;submitHeadline=reading+a+reflexive+association+in+a+recursive+way+for+grails+and+groovy&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F&amp;title=reading+a+reflexive+association+in+a+recursive+way+for+grails+and+groovy" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F&amp;title=reading+a+reflexive+association+in+a+recursive+way+for+grails+and+groovy" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F&amp;title=reading+a+reflexive+association+in+a+recursive+way+for+grails+and+groovy" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F&amp;bm_description=reading+a+reflexive+association+in+a+recursive+way+for+grails+and+groovy" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F&amp;T=reading+a+reflexive+association+in+a+recursive+way+for+grails+and+groovy" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F&amp;title=reading+a+reflexive+association+in+a+recursive+way+for+grails+and+groovy" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F&amp;title=reading+a+reflexive+association+in+a+recursive+way+for+grails+and+groovy" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+reading+a+reflexive+association+in+a+recursive+way+for+grails+and+groovy+@+http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F29%2Freading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy%2F&amp;t=reading+a+reflexive+association+in+a+recursive+way+for+grails+and+groovy" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d580').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d580').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://blog.srvme.de/2009/11/29/reading-a-reflexive-association-in-a-recursive-way-for-grails-and-groovy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>recursive search on a nested (multidimensional) collection for groovy</title>
		<link>http://blog.srvme.de/2009/11/28/recursive-search-on-a-nested-multidimensional-collection-for-groovy/</link>
		<comments>http://blog.srvme.de/2009/11/28/recursive-search-on-a-nested-multidimensional-collection-for-groovy/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 01:35:21 +0000</pubDate>
		<dc:creator>nils</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[crawl]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[hashmap]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[multidimensional]]></category>
		<category><![CDATA[multidimensional map]]></category>
		<category><![CDATA[nested list]]></category>
		<category><![CDATA[nested map]]></category>
		<category><![CDATA[nested set]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://blog.srvme.de/?p=573</guid>
		<description><![CDATA[you can search for any object in a nested list containing hash&#8217;s and lists recursively, check out the tests for examples: here are the tests: class SearchNestedHashTests extends GrailsUnitTestCase &#123; protected void setUp&#40;&#41; &#123; super.setUp&#40;&#41; &#125; protected void tearDown&#40;&#41; &#123; super.tearDown&#40;&#41; &#125; void testHashMap&#40;&#41;&#123; &#160; def map = &#91; 'x' , 'y', 's' &#93; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>you can search for any object in a nested list containing hash&#8217;s and lists recursively, check out the tests for examples:<br />
<strong> </strong></p>
<p><strong>here are the tests:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> SearchNestedHashTests <span style="color: #000000; font-weight: bold;">extends</span> GrailsUnitTestCase <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #993333;">void</span> setUp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006600;">setUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #993333;">void</span> tearDown<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006600;">tearDown</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #993333;">void</span> testHashMap<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">def</span> map <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                            <span style="color: #ff0000;">'x'</span> , <span style="color: #ff0000;">'y'</span>, <span style="color: #ff0000;">'s'</span>
                         <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">def</span> a <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'a'</span>
            <span style="color: #000000; font-weight: bold;">def</span> b <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">false</span>
            <span style="color: #000000; font-weight: bold;">def</span> c <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>
&nbsp;
            map<span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                        <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span>a,b<span style="color: #66cc66;">&#93;</span> : c<span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'y'</span>
                   <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,a<span style="color: #66cc66;">&#41;</span>
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,b<span style="color: #66cc66;">&#41;</span>
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,c<span style="color: #66cc66;">&#41;</span>
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
            map <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                           <span style="color: #ff0000;">'y'</span> : <span style="color: #ff0000;">'null'</span>
                       <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertFalse SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
            map <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                           <span style="color: #ff0000;">'x'</span>:<span style="color: #ff0000;">'null'</span>
                       <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
            map <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                        <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'n'</span> : <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'x'</span>
                    <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertFalse SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #ff0000;">'t'</span><span style="color: #66cc66;">&#41;</span>
            assertFalse SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
            map<span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                        <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'n'</span> : <span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'y'</span>
                    <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
            map <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                        <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'x'</span> : <span style="color: #ff0000;">'n'</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'y'</span>
                    <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
            map<span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                        <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'x'</span>:<span style="color: #ff0000;">'z'</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'n'</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'y'</span>
                    <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
            map<span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                        <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'c'</span>:<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'n'</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #000000; font-weight: bold;">null</span>
                    <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">def</span> x <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'a'</span>:<span style="color: #ff0000;">'b'</span><span style="color: #66cc66;">&#93;</span>
&nbsp;
            map<span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                        <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'y'</span>: x <span style="color: #66cc66;">&#93;</span> : <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'y'</span>
                    <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,x<span style="color: #66cc66;">&#41;</span>
&nbsp;
            map<span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                        <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'y'</span>: <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'a'</span>:<span style="color: #ff0000;">'b'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#93;</span> : <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'y'</span>
                    <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,x<span style="color: #66cc66;">&#41;</span>
&nbsp;
            map<span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                        <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'s'</span>:<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'y'</span>
                    <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertTrue SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>map,<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">def</span> crazyMap <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>
                        <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'c'</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'c'</span>:<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'c'</span>:<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'xxsxx'</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'c'</span>:<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'c'</span>:<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span>          <span style="color: #ff0000;">'X'</span>            :<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">'y'</span>
                    <span style="color: #66cc66;">&#93;</span>
&nbsp;
            assertFalse SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>crazyMap,<span style="color: #ff0000;">'q'</span><span style="color: #66cc66;">&#41;</span>
            assertFalse SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>crazyMap,<span style="color: #ff0000;">'x'</span><span style="color: #66cc66;">&#41;</span><span style="color: #808080; font-style: italic;">//only the capital X is inside</span>
            assertTrue  SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>crazyMap,<span style="color: #ff0000;">'X'</span><span style="color: #66cc66;">&#41;</span><span style="color: #808080; font-style: italic;">//only the capital X is inside</span>
            assertTrue  SearchNestedHash.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>crazyMap,<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'xxsxx'</span>:<span style="color: #ff0000;">'v'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
     <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><strong>here is the Class:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> SearchNestedHash <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">def</span> found <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">synchronized</span> search<span style="color: #66cc66;">&#40;</span>collection,targetObj<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        found <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> searchRec<span style="color: #66cc66;">&#40;</span>collection,targetObj<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">synchronized</span> searchRec<span style="color: #66cc66;">&#40;</span>collection, targetObj<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>collection <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #aaaadd; font-weight: bold;">List</span> <span style="color: #66cc66;">&amp;&amp;</span> collection.<span style="color: #CC0099;">contains</span><span style="color: #66cc66;">&#40;</span>targetObj<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">true</span>
&nbsp;
        collection.<span style="color: #663399;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
                <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>
                    <span style="color: #66cc66;">&#40;</span>
                        collection <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #aaaadd; font-weight: bold;">Map</span>
                        <span style="color: #66cc66;">&amp;&amp;</span>
                        <span style="color: #66cc66;">&#40;</span>
                            it.<span style="color: #006600;">key</span> <span style="color: #66cc66;">==</span> targetObj <span style="color: #66cc66;">||</span>
                            it.<span style="color: #006600;">value</span> <span style="color: #66cc66;">==</span> targetObj <span style="color: #66cc66;">||</span>
                            it.<span style="color: #006600;">key</span>    <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #aaaadd; font-weight: bold;">List</span> <span style="color: #66cc66;">&amp;&amp;</span> it.<span style="color: #006600;">key</span>    .<span style="color: #CC0099;">contains</span><span style="color: #66cc66;">&#40;</span>targetObj<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">||</span>
                            it.<span style="color: #006600;">value</span> <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #aaaadd; font-weight: bold;">List</span> <span style="color: #66cc66;">&amp;&amp;</span> it.<span style="color: #006600;">value</span> .<span style="color: #CC0099;">contains</span><span style="color: #66cc66;">&#40;</span>targetObj<span style="color: #66cc66;">&#41;</span>
                        <span style="color: #66cc66;">&#41;</span>
                    <span style="color: #66cc66;">&#41;</span>
                        <span style="color: #66cc66;">||</span>
                    <span style="color: #66cc66;">&#40;</span>
                        it <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #aaaadd; font-weight: bold;">List</span> <span style="color: #66cc66;">&amp;&amp;</span> it <span style="color: #66cc66;">==</span> targetObj
                    <span style="color: #66cc66;">&#41;</span>
&nbsp;
                <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>found <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">;</span>return<span style="color: #66cc66;">&#125;</span>
            <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>found<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
            collection.<span style="color: #663399;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
                    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>it.<span style="color: #006600;">key</span> <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #aaaadd; font-weight: bold;">Map</span><span style="color: #66cc66;">&#41;</span>
                    searchRec<span style="color: #66cc66;">&#40;</span>it.<span style="color: #006600;">key</span>,targetObj<span style="color: #66cc66;">&#41;</span>
&nbsp;
                    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>it.<span style="color: #006600;">value</span> <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #aaaadd; font-weight: bold;">Map</span><span style="color: #66cc66;">&#41;</span>
                    searchRec<span style="color: #66cc66;">&#40;</span>it.<span style="color: #006600;">value</span>,targetObj<span style="color: #66cc66;">&#41;</span>
&nbsp;
                    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>it <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #aaaadd; font-weight: bold;">List</span><span style="color: #66cc66;">&#41;</span>
                    searchRec<span style="color: #66cc66;">&#40;</span>it,targetObj<span style="color: #66cc66;">&#41;</span>
&nbsp;
                <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
        <span style="color: #66cc66;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">return</span> found
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d573').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d573" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F&amp;submitHeadline=recursive+search+on+a+nested+%28multidimensional%29+collection+for+groovy&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F&amp;title=recursive+search+on+a+nested+%28multidimensional%29+collection+for+groovy" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F&amp;title=recursive+search+on+a+nested+%28multidimensional%29+collection+for+groovy" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F&amp;title=recursive+search+on+a+nested+%28multidimensional%29+collection+for+groovy" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F&amp;bm_description=recursive+search+on+a+nested+%28multidimensional%29+collection+for+groovy" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F&amp;T=recursive+search+on+a+nested+%28multidimensional%29+collection+for+groovy" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F&amp;title=recursive+search+on+a+nested+%28multidimensional%29+collection+for+groovy" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F&amp;title=recursive+search+on+a+nested+%28multidimensional%29+collection+for+groovy" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+recursive+search+on+a+nested+%28multidimensional%29+collection+for+groovy+@+http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fblog.srvme.de%2F2009%2F11%2F28%2Frecursive-search-on-a-nested-multidimensional-collection-for-groovy%2F&amp;t=recursive+search+on+a+nested+%28multidimensional%29+collection+for+groovy" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d573').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d573').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://blog.srvme.de/2009/11/28/recursive-search-on-a-nested-multidimensional-collection-for-groovy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fedora install tutorial on a xen vps minimal installation</title>
		<link>http://blog.srvme.de/2009/01/19/setting-up-my-new-vserver/</link>
		<comments>http://blog.srvme.de/2009/01/19/setting-up-my-new-vserver/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 12:31:07 +0000</pubDate>
		<dc:creator>nils</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[X]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[.htpasswd]]></category>
		<category><![CDATA[acl]]></category>
		<category><![CDATA[asynchrounous]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[decrypt]]></category>
		<category><![CDATA[echo new line]]></category>
		<category><![CDATA[encrypt]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[gnupg]]></category>
		<category><![CDATA[gpg]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[linux tutorial]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[secure]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[trac]]></category>
		<category><![CDATA[tunnel]]></category>
		<category><![CDATA[vimrc]]></category>
		<category><![CDATA[virtual]]></category>
		<category><![CDATA[vncserver]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[xstartup]]></category>

		<guid isPermaLink="false">http://snackycracky.wordpress.com/?p=232</guid>
		<description><![CDATA[in my eyes i got a good and cheap vps from ispone-business.de; the xl package there. when everything turns out ok with that company than i am adding 512 Mb RAM for 60 Euro once to have one gig of RAM. i choosed fedora 9 for the os. so here is what i did: first [...]]]></description>
			<content:encoded><![CDATA[<p>in my eyes i got a good and cheap vps from ispone-business.de; the xl package there.  when everything turns out ok with that company than i am adding 512 Mb RAM for 60 Euro once to have one gig of RAM. i choosed <strong>fedora 9</strong> for the os.  so here is what i did:  first root login:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>adduser username
passwd username
echo 'username ALL=(ALL) ALL' &gt;&gt; /etc/sudoers #allowes user to <strong>use sudo</strong>
su username
echo 'export PATH=$PATH:/sbin' &gt;&gt; ~/.bashrc #<strong>adding /sbin to my path</strong>
echo -e 'syntax on\nset number' &gt; ~/.vimrc #this <strong>enables syntax and line numbers for vim</strong></pre>
</ul>
<p>exit out of the system for an easy login with</p>
<h2>asynchrounous key authentication</h2>
<p>from the local machine:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>ssh-keygen -t rsa
ssh username@remote-host mkdir -p .ssh
cat ~/.ssh/id_rsa.pub | ssh username@remote-host 'cat &gt;&gt; .ssh/authorized_keys2'</pre>
</ul>
<p>i had to change permissions on the remote machine for the .ssh dir like this:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>chmod 700 ~/.ssh &amp;&amp; chmod 640 ~/.ssh/authorized_keys2</pre>
</ul>
<p>the last thing i did was to <strong>change the port of ssh</strong> to something other than 22. Edit the</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>/etc/ssh/sshd_config</pre>
</ul>
<p>and uncomment port, also set the port to something else at the top of the file. Next change the</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>/etc/sysconfig/iptables</pre>
</ul>
<p>content to ACCEPT the same port (the line with -dport 22). Afterwards restart both with</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>sudo service iptables condrestart &amp;&amp; sudo service sshd restart</pre>
</ul>
<h2>install X and Gnome for vnc:</h2>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>sudo yum groupinstall "X Window System" "GNOME Desktop Environment" &amp;&amp; sudo yum install vnc-server</pre>
</ul>
<p>IMPORTANT: disable the NetworkManager on runlevel 3 :</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>sudo chkconfig --level 3 NetworkManager off</pre>
</ul>
<p>or otherwise the NetworkManager shuts down the network interface while restarting because i am on a fixed network. Read <a href="http://fedoraproject.org/wiki/Tools/NetworkManager#NetworkManager" target="_blank">this</a> for more information. Optional you can restart the vps for testing.</p>
<p>Start and stop the vncserver once so it creates a .vnc dir with the xstartup file. Start it by just typing</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>vncserver &amp;&amp; vncserver -kill :1</pre>
</ul>
<p>the :1 stands for Display number one, the port for this display is 5901. The :1 and the last number of 5901 change synchronously.</p>
<p>i wanted <strong>gnome</strong> to be my <strong>desktop layout</strong>. If you want that too edit the</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>~/.vnc/xstartup</pre>
</ul>
<p>file and replace</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>twm &amp;</pre>
</ul>
<p>by</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>exec gnome-session &amp;</pre>
</ul>
<p>edit</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>/etc/sysconfig/vncservers
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 1223px; width: 1px; height: 1px;">20  VNCSERVERS="1:nilsen31 2:robert31 3:partyplan"</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 1223px; width: 1px; height: 1px;">21  VNCSERVERARGS[1]="-geometry 1280x700 -nolisten tcp -nohttpd -localhost "22  VNCSERVERARGS[2]="-geometry 1280x800 -nolisten tcp -nohttpd -localhost "</div>
</pre>
</ul>
<p>and uncomment the last two lines. this enables some security settings: prevent http connctions and just allows tunnels.</p>
<p>Change the username and display number for your needs and set the geometry settings accordingly. The array index of the</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>VNCSERVERARGS[x]</pre>
<pre style="font:normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">VNCSERVERS="1:someuser1 2:someuser2 3:someuser3"
VNCSERVERARGS[1]="-geometry 1280x700 -nolisten tcp -nohttpd -localhost "
VNCSERVERARGS[2]="-geometry 1280x800 -nolisten tcp -nohttpd -localhost "
...</pre>
</ul>
<p>stands for the display number, so change it accordingly.</p>
<p>turn the vncserver it on with:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>sudo chkconfig vncserver on</pre>
</ul>
<p>i recommend <strong>a </strong><strong>secure connection to your remote display</strong>. This is done by building a tunnel under the ssh connection.</p>
<p>Here is the quote from the ssh manual pages for the -L option:  &#8220;Specifies that the given port on the local (client) host is to be  forwarded to the given host and port on the remote side.&#8221; doing this looks like this</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>ssh -L 5901:localhost:5901 user@remote-host</pre>
</ul>
<p>the number before and after the hostname stands for the incoming and outgoing port. The best vnc viewer for osx is, and i tried like five of them, &#8220;chicken of the vnc&#8221;. Be sure to open the port 5901 in the iptables config file. Connect to localhost on Display 1 in the program.    at my local machine i made a file called remote.sh which lets me <strong>connect quickly to the remote machine</strong> by executing it.</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>echo '#!/bin/bash' &gt; remote.sh &amp;&amp; echo 'ssh -L 5901:localhost:5901 user@remote-host -p port-number' &gt;&gt; remote.sh &amp;&amp; chmod 700 remote.sh</pre>
</ul>
<p>now i just have to type ~/rem, tab(for autocompletion) and return to get in.</p>
<h2>install java &amp; Co</h2>
<p>install c/c++ first:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>sudo yum install compat-gcc-34 compat-gcc-34-c++ libstdc++.so.5</pre>
</ul>
<p>go to the /tmp dir and wget something from http://java.sun.com/javase/downloads/index.jsp</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>cd /tmp
chmod u+x downloadedFile.bin #so it can be executed
./downloadedFile.bin #execute the file
echo -e 'export JAVA_HOME=/usr/local/java/jdk\nexport PATH=$PATH:$JAVA_HOME/bin' &gt;&gt; ~/.bashrc #set JAVA_HOME and add it to your PATH
bash #get a new instance of the shell
java -version #check if it works.</pre>
</ul>
<h3>install maven2</h3>
<p>wget maven2 from <a href="http://maven.apache.org/download.html" target="_blank">here </a></p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>tar xjvf apache-maven-2.0.9-bin.tar.bz2 #extract the archive</pre>
</ul>
<p>move the extracted folder to /usr/local/java/maven2</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>echo -e 'export MAVEN_HOME=/usr/local/java/maven2/\nexport PATH=$PATH:$MAVEN_HOME/bin' &gt;&gt; ~/.bashrc
bash #get a new instance of the bash
mvn -version #check if it works.</pre>
</ul>
<h2>apache &amp; mysql</h2>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>sudo yum install mysql mysql-server mysql-devel phpMyAdmin
sudo chgrp -R mysql /var/lib/mysql  &amp;&amp; sudo chmod -R 770 /var/lib/mysql
sudo service mysqld start &amp;&amp; sudo chkconfig mysqld on
mysqladmin -u root password changeme #set the root password
sudo service httpd start &amp;&amp; sudo chkconfig httpd on
chkconfig --list | grep "mysqld\|httpd" #just testing</pre>
</ul>
<p>add the ports 80 and 443 to /etc/sysconfig/iptables</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre style="font:normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
<span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, fantasy;line-height:19px;white-space:normal;font-size:13px;">
<pre style="font:normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">sudo service iptables condrestart</pre>
<p></span></pre>
</ul>
<p>edit  /etc/httpd/conf.d/phpMyAdmin.conf for access only on 127.0.0.1 and https.</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>RewriteEngine on
RewriteCond   %{SERVER_PORT}  !^443$
RewriteRule ^/phpMyAdmin(.*)$ https://%{HTTP_HOST}/phpMyAdmin$1 [L,R]

Alias /phpMyAdmin /usr/share/phpMyAdmin
&lt;Directory /usr/share/phpMyAdmin/&gt;
       order deny,allow
       deny from all
       allow from 127.0.0.1
&lt;/Directory&gt;
# This directory does not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
&lt;Directory /usr/share/phpMyAdmin/libraries&gt;
       Order Deny,Allow
       Deny from All
       Allow from None
&lt;/Directory&gt;</pre>
</ul>
<p>for later backup put the password for mysqldump in ~/.my.cnf<br />
the content should look like this:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>[mysqldump]
password = cleartextpwd</pre>
</ul>
<p>afterwards set the acl to 700</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>chmod 700 ~/.my.cnf</pre>
</ul>
<h2><span style="font-weight: normal; font-size: 13px; "></p>
<h2 style="font-size: 1.5em; "><span style="font-weight: normal; font-size: 13px; "></p>
<h2 style="font-size: 1.5em; ">configure sendmail for authentication on an external smtp server</h2>
<p>add the following line to /etc/mail/access</p>
<h2 style="font-size: 1.5em; "><span style="font-family: verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-weight: normal; line-height: normal; font-size: 11px; -webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "></p>
<pre class="alt2" style="background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: #edeff1; color: #000000; border-top-color: #ffffff; border-left-color: #ffffff; width: 640px; height: 34px; text-align: left; overflow-x: auto; overflow-y: auto; background-position: initial initial; padding: 6px; margin: 0px; border: 1px inset initial;" dir="ltr">Authinfo:smtp.server.com "U:username" "P:password"</pre>
<p></span></h2>
<p>then run<br />
<span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-weight: normal; line-height: 18px; font-size: 12px; white-space: pre; -webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">makemap hash /etc/mail/access.db &lt; /etc/mail/access</span></p>
<h2 style="font-size: 1.5em; ">version control with subversion and trac</h2>
<p></span></h2>
<p></span></h2>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>sudo yum install subversion trac mod_dav_svn mod_ssl mod_python
mkdir /var/svn &amp;&amp; cd /var/svn
svnadmin create repository</pre>
</ul>
<p>edit the new file /etc/httpd/conf.d/subversion.conf and put this content in it:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>&lt;Location /repos&gt;
       DAV svn
       SVNParentPath /var/svn
       # Limit write permission to list of valid users.
       AuthType Basic
       AuthName "Subversion Authorization Realm"
       AuthzSVNAccessFile /var/svn/svn.acl
       AuthUserFile /var/svn/.htpasswd
       Require valid-user
       #only SSL
       SSLRequireSSL
&lt;/Location&gt;</pre>
</ul>
<p>generate the htpasswd file now:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>htpasswd -cb /var/svn/.htpasswd username password &amp;&amp; chmod 700 /var/svn/.htpasswd</pre>
</ul>
<p>add the svn.acl file so you have access to every repository:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>echo -e '[/]\nusername =  rw' &gt; /var/svn/svn.acl &amp;&amp; chmod 700 /var/svn/svn.acl</pre>
</ul>
<p>i added a view only user to the .htpasswd and acl as well:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>htpasswd -b /var/svn/.htpasswd view only #without -c (create flag)
echo -e '[repository:/]\nview =  r' &gt;&gt; /var/svn/svn.acl # &gt;&gt; = append to file
chown -R apache.apache /var/svn</pre>
</ul>
<h3>trac:</h3>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>trac-admin /var/trac/repository initenv</pre>
</ul>
<p>edit /etc/httpd/conf.d/trac.conf like this:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>&lt;Location /trac &gt;
        SetHandler mod_python
        PythonInterpreter main_interpreter
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnvParentDir /var/trac
        PythonOption TracUriRoot /trac
&lt;/Location&gt;
&lt;LocationMatch "/trac/[^/]+/login"&gt;
<span style="white-space:pre;">	</span>AuthType Basic
<span style="white-space:pre;">	</span>AuthName "Trac"
<span style="white-space:pre;">	</span>AuthUserFile /var/svn/.htpasswd
<span style="white-space:pre;">	</span>SSLRequireSSL
<span style="white-space:pre;">	</span>Require valid-user
&lt;/LocationMatch&gt;</pre>
</ul>
<h2>backup &amp; security</h2>
<h3>get the latest packages</h3>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>yum install yum-updatesd
service yum-updatesd start
chkconfig yum-updatesd on</pre>
</ul>
<h3>encrypted sql dumps by cron</h3>
<p>on the local machine (osx) download <a href="http://sourceforge.net/project/showfiles.php?group_id=248469&amp;package_id=303406&amp;release_id=653421" target="_blank">gnupg2</a><br />
and install it. then go to the command line and type:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>gpg2 --gen-key</pre>
</ul>
<p>transfer the public key to the remote machine:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>cat ~/.gnupg/pubring.gpg | ssh username@remote-host 'cat &gt;&gt; ~/uidpubring.gpg'</pre>
</ul>
<p>on the remote machine:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>yum install gnupg2
gpg2 --import ~/uidpubring.gpg
gpg2 --edit-key uid #uid is the username on your local machine.</pre>
</ul>
<p>in the dialog type &#8220;trust&#8221; and select &#8220;(5) ultimate&#8221;<br />
now you can encrypt files like this:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>gpg2 -r uid --encrypt confidental.zip</pre>
</ul>
<p>decrypt it with this command:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>gpg2 --decrypt confidental.zip.gpg &gt; crypto.zip #this works only with the secring.gpg</pre>
</ul>
<p>now the script for mysql:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>#!/bin/bash

DATE=`date -d yesterday +%Y%m%d%H%M%S`
BAKPATH='/home/username/Documents/Backup/local/sql/'
nice -n 19 mysqldump -u dbUser -a -e --add-drop-table databasename | nice -n 19 gzip -c -9 &gt;  ${BAKPATH}.datenbank_sqldump-${DATE}.gz_INPROGRESS
mv -f ${BAKPATH}.datenbank_sqldump-${DATE}.gz_INPROGRESS ${BAKPATH}datenbank_sqldump-${DATE}.gz
gpg2 -r uid --encrypt ${BAKPATH}datenbank_sqldump-${DATE}.gz
rm -f ${BAKPATH}datenbank_sqldump-${DATE}.gz</pre>
</ul>
<p>notice that i didn&#8217;t have to provide a password because of the ~/.my.cnf. i also added this to my cronjobs</p>
<p>enter the preferred command at</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>crontab -e</pre>
</ul>
<p>before the command put the time to execute. check the crontab man for the syntax.<br />
the secring.gpg is very important only with this and the passphrase you can decrypt the backup.<br />
if you loose it you can reimport it like this:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>gpg2 --import Desktop/secring.gpg</pre>
</ul>
<h3>the whole machine with rsync</h3>
<p>the next command will backup the whole root partition. notice the p1122 for a different ssh port.</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>rsync <span>--verbose</span> -e ssh --rsh='ssh -p1122' --exclude "/sys" --exclude "/dev"
--exclude "/proc" --recursive <span>--progress --times --perms --links </span>
username@remote-host:/ /Volumes/DOS/bak/remote-host/</pre>
</ul>
<p>to restore the backup just flip the remote and local directorys,</p>
<p>for example here i restore the complete www directory from my external hdd to the remote machine:</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre> rsync <span>--verbose</span> -e ssh --rsh='ssh -p1122'  --recursive <span>--progress --times
--perms --links </span> /Volumes/DOS/bak/remote-host/var/www username@remote-host:/var/</pre>
</ul>
<p>i also added this to my cronjobs</p>
<p>enter the preferred command at</p>
<ul style="border: 1px solid #d8d8d8; overflow: auto; background-color: #f8f8f8; width: 100%;">
<pre>crontab -e</pre>
</ul>
<p>before the command put the time to execute. check the crontab man for the syntax.</p>
<h2>references</h2>
<ul>
<li>ssh rsa authentication: http://linuxproblem.org/art_9.html</li>
<li>vnc http://tokyoahead.com/main/multifaq/index.php/65 http://ulyssesonline.com/2006/02/26/vncserver-on-</li>
<li>fedora-core-4/ echo http://www.unix.com/shell-programming-scripting/56666-new-line-</li>
<li>echo.html#post302271726  java: http://www.mjmwired.net/resources/mjm-fedora-f9.html#java</li>
<li>maven: http://beans.seartipy.com/2008/10/05/installing-sun-java-se-6-maven-2-and-tomcat-55-on-fedora-</li>
<li>htpasswd: http://linux.die.net/man/1/htpasswd</li>
<li>sql: http://www.vbulletin-germany.com/forum/showthread.php?t=17548</li>
</ul>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d232').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d232" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F&amp;submitHeadline=fedora+install+tutorial+on+a+xen+vps+minimal+installation&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F&amp;title=fedora+install+tutorial+on+a+xen+vps+minimal+installation" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F&amp;title=fedora+install+tutorial+on+a+xen+vps+minimal+installation" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F&amp;title=fedora+install+tutorial+on+a+xen+vps+minimal+installation" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F&amp;bm_description=fedora+install+tutorial+on+a+xen+vps+minimal+installation" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F&amp;T=fedora+install+tutorial+on+a+xen+vps+minimal+installation" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F&amp;title=fedora+install+tutorial+on+a+xen+vps+minimal+installation" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F&amp;title=fedora+install+tutorial+on+a+xen+vps+minimal+installation" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+fedora+install+tutorial+on+a+xen+vps+minimal+installation+@+http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fblog.srvme.de%2F2009%2F01%2F19%2Fsetting-up-my-new-vserver%2F&amp;t=fedora+install+tutorial+on+a+xen+vps+minimal+installation" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d232').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d232').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://blog.srvme.de/2009/01/19/setting-up-my-new-vserver/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>best way through a truth table</title>
		<link>http://blog.srvme.de/2008/08/19/best-way-through-a-truth-table/</link>
		<comments>http://blog.srvme.de/2008/08/19/best-way-through-a-truth-table/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 15:56:31 +0000</pubDate>
		<dc:creator>nils</dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[best way]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[truth table]]></category>

		<guid isPermaLink="false">http://snackycracky.wordpress.com/?p=85</guid>
		<description><![CDATA[suppose you have a &#8220;truth table&#8221; which looks like this for example: with this algorithm you can get from the left to the right side of the table by switching the true Boolean values next to each other. It calculates the number of row switches down to the minimum possible !!! the Alg. is recursive [...]]]></description>
			<content:encoded><![CDATA[<p>suppose you have a &#8220;truth table&#8221; which looks like this for example:<br />
<a href="http://snackycracky.files.wordpress.com/2008/08/picture-11-copy1.png"><img class="alignnone size-full wp-image-87" src="http://snackycracky.files.wordpress.com/2008/08/picture-11-copy1.png" alt="" width="487" height="125" /></a></p>
<p>with this algorithm you can get from the left to the right side of the table<br />
by switching the true Boolean values next to each other. It calculates the number<br />
of row switches down to the minimum possible !!!<br />
the Alg. is recursive but it&#8217;s not deterministic when in a column is no true Boolean value at all.<br />
In the above picture the alg switches only one time to get from the left to the right side.</p>
<p>It works like this (really abstract):</p>
<ol>
<li>it builds this table by making maps and lists</li>
<li>the loop starts at the most left side of every row in the table and checks for the column value</li>
<li>count the occurrences of unbreaked true values from step 2</li>
<li>if a false value is detected the counting of the true values before is saved in x and the counter is resetted.</li>
<li>get the maximum x in the whole table. this one result y is then one of the best ways.</li>
<li>delete the columns included in y from the table.</li>
<li>if the table has more columns go back to point 2.</li>
</ol>
<p>in my alg i work with calendar dates as columns and row numbers.<br />
most of the comments are in German, ask me if you like a translation.</p>
<p><a href="http://srvme.de/trac/snackycracky_techblog/browser/snackycrack_techblog/searchTheWayTroughATruthTable/tableWayAlg.java" target="_blank">here</a></p>
<p>this is just a innerclass not the actual one, please implement this in your own class&#8230;</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d85').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d85" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F&amp;submitHeadline=best+way+through+a+truth+table&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F&amp;title=best+way+through+a+truth+table" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F&amp;title=best+way+through+a+truth+table" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F&amp;title=best+way+through+a+truth+table" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F&amp;bm_description=best+way+through+a+truth+table" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F&amp;T=best+way+through+a+truth+table" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F&amp;title=best+way+through+a+truth+table" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F&amp;title=best+way+through+a+truth+table" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+best+way+through+a+truth+table+@+http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fblog.srvme.de%2F2008%2F08%2F19%2Fbest-way-through-a-truth-table%2F&amp;t=best+way+through+a+truth+table" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d85').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d85').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://blog.srvme.de/2008/08/19/best-way-through-a-truth-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hibernate inheritance</title>
		<link>http://blog.srvme.de/2008/07/16/hibernate-inheritance/</link>
		<comments>http://blog.srvme.de/2008/07/16/hibernate-inheritance/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 09:14:15 +0000</pubDate>
		<dc:creator>nils</dc:creator>
				<category><![CDATA[AppFuse]]></category>
		<category><![CDATA[classcastexception]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[lazy]]></category>

		<guid isPermaLink="false">http://snackycracky.wordpress.com/?p=21</guid>
		<description><![CDATA[inheritance is a well known part of polymorphism in any object orientated language. To map something like an abstract class called &#8220;Customer&#8221; which has two subcalsses called &#8220;PrivateClient&#8221; and &#8220;CompanyClient&#8221; you have three different choices which are well documented in the hibernate docs (table-per-class, &#8230;). When you retrieve the class from the database by runtime, [...]]]></description>
			<content:encoded><![CDATA[<p>inheritance is a well known part of polymorphism in any object orientated language. To map something like an abstract class called &#8220;Customer&#8221; which has two subcalsses called &#8220;PrivateClient&#8221; and &#8220;CompanyClient&#8221; you have three different choices which are well documented in the hibernate docs (table-per-class, &#8230;).</p>
<p>When you retrieve the class from the database by runtime, hibernate dosen&#8217;t load the real subclass just the superclass, until it gets loaded in deph. By default the lazy loading method does that.</p>
<p>Turning off lazy loading on the superclass in the mapping file prevents loading only the superclass, enabling to cast the superclass to a subclass sucssesfully.</p>
<p>I don&#8217;t really like trying with the keyword &#8220;instancof&#8221; to check which subclass it is, so my roommate pointed me to the &#8220;Visitor Pattern&#8221; but i don&#8217;t really understand it jet. In my future Postings I will include it.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d21').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d21" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F&amp;submitHeadline=hibernate+inheritance&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F&amp;title=hibernate+inheritance" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F&amp;title=hibernate+inheritance" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F&amp;title=hibernate+inheritance" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F&amp;bm_description=hibernate+inheritance" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F&amp;T=hibernate+inheritance" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F&amp;title=hibernate+inheritance" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F&amp;title=hibernate+inheritance" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+hibernate+inheritance+@+http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fblog.srvme.de%2F2008%2F07%2F16%2Fhibernate-inheritance%2F&amp;t=hibernate+inheritance" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://blog.srvme.de/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d21').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d21').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://blog.srvme.de/2008/07/16/hibernate-inheritance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
