<?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>KekoaLand</title>
	<atom:link href="http://blog.kekoav.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kekoav.com</link>
	<description>Random topics covering anything involving software development</description>
	<lastBuildDate>Fri, 26 Feb 2010 06:25:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>A clean slate</title>
		<link>http://blog.kekoav.com/2010/02/25/a-clean-slate/</link>
		<comments>http://blog.kekoav.com/2010/02/25/a-clean-slate/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 05:36:24 +0000</pubDate>
		<dc:creator>kekoav</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://blog.kekoav.com/?p=5</guid>
		<description><![CDATA[It&#8217;s about time I cleaned house and started new with my website and blog. I have thought about how I&#8217;m going to do this, so here&#8217;s the plan. I will not be moving all my old blog articles over, however, a few articles of a more lasting relevance will be pulled over by hand.&#160; I [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s about time I cleaned house and started new with my website and blog. I have thought about how I&#8217;m going to do this, so here&#8217;s the plan.</p>
<p>I will not be moving all my old blog articles over, however, a few articles of a more lasting relevance will be pulled over by hand.&#160; I have moved my blog to WordPress after years of defiance.&#160; I am excited and very satisfied so far with the experience.</p>
<p>It probably took under 10 minutes to get this blog up and running, and the UI is great.&#160; Things are much better than they were even a year ago.&#160; Anyway, this is my new home, welcome.&#160; Stay a while, grab an RSS feed and I&#8217;ll try to make it worthwhile.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kekoav.com/2010/02/25/a-clean-slate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sieve of Eratosthenes in Scala</title>
		<link>http://blog.kekoav.com/2009/06/19/sieve-of-eratosthenes-in-scala/</link>
		<comments>http://blog.kekoav.com/2009/06/19/sieve-of-eratosthenes-in-scala/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 15:50:58 +0000</pubDate>
		<dc:creator>kekoav</dc:creator>
				<category><![CDATA[Computer Science]]></category>

		<guid isPermaLink="false">http://blog.kekoav.com/?p=10</guid>
		<description><![CDATA[Lately, I have been interested in the Scala programming language.  It is actually quite nice, and seems to really work with me and not against me.  I really like the way the functional aspects are combined with imperative, as it makes it so much easier to think about things when my mind is not in [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I have been interested in the Scala programming language.  It is actually quite nice, and seems to really work with me and not against me.  I really like the way the functional aspects are combined with imperative, as it makes it so much easier to think about things when my mind is not in a pure-functional mindset.</p>
<p>Here&#8217;s one little snippet that I&#8217;ve been working on to learn some Scala, another sieve of eratosthenes.  It will work if pasted into the scala interpreter, and then just call the primes function.</p>
<pre>def primes_aux(currentList:List[Int], stopNumber:Int) : List[Int] = {
  if(currentList == Nil)
    Nil
  else {
    val H = currentList.head
    if (H &lt;= stopNumber)
       H :: primes_aux(currentList.tail.remove(num =&gt; (num % H) == 0), stopNumber)
    else
      currentList
  }
}

def primes(maxNumber:Int) : List[Int] = {
  primes_aux((2 to maxNumber).toList, Math.sqrt(maxNumber))
}</pre>
<p>I tried really hard to shrink the code from the erlang version, and I was successful. It is much more succint.  I will probably find some better functions that can help me get rid of or at least simplify the logic.  I have a feeling this can be done in a few short lines of code.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kekoav.com/2009/06/19/sieve-of-eratosthenes-in-scala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sieve of Eratosthenes in Erlang</title>
		<link>http://blog.kekoav.com/2009/04/09/sieve-of-eratosthenes-in-erlang/</link>
		<comments>http://blog.kekoav.com/2009/04/09/sieve-of-eratosthenes-in-erlang/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 20:56:16 +0000</pubDate>
		<dc:creator>kekoav</dc:creator>
				<category><![CDATA[Computer Science]]></category>

		<guid isPermaLink="false">http://blog.kekoav.com/?p=13</guid>
		<description><![CDATA[This is my first real attempt at a semi-useful program in Erlang.  It is the Sieve of Eratosthenes, which is a prime number generator.  The main function is primes() which accepts the number that you would like to count up to.  Luckly, Erlang is a Functional language, so I was able to do some fun [...]]]></description>
			<content:encoded><![CDATA[<p>This is my first real attempt at a semi-useful program in Erlang.  It is the Sieve of Eratosthenes, which is a prime number generator.  The main function is primes() which accepts the number that you would like to count up to.  Luckly, Erlang is a Functional language, so I was able to do some fun things.</p>
<p>I had to modify the algorithm, as the original algorithm uses arrays, and arrays aren&#8217;t really used in Erlang.  I suppose this is probably due to the functional roots that Erlang has.  Scheme in practice tends to stay away from vectors and uses lists more.  I decided to use lists in Erlang, and was able to do some nice recursion, as is normal with Scheme.</p>
<pre>
<pre>-module(sieve).
-export([primes/1]).

%% Removes the multiples of a number from a list
remove_multiples(_, []) -&gt; [];
remove_multiples(N, [H|T]) when (H rem N == 0) -&gt;
        remove_multiples(N, T);
remove_multiples(N, [H|T]) -&gt;
        [H|remove_multiples(N, T)].

%% Generate primes by creating a list of numbers from 0 to N.
%% Then recurse through the list, eliminating multiples off the tail at each recursion.
primes(N) -&gt;
        primes(lists:seq(2,N), math:sqrt(N)).
primes([H|T], StopNumber) when H =
        [H|primes(remove_multiples(H, T), StopNumber)]; %% Does this blow your mind?
primes(L,_)-&gt; L.</pre>
</pre>
<p>I&#8217;m not experienced with Erlang yet, so my apologies if I have bad Erlang style.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kekoav.com/2009/04/09/sieve-of-eratosthenes-in-erlang/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tail Recursion Experiment</title>
		<link>http://blog.kekoav.com/2009/02/10/tail-recursion-experiment/</link>
		<comments>http://blog.kekoav.com/2009/02/10/tail-recursion-experiment/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 20:30:29 +0000</pubDate>
		<dc:creator>kekoav</dc:creator>
				<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://blog.kekoav.com/?p=17</guid>
		<description><![CDATA[I&#8217;ve been learning about how tail recursion allows for nice compiler optimizations. http://en.wikipedia.org/wiki/Tail_recursion &#8211; Great resource I decided to code up a quick experiment of how this can work. I have a simple recursive add function that will add up all the sequential integers up to and including num. This is also a proof of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been learning about how tail recursion allows for nice compiler optimizations.</p>
<p><a href="http://en.wikipedia.org/wiki/Tail_recursion">http://en.wikipedia.org/wiki/Tail_recursion</a> &#8211; Great resource</p>
<p>I decided to code up a quick experiment of how this can work. I have a simple recursive add function that will add up all the sequential integers up to and including num. This is also a proof of Pythagoras&#8217; tetrad. So if I do add(4) the return will be 1 + 2 + 3 + 4 = 10:</p>
<p>add-recursive.c :</p>
<pre>int add(int num) {
   if(num == 0) return 0;
   return (num + add(num - 1));
}

int main(int argc, char** argv) {
   int count;
   if(argc &gt; 1) {
      sscanf(argv[1], "%i", &amp;count);
      printf("Result: %i\n", add(count));
   }
}</pre>
<p>Ok, let&#8217;s try it out</p>
<pre>$ ./add-recursive 4
Result: 10
$ ./add-recursive 100
Result: 5050
$ ./add-recursive 100000
Result: 705082704
$ ./add-recursive 10000000
Segmentation fault</pre>
<p>Uh oh. Looks like we overflowed the stack at 10000000. The solution to such a silly problem would be to use tail recursion, which is a special form of recursion where your final operation is a recursive call. Normally, each recursive call will add a stack frame for each call to add(), but since you&#8217;re only returning the result of the next recursive call, the compiler can re-use the same stack frame, and reload the recursive call onto the same stack frame, thus averting any stack overflow problems.</p>
<p>Here&#8217;s a modified function that will do the same thing, but allow for the tail recursion optimization.</p>
<p>add-tail-recursive.c :</p>
<pre>int add(int num, int count) {
   if(num == 0) return count;
   count += num;
   return add(num - 1, count);
}

int main(int argc, char** argv) {
   int count;
   if(argc &gt; 1) {
      sscanf(argv[1], "%i", &amp;count);
      printf("Result: %i\n", add(count, 0));
   }
}</pre>
<p>Here&#8217;s the new results:</p>
<pre>$ ./add-tail-recursive 4
Result: 10
$ ./add-tail-recursive 100
Result: 5050
$ ./add-tail-recursive 100000
Result: 705082704
$ ./add-tail-recursive 10000000
Result: -2004260032
</pre>
<p>Hey, we got a result, our integer overflowed, but that&#8217;s beside the point, we got an answer, which means the recursion ran to completion without a stack overflow.</p>
<p>So, the obvious response is, &#8220;that&#8217;s a dumb idea to use recursion for adding like that, you should use a for loop&#8221;. Yes, I know, I was just trying to test out this tail recursion in hopes that I will one day find a great use for it.</p>
<p>Note that when you compile your C, you&#8217;ll want to turn on optimizations, I used -O2 for gcc, without that option, it has the same effect of blowing the stack up.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kekoav.com/2009/02/10/tail-recursion-experiment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wild West Domains API Integration</title>
		<link>http://blog.kekoav.com/2007/06/07/wild-west-domains-api-integration/</link>
		<comments>http://blog.kekoav.com/2007/06/07/wild-west-domains-api-integration/#comments</comments>
		<pubDate>Fri, 08 Jun 2007 00:15:49 +0000</pubDate>
		<dc:creator>kekoav</dc:creator>
				<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://blog.kekoav.com/?p=19</guid>
		<description><![CDATA[For work, one of the major projects we have been working on involves integrating a Wild West Domains(Godaddy) API reseller account to automatically register domain names in our application.  The process of figuring out the API is a monumental task due to the lack of clear current documentation, and a muddle of old documentation that [...]]]></description>
			<content:encoded><![CDATA[<p>For work, one of the major projects we have been working on involves integrating a Wild West Domains(Godaddy) API reseller account to automatically register domain names in our application.  The process of figuring out the API is a monumental task due to the lack of clear current documentation, and a muddle of old documentation that can lead you down a difficult and messy path.</p>
<p>I won&#8217;t be posting much of any code here, sorry, but will tell you of my experience, and leave the invitation open for those who may need assistance interpreting the API, or debugging impossibly cryptic certification errors.  Interested persons may contact me about purchasing the PHP interface class that I wrote, along with my own documentation.</p>
<p>It seems the Web Service API is brand new at the time I attempted to create an integration module for our system.  The date posted on the documentation was 5/2007, and it became clear very soon that it had not gone through rigorous revision, as my printed copy of the API has many handwritten notes on things that are not clear, warnings that were not made, and even blatant errors as to what methods to use.</p>
<p>The certification guide is a noble attempt to provide assistance and it does to a great degree, but not enough to effectively guide a programmer unfamiliar with the certification process, and web service methods of the WWD(Wild West Domains) API.</p>
<h3>Java Daemon Nonsense</h3>
<p>The first documentation that was available to me was an old API that to me was a very outdated method of doing things.  Most APIs today are of the SOAP or XML-RPC type, but the method that was described in this document was installing a Java Daemon that you ran on the server on a particular port, and then you communicated with it through your web application.</p>
<p>They also kindly provided a sample PHP website that used what they call the WAPI Daemon.  I was able to install this daemon on my linux box and got the sample website to work, which was partly a miracle because there were many command line options I needed to set on the daemon that weren&#8217;t documented, and so I had to do trial and error to figure it out.</p>
<h3>WAPI vs. Web Service</h3>
<p>I almost began implementing my domain registration module using this Java Daemon, but I noticed a new web service API guide appeared in the ote extranet for WWD.  I was very excited to see this new document pop up, along with its companion the certification guide which appeared a couple weeks later.  I knew this was the way I wanted to do business, now to get it to work.</p>
<p>As excited as I was, I printed out the API for quick reference, and started on a class that would act as the interface.</p>
<h3>Customer Support</h3>
<p>Needless to say in writing the certification driver I found complications early on, as in step 2 of 7.  It took a couple of weeks to get past step 2, and about a month to get to step 3(we had other things to do than just work on this).  Of course this involved the wild west technical support guys, who weren&#8217;t the quickest responders, and had nice canned responses for the old WAPI style XML responses, but not any for the new web service method.</p>
<p>Also forget about talking to an advanced customer support technician, I tried calling in to talk to someone about the API, told them about the problems I was running into with a Poll request using the web service method, and the man on the phone had no clue what the API consisted of.  He said I had to e-mail to get advanced support.</p>
<p>So, I emailed patiently to get answers, finding very few.  There were also bugs in the certification script, which the support team acknowledged they were aware of, this also frustrates me because it&#8217;s like I was trying to hit a moving target.</p>
<p>I felt like I am the only person who is trying to use their new web service API.  There were no real resources or additional guidance aside from the official manuals which were good as a reference, but did not clearly walk you through the process of coding up a certification script, in my opinion.</p>
<h3>Trial and Error</h3>
<p>Debugging can be a straightforward, and not a painful process in many cases when you have clear error messages and feedback to work off of.  Do not expect any of that with the certification process.  The certification script will tell you what data on an XML node is incorrect, but it will not tell you that you&#8217;ve used the wrong method to call the web service, or what XML nodes you are missing, or what the structure of your SOAP request should be.</p>
<p>The debugging process for this project was painful, and involved almost entirely trial and error, and also carefully reading the WSDL file, which I found was more helpful than the web service documentation, as the documentation has missing and misnamed fields in certain instances.</p>
<h3>Certification Success</h3>
<p>Finally after a couple of months of learning the ins and outs of the API, I passed the certification.  Maybe if I was using ASP.net, it may have done everything for me, if this is your situation, good for you, but using PHP, I had to rely on the WSDL file, and needed to know exactly how to structure my SOAP objects so the correct XML would be generated.</p>
<p>If you are looking to integrate with Wild West Domains on any level, you&#8217;ll need a good abstraction layer. Contact me if you would be interested in saving yourself lots of time.</p>
<h3>Update 2/2010</h3>
<p>I have mostly polished the interface and it is available for purchase, contact me for details.  If you would like more information, I have attached the generated documentation and usage examples here: <a href="http://blog.kekoav.com/wp-content/uploads/2010/02/WWD-Integration-Docs.zip">WWD-Integration-Docs</a>.  I know how much of a waste of time it can be to re-invent the wheel when a solution is already there. I charge $400 for the source code for the interface. Just message me, it may mean slicing a couple of weeks off of your development time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kekoav.com/2007/06/07/wild-west-domains-api-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

