<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" version="2.0">

<channel>
	<title>Moving the Curve</title>
	
	<link>http://www.stevideter.com</link>
	<description>Technology, code, and thoughts by Stevi Deter</description>
	<pubDate>Mon, 20 Oct 2008 20:06:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<geo:lat>47.686300</geo:lat><geo:long>-122.096949</geo:long><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/MovingTheCurve" type="application/rss+xml" /><item>
		<title>Annotation Mapping for Ordered Lists in Hibernate</title>
		<link>http://www.stevideter.com/2008/10/20/annotation-mapping-for-ordered-lists-in-hibernate/</link>
		<comments>http://www.stevideter.com/2008/10/20/annotation-mapping-for-ordered-lists-in-hibernate/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 20:06:17 +0000</pubDate>
		<dc:creator>stevi</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[bidirectional]]></category>

		<category><![CDATA[hibernate]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[javax]]></category>

		<category><![CDATA[JPA]]></category>

		<category><![CDATA[mapping]]></category>

		<category><![CDATA[ordered list]]></category>

		<category><![CDATA[persistence]]></category>

		<guid isPermaLink="false">http://www.stevideter.com/?p=41</guid>
		<description><![CDATA[Here&#8217;s another problem that has a simple solution that took me longer than I expected to find.
I am using Hibernate 3.2.5 as my ORM. In one case, I want to map a child collection of items as an ordered List, taking advantage of the database to do my ordering. 
I&#8217;m using Annotations intead of the [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s another problem that has a simple solution that took me longer than I expected to find.</p>
<p>I am using <a title="Hibernate web site" href="http://www.hibernate.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.hibernate.org');" target="_blank">Hibernate 3.2.5</a> as my <a title="Definition of ORM" href="http://en.wikipedia.org/wiki/Object-relational_mapping" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');" target="_blank">ORM</a>. In one case, I want to map a child collection of items as an ordered List, taking advantage of the database to do my ordering. </p>
<p>I&#8217;m using Annotations intead of the hbm.xml format for my mappings in this project. Whenever possible, I&#8217;m using <a title="javax.persistence api" href="http://java.sun.com/javaee/5/docs/api/javax/persistence/package-summary.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/java.sun.com');" target="_blank">javax.persistence</a> mappings in preference too Hibernate&#8217;s annoations.</p>
<p>Referring to <a title="Java Persistence with Hibernate at amazon.com" href="http://www.amazon.com/exec/obidos/ASIN/1932394885/movithecurv-20" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.amazon.com');" target="_blank">Java Persistence with Hibernate</a>, the mapping looks quite complicated, using Hibernate&#8217;s annotations. With some experimentation, I found a simple solution, using just the javax.persistence mappings. For simplicity, I&#8217;ll show the example annotating the Item / Bid class idea we&#8217;re used to from the Hibernate Caveat Emptor example.</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.stevideter.domain</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.Serializable</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.CascadeType</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.Entity</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.Id</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.JoinColumn</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.OneToMany</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.OrderBy</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.Table</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.commons.collections.CollectionUtils</span>;
&nbsp;
@<span style="color: #003399;">Entity</span>
@Table<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ITEM&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Item <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399;">Serializable</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">long</span> serialVersionUID <span style="color: #339933;">=</span> <span style="color: #339933;">-</span>7990110946186412551L;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Integer</span> id;
  <span style="color: #000000; font-weight: bold;">private</span> List<span style="color: #339933;">&lt;</span>Bid<span style="color: #339933;">&gt;</span> bids <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>Bid<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  @Id
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Integer</span> getId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> id;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setId<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span> id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">id</span> <span style="color: #339933;">=</span> id;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @OneToMany<span style="color: #009900;">&#40;</span>cascade<span style="color: #339933;">=</span>CascadeType.<span style="color: #006633;">ALL</span><span style="color: #009900;">&#41;</span>
  @JoinColumn<span style="color: #009900;">&#40;</span>name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;itemid&quot;</span><span style="color: #009900;">&#41;</span>
  @OrderBy<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;userId,date,amount&quot;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">public</span> List<span style="color: #339933;">&lt;</span>Bid<span style="color: #339933;">&gt;</span> getBids<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> bids;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> setBids<span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>Bid<span style="color: #339933;">&gt;</span> bids<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">bids</span> <span style="color: #339933;">=</span> bids;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> addBid<span style="color: #009900;">&#40;</span>Bid bid<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>CollectionUtils.<span style="color: #006633;">isEmpty</span><span style="color: #009900;">&#40;</span>bids<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> bids <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>Bid<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;<span style="color: #009900;">&#125;</span>
    bids.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>bid<span style="color: #009900;">&#41;</span>;
    bid.<span style="color: #006633;">setItem</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> removeBid<span style="color: #009900;">&#40;</span>Bid bid<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>CollectionUtils.<span style="color: #006633;">isNotEmpty</span><span style="color: #009900;">&#40;</span>bids<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      bids.<span style="color: #006633;">remove</span><span style="color: #009900;">&#40;</span>bid<span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>
And for reference, here&#8217;s the mapping in the Bid with the Item as a parent:</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.stevideter.domain</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.Serializable</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.math.BigDecimal</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Date</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.Entity</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.Id</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.JoinColumn</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.ManyToOne</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.persistence.Table</span>;
&nbsp;
@<span style="color: #003399;">Entity</span>
@Table<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;BID&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Bid <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399;">Serializable</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">long</span> serialVersionUID <span style="color: #339933;">=</span> 8165733510722884274L;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Integer</span> id;
  <span style="color: #000000; font-weight: bold;">private</span> Item item;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Date</span> date;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">BigDecimal</span> amount;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Integer</span> userId;
&nbsp;
  @Id
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Integer</span> getId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> id;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setId<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span> id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">id</span> <span style="color: #339933;">=</span> id;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @ManyToOne<span style="color: #009900;">&#40;</span> targetEntity <span style="color: #339933;">=</span> com.<span style="color: #006633;">stevideter</span>.<span style="color: #006633;">domain</span>.<span style="color: #006633;">Item</span>.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#41;</span>
  @JoinColumn<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;itemid&quot;</span>, nullable <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">public</span> Item getItem<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> item;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setItem<span style="color: #009900;">&#40;</span>Item item<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">item</span> <span style="color: #339933;">=</span> item;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Date</span> getDate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> date;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setDate<span style="color: #009900;">&#40;</span><span style="color: #003399;">Date</span> date<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">date</span> <span style="color: #339933;">=</span> date;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">BigDecimal</span> getAmount<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> amount;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setAmount<span style="color: #009900;">&#40;</span><span style="color: #003399;">BigDecimal</span> amount<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">amount</span> <span style="color: #339933;">=</span> amount;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Integer</span> getUserId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> userId;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setUserId<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span> userId<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">userId</span> <span style="color: #339933;">=</span> userId;
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>
With this mapping, the bids collection is managed by the Item, so saving the Item automatically saves the bid collection. </p>
<p>This example does follow the JPA standard of configuration by exception, so column names, etc., that are not explicitly called out follow the default standards.</p>
<p>What has been your trickiest Hibernate or javax.persistence mapping problem? How did you solve it?</p>
<img src="http://feeds.feedburner.com/~r/MovingTheCurve/~4/426774803" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.stevideter.com/2008/10/20/annotation-mapping-for-ordered-lists-in-hibernate/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Finding selected checkbox items in a JSF dataTable</title>
		<link>http://www.stevideter.com/2008/10/09/finding-selected-checkbox-items-in-a-jsf-datatable/</link>
		<comments>http://www.stevideter.com/2008/10/09/finding-selected-checkbox-items-in-a-jsf-datatable/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 18:46:06 +0000</pubDate>
		<dc:creator>stevi</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[jsf]]></category>

		<guid isPermaLink="false">http://www.stevideter.com/?p=35</guid>
		<description><![CDATA[This is one of those problems that I couldn&#8217;t find a complete example for when I needed it, so hopefully this will save somebody else the extra time it took me to piece it together.
We frequently need to have data tables in our UI, and allow the user to select a subset of those items [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of those problems that I couldn&#8217;t find a complete example for when I needed it, so hopefully this will save somebody else the extra time it took me to piece it together.</p>
<p>We frequently need to have data tables in our UI, and allow the user to select a subset of those items for action. In JavaServer Faces, this means having a DataTable, each row having its own checkbox. But when the action is triggered, how to we find which items the user has selected.</p>
<p>The first step is to add a boolean property to your objects that can represent the selection. If you have a lot objects in your domain that will need this property, you may want to consider adding this to an interface or parent bean, otherwise, you can add it directly to your domain object. As a caveat, I don&#8217;t like adding properties to my domain objects that are for UI use only, but in this case, I&#8217;m keeping this as simple as possible. Sometimes pragmatism wins.</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.stevideter.domain</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SelectableItem <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Integer</span> id;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> name;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> selected;
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Integer</span> getId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> id;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setId<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span> id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">id</span> <span style="color: #339933;">=</span> id;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> name;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setName<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">name</span> <span style="color: #339933;">=</span> name;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isSelected<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> selected;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setSelected<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">boolean</span> selected<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">selected</span> <span style="color: #339933;">=</span> selected;
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>
In your view, you&#8217;ll use the dataTable to display the items, including the checkbox:</p>

<div class="wp_syntax"><div class="code"><pre class="jsp" style="font-family:monospace;">&lt;%@ taglib uri=&quot;http://java.sun.com/jsf/html&quot; prefix=&quot;h&quot;%&gt;
&lt;%@ taglib uri=&quot;http://java.sun.com/jsf/core&quot; prefix=&quot;f&quot;%&gt;
&nbsp;
&lt;f:view&gt;&lt;html&gt;&lt;body&gt;
&lt;h:form&gt;
&lt;h:dataTable id=&quot;itemsTable&quot; 
    value=&quot;#{SelectionBean.selectedItems}&quot; var=&quot;item&quot;  &gt;
&nbsp;
&lt;f:facet name=&quot;header&quot;&gt;
  &lt;h:outputText value=&quot;Items&quot; /&gt;
&lt;/f:facet&gt; 
&lt;h:column&gt;
  &lt;f:facet name=&quot;header&quot;&gt;
    &lt;h:outputText value=&quot;Select&quot; /&gt;
  &lt;/f:facet&gt;
  &lt;h:selectBooleanCheckbox value=&quot;#{item.selected}&quot; /&gt;
&lt;/h:column&gt;
&lt;h:column&gt;
  &lt;f:facet name=&quot;header&quot;&gt;
    &lt;h:outputText value=&quot;name&quot; /&gt;  
  &lt;/f:facet&gt; 
    &lt;h:outputText value=&quot;#{item.name}&quot;&gt;&lt;/h:outputText&gt;
&lt;/h:column&gt;
&lt;/h:dataTable&gt;
&lt;h:commandButton title=&quot;selectItems&quot; 
    value=&quot;Select Items&quot;
    actionListener=&quot;#{SelectionBean.submitSelections}&quot; /&gt;
&lt;/h:form&gt;
&lt;/body&gt;&lt;/html&gt;&lt;/f:view&gt;</pre></div></div>

<p>
Now when you click the command button to trigger the submitSelections event, the boolean values for selected items will be set, and you can iterate through your list to find the selected items and act on them as needed.</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.stevideter.BackingBean</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.faces.event.ActionEvent</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.faces.model.DataModel</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.faces.model.ListDataModel</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.stevideter.domain.SelectableItem</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.stevideter.manager.DomainManager</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SelectionBean <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> DataModel selectableItems;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">DomainManager</span> manager;
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> populateSelectableItems<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    selectableItems <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ListDataModel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    selectableItems.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>manager.<span style="color: #006633;">getSelectableItems</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> submitSelections<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    List<span style="color: #339933;">&lt;</span>SelectableItem<span style="color: #339933;">&gt;</span> items <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>SelectableItem<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span>selectableItems.<span style="color: #006633;">getWrappedData</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    List<span style="color: #339933;">&lt;</span>SelectableItem<span style="color: #339933;">&gt;</span> selectedItems <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>SelectableItem<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>SelectableItem item <span style="color: #339933;">:</span> items<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>item.<span style="color: #006633;">isSelected</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        selectedItems.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span>;
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// do what you need to do with selected items</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> DataModel getSelectableItems<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> selectableItems;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setSelectableItems<span style="color: #009900;">&#40;</span>DataModel selectableItems<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">selectableItems</span> <span style="color: #339933;">=</span> selectableItems;
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>
As you can see, this is a very simple solution. Have you seen any other approaches that work?</p>
<img src="http://feeds.feedburner.com/~r/MovingTheCurve/~4/416025898" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.stevideter.com/2008/10/09/finding-selected-checkbox-items-in-a-jsf-datatable/feed/</wfw:commentRss>
		</item>
		<item>
		<title>First actual case of bug being found</title>
		<link>http://www.stevideter.com/2008/09/09/first-actual-case-of-bug-being-found/</link>
		<comments>http://www.stevideter.com/2008/09/09/first-actual-case-of-bug-being-found/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 16:43:48 +0000</pubDate>
		<dc:creator>stevi</dc:creator>
		
		<category><![CDATA[coding life]]></category>

		<category><![CDATA[girl geeks]]></category>

		<category><![CDATA[history]]></category>

		<category><![CDATA[debugging]]></category>

		<category><![CDATA[grace hopper]]></category>

		<guid isPermaLink="false">http://www.stevideter.com/?p=30</guid>
		<description><![CDATA[On September 9, 1947, the Harvard University Mark II Aiken Relay Calculator started having problems. The operators opened it up, and discovered a moth between the points of Relay #70, in Panel F. The moth was removed at taped into the log book with the comment &#8220;First actual case of bug being found.&#8221;
When told of [...]]]></description>
			<content:encoded><![CDATA[<p>On September 9, 1947, the Harvard University Mark II Aiken Relay Calculator started having problems. The operators opened it up, and discovered a moth between the points of Relay #70, in Panel F. The moth was removed at taped into the log book with the comment <a href="http://americanhistory.si.edu/collections/object.cfm?key=35&#038;objkey=30" onclick="javascript:pageTracker._trackPageview('/outbound/article/americanhistory.si.edu');" title="Log book with bug" target="_blank">&#8220;First actual case of bug being found.&#8221;</a></p>
<p>When told of the event, <a href="http://en.wikipedia.org/wiki/Grace_hopper" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');">Grace Murray Hopper</a> was reported to have quipped they were &#8220;debugging&#8221; the machine. There is plenty of evidence the term &#8220;bug&#8221; for a flaw in electronics had been around for decades before this event, this usage helped bring it into the modern popular terminology. </p>
<p>This is also the first introduction that many of us have to Rear Admiral Hopper, a truly remarkable woman. She wrote the first compiler for an electronic computer, <a href="http://en.wikipedia.org/wiki/A-0_programming_language" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');" target="_blank" title="A-0">A-0</a>. She championed the idea that computer languages should be more like English instead of machine code. And she helped establish standards for testing systems and components. </p>
<p>The next time I have to debug a program written in a <a href="http://en.wikipedia.org/wiki/Third-generation_programming_language" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');" title="Third Generation Language" target="_blank">3GL</a>, I&#8217;ll take a moment to thank Grace Hopper for laying the groundwork that made it easier for me. Thank you, Amazing Grace!</p>
<img src="http://feeds.feedburner.com/~r/MovingTheCurve/~4/387812693" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.stevideter.com/2008/09/09/first-actual-case-of-bug-being-found/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to configure a secure JMS connection using Spring</title>
		<link>http://www.stevideter.com/2008/09/05/how-to-configure-a-secure-jms-connection-using-spring/</link>
		<comments>http://www.stevideter.com/2008/09/05/how-to-configure-a-secure-jms-connection-using-spring/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 19:13:56 +0000</pubDate>
		<dc:creator>stevi</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[spring]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[jms]]></category>

		<guid isPermaLink="false">http://www.stevideter.com/?p=29</guid>
		<description><![CDATA[In a comment to my previous post about configuring JMS via Spring, Vikas Kadam asked about configuring a connection to a secure TIBCO EMS topic or queue. As fate would have it, the next issue I dealt with was adding this to my own application. What worked for me was using Spring&#8217;s UserCredentialsConnectionFactoryAdapter as my [...]]]></description>
			<content:encoded><![CDATA[<p>In a comment to my previous post about <a title="Simplifying Spring’s JMS configuration for JndiTemplate" href="http://www.stevideter.com/2008/08/25/simplifying-spring%e2%80%99s-jms-configuration-for-jnditemplate/" >configuring JMS via Spring</a>, Vikas Kadam asked about configuring a connection to a secure TIBCO EMS topic or queue. As fate would have it, the next issue I dealt with was adding this to my own application. What worked for me was using Spring&#8217;s <a title="Spring API" href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/jms/connection/UserCredentialsConnectionFactoryAdapter.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/static.springframework.org');" target="_blank">UserCredentialsConnectionFactoryAdapter</a> as my connection factory for my JmsTemplate. The final configuration looked like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;</span>
<span style="color: #009900;">       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;propertyConfigurer&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.beans.factory.config.PropertyPlaceholderConfigurer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;location&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;file:${catalina.home}/conf/jms.properties&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;messageSender&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.stevideter.spring.jms.MessageSender&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jmsTemplate&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;jmsTemplate&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jmsTemplate&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jms.core.JmsTemplate&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;connectionFactory&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;userCredentialsConnectionFactory&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;defaultDestinationName&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${jms.defaultdestinationname}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;pubSubDomain&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${jms.istopic}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;userCredentialsConnectionFactory&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;targetConnectionFactory&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ref</span> <span style="color: #000066;">bean</span>=<span style="color: #ff0000;">&quot;topicConnectionFactory&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;username&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${jms.username}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${jms.password}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;topicConnectionFactory&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jndi.JndiObjectFactoryBean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jndiTemplate&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;jndiTemplate&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jndiName&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${jms.connectionfactory}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jndiTemplate&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jndi.JndiTemplate&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;environment&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;props<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;prop</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;java.naming.factory.initial&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
          com.tibco.tibjms.naming.TibjmsInitialContextFactory
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/prop<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;prop</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;java.naming.provider.url&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
          ${jms.jndicontexturl}
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/prop<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/props<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/beans<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/MovingTheCurve/~4/384433871" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.stevideter.com/2008/09/05/how-to-configure-a-secure-jms-connection-using-spring/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simplifying Spring’s JMS configuration for JndiTemplate</title>
		<link>http://www.stevideter.com/2008/08/25/simplifying-spring%e2%80%99s-jms-configuration-for-jnditemplate/</link>
		<comments>http://www.stevideter.com/2008/08/25/simplifying-spring%e2%80%99s-jms-configuration-for-jnditemplate/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 23:33:37 +0000</pubDate>
		<dc:creator>stevi</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[spring]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[jms]]></category>

		<category><![CDATA[jndi]]></category>

		<guid isPermaLink="false">http://www.stevideter.com/?p=28</guid>
		<description><![CDATA[I&#8217;ve spent several days, off and on, wrestling with a chicken-and-egg configuration issue.
I have an application that uses Spring 2.0 and is deployed to Tomcat 5.5. We make heavy use of Tomcat&#8217;s JNDI for configuring things like our database connections.
We&#8217;re adding JMS functionality to our application; at this point, we merely need to send events [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent several days, off and on, wrestling with a chicken-and-egg configuration issue.</p>
<p>I have an application that uses Spring 2.0 and is deployed to Tomcat 5.5. We make heavy use of Tomcat&#8217;s JNDI for configuring things like our database connections.</p>
<p>We&#8217;re adding JMS functionality to our application; at this point, we merely need to send events to an existing Tibco EMS 4.4 Topic.</p>
<p>Following the various online tutorials, I was able to use Spring to make my JMS code very lightweight. I was pretty happy with things overall, until I encountered the final problem of setting up the configuration.</p>
<p>The Tibco EMS Server provides its own JNDI services, which I need to connect to the correct topic connection factory. I can use Spring&#8217;s JndiTemplate to configure this additional JNDI connection, but I kept hitting one problem. In every environment I&#8217;m going to deploy to, the value for java.naming.provider.url will be different. Because JndiTemplate is using</p>
<p>for setting the environment, I can&#8217;t use a separate JNDI lookup to populate that value out of Tomcat&#8217;s JNDI.</p>
<p>I needed to abstract this value out of my war file, into a configuration file that can stay on each server, so I don&#8217;t have to change it every time. This is an application that gets deployed fresh each new revision, and the client wasn&#8217;t going to be happy to have to extract the war file and then edit a config file, when that&#8217;s never been needed in the past. In addition, each server we&#8217;re deploying to already has a JNDI configuration for the Tibco EMS server. But, no matter how I tried, I could not find a way to configure the Tomcat JNDI to let me access those values from the Spring configuration file within the application.</p>
<p>The solution I found that finally worked was to use a PropertyPlaceholderConfigurer that pointed to a file in the tomcat conf directory. The final hurdle I had to jump was the correct configuration. If I used property=&#8221;location&#8221; value=&#8221;${catalina.home}/conf/jms.properties&#8221;, Spring would attempt to resolve the value from the servlet container by prepending a slash in front of the catalina.home directory. If I attempted to use a relative path, tomcat wouldn&#8217;t allow me open and read the file. I finally hit on prefixing the path with &#8220;file:&#8221; which was the magic to let Spring know I meant an absolute file path.</p>
<p>I am annoyed I have to add a configuration file, but at least it&#8217;s one more place where we can set the value and forget about it for future deployments.</p>
<p>In case anybody hits this combination of problems, here&#8217;s what finally worked:</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xmlns:jee</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/jee&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;</span>
<span style="color: #009900;">       http://www.springframework.org/schema/beans </span>
<span style="color: #009900;">       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd</span>
<span style="color: #009900;">       http://www.springframework.org/schema/jee </span>
<span style="color: #009900;">       http://www.springframework.org/schema/jee/spring-jee-2.0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
           <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;propertyConfigurer&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.beans.factory.config.PropertyPlaceholderConfigurer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;locations&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>file:${catalina.home}/conf/jms.properties<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/WEB-INF/jdbc.properties<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;messageSender&quot;</span>  </span>
<span style="color: #009900;">             <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.stevideter.spring.jms.MessageSender&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jmsTemplate&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;jmsTemplate&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jmsTemplate&quot;</span> </span>
<span style="color: #009900;">              <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jms.core.JmsTemplate&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;connectionFactory&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;topicConnectionFactory&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;defaultDestinationName&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jee:jndi-lookup</span> <span style="color: #000066;">jndi-name</span>=<span style="color: #ff0000;">&quot;java:comp/env/jms/eventdestname&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;pubSubDomain&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;topicConnectionFactory&quot;</span> </span>
<span style="color: #009900;">             <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jndi.JndiObjectFactoryBean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jndiTemplate&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;jndiTemplate&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jndiName&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;FTTopicConnectionFactory&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jndiTemplate&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jndi.JndiTemplate&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
           <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;environment&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;props<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;prop</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;java.naming.factory.initial&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                            com.tibco.tibjms.naming.TibjmsInitialContextFactory
                         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/prop<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;prop</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;java.naming.provider.url&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                            ${jms.jndicontexturl}
                         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/prop<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/props<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/beans<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/MovingTheCurve/~4/374705728" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.stevideter.com/2008/08/25/simplifying-spring%e2%80%99s-jms-configuration-for-jnditemplate/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Picking the right .NET Framework Version with Specific Reference</title>
		<link>http://www.stevideter.com/2008/08/14/picking-the-right-net-framework-version-with-specific-reference/</link>
		<comments>http://www.stevideter.com/2008/08/14/picking-the-right-net-framework-version-with-specific-reference/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 17:38:02 +0000</pubDate>
		<dc:creator>stevi</dc:creator>
		
		<category><![CDATA[asp.net]]></category>

		<category><![CDATA[c#]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[visual studio]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[csharp]]></category>

		<guid isPermaLink="false">http://www.stevideter.com/?p=26</guid>
		<description><![CDATA[This morning I needed to work on a long-standing ASP.NET web application project. I haven&#8217;t had to run it locally for quite a while. I updated my source from TFS, cleaned and built the solution, and started the project in debug mode. After logging in, I went to a page, and was suddenly staring at [...]]]></description>
			<content:encoded><![CDATA[<p>This morning I needed to work on a long-standing ASP.NET web application project. I haven&#8217;t had to run it locally for quite a while. I updated my source from TFS, cleaned and built the solution, and started the project in debug mode. After logging in, I went to a page, and was suddenly staring at an unexpected and confusing exception:</p>
<pre>The base class includes the field 'ScriptManager1',
but its type (System.Web.UI.ScriptManager)
is not compatible with the type of control
(System.Web.UI.ScriptManager).</pre>
<p>
I put aside the surprise that a type was not compatible with itself, and checked the source control history. The specific page hadn&#8217;t been changed since the last time I&#8217;d tried it. I know the project is under active development, including a recent deployment of the latest version at the client site, so I had ever reason to believe the build should work. </p>
<p>Before sending a panicked email to my team, I did a quick Google search. I found a couple links of similar people with this problem in VS2008, but I&#8217;m still running VS2005. </p>
<p>I realized, however, that I had installed Framework versions 3.0 and 3.5 since I had last had to work on this project. I went to the project references, and checked that for System.Web.Extensions, and noticed that &#8220;Specific Reference&#8221; was set to false. I set this to true, rebuilt the project, and started the debugger again. </p>
<p>This time, success! The page displayed as expected. </p>
<p>What problems have you encountered from having multiple .NET Frameworks installed? </p>
<img src="http://feeds.feedburner.com/~r/MovingTheCurve/~4/364964071" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.stevideter.com/2008/08/14/picking-the-right-net-framework-version-with-specific-reference/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How did you get started in software development?</title>
		<link>http://www.stevideter.com/2008/06/24/how-did-you-get-started-in-software-development/</link>
		<comments>http://www.stevideter.com/2008/06/24/how-did-you-get-started-in-software-development/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 18:06:34 +0000</pubDate>
		<dc:creator>stevi</dc:creator>
		
		<category><![CDATA[Why I Do This]]></category>

		<category><![CDATA[coding life]]></category>

		<category><![CDATA[history]]></category>

		<category><![CDATA[questions]]></category>

		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://www.stevideter.com/?p=25</guid>
		<description><![CDATA[Michael Eaton asks: how did you get started in software development, and I&#8217;m answering. 
How old were you when you started programming? I&#8217;m another late bloomer. I remember having access to an early edition Macintosh for a short period when I was 13 or so, but it didn&#8217;t take. I didn&#8217;t really start programming until [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.michaeleatonconsulting.com/blog/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.michaeleatonconsulting.com');" title="Michael Eaton" target="_blank">Michael Eaton</a> asks: <a href="http://www.michaeleatonconsulting.com/blog/archive/2008/06/04/how-did-you-get-started-in-software-development.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.michaeleatonconsulting.com');" title="original post" target="_blank">how did you get started in software development</a>, and I&#8217;m answering. </p>
<p><strong>How old were you when you started programming?</strong> I&#8217;m another late bloomer. I remember having access to an early edition Macintosh for a short period when I was 13 or so, but it didn&#8217;t take. I didn&#8217;t really start programming until after I made my first web pages (I don&#8217;t count HTML as programming, sorry) and wanted to add some functionality to them. That would have been when I was 24 or so. </p>
<p><strong>How did you get started in programming?</strong> I like to tease my father that he could have saved a lot of money if he&#8217;d encouraged me when I first asked for a computer (shortly after the aforementioned school Macintosh). Instead I ended up getting a degree in International Politics and starting down the researcher path. Then one day I realized I was having more fun maintaining and modifying the FoxPro relational database that went along with the research than doing the research itself. I eventually decided to switch careers, first into web site design (it was all the rage in 1994!) and then into development.</p>
<p><strong>What was your first language?</strong> The first language I had any proficiency in was Perl. I had the great luck to be friends with Nat Torkington and got him a short gig helping out at the Web 1.0 site I was writing HTML for. He inspired me to look into the language and discover what it could do. </p>
<p><strong>What was the first real program you wrote?</strong> The first useful program I can remember was an overtime tracking system, written in Perl with an Informix backend. I still shudder at the memory of the sorts of loops I wrote. </p>
<p><strong>What languages have you used since you started programming?</strong> Professionally, I&#8217;ve written code in Perl, Java, JavaScript, Visual Basic, PHP and C#. I went back to school to get a Computer Information Systems degree, and learned Pascal, C, and C++ in the process, although I don&#8217;t think I can claim to have ever used those specific languages outside class. I&#8217;ve played a bit with Ruby on Rails and I&#8217;m trying to carve out more personal time to learn Haskell this year.</p>
<p><strong>What was your first professional programming gig?</strong> I lucked into a position as the developer for a tech support intranet at Adaptec, which became a proper programming position as I developed the skills. </p>
<p><strong>If you knew then what you know now, would you have started programming?</strong> Yes, and earlier, and with more rigor. </p>
<p><strong>If there is one thing you learned along the way that you would tell new developers, what would it be?</strong> Write more code. There&#8217;s no substitute for writing code and seeing what it does. Just like anything else, it&#8217;s practice that makes you better. </p>
<p>When I first started, I suffered from perfectionists disease, which often lead to the dreaded paralysis by analysis. I wanted to write the most elegant code possible. But I didn&#8217;t have the skill and experience yet to know how to write that code, and ironically held myself back a bit by not just writing code and seeing what worked and what doesn&#8217;t, and why.</p>
<p>These days, I write code at the drop of a hat. My folders are chock full of 5 and 10 line classes that do nothing but verify my understanding of basic concepts in the language. If I have a question, I write a program first to see if I can answer it. And then I truly understand how the language works. The result is I write better code.</p>
<p><strong>What&#8217;s the most fun you&#8217;ve ever had &#8230; programming?</strong> Completely refactoring an existing program. We had a Perl program that let customers submit tech support tickets into our tracking system. It was a typical example of spaghetti code, most of which I&#8217;d inherited and then made worse through my youthful bumbling. I had enough downtime that I could slowly work through the program, end to end. It was a great feeling of satisfaction, evidence of how I was learning. It wasn&#8217;t the most sophisticated program I&#8217;ve written, but it&#8217;s one of the most successful. As far as I know, that program is still in production, 10 years later.</p>
<p>So, how did you get started in programming?</p>
<img src="http://feeds.feedburner.com/~r/MovingTheCurve/~4/319062331" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.stevideter.com/2008/06/24/how-did-you-get-started-in-software-development/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Food, Fun, and Networking: Seattle Girl Geek Dinners</title>
		<link>http://www.stevideter.com/2008/05/20/food-fun-and-networking-seattle-girl-geek-dinners/</link>
		<comments>http://www.stevideter.com/2008/05/20/food-fun-and-networking-seattle-girl-geek-dinners/#comments</comments>
		<pubDate>Tue, 20 May 2008 23:17:33 +0000</pubDate>
		<dc:creator>stevi</dc:creator>
		
		<category><![CDATA[coding life]]></category>

		<category><![CDATA[fun]]></category>

		<category><![CDATA[girl geek dinners]]></category>

		<category><![CDATA[seattle]]></category>

		<guid isPermaLink="false">http://www.stevideter.com/?p=24</guid>
		<description><![CDATA[I first heard about Girl Geek Dinners a while ago, and thought it sounded like a great idea. I sent an email to the original organizers, and soon heard back. They had also just heard from Liz Morgan, another woman in the Seattle area, and suggested we join forces to organize a local group. 
And [...]]]></description>
			<content:encoded><![CDATA[<p>I first heard about <a href="http://girlgeekdinners.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/girlgeekdinners.com');" title="Girl Geek Dinners">Girl Geek Dinners</a> a while ago, and thought it sounded like a great idea. I sent an email to the original organizers, and soon heard back. They had also just heard from Liz Morgan, another woman in the Seattle area, and suggested we join forces to organize a local group. </p>
<p>And so we&#8217;re inviting all local technical women to join us for the <a href="http://www.seattlegirlgeekdinners.com/?p=1" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.seattlegirlgeekdinners.com');">First Seattle Girl Geek Dinner</a>, to be held June 24th at the Microsoft Campus in Redmond. There will be food and beverages, and hopefully a lot of fun!</p>
<p>Please check out our site, let us know if you&#8217;d like to come by signing up, and help us spread the word!</p>
<img src="http://feeds.feedburner.com/~r/MovingTheCurve/~4/294621781" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.stevideter.com/2008/05/20/food-fun-and-networking-seattle-girl-geek-dinners/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How do I find an XmlDocument Element?</title>
		<link>http://www.stevideter.com/2008/05/20/how-do-i-find-an-xmldocument-element/</link>
		<comments>http://www.stevideter.com/2008/05/20/how-do-i-find-an-xmldocument-element/#comments</comments>
		<pubDate>Tue, 20 May 2008 22:00:41 +0000</pubDate>
		<dc:creator>stevi</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[xml]]></category>

		<category><![CDATA[xmlbeans]]></category>

		<category><![CDATA[xpath]]></category>

		<guid isPermaLink="false">http://www.stevideter.com/?p=23</guid>
		<description><![CDATA[We&#8217;re using XMLBeans as part of a project. I had a document called EventConfig that had many EventDetails. I needed to find one EventDetails element based on its child element, EventName. 
Being new to XMLBeans, and in bug fixing mode, I checked the XmlObject API, and saw only that selectPath(String) took a String. I couldn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re using <a href="http://xmlbeans.apache.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/xmlbeans.apache.org');" title="Apache XMLBeans">XMLBeans</a> as part of a project. I had a document called EventConfig that had many EventDetails. I needed to find one EventDetails element based on its child element, EventName. </p>
<p>Being new to XMLBeans, and in bug fixing mode, I checked the <a href="http://xmlbeans.apache.org/docs/2.2.0/reference/org/apache/xmlbeans/XmlObject.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/xmlbeans.apache.org');">XmlObject</a> API, and saw only that selectPath(String) took a String. I couldn&#8217;t find an example of what syntax to use to do this kind of a search. </p>
<p>The answer is <a href="http://www.w3.org/TR/xpath20/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.w3.org');">XPath 2.0</a> (which is noted in the Javadoc for the method, but I didn&#8217;t understand what it meant at the time). </p>
<p>As usual, I found the W3C documentation to be a bit overwhelming. But I did find this <a href="http://www.w3schools.com/XPath/default.asp" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.w3schools.com');">XPath Tutorial</a> which gave the correct syntax for XPath Predicates, which enable us to select specific nodes. Predicates are embedded in square brackets. So for my case, I could find my EventDetails based on the EventName.</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> EventDetails findDetails<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> eventName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    EventDetails eventDetails <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span>;
    <span style="color: #003399;">String</span> queryExpression <span style="color: #339933;">=</span> 
        <span style="color: #003399;">String</span>.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">&quot;declare namespace po = 'http://www.stevideter.com/project/eventconfig';$this/po:EventInfo/EventDetails[EventName='%s']&quot;</span>,eventName<span style="color: #009900;">&#41;</span>;
    EventDetails<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> eventDetailsArray <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>EventDetails<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> EventConfig.<span style="color: #006633;">selectPath</span><span style="color: #009900;">&#40;</span>queryExpression<span style="color: #009900;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>eventDetailsArray <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> eventDetailsArray.<span style="color: #006633;">length</span> <span style="color: #339933;">&gt;</span> 0<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        eventDetails <span style="color: #339933;">=</span> eventDetailsArray<span style="color: #009900;">&#91;</span>0<span style="color: #009900;">&#93;</span>;
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">return</span> eventDetails;
<span style="color: #009900;">&#125;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/MovingTheCurve/~4/294578237" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.stevideter.com/2008/05/20/how-do-i-find-an-xmldocument-element/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Why is Microsoft Excel so popular?</title>
		<link>http://www.stevideter.com/2008/05/14/why-is-microsoft-excel-so-popular/</link>
		<comments>http://www.stevideter.com/2008/05/14/why-is-microsoft-excel-so-popular/#comments</comments>
		<pubDate>Wed, 14 May 2008 21:29:11 +0000</pubDate>
		<dc:creator>stevi</dc:creator>
		
		<category><![CDATA[coding life]]></category>

		<category><![CDATA[excel]]></category>

		<guid isPermaLink="false">http://www.stevideter.com/?p=22</guid>
		<description><![CDATA[Today we had a brainstorming meeting with the business analyst for one of our major clients. We pitched a wireframe for a workflow addition to the application.
The analyst was excited. This fell in line with a meeting she&#8217;d had earlier. The main decision there was to replace a large portion of the UI with Microsoft [...]]]></description>
			<content:encoded><![CDATA[<p>Today we had a brainstorming meeting with the business analyst for one of our major clients. We pitched a wireframe for a workflow addition to the application.</p>
<p>The analyst was excited. This fell in line with a meeting she&#8217;d had earlier. The main decision there was to replace a large portion of the UI with Microsoft Excel templates. Users don&#8217;t like the UI and want to just use the Excel spreadsheets they already have for passing data back and forth.</p>
<p>One of my co-workers sighed, &#8220;Users just like Excel. It&#8217;s got to be the most successful product ever.&#8221;</p>
<p>I&#8217;ve seen this repeatedly. I&#8217;m tasked to build a web-based UI to automate<br />
business processes. Once it goes live, I find out users don&#8217;t want to use the UI &#8212; and always seem to wish they could just use Excel instead. And businesses seem unwilling to force users to use the custom application that seemed so important six months to a year before.</p>
<p>There&#8217;s certainly a requirements gathering and design problem that&#8217;s usually fundamental to causing this problem. There&#8217;s frequently also a training problem once the application is launched.</p>
<p>But why is it always Excel that people want to hang on to? Why is it so useful that it seems to drive a huge portion of business processes in companies large and small?</p>
<p>I think a large part of its appeal is the low barrier to entry - it&#8217;s pretty easy to create a simple spreadsheet. It&#8217;s easy to learn the basics of how to add fields and other simple functions. And it&#8217;s easier to format than Word. All this despite a fairly unintuitive UI.</p>
<p>What can we learn from the high use of Excel? What can we apply from those lessons to our own applications?</p>
<img src="http://feeds.feedburner.com/~r/MovingTheCurve/~4/290456011" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.stevideter.com/2008/05/14/why-is-microsoft-excel-so-popular/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
