<?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>JkbWorld &#187; Tech</title>
	<atom:link href="http://www.jkbworld.com/category/tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jkbworld.com</link>
	<description>If you have to ask...</description>
	<lastBuildDate>Sun, 01 Jan 2012 20:01:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>JkbWorld WordPress Experiment</title>
		<link>http://www.jkbworld.com/tech/jkbworld-wordpress-experiment/</link>
		<comments>http://www.jkbworld.com/tech/jkbworld-wordpress-experiment/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 17:08:44 +0000</pubDate>
		<dc:creator>Jkb</dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.jkbworld.com/blog/?p=5</guid>
		<description><![CDATA[After a philosophical discussion with Jarrod, I determined that WordPress was at least worth a try rather than relying solely on handcrafted HTML.  So, here&#8217;s its shot. If you&#8217;re walking out in the desert, keep an eye out in case you spot a fox, or step on a scorpion! More stuff below the fold&#8230; Let&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>After a philosophical discussion with Jarrod, I determined that WordPress was at least worth a try rather than relying solely on handcrafted HTML.  So, here&#8217;s its shot.</p>
<p>If you&#8217;re walking out in the desert, keep an eye out in case you spot a fox, or step on a scorpion!</p>
<p><span id="more-5"></span>More stuff below the fold&#8230;</p>
<p>Let&#8217;s pretend we have a nice description of one of our outdoor adventures here.</p>
<p><!-- Facebook Badge START --><a style="font-family: &amp;quot;lucida grande&amp;quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3b5998; text-decoration: none;" title="Jeff Brown" onclick="_gaq.push(['_trackEvent', 'Click', 'Play', 'FaceBook Badge Click']);" href="http://www.facebook.com/people/Jeff-Brown/641706531" target="_TOP">Jeff Brown</a><br />
<a title="Jeff Brown" href="http://www.facebook.com/people/Jeff-Brown/641706531" target="_TOP"><img style="border: 0px;" src="http://badge.facebook.com/badge/641706531.2072.1278083612.png" alt="" width="120" height="173" /></a><!-- Facebook Badge END --></p>
<p>Blah blah blah, blah blah blah, blah blah blah blah-blah.  Blah blah blah,  blah blah!  Blah blah blah blah blah-blah blah blah.  Blah blah blah, blah blah blah, blah blah blah blah-blah.  Blah blah blah,  blah blah!  Blah blah blah blah blah-blah blah blah.  Blah blah blah, blah blah blah, blah blah blah blah-blah.  Blah blah blah,  blah blah!  Blah blah blah blah blah-blah blah blah.  Blah blah blah, blah blah blah, blah blah blah blah-blah.  Blah blah blah,  blah blah!  Blah blah blah blah blah-blah blah blah.</p>
<p><a onclick="javascript:pageTracker._trackEvent('LinkClick', 'MotoSport', 'http://www.motosport.com');" href="http://www.motosport.com" target="_blank">Motorcycle Helmets</a></p>
<p>
<!-- Begin Featured Gear Block -->
<style>
a.gearreview {
  font-size: 1em; 
  font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
  text-decoration: none;
}
</style>

<table width="100%" border="0" cellpadding="0">
  <th colspan="4"><img src="http://www.jkbworld.com/featuredgear/featuredgear-logo.png"></th>
  <tr>
    <td><a target="_blank" href="http://www.jkbworld.com/gear-review/gear-review-smokehouse-little-chief-electric-smoker/"><img width="100" height="100" src="http://www.jkbworld.com/featuredgear/pictures/smokehouse-little-chief-electric-smoker.png" border="0"></a></td>
    <td><a target="_blank" href="http://www.jkbworld.com/hiking/gear-review-exofficio-exo-dri-tee-shirt/"><img width="100" height="100"  src="http://www.jkbworld.com/featuredgear/pictures/exofficio-mens-exo-dri-short-sleeve-tee.png" border="0"></a></td>
    <td><a target="_blank" href="http://www.jkbworld.com/hiking/gear-review-100-hikes-in-the-central-oregon-cascades-by-william-l-sullivan/"><img width="100" height="100"  src="http://www.jkbworld.com/featuredgear/pictures/sullivan-central-oregon-cascades.png" border="0"></a></td>
    <td><a target="_blank" href="http://www.jkbworld.com/hiking/gear-review-camelbak-better-bottle/"><img width="100" height="100" src="http://www.jkbworld.com/featuredgear/pictures/camelbak-better-bottle.png" border="0"></a></td>
    <!--<td><img width="100" height="100"  src="http://www.jkbworld.com/featuredgear/pictures/merrell-phase-ii-boots.png"></td>-->
    <!--<td><img width="100" height="100"  src="http://www.jkbworld.com/featuredgear/pictures/fieldline-explorer-ii-backpack.png"></td>-->
  </tr>
  <tr>
    <td valign="top" bgcolor="#99CCFF"><a class="gearreview" target="_blank" href="http://www.jkbworld.com/gear-review/gear-review-smokehouse-little-chief-electric-smoker/">Smokehouse Little Chief Electric Smoker</a></td>    
    <td valign="top" bgcolor="#99CCFF"><a class="gearreview" target="_blank" href="http://www.jkbworld.com/hiking/gear-review-exofficio-exo-dri-tee-shirt/">Exofficio Exo Dri Tee Shirt</a></td>
    <td valign="top" bgcolor="#99CCFF"><a class="gearreview" target="_blank" href="http://www.jkbworld.com/hiking/gear-review-100-hikes-in-the-central-oregon-cascades-by-william-l-sullivan/">100 Hikes in the Central Oregon Cascades</a></td>
    <td valign="top" bgcolor="#99CCFF"><a class="gearreview" target="_blank" href="http://www.jkbworld.com/hiking/gear-review-camelbak-better-bottle/">Camelbak Better Bottle</a></td>
    <!--<td valign="top" bgcolor="#99CCFF"><a class="gearreview" target="_blank">Merrell Phase II Hiking Boots</a></td>-->
    <!--<td valign="top" bgcolor="#99CCFF"><a class="gearreview" target="_blank">Fieldline Explorer II Backpack</a></td>-->

  </tr>


  <th colspan="4"><img src="featuredgear-footer.png"></th>
</table>
<!-- End Featured Gear Block -->
</p>
<p><!--googlemap--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jkbworld.com/tech/jkbworld-wordpress-experiment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dominoes and Chessboards</title>
		<link>http://www.jkbworld.com/tech/dominoes-and-chessboards/</link>
		<comments>http://www.jkbworld.com/tech/dominoes-and-chessboards/#comments</comments>
		<pubDate>Thu, 20 Jan 2005 17:00:03 +0000</pubDate>
		<dc:creator>Jkb</dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.jkbworld.com/?p=322</guid>
		<description><![CDATA[Simulation of how to arrange dominoes on a chessboard with both corner squares cut off using Java and Recursion.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="Dominoes and Chessboards" src="http://www.jkbworld.com/content/dominoes/transboard1.png" alt="" width="138" height="138" /><strong>Dominoes and Chessboards<br />
(c) 2005 by Jkb and JkbWorld<br />
Reprinted from 01/20/2005</strong></p>
<p><strong>Introduction:</strong></p>
<p>I was reading my <a href="http://clickserve.cc-dt.com/link/click?lid=41000000028904433">Essentials of Artificial Intelligence</a> book by Ginsberg and he mentioned a problem about placing 32 dominoes neatly on a chessboard. Then, after the dominoes were placed, two opposite corner spaces were cut off the chessboard and one of the dominoes was removed. The question was now, &#8220;Can you place 31 dominoes on an 8&#215;8 chessboard with the corners cut off?&#8221;. He didn&#8217;t answer the question, leaving it as a task for the curious.</p>
<p>I knew I could simply look up the answer, but I wanted to write a program that could answer it for me. I also found a new Java library called POI that allows you to write to Excel files, so I wanted to use that at some point, too.</p>
<hr />
<span id="more-322"></span><strong>Theorizing:</strong><img class="alignright" title="Small Dominoes 1" src="http://www.jkbworld.com/content/dominoes/domsmall1.png" alt="" width="75" height="50" /></p>
<p>The next day, I mentioned this problem to my mathematician friend, Charlie. We had been debating problems that could be solved by exhausting possibilities using the computer versus solving using a mathematical formula, so when we found this problem, we decided to discuss it some more over lunch. We went up to Burger King, and talked about it. We both agreed that we should be able to reduce the problem down to a 4 x 4 chessboard, so we attempted to arrange pepper packets to simulate a 4 x 4, but were unable to find the correct arrangement to solve it. We did not have proof that an 8 x 8 or 16 x 16 could not be done, however, but we were leaning in that direction.</p>
<hr />
<strong>Testing:</strong><img class="alignright" title="Small Dominoes 2" src="http://www.jkbworld.com/content/dominoes/domsmall2.png" alt="" width="75" height="50" /></p>
<p>I wrote a program that would create an N x N, 2-dimensional array to simulate chessboards of different sizes. Basically, you would pass it a move by providing the coordinates of two squares. The program would then toggle the &#8220;empty/occupied&#8221; flag based on those coordinates. The program then built the search space by analyzing each square and reviewing the squares both to the left and right and above and below checking for empties. If it found two adjacent squares, it would add that as a possible move to the search space. Now, I initially tested a 4 x 4 and it took an incredibly long time to run. I optimized the code by removing the checks for blank squares to the left and checks for blank squares above, since the square above and square to the left would have already checked the current square.</p>
<p>I accomplished the corner cutting by making a move of (0-0-(N-1)-(N-1)), which &#8220;occupied&#8221; the opposite corners. All subsequent moves avoided these two squares. I didn&#8217;t put any input checking into the system, since the available moves are all generated from the program anyway.<br />
I noticed that in preliminary runs, more data would be stored than I could view on a screen, even by scrolling, so I decided to write the combinations the program had tried to an Excel file.</p>
<p><a href="http://www.jkbworld.com/content/dominoes/Dominoes.java.txt">Dominoes.java</a> &#8211; Code to simulate problem.</p>
<hr />
<strong>Results:</strong><img class="alignright" title="Small Dominoes 3" src="http://www.jkbworld.com/content/dominoes/domsmall3.png" alt="" width="75" height="50" /></p>
<p>My 4 x 4 analysis ran for 2 minutes (without Excel), producing no solutions. The Excel output was a flop. Because the program had to keep the Excel file in memory and continually write to the file, the memory was eaten at an alarming rate resulting in a crash caused by too small a heap size. I suppose I could tweak the JRE to get a larger heap space, but it&#8217;s not really worth it.</p>
<p>I ran one simulation (it may have been a 4 x 4 with no top-left optimizations, or an 8 x 8 with optimization) that ran for 30 hours on a Pentium 4 computer (also without Excel output) but did not produce a solution either.</p>
<p>I ran a 16 x 16 simulation on my office computer for a day and a half before killing the process because I knew it would not find a solution. I may run the program again another day just to see how long it takes to analyze the entire search space for the problem.</p>
<p>We arrived at the answer by looking at the relationship between a single domino and a chess board. When a domino is laying on a chess board, it covers up both a black and a white square. Opposite corners of a chess board are the same color, so if you cut off the black corners, you would have 30 black squares and 32 white squares. As you can see, there is no way to accomplish the task, so there was no point in continuing.</p>
<hr />
<strong>Conclusion:</strong><img class="alignright" title="Small Dominoes 1" src="http://www.jkbworld.com/content/dominoes/domsmall1.png" alt="" width="75" height="50" /></p>
<p>This was just a fun little experiment with some Java Code. No earth-shattering problems or revelations. In the end, it turned out that a little bit of logical analysis can solve this particular problem better than trying all of the different domino combinations on a chessboard.</p>
<hr />
<strong>Sources:</strong><img class="alignright" title="Small Dominoes 2" src="http://www.jkbworld.com/content/dominoes/domsmall2.png" alt="" width="75" height="50" /></p>
<p>Matthew Ginsberg, <a href="http://clickserve.cc-dt.com/link/click?lid=41000000028904433">Essentials of Artificial Intelligence</a></p>
<p>Google Search for &#8220;Dominoes on a Chessboard&#8221; &#8211; I don&#8217;t remember the exact search I did, but I found a great page that had the solution.</p>
<p><a href="http://poi.apache.org/">Apache POI (apache.org)</a><br />

<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-4929797971804321";
/* Horse Channel Ad */
google_ad_slot = "9681778462";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jkbworld.com/tech/dominoes-and-chessboards/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Jkb&#8217;s Axis Fun with Google Web Services API</title>
		<link>http://www.jkbworld.com/tech/jkbs-axis-fun-with-google-web-services-api/</link>
		<comments>http://www.jkbworld.com/tech/jkbs-axis-fun-with-google-web-services-api/#comments</comments>
		<pubDate>Mon, 10 Jan 2005 21:00:23 +0000</pubDate>
		<dc:creator>Jkb</dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.jkbworld.com/?p=166</guid>
		<description><![CDATA[Jkb&#8217;s Axis Fun with Google Web Services API (c) 2005 by Jkb and JkbWorld.com 01/10/2005 (republished 8/27/2009 because of all the linking) JkbWorld.com Introduction: The Google Web Services API is a web service that allows developers like me to learn and integrate Google&#8217;s famous search engine capabilities into applications. This webpage is an attempt to [...]]]></description>
			<content:encoded><![CDATA[<p><a name="top"></a><img src="http://www.jkbworld.com/content/googleaxis/google.gif"><img src="http://www.jkbworld.com/content/googleaxis/axis.jpg" height=75 ><br />
<small>Jkb&#8217;s Axis Fun with Google Web Services API<br />
(c) 2005 by Jkb and JkbWorld.com<br />
01/10/2005  (republished 8/27/2009 because of all the linking)<br />
<a href="http://www.jkbworld.com/">JkbWorld.com</a></small><br />
<img src=http://www.jkbworld.com/content/googleaxis/googleballs.gif alt="Graphics kindly borrowed without permission from Google..."></p>
<hr />
<p><b><u>Introduction:</u></b></p>
<p>The Google Web Services API is a web service that allows developers like me to learn and integrate Google&#8217;s famous search engine capabilities into applications.  This webpage is an attempt to capture some of the things I learned from it so that someone else might find it useful and also so I won&#8217;t forget how I did it.  Here&#8217;s my story:
<p>
<span id="more-166"></span></p>
<hr />
<p><b><u>Table of Contents:</u></b></p>
<ul>
<li><a href="#back">Background</a></li>
<li><a href="#gwsapi">Google Web Services API</a></li>
<li><a href="#apacheaxis">Apache Axis</a></li>
<li><a href="#tempconvclient">TempConversionClient</a></li>
<li><a href="#wsdl2java">WSDL2Java</a></li>
<li><a href="#casestudy">Case Study</a></li>
<li><a href="#lessonslearned">Lessons Learned</a></li>
<li><a href="#nexttime">Next Time</a></li>
<li><a href="#sources">Sources</a></li>
<li><a href="#links">Links</a></li>
</ul>
<hr /><!-- -------------------------------------------------- --></p>
<p><b><u>Background:<a name="back"></a></u></b></p>
<p>Think of &quot;Web Services&quot; as a programming language-independent way to share methods and functions with other programs.  These programs may be on the same computer, on the same network, or across the Internet.</P></p>
<p>I got involved with Web Services while trying to learn about a thing called Internet Parts Ordering (IPO), a standard put together by the AAIA (<a href="http://www.aftermarket.org">aftermarket.org</a>).  IPO is basically a way to send special orders from an auto parts store to an order processing system using the Internet.  IPO uses Web Services to do this, and I didn&#8217;t know much about Web Services, so that&#8217;s why I started playing with this stuff to see if I could figure it out and decide if I could build it or buy it for Transpro (<a href="http://www.transpro.com/">transpro.com</a>). Carquest (<a href="http://www.carquest.com/">carquest.com</a>) was the leading IPO partner for a while, so we looked at their IPO files and setup when trying to put ours together.</P></p>
<p>Ironically, the first place I looked for Web Services examples was Google.  I searched for public web services.  I figured I could find some publicly available service to talk to, write a consumer, or client, to the service and then see how it worked.  I found a few, a Web Service API for Amazon.com, National Oceanic and Atmospheric Administration (NOAA) (<a href="http://www.noaa.gov/">noaa.gov</a>) Forecase Service, and finally Google&#8217;s very own Web Service.</p>
<p>The NOAA Web Service was the first one I looked at, but I managed to confuse the hell out of myself, get frustrated with it and toss it aside. (I may make a similar page for that project in the future)  Anyway, I managed to get it to work at a basic level, but could not figure out how to get at the data so I moved on.  Amazon&#8217;s API had a ton of stuff, but I could not think of anything practical to do with it.  Finally, I found Google&#8217;s Web Services API.</p>
<p><small><small><a href="#top">Back to Top</a></small></small></p>
<hr /><!-- -------------------------------------------------- --></p>
<p><b><u>Google Web Services API:<a name="gwsapi"></a></u></b></p>
<p>Google Web Services API seemed like something useful that I could use.  I figured, I can pass it a search term, and it&#8217;ll pass back some result, right?  This made sense to me and did not sound<br />
TOO daunting a challenge.</p>
<p>Before I could use Google&#8217;s stuff, I had to sign up for a developer&#8217;s account.  Basically, this is a free account that will let me do up to 1000 queries per day.  In exchange for this free account, Google can get me hooked on queries so that one day I might purchase a license that will let me embed Google into an application and sell it and let Google make money, etc.  Click the Google link way down at the bottom to learn more about it.</p>
<p>Once I got my license key, I downloaded the API and started looking at the files.  Basically, Google provided several things.  First, they provided a Web Services Description Language, or WSDL file (see link below).  This file describes in simple, computer language-independent terms, the names of functions, their parameters and return values.  They also provided nice Java and C# packages that can allow you to simply and easily connect the Google functionality<br />
into your program.  Lastly, they provided API documentation and Readme files and lots of other great stuff.</p>
<p>I thought about how to use these new toys that Google had given me, and decided to work with the WSDL file. I figured, since I would not get a nice Java package for IPO (Thanks a lot, Carquest and AAIA), I should work with the WSDL so I wouldn&#8217;t need to learn it again.  Carquest&#8217;s IPO implementation only provided the WSDL, so<br />
I was determined to build a Web Services Client with just the WSDL file.  But how?</p>
<p><a href="http://www.jkbworld.com/content/googleaxis/GoogleSearch.wsdl">GoogleSearch.wsdl</a></p>
<p><small><small><a href="#top">Back to Top</a></small></small></p>
<hr /><!-- -------------------------------------------------- --></p>
<p><b><u>Apache Axis:<a name="apacheaxis"></a></u></b></p>
<p>I searched around for another hour or two looking for a way to get from a WSDL file to a Web Service with no success.  I was about to give up, when that very day, I got my issue of Dr. Dobb&#8217;s Journal (<a href=http://www.ddj.com>ddj.com</a>) and the featured article was &#8220;Building Web Services with Apache Axis&#8221;.  It was a well-written article other than the fact that not a single link from the article worked.  It described how simple it was to write a Java web service and deploy it using this nifty Tomcat servlet-based framework called Axis, by the Jakarta project.  I knew that I would need to download, install and learn about Axis.</p>
<p>Initially, getting Axis to work was a challenge.  I had just installed Java Development Kit 1.5, and it did not occur to me right away that the Stable version of Axis 1.1 would not work with it.  After searching<br />
around on the Internet and some mailing lists, I discovered that you need Axis 1.2 RC1!  Then, I discovered that if you have the Tomcat Security Manager enabled, Axis won&#8217;t work.  You also need to make sure that the Axis directory and files under the Tomcat root are owned by the Tomcat user.</P></p>
<p>Once Axis is installed, you need to run the happyaxis.jsp page, which then reviews the classpaths and Java libraries in them, suggesting ones that are mandatory for Axis to work, and recommending others to add additional functionality to your implementation.  Some of the JAR files are <b>activation.jar, commons-discovery.jar, commons-logging.jar, gnumail.jar, xerces.jar, jaxrpc.jar</b> and others.  As you add the many JARs to the classpath, restart Tomcat and view the happyaxis.jsp, your Axis installation becomes more and more happy, until it is reported<br />
that all of the dependencies and recommendations are met.  At this point, you are ready to use Axis.</p>
<p>The Dr. Dobb&#8217;s article was pretty good, since it explained exactly what I needed to do in reasonably simple terms and steps.  Basically, the article was like &#8220;First, you write some methods in a file, name it a .jws file instead of a .java file, and place it in the Axis tree.  Oh yeah.  That&#8217;s it, you&#8217;re done.&#8221;  The simplicity of it was so mind blowing, I thought I must&#8217;ve made a mistake somewhere.  But I didn&#8217;t.  I had a nice little web service from the article that converted Fahrenheit to Celcius and back (See TemperatureConversion.jws below).<br />
Then, I continued experimenting and wrote one on my own that returned modifications to a String (StringReturn.jws).<br />
I thought to myself &#8220;Web Services are Easy!&#8221;.  Little did I know that the Web Services gods were watching me&#8230; and they were angry.</p>
<p><font color=#0000FF>Dr. Dobb&#8217;s Article</font><br />
<a href="http://www.jkbworld.com/content/googleaxis/TemperatureConversion.jws">TemperatureConversion.jws</a><br />
<a href="http://www.jkbworld.com/content/googleaxis/StringReturn.jws">StringReturn.jws</a></p>
<p><small><small><a href="#top">Back to Top</a></small></small></p>
<hr /><!-- -------------------------------------------------- --></p>
<p><b><u>TempConversionClient:<a name="tempconvclient"></a></u></b></p>
<p>I did mention the TempConversionClient web service from the article, so I guess it&#8217;s helpful if I put the client code out here.  I used Ant (<a href="http://ant.apache.org">ant.apache.org</a>) to compile and execute the web service.  You&#8217;ll notice the build.xml file, too, which has the Axis JAR&#8217;s and dependencies in the Ant<br />
classpath.  Then, I battled and fought with log4j.properties for a while, too, but I don&#8217;t remember if I needed it for this example.  If not, what the heck, that&#8217;s what a log4j.properties file looks like.</p>
<p>
<a href="http://www.jkbworld.com/content/googleaxis/TempConversionClient.java.txt">TempConversionClient.java</a><br />
<a href="http://www.jkbworld.com/content/googleaxis/TCC_build.xml">build.xml</a><br />
<a href="http://www.jkbworld.com/content/googleaxis/log4j.properties">log4j.properties</a>
</p>
<p><small><small><a href="#top">Back to Top</a></small></small></p>
<hr /><!-- -------------------------------------------------- --></p>
<p><b><u>WSDL2Java:<a name="wsdl2java"></a></u></b></p>
<p>Okay&#8230; I&#8217;m getting off on a tangent with the TemperatureConversion web service and TempConversionClient<br />
client.  Back to my Google story:</p>
<p>Once I had Axis going and was happy because I figured out Web Services, I started looking into getting from a WSDL file to a Java program.  I think my google query was something like &#8220;Axis WSDL Java&#8221;.  I got a set of results including a nice little utility called WSDL2Java.</p>
<p>WSDL2Java is an Axis utility that uses the specifications defined in the WSDL file to create the Java Classes needed to use a web service.  It sets up the methods of the web service interfaces based on how<br />
they are defined in the WSDL.</P></p>
<p>Here are the files created using the WSDL2Java:</p>
<ul>
<li><a href="http://www.jkbworld.com/content/googleaxis/googlesearch/DirectoryCategory.java.txt"> DirectoryCategory.java</a></li>
<li><a href="http://www.jkbworld.com/content/googleaxis/googlesearch/GoogleSearchBindingStub.java.txt"> GoogleSearchBindingStub.java</a></li>
<li><a href="http://www.jkbworld.com/content/googleaxis/googlesearch/GoogleSearchPort.java.txt"> GoogleSearchPort.java</a></li>
<li><a href="http://www.jkbworld.com/content/googleaxis/googlesearch/GoogleSearchResult.java.txt"> GoogleSearchResult.java</a></li>
<li><a href="http://www.jkbworld.com/content/googleaxis/googlesearch/GoogleSearchService.java.txt"> GoogleSearchService.java</a></li>
<li><a href="http://www.jkbworld.com/content/googleaxis/googlesearch/GoogleSearchServiceLocator.java.txt"> GoogleSearchServiceLocator.java</a></li>
<li><a href="http://www.jkbworld.com/content/googleaxis/googlesearch/ResultElement.java.txt"> ResultElement.java</a></li>
</ul>
<p>Once created, you simply need to create the client that uses them.</p>
<p><small><small><a href="#top">Back to Top</a></small></small></p>
<hr /><!-- -------------------------------------------------- --></p>
<p><b><u>Case Study:<a name="casestudy"></a></u></b></p>
<p>After creating the Java files using WSDL2Java, I was not quite sure where to start.  I did some more searching around and discovered a very straightforward example on how to create the Google Web Service consumer on Bawsug.  You might notice my GoogleClient.java program looks similar to Bawsug&#8217;s.  That&#8217;s probably because I was influenced.  Ah well.</P></p>
<p>Once Bawsug pointed me in the right direction, I implemented a Spelling Suggestions check of some test data, which seemed to work reasonably well.  I also implemented a search, which produced the search results as expected.  It seemed just as simple as the original TemperatureConversion web service!</p>
<p>I decided that the little experiments were fun, but not very interesting.  I decided to create a program that would perform a Google search, format, and report back the results for &quot;Jkb&quot; and &quot;Jkb World&quot; in an HTML Page.  I guess I&#8217;m vain, but then I could use this as a crazy link on my<br />
website.</P></p>
<p>See the Java code for yourself down below.  It&#8217;s not difficult at all to follow.  You&#8217;ll also see the Ant script to compile and execute it, too.  I actually cheated and took my original TempConversionClient<br />
build.xml file and modified it.  I even left the TempConversionClient lines in as &#8220;examples&#8221;.  I know&#8230; I&#8217;m lazy.</p>
<p>When using the WSDL2Java-generated code, there are two important lines that you need to have before you call the web service.  These lines are:</p>
<p><quote><br />
GoogleSearchService service = new GoogleSearchServiceLocator();<br />
GoogleSearchPort google = service.getGoogleSearchPort();<br />
</quote></p>
<p>Similar to a Factory, you get a new instance of a GoogleSearchService from the Locator, which goes out and finds<br />
the GoogleSearchService from the Web Service endpoint&#8217;s server.  Next, you connect the GoogleSearchPort to the service by telling the service to give you an instance.  Once completed, you have your link to the web service, and can then call the methods of it.  I put a link to a WSDL Tutorial in the Sources section, which describes how WSDL and Web Services work.  You will understand what Services and Ports do from reading it.</p>
<p><a href="http://www.jkbworld.com/content/googleaxis/googlesearch/GoogleClient.java.txt">GoogleClient.java</a><br />
<a href="http://www.jkbworld.com/content/googleaxis/googlesearch/build.xml">build.xml</a></p>
<p><small><small><a href="#top">Back to Top</a></small></small></p>
<hr /><!-- -------------------------------------------------- --></p>
<p><b><u>Lessons Learned:<a name="lessonslearned"></a></u></b></p>
<p>Once I successfully got my GoogleClient web service consumer to work, understood how WSDL2Java worked, and seemed generally comfortable with the way Web Services worked, I talked to a guy over in the Carquest web commerce department, who explained that the SOAP-RPC, or SOAP Remote Procedure Call, technique that I<br />
was using was deprecated, and that the industry had moved on to Document Literals and that SOAP-RPC was being removed from the Web Services specifications.  Now, I have not searched for whether or not it was being discontinued, particularly since I now had a handle on it and also I suspected that they were blowing smoke, since they have some kind of deal where you can pay them to develop it.  But the Web Services Gods had cursed this particular effort by introducing some doubt to the implementation.</p>
<p>The Google Web Services API utilizes SOAP-RPC.  SOAP-RPC basically works like a regular function call, the web service function gets passed parameters, and the result is of a known type.  Other types of web services use a technique called Document Literal, where the result instead of a known type is a document that can be of any type.  Knowing what I do at this point in time, I would say that Document Literal is the main way web services exchange data.  Using a web service function like a SOAP-RPC call is a way of utilizing the web services API at a higher level.</p>
<p>Of course, time will tell, and as I experiment more with this technology, the more I will learn and understand about it.</p>
<p><small><small><a href="#top">Back to Top</a></small></small></p>
<hr /><!-- -------------------------------------------------- --></p>
<p><b><u>Next Time:<a name="nexttime"></a></u></b></p>
<p>My next Web Services installment will cover Document Literals.  I was learning a little about SOAP and Java when I got the book &#8220;Java and SOAP&#8221; and wrote a simple Web Service client to pull data from the National Weather Service Digital Forecasts.  Of course, this took place even before I started playing with Axis. When I discovered how Axis worked, and what a Document Literal was supposed to be, I revisited this program, and figured out how to get at the data stored in the Literal Document, and pull and manipulate the data.</p>
<p><small><small><a href="#top">Back to Top</a></small></small></p>
<hr />
<p><b><u>Sources:<a name="sources"></a></u></b></p>
<p>The Google Web Services API information can be found at:<br /><a href="http://www.google.com/apis/">http://www.google.com/apis/</a></p>
<p>The Apache Axis information can be found at:<br /><a href="http://ws.apache.org/axis/">http://ws.apache.org/axis/</a></p>
<p>Here is the Bay Area Web Services User Group (BAWSUG) page I followed when I was learning the WSDL2Java:<br />http://www.bawsug.org/archives/000008.html  <b>Sorry, Dead Link</b></p>
<p>This is a W3Schools (<a href="http://www.w3schools.com">w3schools.com</a>) WSDL Tutorial:<br /><a href="http://www.w3schools.com/wsdl/default.asp">http://www.w3schools.com/wsdl/default.asp</a></p>
<p><small><small><a href="#top">Back to Top</a></small></small></p>
<hr />
<p><b><u>Links:<a name="links"></a></u></b></p>
<p>CS 633/733 Grid Computing at University of Alabama linked to us from their Syllabus at:<br /><a href="http://www.cis.uab.edu/cs633/spring2006/">http://www.cis.uab.edu/cs633/spring2006/</a></p>
<p><img src=http://www.jkbworld.com/content/googleaxis/googleballs.gif alt="Graphics kindly borrowed without permission from Google..."></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jkbworld.com/tech/jkbs-axis-fun-with-google-web-services-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Triangle Peg Solitaire</title>
		<link>http://www.jkbworld.com/tech/triangle-peg-solitaire/</link>
		<comments>http://www.jkbworld.com/tech/triangle-peg-solitaire/#comments</comments>
		<pubDate>Sun, 26 Sep 2004 13:30:11 +0000</pubDate>
		<dc:creator>Jkb</dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.jkbworld.com/?p=333</guid>
		<description><![CDATA[Jkb's Triangle Peg Solitaire simulation.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" title="Triangle Peg Solitaire" src="http://www.jkbworld.com/content/pegboard/triangle.jpg" alt="" width="200" height="200" /></p>
<hr /><strong>Introduction:</strong></p>
<p>This is a reprint from 2004 where I wrote a variation of the Triangle Peg Solitaire game that can be played online from a <a href="http://en.wikipedia.org/wiki/Nuts_(Talker)" target="_blank">NUTS</a> talker.  Then, as part of my Artificial Intelligence class, or maybe just for fun&#8211;I don&#8217;t remember&#8211;I wrote a program using recursion to find the solution and then find out how many solutions there are to this puzzle.</p>
<p><span id="more-333"></span><strong><span style="text-decoration: underline;">History:</span></strong></p>
<p>Triangle Peg Solitaire (seen in picture above) has been around for a while.<br />
My first experience with it occurred long ago when my Grandmother and Grandfather Brown brought me one of these games.  They are easily made from wood and golf tees, so they probably picked it up, cheap.  Basically, you start with an empty hole and jump pegs until there is only one peg left.  If you would like to play one of these games, but don&#8217;t want one of your own, they have the games on the tables at Cracker Barrel restaurants.</p>
<p><strong><span style="text-decoration: underline;">PegBoard Program:</span></strong></p>
<p>I labeled all of the holes A through O, and named combinations of three pegs (the jumper&#8217;s original hole, the peg being jumped and the ending hole) as moves.  I modeled this and then wrote a C++ class to represent a board with holes.  There were booleans that indicated whether there was a peg hole or not.  Next, I produced some output functions to draw a picture of the peg board.  Then, some functions that handled the moves and produced the history of moves made.  Finally, I made the program store and produce a pegboard score based on the pegs left behind.</p>
<p><strong><span style="text-decoration: underline;">Recursion:</span></strong></p>
<p>Now that I had a working PegBoard program to play Triangle Peg Solitaire, I remembered a story told by my Artificial Intelligence professor, Dr. Adams, in 2003 and how a relation of his was asked to write a program to solve something about this game.  I figured it would be a good idea to make my program count the number of ways to leave just one peg.  I added an additional function that would replay a history of moves so i could pass a recursing object the history file and start from the same point.  Then, using the set of &#8220;resulting available moves&#8221;, I used the old recursion saying &#8220;Work on the CAR, Recurse with the CDR&#8221;.  I pulled off the first move and recursed the rest.</p>
<hr /><span style="color: #ff0000;">Okay, unfortunately, when the hard drive for the server crashed, so did all my PegBoard stuff.  I was able to recover some of the stuff from my &#8220;backups&#8221; and from the Google cache.  I re-linked the files and all as you can see, but this page is not complete.  When time permits or inspiration hits, I may come back to this and fix it up, but unfortunately, I&#8217;ve got other projects that need time.  Feel free to email me or contact me if you want more information on this project though and I&#8217;ll try to help you out, but unless there&#8217;s some demand, this page is going to stay in its current form.</span></p>
<hr /><strong><span style="text-decoration: underline;">Results:</span></strong></p>
<p>I said in this section that there were 438,984 possible solutions,<span style="text-decoration: line-through;"> all of which are listed in the attached text file.</span></p>
<p>Here are some of the files that I was able to recover:</p>
<ul>
<li><a href="http://www.jkbworld.com/content/pegboard/PegBoard.cpp.txt">PegBoard.cpp</a> Triangle Peg Solitaire Code</li>
<li>http://rec-puzzles.org/new/sol.pl/competition/games/peg.solitaire Dead Link to someone else&#8217;s page.  I don&#8217;t remember why I linked to this guy, but I did.</li>
</ul>
<hr /><strong><span style="text-decoration: underline;">NUTS Talker Pegboard:</span></strong></p>
<p>Here is some <a href="http://en.wikipedia.org/wiki/Nuts_(Talker)" target="_blank">NUTS</a> 2.3 Talker code for Triangle Peg Solitaire:</p>
<p><a href="http://www.jkbworld.com/content/pegboard/pegnuts.txt">Pegnuts.txt</a></p>
<hr /><strong><span style="text-decoration: underline;">Conclusion:</span></strong></p>
<p>Unfortunately, most of the page is gone.  But you get the general idea.  Map the search space and then blind search through the whole thing until you get a result.</p>
<p align="center">
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-4929797971804321";
/* Horse Channel Ad */
google_ad_slot = "9681778462";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
</p>
<p align="center">
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-4929797971804321";
/* Horse Channel Ad */
google_ad_slot = "9681778462";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
</p>
<p align="center">
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-4929797971804321";
/* Horse Channel Ad */
google_ad_slot = "9681778462";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jkbworld.com/tech/triangle-peg-solitaire/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

