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

<channel>
	<title>Kris Neuharth&#039;s Blog</title>
	<atom:link href="http://www.krisneuharth.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.krisneuharth.com</link>
	<description>Life, musings, code and adventure</description>
	<lastBuildDate>Sun, 17 Jan 2010 22:04:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Finding Your Django Version</title>
		<link>http://www.krisneuharth.com/2010/01/17/finding-your-django-version/</link>
		<comments>http://www.krisneuharth.com/2010/01/17/finding-your-django-version/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 21:58:15 +0000</pubDate>
		<dc:creator>Kris Neuharth</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.krisneuharth.com/?p=31</guid>
		<description><![CDATA[When just starting a new Django project I wanted to double-check what version I currently had installed on my development machine. To do this, open a console of your choice and execute the following command:

django-admin.py --version

]]></description>
			<content:encoded><![CDATA[<p>When just starting a new Django project I wanted to double-check what version I currently had installed on my development machine. To do this, open a console of your choice and execute the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">django-admin.py --version</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.krisneuharth.com/2010/01/17/finding-your-django-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Meet Lucy</title>
		<link>http://www.krisneuharth.com/2008/09/06/meet-lucy/</link>
		<comments>http://www.krisneuharth.com/2008/09/06/meet-lucy/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 00:00:52 +0000</pubDate>
		<dc:creator>Kris Neuharth</dc:creator>
				<category><![CDATA[dog]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[labrador]]></category>
		<category><![CDATA[Lucy]]></category>

		<guid isPermaLink="false">http://www.krisneuharth.com/?p=21</guid>
		<description><![CDATA[This post is a little late, but getting a new puppy is a big undertaking and I have not had the time to post pictures of her yet except to Flickr.
Two weeks ago we decided that now is a good time to rescue a dog because Christine is not yet working and has time to [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a little late, but getting a new puppy is a big undertaking and I have not had the time to post pictures of her yet except to Flickr.</p>
<p>Two weeks ago we decided that now is a good time to rescue a dog because Christine is not yet working and has time to help out. We initially went to a shelter looking for a lab puppy that was advertised on their website but instead we fell in love with this face:</p>
<p><img class="aligncenter" src="http://farm4.static.flickr.com/3102/2803068571_55b5c5270e.jpg" alt="Lucy and Christine" /></p>
<p>She is a yellow Labrador Retriever mix of some sort and approximately 6 months old and 35 pounds. She was perfect! We were told that we would be second on the waiting list for her and to come the very next day at 10am and if the other family wasn&#8217;t there on time, that she would be ours. We came back the next day and she was ours, but we had to wait a few days for her to get spayed and checked out by the vet. We spent the rest of the weekend running around town buying things we would need for the new member of the family.</p>
<p><img class="aligncenter" src="http://farm4.static.flickr.com/3153/2824322946_2b1af8de44.jpg" alt="Lucy in her bed" /></p>
<p>We nervously waited the next few days until we could go pick her up and bring her home with us. With such a sweet face and mellow disposition, we decided to call her Lucy since we didn&#8217;t know her first name. When we brought her home the first night, we slept on the floor with her in the living room since the crate we bought for her wasn&#8217;t quite big enough. After the first day she did not seem like she was feeling too well and began to exhibit some strange behaviors, namely deep sleeping and shallow breathing, and a terrible runny nose and cough. We took her to an emergency vet and they told us that we was running a high fever and had a sinus infection, pneumonia, and possible complications with her spay surgery. Yikes!</p>
<p><img class="aligncenter" src="http://farm4.static.flickr.com/3014/2803916002_188c56581e.jpg" alt="Lucy and Christine on a walk" /></p>
<p>They admitted her to the animal hospital and kept her for the Labor Day weekend and put her on an IV for antibiotics to help with her infections. She came home Tuesday evening and looked a lot better but still had the runny nose, but a much wagglier tail. She has been a pretty good dog so far, she loves her new people and has learned a lot already. We think that she has had some training because she is housebroken and understands some basic commands. She hates her new, larger crate and cries and barks when we put her in it for the night. She is still adjusting to being home we think and has some separation anxiety when she is left alone.</p>
<p><img class="aligncenter" src="http://farm4.static.flickr.com/3187/2803916078_867989e749.jpg" alt="Me and Lucy" /></p>
<p>She is learning how to play with her various toys, it seems like her previous owner did not play with her much at all. She is learning how to be a Labrador and is catching on to playing fetch and tug-o-war nicely. Soon we hope to be able to work up to frisbee.</p>
<p><img class="aligncenter" src="http://farm4.static.flickr.com/3040/2824322874_e1c4ce827b.jpg" alt="Lucy gnawing on her bone" /></p>
<p>We are very excited about having her in the family and we hope you can all meet her &#8220;in the fur&#8221; sometime soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.krisneuharth.com/2008/09/06/meet-lucy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding Combinations Using Java</title>
		<link>http://www.krisneuharth.com/2008/01/13/java-combinations/</link>
		<comments>http://www.krisneuharth.com/2008/01/13/java-combinations/#comments</comments>
		<pubDate>Sun, 13 Jan 2008 14:04:19 +0000</pubDate>
		<dc:creator>Kris Neuharth</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.krisneuharth.com/?p=14</guid>
		<description><![CDATA[For a recent project at work I needed to generate all of the possible combinations of config parameters to be used in a parameter sweeping tool. We are using this tool to tune our software. When I first wrote the tool, the number of parameters was not changing so I could use the standard nested [...]]]></description>
			<content:encoded><![CDATA[<p>For a recent project at work I needed to generate all of the possible combinations of config parameters to be used in a parameter sweeping tool. We are using this tool to tune our software. When I first wrote the tool, the number of parameters was not changing so I could use the standard nested for-loop approach to iterate through all the lists of sweepable parameters and obtain all of the possible combinations easily.</p>
<p>In an effort to make the tool more flexible I needed to find a more dynamic way to iterate through all of the lists without the hard coded for-loops. I made some effort on my own but couldn&#8217;t produce the desired results fast enough. This seemed like a common enough problem that someone in the Java community may have already solved and published a solution for. Countless Google searches turned up only posts to development forums seeking the same answer I was.</p>
<p>Since I have been experimenting with Python off and on for the last year I decided to broaden my search to include the Python community. I quickly came across this <a href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/84739"> example. </a> The original author and commenters on that article present several approaches that leverage Python&#8217;s functional programming features which Java is begrudgedly unable to replicate. There was an example that looked like it could be ported to meet my needs because it was more straight forward and didn&#8217;t make use of Python&#8217;s bells and whistles.</p>
<p>Python code:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Title: N-dimensional loop iterator</span>
<span style="color: #808080; font-style: italic;">#Submitter: Philip Nunez</span>
<span style="color: #808080; font-style: italic;">#Last Updated: 2001/11/01</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Description:</span>
<span style="color: #808080; font-style: italic;">#Do nested for loops on an arbitrary list of iterable things.</span>
<span style="color: #808080; font-style: italic;">#Found at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/84739</span>
<span style="color: #ff7700;font-weight:bold;">class</span> nloop:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>,<span style="color: #66cc66;">*</span>varg<span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: #008000;">list</span> = <span style="color: #008000;">list</span><span style="color: black;">&#40;</span>varg<span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">iter_list</span> = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
&nbsp;
        <span style="color: #008000;">self</span>.<span style="color: black;">memo</span> = <span style="color: black;">&#91;</span><span style="color: #008000;">None</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">*</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: #008000;">list</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: #008000;">list</span><span style="color: black;">&#41;</span>:
            <span style="color: #008000;">self</span>.<span style="color: black;">n_iter</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #008000;">self</span>.<span style="color: #008000;">list</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__getitem__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>,index<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">iter_list</span><span style="color: black;">&#91;</span>index<span style="color: black;">&#93;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> n_iter<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>,index,stack<span style="color: black;">&#41;</span>:
        x = stack<span style="color: black;">&#91;</span>index<span style="color: black;">&#93;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> x:
            <span style="color: #008000;">self</span>.<span style="color: black;">memo</span><span style="color: black;">&#91;</span>index<span style="color: black;">&#93;</span> = i
            <span style="color: #ff7700;font-weight:bold;">if</span> index == <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>stack<span style="color: black;">&#41;</span> - <span style="color: #ff4500;">1</span>:
                <span style="color: #008000;">self</span>.<span style="color: black;">iter_list</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #008000;">tuple</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">memo</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">else</span>:
                <span style="color: #008000;">self</span>.<span style="color: black;">n_iter</span><span style="color: black;">&#40;</span>index + <span style="color: #ff4500;">1</span>, stack<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    <span style="color: #ff7700;font-weight:bold;">for</span> tup <span style="color: #ff7700;font-weight:bold;">in</span> nloop<span style="color: black;">&#40;</span><span style="color: #008000;">list</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;abc&quot;</span><span style="color: black;">&#41;</span>,
                     <span style="color: #008000;">list</span><span style="color: black;">&#40;</span><span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
                     <span style="color: #008000;">list</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;def&quot;</span><span style="color: black;">&#41;</span>,
                     <span style="color: #008000;">list</span><span style="color: black;">&#40;</span><span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">5</span>,<span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
                     <span style="color: #008000;">list</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;xyz&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> tup</pre></div></div>

<p>While Java doesn&#8217;t natively support the Python tuple data type, it looked easy enough to port to Java and begin using in my application. Without much trouble I was able to get a version working in Java that accomplished exactly what I needed to. I wrote it in a very generic way that attempted to mimic the Python code as closely as possible.</p>
<p>It is important to mention that I was generating the combinations from lists containing only strings. In order to use this code with other data types more work will probably need to be done. This code is obviously not the best and uses untyped collections but it was good enough for me for this particular tool.</p>
<p>Java code:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.krisneuharth.examples</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
&nbsp;
@SuppressWarnings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;unchecked&quot;</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Author: Kris Neuharth</span>
<span style="color: #666666; font-style: italic;">// Ported directly from Python source found at:</span>
<span style="color: #666666; font-style: italic;">// http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/84739</span>
<span style="color: #666666; font-style: italic;">// Tried to keep it as close to the original and generic as possible</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LoopIterator
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Initialize generic lists</span>
	<span style="color: #003399;">List</span> list<span style="color: #339933;">;</span>
	<span style="color: #003399;">List</span> iter_list<span style="color: #339933;">;</span>
	<span style="color: #003399;">List</span> memo<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Constructor</span>
	<span style="color: #000000; font-weight: bold;">public</span> LoopIterator<span style="color: #009900;">&#40;</span><span style="color: #003399;">List</span> lol<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Initialize lists</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">list</span> <span style="color: #339933;">=</span> lol<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">iter_list</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Find number of expected values</span>
		<span style="color: #000066; font-weight: bold;">int</span> expected <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> list <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">list</span><span style="color: #009900;">&#41;</span>
			expected <span style="color: #339933;">*=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">List</span><span style="color: #009900;">&#41;</span>list<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Test</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>-- Loop Iterator --&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Size: &quot;</span> <span style="color: #339933;">+</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">list</span>.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Contents: &quot;</span> <span style="color: #339933;">+</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">list</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Expected Combinations: &quot;</span> <span style="color: #339933;">+</span> expected <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Create buffer as big as list of lists, init elements to null</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">memo</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> ii <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> ii <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">list</span>.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> ii<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">memo</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>ii, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If the list of lists has more than one list,</span>
		<span style="color: #666666; font-style: italic;">// process it</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">list</span>.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
			n_iter<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Recursive method to generate combinations from all lists</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> n_iter<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index, List<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> stack<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">List</span> x <span style="color: #339933;">=</span> stack.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>index<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> i <span style="color: #339933;">:</span> x<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;">memo</span>.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span>index, i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>index <span style="color: #339933;">==</span> stack.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
				<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">iter_list</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">memo</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">else</span>
				<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">n_iter</span><span style="color: #009900;">&#40;</span>index <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span>, stack<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Utility method to display the combinations</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> display<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> ii <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> str <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">iter_list</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ii<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span>  str.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Utility method to get the list of combinations for further</span>
	<span style="color: #666666; font-style: italic;">// processing</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">List</span> getCombinations<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> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">iter_list</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Driver</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Create data</span>
		<span style="color: #003399;">List</span> list1 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list1.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list1.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;b&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list1.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;c&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003399;">List</span> list2 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list2.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list2.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list2.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;3&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003399;">List</span> list3 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list3.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;w&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list3.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;x&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list3.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;y&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003399;">List</span> list4 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list4.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;4&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list4.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;5&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		list4.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;6&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Create list of lists</span>
		<span style="color: #003399;">List</span> lol <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		lol.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>list1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		lol.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>list2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		lol.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>list3<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		lol.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>list4<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Create loop iterator</span>
		LoopIterator li <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LoopIterator<span style="color: #009900;">&#40;</span>lol<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Display results</span>
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> obj <span style="color: #339933;">:</span> li.<span style="color: #006633;">getCombinations</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>
			<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> oj <span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#41;</span>obj<span style="color: #009900;">&#41;</span>
				<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span>oj <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I hope this was helpful to anyone else looking for a way to do this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.krisneuharth.com/2008/01/13/java-combinations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
