<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
<channel>
	<title>Comments for eknori.de</title>
	
	<link>http://www.eknori.de</link>
	<description>the weird world of eknori</description>
	<lastBuildDate>Tue, 22 May 2012 07:57:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CommentsForEknoride" /><feedburner:info uri="commentsforeknoride" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Comment on org.apache.commons.collections  – MultiValueMap by axel</title>
		<link>http://feedproxy.google.com/~r/CommentsForEknoride/~3/WTaEzTxtEY4/</link>
		<dc:creator>axel</dc:creator>
		<pubDate>Tue, 22 May 2012 07:57:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.eknori.de/?p=2655#comment-4231</guid>
		<description>They say that guava from google is a tad "better" alternative for jakarta commons this days. Personally, I haven't find much use for the jakarta commons except StringUtils in my projects. 
You get this multivalue feature with a simple method like this:

private void addMultivalue(Map&lt;String, Set&gt; map, String key, String value) {
 if ((map==null) ||(key == null) || (value == null))  throw new IllegalArgumentException("None of this arguments should be null: map=" + map + ", key=" + key + ", value=" + value);
Set values = map.get(key);
if (values == null) {
 values = new HashSet();
 values.put(value);
 map.put(key, values);
} else {
  values.add(value);
}

}

Sometimes its questionable if its really worth to add a new 3rd party lib. Well, I allways try to convince people to add this, though: http://commons.apache.org/lang/api-2.5/org/apache/commons/lang/StringUtils.html</description>
		<content:encoded><![CDATA[<p>They say that guava from google is a tad &#8220;better&#8221; alternative for jakarta commons this days. Personally, I haven&#8217;t find much use for the jakarta commons except StringUtils in my projects.<br />
You get this multivalue feature with a simple method like this:</p>
<p>private void addMultivalue(Map&lt;String, Set&gt; map, String key, String value) {<br />
 if ((map==null) ||(key == null) || (value == null))  throw new IllegalArgumentException(&#8220;None of this arguments should be null: map=&#8221; + map + &#8220;, key=&#8221; + key + &#8220;, value=&#8221; + value);<br />
Set values = map.get(key);<br />
if (values == null) {<br />
 values = new HashSet();<br />
 values.put(value);<br />
 map.put(key, values);<br />
} else {<br />
  values.add(value);<br />
}</p>
<p>}</p>
<p>Sometimes its questionable if its really worth to add a new 3rd party lib. Well, I allways try to convince people to add this, though: <a href="http://commons.apache.org/lang/api-2.5/org/apache/commons/lang/StringUtils.html" rel="nofollow">http://commons.apache.org/lang/api-2.5/org/apache/commons/lang/StringUtils.html</a></p>
]]></content:encoded>
	<feedburner:origLink>http://www.eknori.de/2012-05-20/org-apache-commons-collections-multivaluemap/comment-page-1/#comment-4231</feedburner:origLink></item>
	<item>
		<title>Comment on org.apache.commons.collections  – MultiValueMap by Ulrich Krause</title>
		<link>http://feedproxy.google.com/~r/CommentsForEknoride/~3/RUzEsO92ZDQ/</link>
		<dc:creator>Ulrich Krause</dc:creator>
		<pubDate>Mon, 21 May 2012 04:28:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.eknori.de/?p=2655#comment-4230</guid>
		<description>Absolutely true, you can put an object into a map etc. 
The advantage of the MultiMap ( to me ) is that you do not have to care about the logic of how to add the values to the map. 
Using the MultiMap is a more intuitive way to do this. Adding to a map is map.put(key, object) and so is multimap.put(key, object).
Without the multiMap you would have to check, if the key already exists and then add another object to an ( existing ) object for this key. Code, you would have to write by yourself. :)</description>
		<content:encoded><![CDATA[<p>Absolutely true, you can put an object into a map etc.<br />
The advantage of the MultiMap ( to me ) is that you do not have to care about the logic of how to add the values to the map.<br />
Using the MultiMap is a more intuitive way to do this. Adding to a map is map.put(key, object) and so is multimap.put(key, object).<br />
Without the multiMap you would have to check, if the key already exists and then add another object to an ( existing ) object for this key. Code, you would have to write by yourself. <img src='http://www.eknori.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	<feedburner:origLink>http://www.eknori.de/2012-05-20/org-apache-commons-collections-multivaluemap/comment-page-1/#comment-4230</feedburner:origLink></item>
	<item>
		<title>Comment on org.apache.commons.collections  – MultiValueMap by David Leedy</title>
		<link>http://feedproxy.google.com/~r/CommentsForEknoride/~3/FJvmhjs1Y0o/</link>
		<dc:creator>David Leedy</dc:creator>
		<pubDate>Mon, 21 May 2012 01:54:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.eknori.de/?p=2655#comment-4229</guid>
		<description>Looks interesting but maybe I'm missing something. Can't you put an object into a map?  Tree or hash? As the value?  So an array or custom object that could hold multiple values?  I thought so at least. That could give you your multi values I'd think. 
But it is late here....  :-)</description>
		<content:encoded><![CDATA[<p>Looks interesting but maybe I&#8217;m missing something. Can&#8217;t you put an object into a map?  Tree or hash? As the value?  So an array or custom object that could hold multiple values?  I thought so at least. That could give you your multi values I&#8217;d think.<br />
But it is late here&#8230;.  <img src='http://www.eknori.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	<feedburner:origLink>http://www.eknori.de/2012-05-20/org-apache-commons-collections-multivaluemap/comment-page-1/#comment-4229</feedburner:origLink></item>
	<item>
		<title>Comment on Joda to the rescue by Mikkel Flindt Heisterberg</title>
		<link>http://feedproxy.google.com/~r/CommentsForEknoride/~3/-w3LlA0zFqA/</link>
		<dc:creator>Mikkel Flindt Heisterberg</dc:creator>
		<pubDate>Sat, 12 May 2012 07:27:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.eknori.de/?p=2648#comment-4227</guid>
		<description>The date represented by java.util.Date is always the UTC date and hence daylight savings doesn't apply. Daylight savings and time zones is what the java.util.Calendar is for why this is a perfectly fine approach. Of course the date objects would come from a daylight savings/time zone aware piece of code in a real piece of code where Locale etc. apply.</description>
		<content:encoded><![CDATA[<p>The date represented by java.util.Date is always the UTC date and hence daylight savings doesn&#8217;t apply. Daylight savings and time zones is what the java.util.Calendar is for why this is a perfectly fine approach. Of course the date objects would come from a daylight savings/time zone aware piece of code in a real piece of code where Locale etc. apply.</p>
]]></content:encoded>
	<feedburner:origLink>http://www.eknori.de/2012-05-09/joda-to-the-rescue/comment-page-1/#comment-4227</feedburner:origLink></item>
	<item>
		<title>Comment on Joda to the rescue by Stephen Colebourne</title>
		<link>http://feedproxy.google.com/~r/CommentsForEknoride/~3/ljEB3BpYs0g/</link>
		<dc:creator>Stephen Colebourne</dc:creator>
		<pubDate>Fri, 11 May 2012 11:30:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.eknori.de/?p=2648#comment-4226</guid>
		<description>As a general rule, LocalDate should be preferred to DateMidnight for cases like this. Thats because in some time-zones, midnight does not occur on the date of daylight savings change - ie. time jumps from 00:00 to 01:00 with midnight never occurring. DateMidnight clearly has issues with this. LocalDate does not have a time-zone and so handles it fine.

Mikkel, your code ignores daylight savings time days that last 23 or 25 hours. More generally, its only really reliable if your default time-zone is UTC. If thats fine in your case, great, but please don't pretend that the code is equivalent.</description>
		<content:encoded><![CDATA[<p>As a general rule, LocalDate should be preferred to DateMidnight for cases like this. Thats because in some time-zones, midnight does not occur on the date of daylight savings change &#8211; ie. time jumps from 00:00 to 01:00 with midnight never occurring. DateMidnight clearly has issues with this. LocalDate does not have a time-zone and so handles it fine.</p>
<p>Mikkel, your code ignores daylight savings time days that last 23 or 25 hours. More generally, its only really reliable if your default time-zone is UTC. If thats fine in your case, great, but please don&#8217;t pretend that the code is equivalent.</p>
]]></content:encoded>
	<feedburner:origLink>http://www.eknori.de/2012-05-09/joda-to-the-rescue/comment-page-1/#comment-4226</feedburner:origLink></item>
	<item>
		<title>Comment on Joda to the rescue by Ulrich Krause</title>
		<link>http://feedproxy.google.com/~r/CommentsForEknoride/~3/GQs5O9VECCk/</link>
		<dc:creator>Ulrich Krause</dc:creator>
		<pubDate>Fri, 11 May 2012 05:49:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.eknori.de/?p=2648#comment-4225</guid>
		<description>Thx for sharing, Mikkel. Much easier, indeed ...</description>
		<content:encoded><![CDATA[<p>Thx for sharing, Mikkel. Much easier, indeed &#8230;</p>
]]></content:encoded>
	<feedburner:origLink>http://www.eknori.de/2012-05-09/joda-to-the-rescue/comment-page-1/#comment-4225</feedburner:origLink></item>
	<item>
		<title>Comment on Joda to the rescue by Mikkel Flindt Heisterberg</title>
		<link>http://feedproxy.google.com/~r/CommentsForEknoride/~3/LbrUJKbje54/</link>
		<dc:creator>Mikkel Flindt Heisterberg</dc:creator>
		<pubDate>Thu, 10 May 2012 17:58:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.eknori.de/?p=2648#comment-4224</guid>
		<description>While Joda Time is a great library there is an easier way to accomplish what you are trying to do. Simpy remove the time component by doing a simple modulus calculation. I am not trying to be smart about it but we do this quite a lot at OnTime :) Code could look like so:

Date d = new Date();
long lngTime = d.getTime();
lngTime -= lngTime % TimeUnit.DAYS.toMillis(1);
Date dNoTime = new Date(lngTime);

The latter date object creation isn't actually necessary for the comparison. An utility function could be like so:

private boolean isSameDay(Date d1, Date d2) {
  long lngTime1 = d1.getTime();
  lngTime1 -= lngTime1 % TimeUnit.DAYS.toMillis(1);

  long lngTime2 = d2.getTime();
  lngTime2 -= lngTime2 % TimeUnit.DAYS.toMillis(1);

  return lngTime1 == lngTime2;
}

Hope it helps and it helps remove the dependency on Joda Time if that's all you're using it for. </description>
		<content:encoded><![CDATA[<p>While Joda Time is a great library there is an easier way to accomplish what you are trying to do. Simpy remove the time component by doing a simple modulus calculation. I am not trying to be smart about it but we do this quite a lot at OnTime <img src='http://www.eknori.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Code could look like so:</p>
<p>Date d = new Date();<br />
long lngTime = d.getTime();<br />
lngTime -= lngTime % TimeUnit.DAYS.toMillis(1);<br />
Date dNoTime = new Date(lngTime);</p>
<p>The latter date object creation isn&#8217;t actually necessary for the comparison. An utility function could be like so:</p>
<p>private boolean isSameDay(Date d1, Date d2) {<br />
  long lngTime1 = d1.getTime();<br />
  lngTime1 -= lngTime1 % TimeUnit.DAYS.toMillis(1);</p>
<p>  long lngTime2 = d2.getTime();<br />
  lngTime2 -= lngTime2 % TimeUnit.DAYS.toMillis(1);</p>
<p>  return lngTime1 == lngTime2;<br />
}</p>
<p>Hope it helps and it helps remove the dependency on Joda Time if that&#8217;s all you&#8217;re using it for. </p>
]]></content:encoded>
	<feedburner:origLink>http://www.eknori.de/2012-05-09/joda-to-the-rescue/comment-page-1/#comment-4224</feedburner:origLink></item>
	<item>
		<title>Comment on SSJS – @CancelPartialRefresh by Stephan H. Wissel</title>
		<link>http://feedproxy.google.com/~r/CommentsForEknoride/~3/ClNwfs0poPI/</link>
		<dc:creator>Stephan H. Wissel</dc:creator>
		<pubDate>Wed, 09 May 2012 05:03:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.eknori.de/?p=2638#comment-4223</guid>
		<description>Sweet. Keep the @ rolling</description>
		<content:encoded><![CDATA[<p>Sweet. Keep the @ rolling</p>
]]></content:encoded>
	<feedburner:origLink>http://www.eknori.de/2012-05-07/ssjs-cancelpartialrefresh/comment-page-1/#comment-4223</feedburner:origLink></item>
	<item>
		<title>Comment on Access UserBean from Java by Mark Leusink</title>
		<link>http://feedproxy.google.com/~r/CommentsForEknoride/~3/w2JtgFkJ978/</link>
		<dc:creator>Mark Leusink</dc:creator>
		<pubDate>Tue, 08 May 2012 17:45:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.eknori.de/?p=2644#comment-4222</guid>
		<description>Did you also check the source code for the UserBean? It is in the ExtLib download. The get() function is actually pretty handy and you might want to add that to every bean you create to be able to access it in Java:

public static final String BEAN_NAME = "userBean"; //name of the bean

public static UserBean get(FacesContext context) {
 UserBean bean = (UserBean)context.getApplication().getVariableResolver().resolveVariable(context, BEAN_NAME);
 return bean;
}</description>
		<content:encoded><![CDATA[<p>Did you also check the source code for the UserBean? It is in the ExtLib download. The get() function is actually pretty handy and you might want to add that to every bean you create to be able to access it in Java:</p>
<p>public static final String BEAN_NAME = &#8220;userBean&#8221;; //name of the bean</p>
<p>public static UserBean get(FacesContext context) {<br />
 UserBean bean = (UserBean)context.getApplication().getVariableResolver().resolveVariable(context, BEAN_NAME);<br />
 return bean;<br />
}</p>
]]></content:encoded>
	<feedburner:origLink>http://www.eknori.de/2012-05-08/access-userbean-from-java/comment-page-1/#comment-4222</feedburner:origLink></item>
	<item>
		<title>Comment on FollowUp: Paul Withers: Extending Themes – Custom Pager Labels by Real estate consultants gurgaon</title>
		<link>http://feedproxy.google.com/~r/CommentsForEknoride/~3/OhUhtqgZ_gs/</link>
		<dc:creator>Real estate consultants gurgaon</dc:creator>
		<pubDate>Mon, 02 Apr 2012 08:00:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.eknori.de/?p=2614#comment-4221</guid>
		<description>Your blog is perfect, and I like this article. I find the information I need.</description>
		<content:encoded><![CDATA[<p>Your blog is perfect, and I like this article. I find the information I need.</p>
]]></content:encoded>
	<feedburner:origLink>http://www.eknori.de/2012-03-02/followup-paul-withers-extending-themes-custom-pager-labels/comment-page-1/#comment-4221</feedburner:origLink></item>
</channel>
</rss>

