<?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>Caged Mantis</title>
	<atom:link href="http://www.cagedmantis.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cagedmantis.com</link>
	<description>Software engineering and life</description>
	<lastBuildDate>Sat, 16 Jul 2011 21:23:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Prime numbers from 0 to n</title>
		<link>http://www.cagedmantis.com/2011/07/16/prime-numbers-from-0-to-n/</link>
		<comments>http://www.cagedmantis.com/2011/07/16/prime-numbers-from-0-to-n/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 21:23:54 +0000</pubDate>
		<dc:creator>Carlos Amedee</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://www.cagedmantis.com/?p=135</guid>
		<description><![CDATA[Programming challenges, like the ones found on Project Euler, provide a opportunity to learn algorithms and practice optimizing code. problem 10 requires that you &#8220;Find the sum of all the primes below two million.&#8221; I decided this was the perfect problem to tackle on a train ride home. The summation portion of the problem is [...]]]></description>
			<content:encoded><![CDATA[<p>Programming challenges, like the ones found on <a href="http://projecteuler.net/" title="Project Euler">Project Euler</a>, provide a opportunity to learn algorithms and practice optimizing code. <a href="http://projecteuler.net/index.php?section=problems&#038;id=10" title="Project Euler - problem 10">problem 10</a> requires that you &#8220;Find the sum of all the primes below two million.&#8221;  I decided this was the perfect problem to tackle on a train ride home. The summation portion of the problem is trivial. The fun part was finding all of the primes in a particular range of numbers.</p>
<p>A prime number is a number which is only dividable by one and itself without producing a remainder. That sounds simple enough. I wrote a small program which accepts an integer as a command line argument and prints out all of the prime numbers between 0 and that number.</p>
<pre class="brush: cpp; title: Case 1; notranslate">
#include &lt;iostream&gt;
#include &lt;stdlib .h&gt;

bool isPrime(int num) {
  bool prime = true;
  if (num &lt; 2)
    return false;
  for (int i = 2; i &lt; num; ++i) {
    if (num % i == 0)
      prime = false;
  }
  return prime;
}

int main(int argc, char *argv[]) {
  if (argv[1] == NULL)
    return 0;
  const int TOP = atoi(argv[1]);
  std::cout &lt;&lt; &quot;Prime Numbers from 0 - &quot; &lt;&lt; TOP &lt;&lt; &quot;: &quot;;
  for (int j = 0; j &lt;= TOP; ++j) {
    if (isPrime(j))
      std::cout &lt;&lt; j &lt;&lt; &quot; &quot;;
  }
  std::cout &lt;&lt; std::endl;
  return 0;
}
</pre>
<p>Case 1 was the slowest way that I could dream up of reaching a solution. How could I optimize it? When isPrime() is called, it divides by every single number before the function returns with either a boolean true or false. Once a number has been proven to be non-prime there is no need to continue calculating whether it is prime or not. I replaced the following code:</p>
<pre class="brush: cpp; first-line: 4; title: Case 1; notranslate">
bool isPrime(int num) {
  bool prime = true;
  if (num &lt; 2)
    return false;
  for (int i = 2; i &lt; num; ++i) {
    if (num % i == 0)
      prime = false;
  }
  return prime;
}
</pre>
<p>with: </p>
<pre class="brush: cpp; first-line: 4; title: Case 2; notranslate">
bool isPrime(int num) {
  if (num &lt; 2)
    return false;
  for (int i = 2; i &lt; num; ++i) {
    if (num % i == 0)
      return false;
  }
  return true;
}
</pre>
<p>The function is quite a bit faster now. The next optimization was a no-brainer. A number can&#8217;t be divided by more than half of itself and not produce a remainder. I decided to divide the number of divisors in half by replacing:</p>
<pre class="brush: cpp; first-line: 7; title: Case 2; notranslate">
  for (int i = 2; i &lt; num; ++i) {
</pre>
<p>with:</p>
<pre class="brush: cpp; first-line: 7; title: Case 3; notranslate">
  for (int i = 2; i &lt; (num/2)+1; ++i) {
</pre>
<p>This produced yet another incremental speedup. I sat on the train and had a fuzzy theory pop up in my head. Can the upper limit of a divisor need to be greater than the square root of a number? It was worth a try:</p>
<pre class="brush: cpp; first-line: 4; title: Case 3; notranslate">
bool isPrime(int num) {
  if (num &lt; 2)
    return false;
  for (int i = 2; i &lt; (num/2)+1; ++i) {
    if (num % i == 0)
      return false;
  }
  return true;
}
</pre>
<p>Replaced with: </p>
<pre class="brush: cpp; first-line: 4; title: Case 4; notranslate">
#include &lt;math .h&gt;

bool isPrime(int num) {
  if (num &lt; 2)
    return false;
  double maxDivisor = pow((double)num+1, 0.5);
  for (int i = 2; i &lt;= (int)maxDivisor; ++i) {
    if (num % i == 0)
      return false;
  }
  return true;
}
</pre>
<p>The speed increase that case 4 provided was substantial. By this point I was able to solve the problem in a trivial amount of time. This was when I decided that it would be fun to see how others have solved this problem. I searched around and discovered this guy names Eratosthenes (maybe you&#8217;ve heard of him). After marveling at the fact that Eratosthenes was able to solve this problem efficiently more than 2000 years ago I dug into learning about the <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" title="Sieve of Eratosthenes">Sieve of Eratosthenes</a>.</p>
<p>Essentially, Eratosthenes was able to efficiently calculate a series of prime numbers by using previous primes in order to help calculate future primes by eliminate non-primes. I then remembered learning about it in high school but it was long gone by the time I reached this problem.</p>
<pre class="brush: cpp; title: Case 5; notranslate">
#include &lt;iostream&gt;
#include &lt;stdlib .h&gt;

int main(int argc, char *argv[])
{
  if (argv[1] == NULL)
    return 0;
  const int TOP = atoi(argv[1]);
  std::cout &lt; &lt; &quot;Prime Numbers from 0 - &quot; &lt;&lt; TOP &lt;&lt; &quot;: &quot;;

  bool* sieve = new bool[TOP+1];
  std::fill_n(sieve, TOP+1, 1);
  sieve[0] = 0;
  sieve[1] = 0;
  for (int i = 2; i &lt;= TOP; ++i) {
    if (sieve[i] == 1) {
      std::cout &lt;&lt; i &lt;&lt; &quot; &quot;;
      for (int j = i; j &lt;= TOP; j+=i) {
        sieve[j] = 0;
      }
    }
  }
  delete[] sieve;
  return 0;
}
</pre>
<p>With larger inputs, this was the most optimal way to compute a range of primes that I wrote up. It uses more memory than the previous methods. There are further optimized algorithms which do things like remove memory for even numbers(which are never prime except for 2). I would have dug deeper and attempted the <a href="http://en.wikipedia.org/wiki/Sieve_of_Atkin" title="sieve of atkin">Sieve of Atkin</a> but that was out of the scope of my train ride.</p>
<p><img src="http://www.cagedmantis.com/images/blog/chart1.png" alt="Performance" /></p>
<p><img src="http://www.cagedmantis.com/images/blog/chart2.png" alt="Performance" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagedmantis.com/2011/07/16/prime-numbers-from-0-to-n/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>2010 Recap</title>
		<link>http://www.cagedmantis.com/2011/01/21/2010-recap/</link>
		<comments>http://www.cagedmantis.com/2011/01/21/2010-recap/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 14:55:31 +0000</pubDate>
		<dc:creator>Carlos Amedee</dc:creator>
				<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://www.cagedmantis.com/?p=117</guid>
		<description><![CDATA[We are almost a month into the new year and here I am writing about last year. Well, 2010 was a bittersweet year. It was a year that contained many blessings and some tragedies. I have found myself in a state where the tragedies have tried to overshadowed the blessings. Being a first time home [...]]]></description>
			<content:encoded><![CDATA[<p>We are almost a month into the new year and here I am writing about last year. Well, 2010 was a bittersweet year. It was a year that contained many blessings and some tragedies. I have found myself in a state where the tragedies have tried to overshadowed the blessings. Being a first time home owner is an empowering feeling. Wondering how your family in Haiti is doing after a horrific earthquake is conjures up feelings that I can&#8217;t even begin to describe. This one of the most difficult years of my life and I want to remember it. It spurred the most personal growth. It solidified my faith. 2010 showed me how much I have to hustle in 2011.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagedmantis.com/2011/01/21/2010-recap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Summer School on Multicore Programming</title>
		<link>http://www.cagedmantis.com/2010/07/25/summer-school-on-multicore-programming/</link>
		<comments>http://www.cagedmantis.com/2010/07/25/summer-school-on-multicore-programming/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 12:40:18 +0000</pubDate>
		<dc:creator>Carlos Amedee</dc:creator>
				<category><![CDATA[multicore]]></category>
		<category><![CDATA[parallelism]]></category>

		<guid isPermaLink="false">http://www.cagedmantis.com/?p=111</guid>
		<description><![CDATA[One of my goals for this summer is to learn a bit more about multicore programming. I learned that the University of Illinois had a summer school program where you recieve an in depth introduction into many diffrent implementations of multicore programming methedologies. The course covered the following: POSIX Threads Parallelism in Java OpenMP TBB [...]]]></description>
			<content:encoded><![CDATA[<p>One of my goals for this summer is to learn a bit more about multicore programming. I learned that the <a href="http://www.upcrc.illinois.edu/summer/2010/index.html">University of Illinois</a> had a <a href="http://www.upcrc.illinois.edu/summer/2010/index.html">summer school</a> program where you recieve an in depth introduction into many diffrent implementations of multicore programming methedologies. The course covered the following:</p>
<ul>
<a href="http://en.wikipedia.org/wiki/POSIX_Threads">POSIX Threads</a><br />
Parallelism in Java<br />
<a href="http://openmp.org/wp/">OpenMP</a><br />
<a href="http://www.threadingbuildingblocks.org/">TBB</a><br />
<a href="http://www.khronos.org/opencl/">OpenCL</a><br />
<a href="http://www.nvidia.com/object/cuda_home_new.html">Cuda</a></ul>
<p>I had a great time with the program and look forward to implementing what I have learned into a couple of projects I am working on. I highly recommend this program if you have any interest in multicore programming.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagedmantis.com/2010/07/25/summer-school-on-multicore-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My desktop is how old?</title>
		<link>http://www.cagedmantis.com/2010/06/30/my-desktop-is-how-old/</link>
		<comments>http://www.cagedmantis.com/2010/06/30/my-desktop-is-how-old/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 20:49:12 +0000</pubDate>
		<dc:creator>Carlos Amedee</dc:creator>
				<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://www.cagedmantis.com/?p=101</guid>
		<description><![CDATA[I feel as if I am in the minority of the general tech population when I state that I do not favor coding/gaming/fixing on my laptop over my desktop. I despise having a single monitor to work with. Having to rub a little rubber nub or touch a pad in order to move my cursor [...]]]></description>
			<content:encoded><![CDATA[<p>I feel as if I am in the minority of the general tech population when I state that I do not favor coding/gaming/fixing on my laptop over my desktop. I despise having a <a href="http://www.codinghorror.com/blog/2008/03/does-more-than-one-monitor-improve-productivity.html">single monitor</a> to work with. Having to rub a little rubber nub or touch a pad in order to move my cursor around is less than optimal. That fact that I am a &#8220;big dude&#8221; consistently hunched over a tiny laptop does not help at all. These are all reasons why I love sitting at my desktop to hack away on whatever project or work has taken a hold of my interest. </p>
<p>A couple of weeks ago I realized that I barely ever touched my desktop. I thought this was a bit strange and set out to discover why. Well, it did not take long to find out what had happed. You see, my desktop is a dual boot Ubuntu / Windows 7 box which is going on being six years old now. I hate waiting for the thing to boot up. The whole machine is as slow as molasses. Halfway through any project I give up and work on the mac mini. This is the perfect opportunity to start a summer time project.  </p>
<p>I decided to build myself a new desktop machine. Convincing myself it would be lots of fun to do it. It will be more challenging this time around. With a little help from Noman this is what I came up with:</p>
<p><img src="http://www.cagedmantis.com/images/computer_build/computer_build_sm.JPG" alt="Computer parts" width="500" height="358" align="center"/></p>
<p><a href="http://www.amazon.com/gp/product/B0038JE9MU?ie=UTF8&#038;tag=cagemant-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B0038JE9MU">Intel Core i7 Processor i7-930 2.80GHz 8 MB LGA1366 CPU</a><img src="http://www.assoc-amazon.com/e/ir?t=cagemant-20&#038;l=as2&#038;o=1&#038;a=B0038JE9MU" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<p><a href="http://www.amazon.com/gp/product/B002G1YPH0?ie=UTF8&#038;tag=cagemant-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B002G1YPH0">Cooler Master Hyper 212 Plus</a><img src="http://www.assoc-amazon.com/e/ir?t=cagemant-20&#038;l=as2&#038;o=1&#038;a=B002G1YPH0" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<p><a href="http://www.amazon.com/gp/product/B0034CSTFY?ie=UTF8&#038;tag=cagemant-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B0034CSTFY">Gigabyte LGA1366 Motherboard GA-X58A-UD3R</a><img src="http://www.assoc-amazon.com/e/ir?t=cagemant-20&#038;l=as2&#038;o=1&#038;a=B0034CSTFY" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<p><a href="http://www.amazon.com/gp/product/B001K4PWXA?ie=UTF8&#038;tag=cagemant-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B001K4PWXA">G.SKILL 6GB (3 x 2GB) 240-Pin DDR3 SDRAM DDR3 1600 (PC3 12800) Triple Channel Kit F3-12800CL9T-6GBNQ</a><img src="http://www.assoc-amazon.com/e/ir?t=cagemant-20&#038;l=as2&#038;o=1&#038;a=B001K4PWXA" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<p><a href="http://www.amazon.com/gp/product/B001OD76RW?ie=UTF8&#038;tag=cagemant-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B001OD76RW">Acer H233H bmid 23-Inch Widescreen LCD Display</a><img src="http://www.assoc-amazon.com/e/ir?t=cagemant-20&#038;l=as2&#038;o=1&#038;a=B001OD76RW" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<p><a href="http://www.amazon.com/gp/product/B001NXDQD6?ie=UTF8&#038;tag=cagemant-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B001NXDQD6">EVGA nVidia GeForce GTX260 Core 216-55nm Superclocked 896 MB DDR3 2DVI PCI-Express Video Card 896-P3-1257-AR</a><img src="http://www.assoc-amazon.com/e/ir?t=cagemant-20&#038;l=as2&#038;o=1&#038;a=B001NXDQD6" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<p><a href="http://www.amazon.com/gp/product/B0029F21LK?ie=UTF8&#038;tag=cagemant-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B0029F21LK">Corsair CMPSU-750HX 750-Watt HX Professional Series 80 Plus Certified Power Supply compatible with Core i7 and Core i5</a><img src="http://www.assoc-amazon.com/e/ir?t=cagemant-20&#038;l=as2&#038;o=1&#038;a=B0029F21LK" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<p><a href="http://www.amazon.com/gp/product/B002IJA1EG?ie=UTF8&#038;tag=cagemant-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B002IJA1EG">Intel 80 GB X25M Mainstream SATA II Solid State Drive (SSD) Retail Package SSDSA2MH080G2R5</a><img src="http://www.assoc-amazon.com/e/ir?t=cagemant-20&#038;l=as2&#038;o=1&#038;a=B002IJA1EG" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<p>This is the perfect project to kick off the summer. Expect an update once i actually put the thing together.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagedmantis.com/2010/06/30/my-desktop-is-how-old/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Last Month or So</title>
		<link>http://www.cagedmantis.com/2010/06/12/last-month-or-so/</link>
		<comments>http://www.cagedmantis.com/2010/06/12/last-month-or-so/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 23:13:04 +0000</pubDate>
		<dc:creator>Carlos Amedee</dc:creator>
				<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://www.cagedmantis.com/?p=96</guid>
		<description><![CDATA[For those who are asking, yes, I am still alive. I have dropped out of the view of many of my friends and family. Apparently this past semester has taken a bit out of me at school. I have been relaxing and recouping. Not to worry though, I am getting my swagger back. I should [...]]]></description>
			<content:encoded><![CDATA[<p>For those who are asking, yes, I am still alive. I have dropped out of the view of many of my friends and family. Apparently this past semester has taken a bit out of me at school. I have been relaxing and recouping. Not to worry though, I am getting my <a href="http://www.urbandictionary.com/define.php?term=swagger">swagger</a> back. I should be reaching out to everybody really soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagedmantis.com/2010/06/12/last-month-or-so/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>So You Want To Learn Emacs</title>
		<link>http://www.cagedmantis.com/2010/03/08/so-you-want-to-learn-emacs/</link>
		<comments>http://www.cagedmantis.com/2010/03/08/so-you-want-to-learn-emacs/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 19:16:28 +0000</pubDate>
		<dc:creator>Carlos Amedee</dc:creator>
				<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://www.cagedmantis.com/?p=71</guid>
		<description><![CDATA[Every proffessor in school preaches the merits of learning Emacs. They tell you how much faster you will code without having the need to touch the mouse. They preach how you would no longer need to select diffrent ide&#8217;s for each language you write in. Emacs can easily be extended and modified to your specific [...]]]></description>
			<content:encoded><![CDATA[<p>Every proffessor in school preaches the merits of learning Emacs. They tell you how much faster you will code without having the need to touch the mouse. They preach how you would no longer need to select diffrent ide&#8217;s for each language you write in. Emacs can easily be extended and modified to your specific needs through the use of Lisp (a language everybody should learn). Heck, they even mention that you can check your email and connect to irc through emacs. After all this Emacs indoctrination, the professor then turns to you and hands you a cheat sheet. Gee thanks. </p>
<p>In an effort to master Emacs, I have installed it on all of the machines I use.  These are some of the links that I have found helpful:</p>
<p><strong>Installation: </strong><br />
<a href="http://www.claremontmckenna.edu/math/alee/emacs/emacs.html">Windows</a><br />
<a href="http://homepage.mac.com/zenitani/emacs-e.html">Mac: Carbon Emacs</a></p>
<p><strong>Configuration: </strong><br />
<a href="http://steve.yegge.googlepages.com/effective-emacs">Yegge: 10 Specific Ways to Improve Your Productivity With Emacs</a><br />
<a href="http://www.arunrocks.com/blog/archives/2008/02/20/5-indespensible-tips-for-emacs-on-windows/">5 Indispensable Tips for Emacs on Windows</a></p>
<p><strong>Sample configurations: </strong><br />
<a href="http://steve.yegge.googlepages.com/my-dot-emacs-file">Yegge: my .emacs file</a><br />
<a href="http://github.com/technomancy/emacs-starter-kit">Phil Hagelberg: emacs-starter-kit</a><br />
<a href="http://github.com/justinlilly/emacs-starter-kit">Justin Lilly: Fork of emacs-starter-kit with python support</a></p>
<p><strong>Extensions / plugins: </strong><br />
<a href="http://code.google.com/p/yasnippet/">Yasnippet </a><br />
<a href="http://cedet.sourceforge.net/">Cedet (C++ development tools)</a></p>
<p><strong>Misc. / Tutorial:</strong><br />
<a href="http://www.gnu.org/software/emacs/tour/">A Guided Tour of Emacs</a><br />
<a href="http://peepcode.com/products/meet-emacs">Peepcode: Meet Emacs</a><br />
<a href="http://edward.oconnor.cx/2009/07/learn-emacs-in-ten-years">Learn Emacs in Ten Years</a><br />
<a href="http://www.reddit.com/r/emacs/">Emacs Subreddit</a><br />
<a href="http://www.stratospark.com/blog/2010/fullscreen_emacs_on_osx.html">Fullscreen Emacs on OSX</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagedmantis.com/2010/03/08/so-you-want-to-learn-emacs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Source Mentoring: Drizzle</title>
		<link>http://www.cagedmantis.com/2009/08/10/open-source-mentoring-drizzle/</link>
		<comments>http://www.cagedmantis.com/2009/08/10/open-source-mentoring-drizzle/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 16:52:06 +0000</pubDate>
		<dc:creator>Carlos Amedee</dc:creator>
				<category><![CDATA[drizzle]]></category>

		<guid isPermaLink="false">http://www.cagedmantis.com/?p=69</guid>
		<description><![CDATA[I&#8217;ve decided to become involved in an open source project. My current interest (and day job) revolve around digital asset management systems and workflows. Give me a large amount of data to manipulate and I will show you a happy man. Drizzle seems like an obvious choice for my interests. I have always wanted to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to become involved in an open source project. My current interest (and day job) revolve around digital asset management systems and workflows.  Give me a large amount of data to manipulate and I will show you a happy man. <a href="https://launchpad.net/drizzle">Drizzle</a> seems like an obvious choice for my interests.  I have always wanted to poke around the innards of a database system. I really enjoy coding in c++ (some call me crazy). And they offer mentoring in certain projects. As I always say, I want to see how deep this rabbit hole really is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagedmantis.com/2009/08/10/open-source-mentoring-drizzle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check for a Running Process on a Windows Machine</title>
		<link>http://www.cagedmantis.com/2009/06/10/check-for-a-process-on-a-windows-machine/</link>
		<comments>http://www.cagedmantis.com/2009/06/10/check-for-a-process-on-a-windows-machine/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 19:21:55 +0000</pubDate>
		<dc:creator>Carlos Amedee</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.cagedmantis.com/?p=51</guid>
		<description><![CDATA[This is a quick and dirty method to check for a running process on a windows machine using Ruby.]]></description>
			<content:encoded><![CDATA[<p>This is a quick and dirty method to check for a running process on a windows machine using Ruby.</p>
<pre class="brush: ruby; title: ; notranslate">
require 'win32ole'
require 'net/smtp'
require 'yaml'

def send_email(message)
  begin
    msg = &lt;&lt;END_OF_MESSAGE
From: #{$from_alias} &lt;#{$from}&gt;
To: #{$to_alias} &lt;#{$to}&gt;
Subject: #{$subject}
#{message}
END_OF_MESSAGE

    Net::SMTP.start('smtp.company.com') do |smtp|
      smtp.send_message msg, $from, $to
    end
  rescue =&gt; error
    puts &quot;Exception: #{error}&quot;
  end
end

$from_alias = &quot;Email Alias&quot;
$from = &quot;processWatcher@company.com&quot;
$subject = &quot;Process Error&quot;
$to_alias = &quot;Email Alias&quot;
$to = &quot;alerts@company.com&quot;

#Server list
$proc = [&quot;Server1&quot;, &quot;Server2&quot;]

$proc.each { |record|
  runningProc = false
  begin
    wmi = WIN32OLE.connect(&quot;winmgmts://#{record}&quot;)
    processes = wmi.ExecQuery(&quot;select * from win32_process&quot;)
  rescue =&gt; error
    puts &quot;Exception: #{error}&quot;
  end
  for process in processes do
    if (process.Name == &quot;SampleProcess.exe&quot;)
      puts &quot;Server: #{record} Name: #{process.Name}&quot;
      runningProc = true
    end
  end

  if runningProc
    puts &quot;Process on #{record} not running as of #{Time.now}. Please check the server.&quot;
    send_email(&quot;Process on #{record} not running as of #{Time.now}. Please check the server.&quot;)
  end
}

begin
  File.copy(line.strip, root + templine.strip)
rescue =&gt; error
  puts &quot;Error Copying File: Exception: #{error}&quot;
  error
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cagedmantis.com/2009/06/10/check-for-a-process-on-a-windows-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Late to a meeting</title>
		<link>http://www.cagedmantis.com/2009/03/25/late-to-a-meeting/</link>
		<comments>http://www.cagedmantis.com/2009/03/25/late-to-a-meeting/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 23:30:25 +0000</pubDate>
		<dc:creator>Carlos Amedee</dc:creator>
				<category><![CDATA[Off-topic]]></category>
		<category><![CDATA[silly]]></category>

		<guid isPermaLink="false">http://www.cagedmantis.com/?p=45</guid>
		<description><![CDATA[This is a voicemail which was left on my machine when I was late for a meeting: voicemail]]></description>
			<content:encoded><![CDATA[<p>This is a voicemail which was left on my machine when I was late for a meeting: <a title="Voicemail" href="http://www.cagedmantis.com/wp/wp-content/uploads/2009/03/late_to_meeting.wav">voicemail</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagedmantis.com/2009/03/25/late-to-a-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.cagedmantis.com/wp/wp-content/uploads/2009/03/late_to_meeting.wav" length="18260" type="audio/x-wav" />
		</item>
		<item>
		<title>Sending Email via MsSql</title>
		<link>http://www.cagedmantis.com/2009/01/13/sending-email-via-mssql/</link>
		<comments>http://www.cagedmantis.com/2009/01/13/sending-email-via-mssql/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 19:17:28 +0000</pubDate>
		<dc:creator>Carlos Amedee</dc:creator>
				<category><![CDATA[Mssql]]></category>

		<guid isPermaLink="false">http://www.cagedmantis.com/?p=40</guid>
		<description><![CDATA[Microsoft&#8217;s Sql Server always required an odd if not cumbersome configuration in order for emails to be sent by Sql Server itself. An extremely lightweight method of sending emails through mssql is using xp_smtp_sendmail. Xpsmtp adds an extended stored procedure with allows you to easily send emails from Sql Server.]]></description>
			<content:encoded><![CDATA[<p>Microsoft&#8217;s Sql Server always required an odd if not cumbersome configuration in order for emails to be sent by Sql Server itself.  An extremely lightweight method of sending emails through mssql is using <a href="http://sqldev.net/xp/xpsmtp.htm">xp_smtp_sendmail</a>. Xpsmtp adds an extended stored procedure with allows you to easily send emails from Sql Server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagedmantis.com/2009/01/13/sending-email-via-mssql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

