<?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>imwill.com &#187; java</title>
	<atom:link href="http://imwill.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://imwill.com</link>
	<description>Automation, Software Development, Web Technologies.</description>
	<lastBuildDate>Mon, 29 Aug 2011 18:24:32 +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>Hibernate Dependencies for a Maven Web App</title>
		<link>http://imwill.com/hibernate-dependencies-maven-webap/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hibernate-dependencies-maven-webap</link>
		<comments>http://imwill.com/hibernate-dependencies-maven-webap/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 10:49:34 +0000</pubDate>
		<dc:creator>Hendrik Will</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://imwill.com/?p=134</guid>
		<description><![CDATA[If you&#8217;re using Maven to build a Web App with the latest version of Hibernate you only need to add the hibernate-core dependency to your pom.xml (Project Object Model).  The Hibernate project added their own pom.xml which will download all other library dependencies from the Maven repository for you automatically. I saw that many blogs [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using <strong>Maven</strong> to build a <strong>Web App</strong> with the latest version of <strong>Hibernate</strong> you only need to add the <strong>hibernate-core</strong> dependency to your pom.xml (Project Object Model).  The Hibernate project added their own pom.xml which will download all other library dependencies from the <strong>Maven repository</strong> for you automatically.</p>
<p>I saw that many blogs still refer that you have to add many dependencies to use Hibernate which confused me a lot. Also <a href="http://community.jboss.org/en/build/blog/2011/05/24/rsync-jbossorg-to-maven-central">JBoss recently started to sync their repository</a> with the Maven repository. So there is <strong>no need to add another JBoss repository</strong> to your pom.xml.<br />
<span id="more-134"></span><br />
<div class="wp-caption alignnone" style="width: 362px"><img title="Maven Hibernate Core Dependencies" src="http://imwill.com/wp-content/uploads/2011/07/maven-hibernate-core.jpg" alt="" width="352" height="157" /><p class="wp-caption-text">Maven Hibernate Core Dependencies</p></div></p>
<p>Here is a snippet:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;dependency&gt;
 &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
  &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
  &lt;version&gt;3.6.3.Final&lt;/version&gt;
&lt;/dependency&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://imwill.com/hibernate-dependencies-maven-webap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Measure elapsed time with Java</title>
		<link>http://imwill.com/measure-elapsed-time-java/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=measure-elapsed-time-java</link>
		<comments>http://imwill.com/measure-elapsed-time-java/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 14:14:30 +0000</pubDate>
		<dc:creator>Hendrik Will</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://imwill.com/?p=105</guid>
		<description><![CDATA[For my recent experimental gaming project I wanted to measure the overall elapsed time since the beginning of a game. In my main class I added a startup variable of type long which contains the current time in milliseconds. At the end of a game call the function stopWatch(startup); to get the elapsed time in [...]]]></description>
			<content:encoded><![CDATA[<p>For my recent experimental gaming project I wanted to measure the overall elapsed time since the beginning of a game.<br />
In my main class I added a <code>startup</code> variable of type <code>long</code> which contains the current time in milliseconds. At the end of a game call the function <code>stopWatch(startup);</code> to get the elapsed time in seconds.<span id="more-105"></span></p>
<pre class="brush: java; title: ; notranslate">
	/**
	 * Method to measure elapsed time since start time until now
	 * @param startTime Time of start in milliseconds
	 * @return Elapsed time in seconds as Long
	 */
	public static long stopWatch(long startTime) {
		long endTime = System.currentTimeMillis();
		endTime = endTime-startTime;

		long seconds =
						TimeUnit.MILLISECONDS.toSeconds(endTime) -
						TimeUnit.MINUTES.toSeconds(
								TimeUnit.MILLISECONDS.toMinutes(endTime)
						);

		return seconds;
	}
</pre>
<p>Example:</p>
<pre class="brush: java; title: ; notranslate">
long startup = System.currentTimeMillis();

Thread.sleep(3000);

System.out.println(&quot;This took &quot; + stopWatch(startup) + &quot; seconds.&quot;);
</pre>
<p>This will result in <code>This took 3 seconds.</code></p>
<p><a class="FlattrButton" style="display:none;" href="http://imwill.com/measure-elapsed-time-java/"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://imwill.com/measure-elapsed-time-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Implode a String Array with Java</title>
		<link>http://imwill.com/implode-string-array-java/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=implode-string-array-java</link>
		<comments>http://imwill.com/implode-string-array-java/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 15:47:37 +0000</pubDate>
		<dc:creator>Hendrik Will</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://imwill.com/?p=97</guid>
		<description><![CDATA[A couple weeks ago I began to study Java for my Java class at university. As I&#8217;m used to PHP I noticed some differences and also missed some useful functions which PHP already has built-in. In PHP we have the String function implode, in Java we have to build our own method for this. The [...]]]></description>
			<content:encoded><![CDATA[<p>A couple weeks ago I began to study Java for my Java class at university. As I&#8217;m used to PHP I noticed some differences and also missed some useful functions which PHP already has built-in.<br />
<span id="more-97"></span><br />
In <strong>PHP </strong>we have the <a href="http://php.net/manual/en/function.implode.php" target="_blank">String function implode</a>, in <strong>Java </strong>we have to build our own method for this. The following example shows you <strong>how to join array elements with a glue string</strong> and get a String output of all array elements.</p>
<pre class="brush: java; title: ; notranslate">
/**
* Method to join array elements of type string
* @author Hendrik Will, imwill.com
* @param inputArray Array which contains strings
* @param glueString String between each array element
* @return String containing all array elements seperated by glue string
*/
public static String implodeArray(String[] inputArray, String glueString) {

/** Output variable */
String output = &quot;&quot;;

if (inputArray.length &gt; 0) {
	StringBuilder sb = new StringBuilder();
	sb.append(inputArray[0]);

	for (int i=1; i&lt;inputArray.length; i++) {
		sb.append(glueString);
		sb.append(inputArray[i]);
	}

	output = sb.toString();
}

return output;
}
</pre>
<p>Usage example:</p>
<pre class="brush: java; title: ; notranslate">
String[] stringArray = {&quot;String1&quot;, &quot;String2&quot;, &quot;String3&quot;};
System.out.println(implodeArray(stringArray, &quot;,&quot;));
</pre>
<p>This will print out <strong>String1, String2, String3</strong>.</p>
<p>The same method would be possible with an array of any other type for example an <strong>int </strong>Array.</p>
<p><a class="FlattrButton" style="display: none;" href="http://imwill.com/implode-string-array-java/"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://imwill.com/implode-string-array-java/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Getting HTC Desire to work with Android SDK on Vista 64</title>
		<link>http://imwill.com/getting-htc-desire-android-sdk-vista64/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-htc-desire-android-sdk-vista64</link>
		<comments>http://imwill.com/getting-htc-desire-android-sdk-vista64/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 21:34:30 +0000</pubDate>
		<dc:creator>Hendrik Will</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[usb-driver]]></category>
		<category><![CDATA[vista]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://imwill.com/?p=95</guid>
		<description><![CDATA[Even for the newest Android SDK I ran into problems getting it to work with my HTC Desire on Vista 64. Probably it&#8217;s the same problem for other Windows 64bit versions. If you connect  your phone to your computer via USB you will be asked to install a USB driver for ADB. You will point [...]]]></description>
			<content:encoded><![CDATA[<p>Even for the newest Android SDK I ran into problems getting it to work with my HTC Desire on Vista 64. Probably it&#8217;s the same problem for other Windows 64bit versions.</p>
<p>If you connect  your phone to your computer via USB you will be asked to install a USB driver for ADB.<br />
You will point the installer to your <code>\android-sdk-directory\usb_driver\</code> but it won&#8217;t be able to find a matching driver.</p>
<p>Find <code>\android-sdk-directory\usb_driver\android_winusb.inf</code> and open it with your favorite text editor.<br />
Now find the line with <code>[Google.NTx86]</code> and <code>[Google.NTamd64]</code></p>
<p>Enter the following after both of these lines:</p>
<pre class="brush: php; title: ; notranslate">
;HTC Desire
%SingleAdbInterface%        = USB_Install, USB\VID_0BB4&amp;PID_0C87
%CompositeAdbInterface%     = USB_Install, USB\VID_0BB4&amp;PID_0C87&amp;MI_01
;
</pre>
<p>Save the file and try again to install the drivers. Point the installer to <code>\android-sdk-directory\usb_driver\</code>. <strong>Do not choose one of the sub directories.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://imwill.com/getting-htc-desire-android-sdk-vista64/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>svntask examples for Apache Ant</title>
		<link>http://imwill.com/svntask-examples-for-apache-ant/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=svntask-examples-for-apache-ant</link>
		<comments>http://imwill.com/svntask-examples-for-apache-ant/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 00:36:02 +0000</pubDate>
		<dc:creator>Hendrik Will</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://imwill.com/?p=7</guid>
		<description><![CDATA[A couple days ago I had my first experience with Apache Ant. If you have never heard of it before you should definitely check it out. Apache Ant is a very simple JAVA-based build tool with xml-based configuration files for automation. I wanted to automate the process of importing/exporting specific MySQL database tables.In the next [...]]]></description>
			<content:encoded><![CDATA[<p>A couple days ago I had my first experience with Apache Ant. If you have never heard of it before you should definitely check it out. Apache Ant is a very simple JAVA-based build tool with xml-based configuration files for automation.</p>
<p>I wanted to automate the process of importing/exporting specific MySQL database tables.In the next step I wanted to update and commit the data to SVN. After a quick research I found the JAVA lib svntask which is based on SVNKit very useful.<br />
<span id="more-7"></span><br />
The only disadvantage in my opinion is that there is almost no documentation yet. To help other developers to get off on the right foot and save some time I&#8217;ll give some examples in the following section.</p>
<h3>SVN update example:</h3>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- SVN update --&gt;
&lt;target name=&quot;svn-update&quot;&gt;
	&lt;svn&gt;
		&lt;update
			path=&quot;/workspace/path&quot;
			force=&quot;false&quot; recursive=&quot;false&quot;
		/&gt;
	&lt;/svn&gt;
&lt;/target&gt;
</pre>
<p>Optional arguments you can use are <strong>recursive</strong>(default: <em>true</em>) and <strong>force</strong>(default: <em>true</em>).</p>
<h3>SVN add example:</h3>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- SVN add --&gt;
&lt;target name=&quot;svn-add&quot;&gt;
	&lt;svn&gt;
		&lt;add
			path=&quot;/workspace/project&quot;
			force=&quot;false&quot;
		/&gt;
	&lt;/svn&gt;
&lt;/target&gt;
</pre>
<p>Optional <em>boolean </em>arguments are <strong>force</strong>, <strong>mkdir</strong>, <strong>climbUnversionedParents</strong>, <strong>includeIgnored </strong>and <strong>makeParents</strong>(default for all except mkrdir is <em>true</em>).</p>
<h3>SVN commit example:</h3>
<p>With version 1.0.7 authentication failed for me. So I added the username/password authentication to the commit class. You can get the temporary version <a href="http://svntask.googlecode.com/issues/attachment?aid=-5162993630516291954&#038;name=svntask.jar">here</a> until the next update of svntask.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- SVN Commit --&gt;
&lt;target name=&quot;svn-commit&quot;&gt;
	&lt;!-- don't store password in property files, use input  --&gt;
	&lt;input
		message=&quot;Enter SVN password:&quot;
		addproperty=&quot;svn.password&quot;
	 /&gt;
	&lt;svn&gt;
		&lt;commit
			path=&quot;/workspace/project/trunk&quot;
			commitMessage=&quot;Test commit&quot;
			force=&quot;true&quot;
			username=&quot;user&quot; password=&quot;${svn.password}&quot;
		/&gt;
	&lt;/svn&gt;
&lt;/target&gt;
</pre>
<p>Optional <em>boolean </em>arguments are <strong>keepLocks </strong>and <strong>force</strong>.</p>
<h3>SVN ls update example:</h3>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- SVN ls --&gt;
&lt;target name=&quot;svn-ls&quot;&gt;
	&lt;svn&gt;
		&lt;ls
			repository=&quot;http://domain.tld&quot;
			path=&quot;/svn/repos/project/trunk&quot;
		/&gt;
	&lt;/svn&gt;
&lt;/target&gt;
</pre>
<p>Optional argument is <strong>delimeter</strong>(default: , ).</p>
<h3>SVN info example:</h3>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- SVN info --&gt;
&lt;target name=&quot;svn-info&quot;&gt;
	&lt;svn&gt;
		&lt;info
			path=&quot;/workspace/project/trunk&quot;
			committedRevisionProperty=&quot;revisionVersion&quot;
			authorProperty=&quot;revisionAuthor&quot;
			committedDateProperty=&quot;revisionDate&quot;
		/&gt;
	&lt;/svn&gt;
	&lt;!-- show revision, author and date --&gt;
	&lt;property
		name=&quot;version&quot;
		value=&quot;At revision ${revisionVersion} by ${revisionAuthor} on ${revisionDate}&quot;
	/&gt;
	&lt;echo message=&quot;${version}&quot;/&gt;
&lt;/target&gt;
</pre>
<p>I didn&#8217;t use <strong>log</strong>, <strong>status </strong>and <strong>switch </strong>so far. I will post examples if I will use it in the future.</p>
<p><strong>Some useful links:</strong><br />
svntask: <a href="http://code.google.com/p/svntask/">http://code.google.com/p/svntask/</a><br />
Apache Ant project: <a href="http://ant.apache.org/">http://ant.apache.org/</a></p>
<p><a class="FlattrButton" style="display:none;" href="http://imwill.com/svntask-examples-for-apache-ant/"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://imwill.com/svntask-examples-for-apache-ant/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

