<?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>bigmarv.net</title>
	<atom:link href="http://www.bigmarv.net/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.bigmarv.net/blog</link>
	<description></description>
	<lastBuildDate>Sat, 05 May 2012 21:26:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Clearing floats the right way</title>
		<link>http://www.bigmarv.net/blog/?p=287</link>
		<comments>http://www.bigmarv.net/blog/?p=287#comments</comments>
		<pubDate>Sat, 05 May 2012 21:26:37 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[css overflow div html]]></category>

		<guid isPermaLink="false">http://www.bigmarv.net/blog/?p=287</guid>
		<description><![CDATA[This page here shows how to how to clear floats the RIGHT way when you&#8217;re using a containing div around your floating elements. Using overflow : auto lets the containing div grow to the appropriate height. And it doesn&#8217;t require a trailing div upon which to apply the clear : both style. Using structural HTML [...]]]></description>
			<content:encoded><![CDATA[<p>This page here shows how to <a href="http://www.quirksmode.org/css/clearing.html">how to clear floats the RIGHT way</a> when you&#8217;re using a containing div around your floating elements.  Using <code>overflow : auto</code> lets the containing div grow to the appropriate height.  And it doesn&#8217;t require a trailing div upon which to apply the <code>clear : both</code> style.  Using structural HTML to perform styling?  Ugh.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigmarv.net/blog/?feed=rss2&#038;p=287</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JUnit 4.4 includes Hamcrest core matchers?</title>
		<link>http://www.bigmarv.net/blog/?p=283</link>
		<comments>http://www.bigmarv.net/blog/?p=283#comments</comments>
		<pubDate>Tue, 01 May 2012 23:04:28 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java junit]]></category>

		<guid isPermaLink="false">http://www.bigmarv.net/blog/?p=283</guid>
		<description><![CDATA[Interesting read on what&#8217;s new in JUnit 4.4.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.javacodegeeks.com/2012/05/junit-and-hamcrest-improving-on.html?utm_source=feedburner&#038;utm_medium=feed&#038;utm_campaign=Feed%3A+JavaCodeGeeks+%28Java+Code+Geeks%29&#038;utm_content=FaceBook">Interesting read</a> on what&#8217;s new in JUnit 4.4.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigmarv.net/blog/?feed=rss2&#038;p=283</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wiring EHCache into your app with Spring</title>
		<link>http://www.bigmarv.net/blog/?p=281</link>
		<comments>http://www.bigmarv.net/blog/?p=281#comments</comments>
		<pubDate>Tue, 01 May 2012 21:14:56 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java cache ehcache spring webapp]]></category>

		<guid isPermaLink="false">http://www.bigmarv.net/blog/?p=281</guid>
		<description><![CDATA[Here&#8217;s a great straight forward tutorial on how to use Spring to wire EHCache into your Java web application.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a <a href="http://byteco.de/2010/01/26/integrating-spring-and-ehcache/">great straight forward tutorial</a> on how to use Spring to wire EHCache into your Java web application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigmarv.net/blog/?feed=rss2&#038;p=281</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Interview Questions</title>
		<link>http://www.bigmarv.net/blog/?p=279</link>
		<comments>http://www.bigmarv.net/blog/?p=279#comments</comments>
		<pubDate>Tue, 01 May 2012 21:00:29 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bigmarv.net/blog/?p=279</guid>
		<description><![CDATA[Some darned good (and not so easy) Java interview questions.]]></description>
			<content:encoded><![CDATA[<p>Some darned good (and not so easy) <a href="http://www.fromdev.com/2008/05/java-collections-questions.html">Java interview questions</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigmarv.net/blog/?feed=rss2&#038;p=279</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The one where I try to learn OAuth&#8230;</title>
		<link>http://www.bigmarv.net/blog/?p=269</link>
		<comments>http://www.bigmarv.net/blog/?p=269#comments</comments>
		<pubDate>Sat, 28 Apr 2012 22:31:55 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bigmarv.net/blog/?p=269</guid>
		<description><![CDATA[As I try to learn OAuth and how to add it to my site, this article really helped get the basic understanding.]]></description>
			<content:encoded><![CDATA[<p>As I try to learn OAuth and how to add it to my site, this <a href="http://hueniverse.com/2007/10/beginners-guide-to-oauth-part-ii-protocol-workflow/">article</a> really helped get the basic understanding.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigmarv.net/blog/?feed=rss2&#038;p=269</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling ssh on Mac OSX</title>
		<link>http://www.bigmarv.net/blog/?p=244</link>
		<comments>http://www.bigmarv.net/blog/?p=244#comments</comments>
		<pubDate>Wed, 25 Apr 2012 21:11:16 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bigmarv.net/blog/?p=244</guid>
		<description><![CDATA[The Apple Mac OS X operating system has SSH installed by default but the SSH daemon is not enabled. This means you can’t login remotely or do remote copies until you enable it. To enable it, go to ‘System Preferences’. Under ‘Internet &#038; Networking’ there is a ‘Sharing’ icon. Run that. In the list that [...]]]></description>
			<content:encoded><![CDATA[<p>The Apple Mac OS X operating system has SSH installed by default but the SSH daemon is not enabled. This means you can’t login remotely or do remote copies until you enable it.</p>
<p>To enable it, go to ‘System Preferences’. Under ‘Internet &#038; Networking’ there is a ‘Sharing’ icon. Run that. In the list that appears, check the ‘Remote Login’ option.</p>
<p>This starts the SSH daemon immediately and you can remotely login using your username. The ‘Sharing’ window shows at the bottom the name and IP address to use. You can also find this out using ‘whoami’ and ‘ifconfig’ from the Terminal application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigmarv.net/blog/?feed=rss2&#038;p=244</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spring+Hibernate CRUD example</title>
		<link>http://www.bigmarv.net/blog/?p=267</link>
		<comments>http://www.bigmarv.net/blog/?p=267#comments</comments>
		<pubDate>Wed, 25 Apr 2012 18:18:17 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bigmarv.net/blog/?p=267</guid>
		<description><![CDATA[http://www.javacodegeeks.com/2011/04/spring-mvc3-hibernate-crud-sample.html]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.javacodegeeks.com/2011/04/spring-mvc3-hibernate-crud-sample.html" title="Handy Spring+Hibernate CRUD example.">http://www.javacodegeeks.com/2011/04/spring-mvc3-hibernate-crud-sample.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigmarv.net/blog/?feed=rss2&#038;p=267</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blocking Meebo, the most annoying news site ad nonsense</title>
		<link>http://www.bigmarv.net/blog/?p=265</link>
		<comments>http://www.bigmarv.net/blog/?p=265#comments</comments>
		<pubDate>Tue, 24 Apr 2012 19:18:37 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[meebo adblock chrome]]></category>

		<guid isPermaLink="false">http://www.bigmarv.net/blog/?p=265</guid>
		<description><![CDATA[Here&#8217;s how to block Meebo using Adblock. Worked for my Chrome install. http://www.chizang.net/alex/blog/2010/08/19/block-meebo-bar/]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how to block Meebo using Adblock.  Worked for my Chrome install.</p>
<p>http://www.chizang.net/alex/blog/2010/08/19/block-meebo-bar/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigmarv.net/blog/?feed=rss2&#038;p=265</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excellent webinar on Continuous Integration by Thoughtworks</title>
		<link>http://www.bigmarv.net/blog/?p=254</link>
		<comments>http://www.bigmarv.net/blog/?p=254#comments</comments>
		<pubDate>Thu, 12 Apr 2012 22:26:15 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[continuous-integration release-management software-engineering]]></category>

		<guid isPermaLink="false">http://www.bigmarv.net/blog/?p=254</guid>
		<description><![CDATA[Here&#8217;s an excellent webinar on Continuous Integration by Thoughtworks.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an excellent <a href="http://continuous-delivery.thoughtworks.com/events/introduction-continuous-delivery">webinar</a> on Continuous Integration by <a href="http://thoughtworks.com">Thoughtworks</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigmarv.net/blog/?feed=rss2&#038;p=254</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Hibernate&#8217;s ability to create a user defined type to fix clunky Oracle CLOB code</title>
		<link>http://www.bigmarv.net/blog/?p=251</link>
		<comments>http://www.bigmarv.net/blog/?p=251#comments</comments>
		<pubDate>Mon, 02 Apr 2012 22:47:24 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[database oracle hibernate]]></category>

		<guid isPermaLink="false">http://www.bigmarv.net/blog/?p=251</guid>
		<description><![CDATA[Very helpful post over here explained how to use Hibernate&#8217;s UserType to create a custom type to override the behavior of Oracle&#8217;s CLOB types. Because no programmer can leave well enough alone, I tweaked his code, and made the Unicode related fix suggested in the comments there. Here&#8217;s the code I&#8217;m using, and it works [...]]]></description>
			<content:encoded><![CDATA[<p>Very helpful post <a href="http://www.reverttoconsole.com/blog/hibernate-jpa/mapping-a-clob-type-in-hibernate-and-oracle-9i10g">over here</a> explained how to use Hibernate&#8217;s UserType to create a custom type to override the behavior of Oracle&#8217;s CLOB types.  </p>
<p>Because no programmer can leave well enough alone, I tweaked his code, and made the Unicode related fix suggested in the comments there.  Here&#8217;s the code I&#8217;m using, and it works brilliantly on Java + Hibernate + Oracle 11:</p>
<pre>
package net.bigmarv.hibernate.types;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;

import org.hibernate.HibernateException;
import org.hibernate.usertype.UserType;

/**
 * Way of mapping an Oracle CLOB field as user defined type
 * in Hibernate.  Makes it easier to read these fields.
 * Borrowed from this
 * <a href="http://www.reverttoconsole.com/blog/hibernate-jpa/mapping-a-clob-type-in-hibernate-and-oracle-9i10g/">Blog Entry</a>
 */
public class ClobType implements UserType {

    @Override
	public int [] sqlTypes() {
        return new int [] { Types.CLOB };
    }

    /**
     * Returns the class that this Clob is converted to.
     */
    @SuppressWarnings( "rawtypes" )
	@Override
	public Class returnedClass() {
        return String.class;
    }

    @Override
	public boolean equals( Object left, Object right )
	throws HibernateException {
        if ( left == null || right == null ) {
            return false;
        }

        if ( !(left instanceof String) || !(right instanceof String) ) {
            return false;
        }

        return ( ( String )left ).equals( right );
    }

    @Override
	public int hashCode( Object o )
	throws HibernateException {
        return o.hashCode();
    }

    @Override
	public Object nullSafeGet( ResultSet resultSet, String [] names, Object owner )
    throws HibernateException, SQLException {

        StringBuilder sb = new StringBuilder();
        try {
            // First we get the stream
            //InputStream is = resultSet.getAsciiStream( names[0] );  // Should be getCharacterStream for unicode
            Reader reader = resultSet.getCharacterStream( names[ 0 ] );
        	char [] buf = new char[ 4096 ];
            int read = -1;

            while ( reader != null &#038;&#038; ( read = reader.read(buf)) >= 0) {
                sb.append( buf, 0, read );
            }
            if ( reader != null ) {
                reader.close();
            }
            return sb.toString();
        }
        catch ( IOException ioException ) {
            throw new HibernateException( "Unable to read from resultset", ioException );
        }
    }

    @Override
	public void nullSafeSet( PreparedStatement pst, Object data, int index )
    throws HibernateException, SQLException {
        data = data == null ? new String() : data;
        String in = (String) data;

        byte[] buf = in.getBytes();
        int len = buf.length;

        ByteArrayInputStream bais = new ByteArrayInputStream(buf);

        pst.setAsciiStream(index, bais, len);
    }

    @Override
	public Object deepCopy( Object object )
	throws HibernateException {
    	if ( object == null ) {
    		object = new String();
    	}
        String in = ( String )object;
        int len = in.length();
        char [] buf = new char[ len ];

        for ( int i = 0; i < len; i++ ) {
            buf[ i ] = in.charAt( i );
        }
        return new String( buf );
    }

    @Override
	public boolean isMutable() {
        return false;
    }

    @Override
	public Serializable disassemble( Object arg0 )
	throws HibernateException {
        return ( String )arg0;
    }

    @Override
	public Object assemble( Serializable arg0, Object arg1 )
    throws HibernateException {
        return this.deepCopy( arg0 );
    }

    @Override
	public Object replace( Object arg0, Object arg1, Object arg2 )
    throws HibernateException {
        return this.deepCopy( arg0 );
    }
}
</pre>
<p>Once you've created this class and put it in an appropriate package, you'll need to update your <code>.hbm.xml</code> files to use the new type.  In my case, I had columns defined as</p>
<pre>
    &lt;property name="foo" column="foo" type="clob" /&gt;
</pre>
<p>I changed this to </p>
<pre>
    &lt;property name="foo" column="foo" type="net.bigmarv.hibernate.types.ClobType" /&gt;
</pre>
<p>I then ran </p>
<pre>
    mvn hibernate:hbm2java
</pre>
<p>and then recompiled, and I was done.  Beautiful stuff!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigmarv.net/blog/?feed=rss2&#038;p=251</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

