<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Code Theory</title>
	<atom:link href="http://codetheory.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codetheory.wordpress.com</link>
	<description>“First, solve the problem. Then, write the code.”</description>
	<lastBuildDate>Sun, 01 May 2011 18:38:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codetheory.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Code Theory</title>
		<link>http://codetheory.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codetheory.wordpress.com/osd.xml" title="Code Theory" />
	<atom:link rel='hub' href='http://codetheory.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Robot Microcontroller Options</title>
		<link>http://codetheory.wordpress.com/2011/05/01/robot-microcontroller-options/</link>
		<comments>http://codetheory.wordpress.com/2011/05/01/robot-microcontroller-options/#comments</comments>
		<pubDate>Sun, 01 May 2011 18:35:00 +0000</pubDate>
		<dc:creator>Greg Ebert</dc:creator>
				<category><![CDATA[RaaS]]></category>
		<category><![CDATA[Robotics]]></category>

		<guid isPermaLink="false">https://codetheory.wordpress.com/2011/05/01/robot-microcontroller-options/</guid>
		<description><![CDATA[I have been spending a bulk of my time recently with work, but I do find moments to research the next major steps of my project.&#160; The main thing I have been spending my time on is trying locate the brains of my robot.&#160; This has been an interesting challenge, because I need to be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=79&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been spending a bulk of my time recently with work, but I do find moments to research the next major steps of my project.&#160; The main thing I have been spending my time on is trying locate the brains of my robot.&#160; This has been an interesting challenge, because I need to be able to manage power consumption and flexibility in how I deploy and manage code.&#160; I wanted to find a platform powerful enough to drive a complex autonomous robotics systems that supports complex AI components.&#160; I also needed the system to be easy to program, because I simply don’t have the time to hack around with esoteric control systems and drivers.</p>
<p align="left">There are a few Microcontroller boards out there.&#160; The most interesting one to me is the Arduino board.&#160; This is an open-source platform for physical control computing.&#160; Recently the Netduino board was released.&#160; This little beauty is an .net version of the Arduino board.&#160; Most of the available shields are compatible with this platform.&#160; I just recently ordered the Netduino-Plus.<a href="http://codetheory.files.wordpress.com/2011/05/netduino-plus.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:right;padding-top:0;border-width:0;margin:9px 0 0 14px;" title="Netduino-plus" border="0" alt="Netduino-plus" align="right" src="http://codetheory.files.wordpress.com/2011/05/netduino-plus_thumb.jpg?w=208&#038;h=208" width="208" height="208" /></a></p>
<p align="left">
<p align="left">
<p align="left">
<p align="left">Here is a list of some of the Netduino-Plus features.&#160; There is a lot of flexibility built into this microcontroller.</p>
<ul>
<li>Atmel 32-bit microcontroller </li>
<li>Speed: 48MHz, ARM7 </li>
<li>Code Storage: 64 KB without networking: 128 KB </li>
<li>RAM: 28 KB without networking: 60 KB </li>
<li>Ethernet: 100 mbps </li>
<li>network stack: lwIP </li>
<li>Micro SD (up to 2 GB) </li>
<li>Auto card detect </li>
<li>Input: 7.5 &#8211; 12.0 VDC or USB powered </li>
<li>Output: 5 VDC and 3.3 VDC regulated </li>
</ul>
<p>I have also been looking into a much more flexible and probably more suitable set of boards for me.&#160; Because of the complex code requirements I have, the PICO-ITX set of Microcontroller boards seems to be a good fit.&#160; They have a very small footprint.&#160; Reasonable power requirements and can run in most cases the latest windows 7 operating systems without any problem.&#160; Additionally most of the newer boards have full IO support that any modern computer would have.</p>
<p>I have been looking at these models.&#160; They are powerful and cost effective enough to be part of my robotics build projects.&#160; The PICO-ITX form <a href="http://codetheory.files.wordpress.com/2011/05/epia-px.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;margin:5px 15px 0 0;" title="epia-px" border="0" alt="epia-px" align="left" src="http://codetheory.files.wordpress.com/2011/05/epia-px_thumb.jpg?w=260&#038;h=140" width="260" height="140" /></a>factor is just a little larger than a playing card, coming in at 10cm x 7.2cm.&#160; The VIA EPIA-P830 Pico-ITX board takes advantage of a 1.2GHz 64-bit processor.&#160; These boards usually price in at about 270$.&#160; You can purchase them at <a href="http://www.e-itx.com/epia-p830-12l.html">e-itx.com</a>.</p>
<p>These boards are a little higher on the power consumption.&#160; If this is critical to your build then you are going to want to keep an eye this.&#160; You will also want to get a PSU that supports wide input.&#160; This board is powerful enough to run Windows 7 x64 if that’s what you build requires.</p>
<p>Here are a few of the boards highlights.</p>
<ul>
<li>Compact 10cm x 7.2cm Pico-ITX form factor </li>
<li>High performance 64-bit VIA Nano processor </li>
<li>Latest VIA VX900 media system processor </li>
<li>HD video performance 1080p </li>
<li>Native HDMI, VGA and LVDS support </li>
<li>Support for DDR3 system memory </li>
<li>Support for two 1x PCIe expansion connector </li>
<li>HD audio support </li>
<li>Legacy I/O support GPIO, SMBus </li>
</ul>
<ul>If this is a bit too much board for your robotics requirements, you can find some less powerful boards in a slightly cheaper price range.&#160; I was pointed to this little eBox-2300/2310DXA, <a href="http://www.dealextreme.com/p/ultra-mini-fanless-compact-pc-computer-w-tdx600-1ghz-cpu-windows-98-2000-xp-ce-dos-linux-70770">Ultra-Mini Fanless Compact PC Computer w/ TDX600 1GHz CPU</a>.&#160; Its very reasonably prices in <a href="http://codetheory.files.wordpress.com/2011/05/sku_70770_1_small.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;float:right;padding-top:0;border-width:0;margin:5px 0 0 10px;" title="sku_70770_1_small" border="0" alt="sku_70770_1_small" align="right" src="http://codetheory.files.wordpress.com/2011/05/sku_70770_1_small_thumb.jpg?w=160&#038;h=160" width="160" height="160" /></a>at $158.&#160; It can run most of the major windows and Linux operating systems and has enough power to drive a complex code project.&#160; </ul>
<ul>As you can see there are plenty of options out there and I am only scratching the surface.&#160; You are going to want to pay close attention to the requirements of your project to help you decide which direction to go info for your microcontroller.&#160; You can go with much cheaper options that can cost as little a few dollars to control your unit.&#160; A good place to locate robotics parts is the <a href="http://www.sparkfun.com/search/results?term=microcontroller&amp;what=products">SparkFun</a> website.&#160; </ul>
<p>The next step for me is take make my choice.&#160; My next entry of “Robot Adventures” will include the integration of an advanced Microcontroller.&#160; Once that piece is in place, my robot will no longer need to be tethered to my laptop and it will be able to move around on its own and make logical decisions based on what it senses in the environment around it.</p>
<br />Filed under: <a href='http://codetheory.wordpress.com/category/raas/'>RaaS</a>, <a href='http://codetheory.wordpress.com/category/robotics/'>Robotics</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetheory.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetheory.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetheory.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetheory.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetheory.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetheory.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetheory.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetheory.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetheory.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetheory.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetheory.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetheory.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetheory.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetheory.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=79&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetheory.wordpress.com/2011/05/01/robot-microcontroller-options/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6a2096345594ed3a3efbb3ff7e7e5130?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/05/netduino-plus_thumb.jpg" medium="image">
			<media:title type="html">Netduino-plus</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/05/epia-px_thumb.jpg" medium="image">
			<media:title type="html">epia-px</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/05/sku_70770_1_small_thumb.jpg" medium="image">
			<media:title type="html">sku_70770_1_small</media:title>
		</media:content>
	</item>
		<item>
		<title>Robot Adventures: The Beginning</title>
		<link>http://codetheory.wordpress.com/2011/02/06/robot-adventures-the-beginning/</link>
		<comments>http://codetheory.wordpress.com/2011/02/06/robot-adventures-the-beginning/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 03:40:34 +0000</pubDate>
		<dc:creator>Greg Ebert</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[RaaS]]></category>
		<category><![CDATA[Robotics]]></category>
		<category><![CDATA[Robot]]></category>

		<guid isPermaLink="false">https://codetheory.wordpress.com/2011/02/06/robot-adventures-the-beginning/</guid>
		<description><![CDATA[Christmas came and went this year.&#160; The question from everyone was, “What do you want?&#34; and my answer was always, “I have no idea”.&#160; So I thought about some of things I have always enjoyed and lost the time to do.&#160; One thing came to the top, that was the tinkering I did with X10 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=72&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Christmas came and went this year.&#160; The question from everyone was, “What do you want?&quot; and my answer was always, “I have no idea”.&#160; So I thought about some of things I have always enjoyed and lost the time to do.&#160; One thing came to the top, that was the tinkering I did with X10 and voice activated home devices I enabled with the Microsoft Speech SDK, when it first came out.&#160; I had an ah-ha moment and I asked for a Robot.&#160; Something that was a basic platform that I could extend while exploring the fun side of auto-mating machines.&#160; I wanted to get back into creations that I could interact with.</p>
<p>About 3 weeks into January of 2011, a robot showed up at my front door.&#160; Sure it was late, because they were backordered.&#160; I almost forgot about it, but when it showed up, I had a new adventure to start and I was excited about it.&#160; I opened the box an inside was the <a href="http://www.roboticsconnection.com/p-15-traxster-robot-kit.aspx" target="_blank">Traxster II</a> from Robot Connections.</p>
<p><a href="http://codetheory.files.wordpress.com/2011/02/traxsterrobotkitlarge.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:right;border-top:0;border-right:0;padding-top:0;margin:0 0 0 24px;" title="TraxsterRobotKitLarge" border="0" alt="TraxsterRobotKitLarge" align="right" src="http://codetheory.files.wordpress.com/2011/02/traxsterrobotkitlarge_thumb.jpg?w=256&#038;h=184" width="256" height="184" /></a>I started assessing what I had.&#160; All the parts that I asked for were there.&#160; I knew it would fall short, because I had no real idea all the pieces that I needed.&#160; This was a lot more advanced than the simple X10 components I had worked with in the past.&#160; Over the following weeks, I would find out how deep a space this was and how simple or complex I could go if I wanted.&#160; My nature led me to the complex very quickly, but I will get to that a little later.&#160; The robot is tracked platform.&#160; This gives me a little more flexibility in driving.&#160; The system has two motors, one for the left track and one for the right track.&#160; Plus I think it looks a lot tougher than a wheeled robot.&#160; This will be the start of a multi-part blog on my robotic adventures.&#160; Let the adventures begin.</p>
<p>Now that I have my Traxster, I needed to have a plan.&#160; Something that would give me some targeted goals to build to.&#160; Something to challenge my robotics skills and my programming skills.&#160; There where a few options but I opted to program my robot to defend my bedroom entrance from our new cats.&#160; We have a pretty big house and there is no need for them to be in there.&#160; A friend of mine mentioned the Bedroom Defense System (BDS) and it stuck.&#160; This gives me a pretty well defined and achievable goal to reach for.&#160; Here are a few of the requirements.&#160; </p>
<ul>
<li>Run as an autonomous unit with no human control</li>
<li>Recognize the targets using optical recognition</li>
<li>Guard entry to the doorway using active defense techniques</li>
<li>Allow remote telemetry and interaction from anywhere (<a href="http://en.wikipedia.org/wiki/Robot_as_a_Service" target="_blank">RaaS</a>)</li>
<li>Have fun and learn some new techniques</li>
</ul>
<p><a href="http://codetheory.files.wordpress.com/2011/02/melvin.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;margin:0 15px 0 0;" title="Melvin" border="0" alt="Melvin" align="left" src="http://codetheory.files.wordpress.com/2011/02/melvin_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a>I started with the base Traxster II platform and the <a href="http://www.roboticsconnection.com/p-16-serializer-robot-controller.aspx" target="_blank">Serializer 3.0 Robot Controller</a>.&#160; This is a solid serializer to start with and it provides a lot of flexibility out of the box.&#160; I was able to assemble the robot fairly quickly.&#160; The most tedious part was putting the tracks together.&#160; There were a lot of small parts and each piece of the track needed to added individually.&#160; If you notice the photo, one of the cats has stopped by to see what is going on.&#160; A couple of the tracks broke on me while I was inserting the pins, but the track kit supplied a few extras, so I had enough when I was done.&#160; I also integrated the motors and the serializer board.&#160; The belt gears went on fairly easy, there was a little sticking with the powder <a href="http://codetheory.files.wordpress.com/2011/02/wp_000018.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:right;border-top:0;border-right:0;padding-top:0;margin:10px 0 10px 13px;" title="WP_000018" border="0" alt="WP_000018" align="right" src="http://codetheory.files.wordpress.com/2011/02/wp_000018_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a>coating but tightening the screws evenly pressed them in cleanly.&#160; The next big step was identifying the additional parts I needed to order.&#160; There are a lot of choices, I would so limitless.&#160; I opted to go with a few specific parts, to stay in alignment with my goals.&#160; The one that I am most excited about is the optics.&#160; I purchased a <a href="http://www.trossenrobotics.com/p/Microsoft-LifeCam-Cinema-Webcam-HD-robot-camera.aspx" target="_blank">Microsoft LifeCam</a> and parts to build a turret configuration to start down the road optical recognition road.&#160; There are also a few open source options for object recognition and navigation that I will cover in a later blog entry.&#160; I also picked up a smaller laser attachment that I can use as a distraction.&#160; In addition to this, I invested in <a href="http://www.trossenrobotics.com/store/p/5827-Xbee-Pro-60mW-with-Wire-Antenna.aspx" target="_blank">XBee wireless</a> and some RFID technology from <a href="http://www.trossenrobotics.com/p/REDBEE-Wireless-rfid-reader.aspx" target="_blank">RedBee</a>.&#160; All of these will be staged into the design over time.</p>
<p>While putting together my creation, I dug deep into how far I could extend the the robot.&#160; This is where things started to get complex.&#160; To really create a robot properly, I need to be creative on all fronts.&#160; I also need to have at least a basic and optimally an intermediate knowledge of electronics.&#160; I think I am OK in that area, but there is definitely a lot of relearning I am going to need to do.&#160; In addition there are a lot of new parts and tools to play with.&#160; I purchased a new digital multi-meter.&#160; I also have my eye on a portable Oscilloscope from <a href="http://www.seeedstudio.com/depot/preorder-dso-quad-beta-test-p-736.html?cPath=174&amp;zenid=2f2044c8e6bef0936efb963af51ca798" target="_blank">seedstudio</a>, but its currently in beta so I am going to wait until its ready for prime time.&#160; </p>
<p>I started with the platform layout and the initial build of the components.&#160; I pulled apart an old DVD player and extracted a few parts to enhance my installation points.&#160; Here are a few screen shoots of my progress, which include the optics turret, the XBee wireless and some additional platform parts pulled from the DVD player.</p>
<p align="center"><a href="http://codetheory.files.wordpress.com/2011/02/wp_000054.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="WP_000054" border="0" alt="WP_000054" src="http://codetheory.files.wordpress.com/2011/02/wp_000054_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a><a href="http://codetheory.files.wordpress.com/2011/02/wp_000039.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="WP_000039" border="0" alt="WP_000039" src="http://codetheory.files.wordpress.com/2011/02/wp_000039_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a><a href="http://codetheory.files.wordpress.com/2011/02/wp_000060.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="WP_000060" border="0" alt="WP_000060" src="http://codetheory.files.wordpress.com/2011/02/wp_000060_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a><a href="http://codetheory.files.wordpress.com/2011/02/wp_000053.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="WP_000053" border="0" alt="WP_000053" src="http://codetheory.files.wordpress.com/2011/02/wp_000053_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a><a href="http://codetheory.files.wordpress.com/2011/02/wp_000057.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="WP_000057" border="0" alt="WP_000057" src="http://codetheory.files.wordpress.com/2011/02/wp_000057_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a><a href="http://codetheory.files.wordpress.com/2011/02/wp_000065.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="WP_000065" border="0" alt="WP_000065" src="http://codetheory.files.wordpress.com/2011/02/wp_000065_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
<p>I still don’t have all the components I need to program against the robot.&#160; To get all the components running they are going to each voltage.&#160; I ordered a pair of 9.6V NiHM battery packs.&#160; The serializer board has a 12V regulated input and 4-6V un-regulated input.&#160; At this point, I am going to build the proper voltage regulator myself.&#160; I bought a bunch of resistors, capacitors and regulators at the local radio shack.&#160; I will follow up with the solution in a later entry as well.&#160; I know I don’t have the right power yet and I want to make sure I cover the voltage requirements properly.</p>
<p><strong>More to come…</strong></p>
<p>Cheers,   <br />g </p>
<br />Filed under: <a href='http://codetheory.wordpress.com/category/software/development/'>Development</a>, <a href='http://codetheory.wordpress.com/category/raas/'>RaaS</a>, <a href='http://codetheory.wordpress.com/category/robotics/'>Robotics</a> Tagged: <a href='http://codetheory.wordpress.com/tag/robot/'>Robot</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetheory.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetheory.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetheory.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetheory.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetheory.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetheory.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetheory.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetheory.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetheory.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetheory.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetheory.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetheory.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetheory.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetheory.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=72&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetheory.wordpress.com/2011/02/06/robot-adventures-the-beginning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6a2096345594ed3a3efbb3ff7e7e5130?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/02/traxsterrobotkitlarge_thumb.jpg" medium="image">
			<media:title type="html">TraxsterRobotKitLarge</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/02/melvin_thumb.jpg" medium="image">
			<media:title type="html">Melvin</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/02/wp_000018_thumb.jpg" medium="image">
			<media:title type="html">WP_000018</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/02/wp_000054_thumb.jpg" medium="image">
			<media:title type="html">WP_000054</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/02/wp_000039_thumb.jpg" medium="image">
			<media:title type="html">WP_000039</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/02/wp_000060_thumb.jpg" medium="image">
			<media:title type="html">WP_000060</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/02/wp_000053_thumb.jpg" medium="image">
			<media:title type="html">WP_000053</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/02/wp_000057_thumb.jpg" medium="image">
			<media:title type="html">WP_000057</media:title>
		</media:content>

		<media:content url="http://codetheory.files.wordpress.com/2011/02/wp_000065_thumb.jpg" medium="image">
			<media:title type="html">WP_000065</media:title>
		</media:content>
	</item>
		<item>
		<title>What is RaaS</title>
		<link>http://codetheory.wordpress.com/2011/02/01/what-is-raas/</link>
		<comments>http://codetheory.wordpress.com/2011/02/01/what-is-raas/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 15:01:20 +0000</pubDate>
		<dc:creator>Greg Ebert</dc:creator>
				<category><![CDATA[RaaS]]></category>
		<category><![CDATA[Robotics]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Robot as a Service]]></category>

		<guid isPermaLink="false">https://codetheory.wordpress.com/2011/02/01/what-is-raas/</guid>
		<description><![CDATA[Robot as a Service or RaaS is a technique used in the field of software based technology.&#160; It enables an agent to enlist a robotic entity to perform actions.&#160; In its simplest form the robot becomes a service end point for a user to command.&#160; Generally the service can only be acquired by a single [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=53&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Robot as a Service or RaaS is a technique used in the field of software based technology.&#160; It enables an agent to enlist a <a href="http://en.wikipedia.org/wiki/Robots">robotic</a> entity to perform actions.&#160; In its simplest form the robot becomes a service end point for a user to command.&#160; Generally the service can only be acquired by a single user at a time, but some robotic systems may allow multi-user integration as passive observers to the telemetry data of the robot.</p>
<p><strong>Purpose     <br /></strong>The goals of RaaS are to enable an agent to control robotic entities in remote or distant locations, safely and securely using a common interface model.&#160; Today most robots are disconnected from the digital world.&#160; The need for to control remote robots is going to become more important over the next few decades.&#160; Currently there are various techniques to doing this, but RaaS creates a unified approach to robotic service delivery.</p>
<p><strong>History     <br /></strong>RaaS is a fairly new technique, but there are a few recent examples that within the last decade that demonstrate its value to individuals and society as a whole.&#160; The best example that expands our understanding of how RaaS can impact our lives is the Robotic missions to the moon.&#160; We are most familiar with the explorations of <a href="http://en.wikipedia.org/wiki/Spirit_and_Opportunity">Spirit and Opportunity</a>.&#160; While this technique is still evolving the future has almost unlimited potential. </p>
<p><strong>Characteristics     <br /></strong>Robot as a Service (RaaS) has a few important characteristics that, even though the term may be interpreted by people in different ways.&#160; There are specific characteristics that can be found in common.</p>
<ul>
<li>It enables intra-network and inter-network based robotic services to any user.&#160; Typically the interaction is available for a single user per robotic instance to command at any time.&#160; </li>
<li>Upgrades changes or enhancements to the robot are simply discovered and the user benefits from those changes.</li>
<li>The client simply discovers the services and issues commands.&#160; The clients hardware or software are transparent and not important to the robot.</li>
<li>Security and performance are generally weighted higher during implementation because of the potential uses for a robot and the volume/nature of telemetry data that is transmitted.</li>
</ul>
<p><strong>Benefits     <br /></strong>The benefits of RaaS are far and wide reaching.&#160; What makes the application of RaaS unique to other software techniques in use today is the control of a physical entity located somewhere other than the controller.&#160; The practical applications are significant.&#160; Here is a short list of some of the uses.</p>
<ul>
<li>Control of remote mining equipment.</li>
<li>Medical assist robots.</li>
<li>Autonomous military units.</li>
<li>Home automation.</li>
<li>Industrial manufacturing lines.</li>
<li>Space exploration.</li>
</ul>
<p>Enabling a user to control an physical entity in a remote location provides great value in leveraging both skills and impact.&#160; It allows the user to project into the location and perform actions or observe.</p>
<p><strong>Implementation     <br /></strong>When implementing a RaaS architecture it is important to understand the what is being enabled and the human risk factors involved.&#160; A robot exists in the physical world with people.&#160; Since the controller is physically in another location, the environment that the robot is operating in should be well understood if the robot is mobile or performs actions that can be harmful to a life form.</p>
<p>Information about the robot needs to be discoverable.&#160; Using a common discovery method like a Robot Service Discovery Language or RSDL.&#160; This would be similar to Web Service Discovery Language or WSDL, which is commonly used in <a href="http://en.wikipedia.org/wiki/Software_as_a_service">SaaS</a> web based implementations.&#160; This allows the consumer to discover the following aspects of a robot.</p>
<ul>
<li>Name</li>
<li>Location</li>
<li>Status</li>
<li>Sensors</li>
<li>Connection Instructions</li>
<li>Telemetry requirements</li>
</ul>
<p>Performance is a critical factor in a RaaS implementation.&#160; Because of response times telemetry data volumes this can be a challenge.&#160; It is important that the experience feels and responds real time or near-real time. </p>
<p>Because RaaS is a direct interaction with a user and a robot, a limited amount of controlling user connections can be made.&#160; Most services will only support one user and observation connections.&#160; Or for more complex robots multiple controllers can be connected to aspects of the robot.&#160; For example a robot controlled tank may allow a driver, navigator and a gunner to be connected to run aspects of the system. Connections are typically negotiated and secured to allow the controller to have exclusive connectivity to manipulate the robots sensors, servos and motors.</p>
<p><strong>Limitation     <br /></strong>The main limiting factor is network performance.&#160; One of the limiting factors encountered today are available network bandwidth.&#160; This can impact the usability and value of a RaaS implementation.&#160; As new network technologies like are discovered or existing technologies are improved RaaS implementations will have dramatic improvements and new implementations will be possible.&#160; Other factors that impact performance are encryption and compression for transmitting high volumes of data.</p>
<br />Filed under: <a href='http://codetheory.wordpress.com/category/raas/'>RaaS</a>, <a href='http://codetheory.wordpress.com/category/robotics/'>Robotics</a>, <a href='http://codetheory.wordpress.com/category/web-services/'>Web Services</a> Tagged: <a href='http://codetheory.wordpress.com/tag/raas/'>RaaS</a>, <a href='http://codetheory.wordpress.com/tag/robot-as-a-service/'>Robot as a Service</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetheory.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetheory.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetheory.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetheory.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetheory.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetheory.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetheory.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetheory.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetheory.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetheory.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetheory.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetheory.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetheory.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetheory.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=53&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetheory.wordpress.com/2011/02/01/what-is-raas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6a2096345594ed3a3efbb3ff7e7e5130?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>
	</item>
		<item>
		<title>Software Architects: finding balance</title>
		<link>http://codetheory.wordpress.com/2009/11/12/software-architects-finding-balance/</link>
		<comments>http://codetheory.wordpress.com/2009/11/12/software-architects-finding-balance/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 05:08:00 +0000</pubDate>
		<dc:creator>Greg Ebert</dc:creator>
				<category><![CDATA[Architect]]></category>
		<category><![CDATA[Balance]]></category>
		<category><![CDATA[Execution]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://codetheory.wordpress.com/2009/11/12/software-architects-finding-balance</guid>
		<description><![CDATA[Keeping balance between design and execution, is fundamental to being a great architect.&#160; This is always a struggle.&#160; Making sure that your visibility on things stays broad and your technical skills at their peek.&#160; All while watching the industry direction and recalculating risks of new technology emergence.&#160; Contextually, the reference of architect will refer to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=15&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Keeping balance between design and execution, is fundamental to being a great architect.&#160; This is always a struggle.&#160; Making sure that your visibility on things stays broad and your technical skills at their peek.&#160; All while watching the industry direction and recalculating risks of new technology emergence.&#160; Contextually, the reference of architect will refer to the position of a Professional Software Architect at all levels of his/her career.</p>
<p>I have been doing architecture at many companies over the years. The most significant observation is that most companies really don’t know what architects do. I find this a bit shocking in one sense. Trying to understand why you would hire a highly skilled resource and have them function in roles not suited is hard to grasp, and a significant waste of resources. I sometimes relate this to the movie “Troy”. I see Achilles as the one of the most prolific combat architects of all time. He was one of the most skilled warriors on the battlefield. He was also a top notch tactician. There is a fine balance that is kept here.&#160;&#160; The balance between knowing and understanding the art and then being capable of executing that art is what truly defines the architect.</p>
<p>When this fundamental balance is broken the architect becomes pulled into one of two directions that diminish the effectiveness of the role itself. I have seen many articles on the premise of whether an architect should code or not. The answer is quite simple, the architect must code. Fundamentally this is the skill that keeps the architect grounded in his/her ability to execute.</p>
<p>The ability to execute is what firmly plants the architect’s assertions in reality. It also provides a solid platform to earn the respect of peers, as well as, the development staff.&#160;&#160; Respect in the ability to execute becomes essential to provide the other functions required to be an architect. It becomes difficult to push directions and practices if the grounding cannot be communicated and demonstrated in a fashion that is acceptable to a skilled developer. Imagine if Achilles could only talk about swordsmanship and not actually wield that weapon in a skilled manner. He may also be a tactician, yet the warrior skills do not exist. In its purist sense he could not be taken seriously when wielding that weapon in the presence of his skilled soldiers. He would lose.</p>
<p>But earning the respect of your peers and subordinates is only half of the responsibility. The other half is to earn the respect of those that rely on you to understand their visions. To design/architect the outcome in a positive, almost perfect manner. This encompasses the other significant function of the architect. To understand the customers goals and derive the true meaning of the overarching concerns. This in itself can be a very complex and daunting role. The need to be an ambassador and a respected advisor is crucial. This is the area where the trap of management comes into play.</p>
<p>Engaging in high level planning meetings and being involved in customer facing discussions to understand what needs to be expressed into software. These are essential roles of the architect. In many cases an architect can function as a skilled manager or business representative if required. But this is not a chosen path, but more a required skill to make the correct translations into the design. Remember that software is a very precise expression of business flow and execution. Done correctly it can provide great efficiencies that scale across a business. Done incorrectly, it can reduce or negate the efforts to create profitability. Drawing an architect into management practices and away from their core functions is a disservice to the company and its goals.&#160; Achilles would report to the generals and the visionaries his impressions and interpretations of their plans. How they might create success or failure on the battlefield.&#160; Had Achilles been drawn into the political ebb and flow of those he consults for, his advice might be skewed.&#160; Spending to much time away from sparring would cause him to lose his edge in execution.</p>
<p>If the transitions are welcome to all parties then a good architect will recognize the risks and prepare them. We cannot forget that a primary function of an architect is risk mitigation in the design and implementation. Creating a disruption in the skill balance is a risk in itself. Having a skilled architect on your team creates a greater chance of both short and long term success with your IT initiatives. Understanding the meaning of that value of the position and preserving its intent is the responsibility of everyone that engages that position and when that balance becomes lost, it is the responsibility of the architect to communicate it.</p>
<br />Posted in Architect, Balance Tagged: Architect, Balance, Execution, Software <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetheory.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetheory.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetheory.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetheory.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetheory.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetheory.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetheory.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetheory.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetheory.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetheory.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetheory.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetheory.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetheory.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetheory.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=15&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetheory.wordpress.com/2009/11/12/software-architects-finding-balance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6a2096345594ed3a3efbb3ff7e7e5130?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>
	</item>
		<item>
		<title>VCS is only part of ALM</title>
		<link>http://codetheory.wordpress.com/2009/11/07/vcs-is-only-part-of-alm/</link>
		<comments>http://codetheory.wordpress.com/2009/11/07/vcs-is-only-part-of-alm/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 16:36:00 +0000</pubDate>
		<dc:creator>Greg Ebert</dc:creator>
				<category><![CDATA[ALM]]></category>
		<category><![CDATA[Governance]]></category>
		<category><![CDATA[Source Control]]></category>

		<guid isPermaLink="false">http://codetheory.wordpress.com/2009/11/12/vcs-is-only-part-of-alm</guid>
		<description><![CDATA[Version Control Systems(VCS) only covers a portion of Application Life cycle Management(ALM).&#160; Its important to understand what your needs are and use the correct tools.&#160; VCS will fall short if your looking to manage application life cycles.&#160; If you are building enterprise solutions and run with large teams, making the investment in ALM pays off [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=14&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Version Control Systems(VCS) only covers a portion of Application Life cycle Management(ALM).&#160; Its important to understand what your needs are and use the correct tools.&#160; VCS will fall short if your looking to manage application life cycles.&#160; If you are building enterprise solutions and run with large teams, making the investment in ALM pays off almost immediately.</p>
<p>Modern software projects tend to be very complex and require fast and efficient delivery cycles, that leave simple VCS systems lacking.&#160; Even in small teams, ALM has many advantages.&#160; I find very few cases where simply having a source control system is sufficient.</p>
<p>In the world of ALM, there are two approaches.&#160; You can cobble together an ALM system from many tools or you can get an integrated solution.&#160; I always prefer the later, because the cost of doing the tools integration is high.&#160; In addition, it tends to create pockets of knowledge of the process workings and in some cases a single point of failure among the skill sets.&#160; You can get integrated solutions from vendors like Borland, Microsoft or Serena.</p>
<p>There are cost differentials to consider.&#160; Many of the ALM products or commercial and come with a price.&#160; While you can probably get VCS, Defect, Project tracking tools to create an ALM process, you still pay for that in time and complexity.&#160; A home built solution takes time to get off the ground and usually has that one guy that knows how it all works.&#160; To everyone else it tends to be a mystery.</p>
<p>If your producing software, the quality can be directly impacted by the process that is applied to the production of the software.&#160; Using an ALM tool can greatly amplify a software engineering teams ability to create a quality product.</p>
<p>Some of the benefits of ALM:</p>
<ul>
<li>Better collaboration and communication among teams </li>
<li>Increased productivity and faster development through tool integration </li>
<li>Improved quality and defect tracking </li>
<li>Adaptability to business changes and market demand </li>
<li>Improved project governance through visibility and transparency </li>
</ul>
<p>Managing the life cycles around code are fundamental to leveraging your teams most effectively.&#160; Everything that interacts with that code, from new requirements to maintenance support and defect corrections, can cause the code base to experience entropy.&#160; There are already very complex process and problems and chaining effects of change that need to be mitigated.&#160; Using tools that allow developers, testers and project managers to have visibility into the process and make adjustments quickly help to keep the product in a stable and manageable state.</p>
<p>As projects grow, the importance branching, merging and conflict resolution become extremely important.&#160; And the ability to map artifacts to code and trace it through the process becomes vital to releasing features while maintaining existing features.&#160; Planning and scheduling work against branches and communication with quality teams can be cumbersome when your process and tools are not integrated.</p>
<p>How you organize your teams and the tools they use can make or break the product you are trying to produce.&#160; Simply using a VCS will limit your ability to be competitive in the marketplace.&#160; He who has the best people and the best process wins.</p>
<br />Posted in ALM Tagged: ALM, Governance, Source Control <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetheory.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetheory.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetheory.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetheory.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetheory.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetheory.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetheory.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetheory.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetheory.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetheory.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetheory.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetheory.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetheory.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetheory.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=14&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetheory.wordpress.com/2009/11/07/vcs-is-only-part-of-alm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6a2096345594ed3a3efbb3ff7e7e5130?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>
	</item>
		<item>
		<title>The simple things that we take for granted</title>
		<link>http://codetheory.wordpress.com/2009/07/22/the-simple-things-that-we-take-for-granted/</link>
		<comments>http://codetheory.wordpress.com/2009/07/22/the-simple-things-that-we-take-for-granted/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 07:26:00 +0000</pubDate>
		<dc:creator>Greg Ebert</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Delegate]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[Recursion]]></category>
		<category><![CDATA[Sorting]]></category>

		<guid isPermaLink="false">http://codetheory.wordpress.com/2009/07/22/the-simple-things-that-we-take-for-granted</guid>
		<description><![CDATA[Would you ever find yourself in a situation where the simplest things seem to make no sense.&#160; Well, its possible.&#160; And for those times, I have provided some of those simple things as a reminder to myself that the basics matter.&#160; We do them every day, and take them for granted. For those heroic academics [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=13&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Would you ever find yourself in a situation where the simplest things seem to make no sense.&#160; Well, its possible.&#160; And for those times, I have provided some of those simple things as a reminder to myself that the basics matter.&#160; We do them every day, and take them for granted.</p>
<p>For those heroic academics out that that just need simple little solutions to basic problems, here is just some playing around.&#160; What&#8217;s crazy is that I have written so many lines of code over my career, that I just felt like writing these little silly blocks of code, to prove to myself that I my brain still functions.</p>
<p>Here is how one might sort an array without using the built in sort method:</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:af54fb22-ec26-4d67-8de5-fce53325466a" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:300px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">[TestMethod]public void SortTest()</li>
<li>{&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;string[] array = new string[] { &quot;c&quot;, &quot;a&quot;, &quot;d&quot;, &quot;b&quot;, &quot;f&quot;&#160;&#160;};&#160;&#160;</li>
<li>&#160;&#160;var result = from str in array&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;orderby str&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;select str;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;Console.WriteLine(string.Join(&quot;,&quot;, result.ToArray()));</li>
<li>}</li>
</ol></div>
</p></div>
</p></div>
<p>&#160;</p>
<p>Here is something simple that would break down cents into the least amount of coins, based on dimes and nickels and pennies.&#160; I recently updated this using Lambda expressions.&#160; If someone needed to do that:</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:95f5212a-2f29-4096-b8d2-b8959bd14a92" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:500px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">[TestMethod]public void ChangeTest()</li>
<li>{&#160;&#160;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;decimal total = 1.44m;&#160;&#160;&#160;&#160;</li>
<li>&#160;&#160;Func&lt;decimal, int&gt; getpennies = (a) =&gt; </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;((int)(a * 100) % 100 % 25 % 10 % 5) / 1;&#160;&#160;&#160;&#160;</li>
<li>&#160;&#160;Func&lt;decimal, int&gt; getnickles = (a) =&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;((int)(a * 100) % 100 % 25 % 10) / 5;&#160;&#160;&#160;&#160;</li>
<li>&#160;&#160;Func&lt;decimal, int&gt; getdimes = (a) =&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;((int)(a * 100) % 100 % 25) / 10;&#160;&#160;&#160;&#160;</li>
<li>&#160;&#160;Func&lt;decimal, int&gt; getquarters = (a) =&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;((int)(a * 100) % 100) / 25;&#160;&#160;&#160;&#160;</li>
<li>&#160;&#160;Func&lt;decimal, int&gt; getdollars = (a) =&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;((int)(a * 100)) / 100;&#160;&#160;&#160;&#160;</li>
<li>&#160;&#160;Console.WriteLine(&quot;Dollars: {0}, Quarters: {1}, Dimes: {2}, </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;Nickles: {3}, Pennies: {4}&quot;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;, getdollars(total), getquarters(total), getdimes(total)</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;, getnickles(total), getpennies(total));</li>
<li>}</li>
</ol></div>
</p></div>
</p></div>
<p>&#160;</p>
<p>And if you were in the mood to do some simple recursion, something we all have done in those scenarios where it makes sense.&#160; This one sets a recursive limit and adds up the values as it goes along:</p>
<p>&#160;</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8a806245-7df5-4352-a65a-f71838d860ba" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:300px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">[TestMethod]public void RercursionTest()</li>
<li>{&#160;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;Recurse(1, 4, 0);</li>
<li>}</li>
<li style="background:#f3f3f3;">static void Recurse(int currentdepth, int maxdepth, int sum)</li>
<li>{&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;if (currentdepth &gt; maxdepth) </li>
<li>&#160;&#160;&#160;&#160;&#160;return;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;Recurse(currentdepth + 1, maxdepth, currentdepth + sum);&#160;&#160;</li>
<li>}</li>
</ol></div>
</p></div>
</p></div>
<p>Enjoy!!!</p>
<br />Posted in Software Tagged: Delegate, Linq, Recursion, Sorting <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetheory.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetheory.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetheory.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetheory.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetheory.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetheory.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetheory.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetheory.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetheory.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetheory.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetheory.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetheory.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetheory.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetheory.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=13&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetheory.wordpress.com/2009/07/22/the-simple-things-that-we-take-for-granted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6a2096345594ed3a3efbb3ff7e7e5130?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>
	</item>
		<item>
		<title>Recursion with Linq</title>
		<link>http://codetheory.wordpress.com/2009/05/10/recursion-with-linq/</link>
		<comments>http://codetheory.wordpress.com/2009/05/10/recursion-with-linq/#comments</comments>
		<pubDate>Sun, 10 May 2009 16:15:00 +0000</pubDate>
		<dc:creator>Greg Ebert</dc:creator>
				<category><![CDATA[Framework]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[Recursion]]></category>

		<guid isPermaLink="false">http://codetheory.wordpress.com/?p=11</guid>
		<description><![CDATA[Have you ever needed a way to re-curse an object hierarchy in a very generic and simple way.&#160; I can show you how to do this and have it so simple to use that its just another part of you Linq query infrastructure. Recursion can be a very useful operation if you need to dig [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=11&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Have you ever needed a way to re-curse an object hierarchy in a very generic and simple way.&#160; I can show you how to do this and have it so simple to use that its just another part of you Linq query infrastructure.</p>
<p>Recursion can be a very useful operation if you need to dig deep into an object Hierarchy. If recursion is used in conjunction with Linq, it can be a very powerful way to extract collections or very specific items that you are looking for but don&#8217;t know the exact location to. There are a few simple things that I implemented to achieve this effect in my Theorem framework. I will break them down and explain why the particular technique was used.</p>
<p>One thing that I needed to do was establish a way to get at children on my base classes. BusinessBase is an abstract class that I derive all my business objects from, but it can be anything in your case. I added an interact to my BusinessBase class called IBusinessBase. Notice the ChildCollections being enforced here. That class will become one of the cornerstones required to make this all work.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:95068d94-d88f-49b2-a18a-d1e0678120ad" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:500px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">public interface IBusinessBase </li>
<li>{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;string Id { get; } </li>
<li>&#160;&#160;&#160;&#160;ChildCollections ChildCollections { get; } </li>
<li style="background:#f3f3f3;">}</li>
</ol></div>
</p></div>
</p></div>
<p>Now, lets take a look at the ChildCollections class and see what it does. Its very simply really. It creates a collection of all the BusinessCollectionBase&lt;&gt; objects that I have defined as properties on my object. In this case you can substitute ListBase&lt;&gt; for List&lt;&gt;, which is a custom list implementation I use in Theorem.&#160; This class simple acts as a container for the collections and exposes and object[] to contain all the items in the collection.&#160; This important for the recursion to work properly.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:223b47f5-105d-43f3-ae93-444d87e46beb" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:500px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">public class ChildCollections : ListBase, IChildCollections </li>
<li>{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;public object[] AllItems </li>
<li>&#160;&#160;&#160;&#160;{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;get </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;List&lt; object&gt; items = new List&lt; object&gt;(); </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i &lt; this.Count; i++) </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;IEnumerator e = this[i].GetEnumerator(); </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;while (e.MoveNext()) </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;items.Add(e.Current); </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return items.ToArray(); </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} </li>
<li>&#160;&#160;&#160;&#160;} </li>
<li style="background:#f3f3f3;">}</li>
</ol></div>
</p></div>
</p></div>
<p>The interface IChildCollections looks like this.&#160; It cab be used to create your own custom collection containers in any way you like.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a9cd363c-7423-4fae-9160-33a4a57a8ed6" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:500px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">public interface IChildCollections </li>
<li>{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;object[] AllItems { get; } </li>
<li>}</li>
</ol></div>
</p></div>
</p></div>
<p>Once you have this all established we can move on to the extension method that will allow us to extend Linq in a way that will allow recursion on out the object models.&#160; Simple create a namespace and add the following code.&#160; The extension method takes advantage of a few very cool features of .net.&#160; For example the<strong> </strong><a href="http://msdn.microsoft.com/en-us/library/9k7k7cf0.aspx"><strong>yield</strong></a> statement and <a href="http://msdn.microsoft.com/en-us/library/bb549151.aspx"><strong>Func</strong></a> Delegate.</p>
<p>We are simply going to iterate over the IEnumerable objects of Type T, which I will demonstrate later.&#160; The enumeration item discovered happens to be another IEnumerable collection then we will yield each item and re-curse if necessary.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:85c99b1c-9e71-446a-9612-37554aa7833f" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:500px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">namespace Theorem.Linq </li>
<li>{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;static public class LinqExtensions </li>
<li>&#160;&#160;&#160;&#160;{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;public static IEnumerable Recurse(this IEnumerable source,&#160;&#160;</li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Func&lt; T, IEnumerable &gt; recurse) </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;foreach (T item in source) </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yield return item; </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;IEnumerable enumerable = recurse(item);</li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (enumerable != null) </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;foreach (T itemRecurse in </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Recurse(enumerable, recurse)) </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yield return itemRecurse; </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} </li>
<li>&#160;&#160;&#160;&#160;} </li>
<li style="background:#f3f3f3;">}</li>
</ol></div>
</p></div>
</p></div>
</p>
<p>I have a BusinessBase object in my framework that implements the IBusinessBase interface.&#160; This forces me to create an implementation that looks like this.&#160; In my case I wanted to constrain my ChildCollection to typeof(IBusinessCollectionBase&lt;&gt;).&#160; By doing this, I am only extracting out framework collections, which is what I want in my case.&#160; But you could very easily open this up to IEnumerable&lt;&gt; and or more for recursion.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f964598a-f406-48e4-afb9-7be83d6953b3" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:500px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">public ChildCollections ChildCollections </li>
<li>{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;get </li>
<li>&#160;&#160;&#160;&#160;{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (_children == null) </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;_children = new ChildCollections(); </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;PropertyInfo[] props = this.GetType().GetProperties(); </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i &lt; props.Length; i++) </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (props[i].PropertyType.GetInterface( </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;typeof(IBusinessCollectionBase&lt;&gt;).Name) != null) </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;_children.Add((IEnumerable)</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;props[i].GetValue(this, null)); </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return _children; </li>
<li>&#160;&#160;&#160;&#160;} </li>
<li style="background:#f3f3f3;">}</li>
</ol></div>
</p></div>
</p></div>
<p>Ok, so on to a use case for this code and a demonstration of the output.&#160; Lets take an example from Theorem where we have a Group object that contains a collection of Groups as a property.&#160; We will then re-curse the structure with very little code.&#160; Here is a test method from Theorem.&#160; The lines to note are highlighted that demonstrate the recursion call.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:453ff9bd-279c-4163-966d-582c96989192" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:500px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">using System; </li>
<li>using System.Linq; </li>
<li style="background:#f3f3f3;">using System.Security; </li>
<li>using System.Security.Permissions; </li>
<li style="background:#f3f3f3;">using System.Transactions; </li>
<li>using Microsoft.VisualStudio.TestTools.UnitTesting; </li>
<li style="background:#f3f3f3;">using Theorem.Application.Security.Authorization; </li>
<li>using Theorem.Core; </li>
<li style="background:#f3f3f3;">using Theorem.Core.Data; </li>
<li>using Theorem.Linq;</li>
<li style="background:#f3f3f3;">&#8230;</li>
<li>[TestMethod] </li>
<li style="background:#f3f3f3;">public void Autorization_Core_Recursion() </li>
<li>{ </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;AuthorizationController ac = new AuthorizationController(); </li>
<li>&#160;&#160;&#160;&#160;Groups groups = ac.GetGroups();</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;Assert.IsNotNull(groups); </li>
<li>&#160;&#160;&#160;&#160;Group group = (from g in groups </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;where g.Name == &quot;Administrators&quot; </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;select g).FirstOrDefault(); </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;</li>
<li>&#160;&#160;&#160;&#160;Assert.AreEqual(&quot;Administrators&quot;, group.Name);</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;</li>
<li>&#160;&#160;&#160;&#160;Group groupA = new Group() { Name = &quot;test1&quot; }; </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;groupA.Groups.Add(new Group() { Name = &quot;test2&quot; }); </li>
<li>&#160;&#160;&#160;&#160;groupA.Groups.Add(new Group() { Name = &quot;test6&quot; });</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;Group groupB = new Group() { Name = &quot;test5&quot; }; </li>
<li>&#160;&#160;&#160;&#160;groupB.Groups.Add(new Group() { Name = &quot;test7&quot; }); </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;groupB.Groups.Add(new Group() { Name = &quot;test8&quot; });</li>
<li>&#160;&#160;&#160;&#160;groupA.Groups.Add(groupB);</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;group.Groups.Add(new Group() { Name = &quot;test3&quot; }); </li>
<li>&#160;&#160;&#160;&#160;group.Groups.Add(groupA); </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;group.Groups.Add(new Group() { Name = &quot;test4&quot; });</li>
<li>&#160;&#160;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;var items = group.ChildCollections.AllItems.Cast( </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Group).Recurse( x =&gt; x.ChildCollections.AllItems.Cast( </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Group)).OrderBy( x =&gt; x.Name);</li>
<li>&#160;&#160;&#160;&#160;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;foreach (Group item in items) </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Console.WriteLine(item.Name); </li>
<li style="background:#f3f3f3;">}</li>
</ol></div>
</p></div>
</p></div>
</p>
<p>And here are the results.&#160; You can see that I am specifically casting into group objects, because I know that is what I am working with in this case.&#160; But I could very easily cast into BusinessBase if I wanted to and get items of all types.</p>
<p>test1    <br />test2     <br />test3     <br />test4     <br />test5     <br />test6     <br />test7     <br />test8</p>
<p>As you can see, one simple line of code is all that you need to extract out all the items of a specific type to a collection that you can work with.&#160; This has been tremendously valuable in many cases.&#160; I hope you see the value as well.</p>
<br />Posted in Framework, Linq, Recursion Tagged: Linq, Recursion <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetheory.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetheory.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetheory.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetheory.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetheory.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetheory.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetheory.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetheory.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetheory.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetheory.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetheory.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetheory.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetheory.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetheory.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=11&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetheory.wordpress.com/2009/05/10/recursion-with-linq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6a2096345594ed3a3efbb3ff7e7e5130?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>
	</item>
		<item>
		<title>Messing with PowerShell</title>
		<link>http://codetheory.wordpress.com/2009/04/18/messing-with-powershell/</link>
		<comments>http://codetheory.wordpress.com/2009/04/18/messing-with-powershell/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 02:42:00 +0000</pubDate>
		<dc:creator>Greg Ebert</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Weather]]></category>
		<category><![CDATA[Web Service]]></category>
		<category><![CDATA[Xml]]></category>

		<guid isPermaLink="false">http://codetheory.wordpress.com/2009/04/18/messing-with-powershell</guid>
		<description><![CDATA[Up until recently, I have not used Windows PowerShell for very much.&#160; I tend to find myself opening the old staple, cmd window.&#160; I dug into what Windows PowerShell has to offer.&#160; I&#8217;d like to share a little of that with everyone.&#160; You may find it&#8217;s an extremely powerful utility for making your daily work [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=12&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Up until recently, I have not used Windows PowerShell for very much.&#160; I tend to find myself opening the old staple, cmd window.&#160; I dug into what Windows PowerShell has to offer.&#160; I&#8217;d like to share a little of that with everyone.&#160; You may find it&#8217;s an extremely powerful utility for making your daily work cycle a little easier.</p>
<p>In the very short time I have used PowerShell; I have found it very valuable.&#160; I created an example that will demonstrate how&#160; you can create a profile and have it run some custom script on start up.&#160; It was quick and simple for me to put together.</p>
<p>The main demonstration will be a function that calls out to a web based XML service, hosted by the National Oceanic and Atmospheric Administration (NOAA).&#160; If you have ever gone into the great outdoors in North America, you are probably familiar with NOAA radios and the value their service provides.&#160; I wanted to make a quick integration to pull weather based on a NOAA station ID.</p>
<p>Here is the completed <a href="http://labs.contexttheory.com/Portals/1/Blog/Files/2/9/Profile.zip">PowerShell Profile</a> &#8211; Profile.ps1 file I created for this demonstration.&#160; Just download and place this file in your %SystemDrive%\Users\{AccountName}\Documents\WindowsPowerShell folder.&#160; Next time you start PowerShell it will be active.</p>
<p>You may need to run this command to allow PowerShell to execute the scripts.   <br />Set-ExecutionPolicy RemoteSigned</p>
<p>The main script we care about here is this:</p>
<p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e4fbfe27-1650-4bef-858a-6f31758596d5" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:500px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">function Out-Weather([string]$station) {</li>
<li>&#160;&#160;&#160;&#160;if(!$station) { $station = &quot;KCOS&quot; }</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;$a = New-Object net.webclient</li>
<li>&#160;&#160;&#160;&#160;&quot;Calling NOAA service for weather information on $station&quot;</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;[xml]$x = $a.DownloadString(</li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&quot;http://www.weather.gov/xml/current_obs/&quot; + $station + &quot;.xml&quot;)</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;$credit = $x.current_observation.credit</li>
<li>&#160;&#160;&#160;&#160;$location = $x.current_observation.location</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;$observation_time = $x.current_observation.observation_time</li>
<li>&#160;&#160;&#160;&#160;&quot;&quot; </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;{0}&#8221; -f $credit | Write-Host -ForegroundColor white</li>
<li>&#160;&#160;&#160;&#160;&quot;Location: {0}&quot; -f $location | Write-Host -ForegroundColor white</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;&quot;</li>
<li>&#160;&#160;&#160;&#160;&quot;{0}&quot; -f $observation_time | Write-Host -ForegroundColor gray</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&quot;</li>
<li>&#160;&#160;&#160;&#160;$weather = $x.current_observation.weather</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;$temperature_string = $x.current_observation.temperature_string</li>
<li>&#160;&#160;&#160;&#160;$dewpoint_string = $x.current_observation.dewpoint_string</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;$wind_string = $x.current_observation.wind_string</li>
<li>&#160;&#160;&#160;&#160;$pressure_string = $x.current_observation.pressure_string</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;$windchill_string = $x.current_observation.windchill_string</li>
<li>&#160;&#160;&#160;&#160;$visibility_mi = $x.current_observation.visibility_mi</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;`tWeather&#160;&#160;&#160;&#160;&#160;{0}&quot; -f $weather </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;| Write-Host -ForegroundColor green</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;`tTempurature {0}&quot; -f $temperature_string </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;| Write-Host -ForegroundColor green</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;`tDew Point&#160;&#160;&#160;{0}&quot; -f $dewpoint_string </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;| Write-Host -ForegroundColor green</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;`tWind&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{0}&quot; -f $wind_string </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;| Write-Host -ForegroundColor green</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;`tWind Chill&#160;&#160;{0}&quot; -f $windchill_string </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;| Write-Host -ForegroundColor green</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;`tPressure&#160;&#160;&#160;&#160;{0}&quot; -f $pressure_string </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;| Write-Host -ForegroundColor green</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;`tVisibility&#160;&#160;{0} miles&quot; -f $visibility_mi </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;| Write-Host -ForegroundColor green</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&quot;&quot;</li>
<li>}</li>
<li style="background:#f3f3f3;">Set-Alias w Out-Weather</li>
</ol></div>
</p></div>
</p></div>
<p>&#160; </p>
<p>There are a couple lines of interest in here.&#160; The one that actually makes the call out to NOAA.&#160; This is the call return the XML that we will parse through for display.&#160; you can directly hit this service for your location at <a href="http://www.nws.noaa.gov/alerts/">http://www.nws.noaa.gov/alerts/</a>.&#160; This is where this example gets its feed from.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:98514946-cc31-4446-a5fc-3d486262696a" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:300px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">$a = New-Object net.webclient </li>
<li>[xml]$x = $a.DownloadString(&quot;http://www.weather.gov/xml/current_obs/&quot; </li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;+ $station + &quot;.xml&quot;)</li>
</ol></div>
</p></div>
</p></div>
<p>&#160;</p>
<p>If you look at the about lines, that is where the magic happens.&#160; $a represents a new object created by powershell.&#160; You can find more information on this <a href="http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.80).aspx">here</a>.&#160; PowerShell has the ability to create objects and use them,&#160; unlike batch files.&#160; The next line calls the service and gets the response as a string.&#160; It then places it into am XML type for use.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c31abacb-4449-4d94-baf6-0dac70dbfd1e" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:300px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">$weather = $x.current_observation.weather </li>
<li>$temperature_string = $x.current_observation.temperature_string</li>
</ol></div>
</p></div>
</p></div>
<p>&#160;</p>
<p>The above lines are also very interesting to note.&#160; Since we specified the return string as type XML literal, the data that was loaded is addressable directly though the System.XML.XmlDocument object.&#160; The syntax is very simple to write and it makes it easy to drill down into the XML document.&#160; In my case I am simply fully qualifying the path the the element that I wish to pull data from.&#160; You can get as fancy as you want here, even iterate through collections if needed.</p>
<p>Take a look at the out this produces when you install it.&#160; Simply running the command; w at the prompt will produce the current weather for the default site provided in the script.&#160; Running the command; w KDEN, will produce output for the Denver area.&#160; Visit the link provided to NOAA in this blog to find details on a weather site your interested in.</p>
<div style="width:604px;display:block;float:none;margin-left:auto;margin-right:auto;padding:0;" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:395bd520-1dd1-43c3-b963-e7b8672b1d02" class="wlWriterSmartContent"><a href="http://lh6.ggpht.com/_oDx7w0OJjSw/SwinRqTDtuI/AAAAAAAAACM/DykS18Aykus/untitled-8x6.jpg?imgmax=800" rel="thumbnail"><img border="0" alt="" src="http://lh6.ggpht.com/_oDx7w0OJjSw/SwinSLRx5mI/AAAAAAAAACU/06G7HZPdg-o/untitled%5B9%5D.png?imgmax=800" width="598" height="387" /></a></div>
<p>I hope you found this little experiment with Microsoft PowerShell useful.&#160; It helped me better understand the capabilities and usefulness of the tool.&#160; I don&#8217;t think you will catch me without PowerShell open in the future.&#160; If you really want to get some juice out of your PowerShell you can also install <a href="http://www.powergui.org/downloads.jspa">PowerGUI</a>, which is a powerful scripting management IDE for your PowerShell scripts.</p>
<p>Enjoy!</p>
<br />Posted in PowerShell Tagged: PowerShell, Weather, Web Service, Xml <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetheory.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetheory.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetheory.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetheory.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetheory.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetheory.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetheory.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetheory.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetheory.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetheory.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetheory.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetheory.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetheory.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetheory.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=12&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetheory.wordpress.com/2009/04/18/messing-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6a2096345594ed3a3efbb3ff7e7e5130?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>

		<media:content url="http://lh6.ggpht.com/_oDx7w0OJjSw/SwinSLRx5mI/AAAAAAAAACU/06G7HZPdg-o/untitled%5B9%5D.png?imgmax=800" medium="image" />
	</item>
		<item>
		<title>Returning XmlDocument objects from a WCF service</title>
		<link>http://codetheory.wordpress.com/2008/12/30/returning-xmldocument-objects-from-a-wcf-service/</link>
		<comments>http://codetheory.wordpress.com/2008/12/30/returning-xmldocument-objects-from-a-wcf-service/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 02:56:00 +0000</pubDate>
		<dc:creator>Greg Ebert</dc:creator>
				<category><![CDATA[Framework]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Serialize]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Xml]]></category>
		<category><![CDATA[XmlSerializerFormat]]></category>

		<guid isPermaLink="false">http://codetheory.wordpress.com/2008/12/30/returning-xmldocument-objects-from-a-wcf-service</guid>
		<description><![CDATA[There are scenarios when you want to return raw XML from a service call.&#160; If you have code from a legacy asmx service, WCF needs some minor adjustments to support returning an XmlDocument or an XmlNode as a result.&#160; I&#8217;ll show you how to get that code running with little effort. There are scenarios when [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=10&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are scenarios when you want to return raw XML from a service call.&#160; If you have code from a legacy asmx service, WCF needs some minor adjustments to support returning an XmlDocument or an XmlNode as a result.&#160; I&#8217;ll show you how to get that code running with little effort.</p>
<p>There are scenarios when you want to return raw XML from a service call.&#160; If you have code from a legacy asmx service, WCF needs some minor adjustments to support returning an XmlDocument or an XmlNode as a result.&#160; I&#8217;ll show you how to get that code running with little effort.</p>
<p>Here is a very simple example of a WCF service contract.&#160; Please note that the return type and parameter are specified as XmlElement and the method is decorated with the XmlSerializerFormat.&#160; The decoration is necessary for WCF to use the System.Xml.Serialization.XmlSerializer instead of the default System.Runtime.Serialization.XmlObjectSerializer to serialize the result.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:462f117e-3ba5-476f-adb5-209a4679ef52" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:300px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">[ServiceContract]</li>
<li>public interface IService</li>
<li style="background:#f3f3f3;">{</li>
<li>&#160;&#160;[OperationContract, XmlSerializerFormat]</li>
<li style="background:#f3f3f3;">&#160;&#160;XmlElement Process(XmlElement parameter);</li>
<li>}</li>
</ol></div>
</p></div>
</p></div>
<p> Now you need to implement the code for the service.&#160; For the sake of simplicity, I am going to load and XmlDocument and echo it back as the result. The key is to return the documents DocumentElement property as the result.&#160; DocumentElement and XmlDocument both implement the IXPathNavigable interface through their inheritance hierarchy.   <br /> 
</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:76734860-cf04-468f-a3d4-3a8dd888a5ef" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;max-height:300px;overflow:auto;">
<ol style="background:#ffffff;margin:0;padding:0 0 0 5px;">
<li>&nbsp;</li>
<li style="background:#f3f3f3;">public class Service : IService</li>
<li>{</li>
<li style="background:#f3f3f3;">&#160;&#160;public Service() {&#160;&#160;&#160;}</li>
<li>&#160;&#160;public XmlElement Execute(XmlElement parameter)</li>
<li style="background:#f3f3f3;">&#160;&#160;{</li>
<li>&#160;&#160;&#160;&#160;XmlDocument xd = new XmlDocument();</li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;xd.LoadXml(parameter.OuterXml);</li>
<li>&#160;&#160;&#160;&#160;return xd.DocumentElement;</li>
<li style="background:#f3f3f3;">&#160;&#160;}</li>
<li>}</li>
</ol></div>
</p></div>
</p></div>
<p> If you implement this code you will see that you can continue to use XmlDocument objects as input parameters and results with very little changes to your existing code.&#160; If you use XML to transfer data you should ensure that you enforce integrity in the contract by some validation mechanism, such as xsd validation.   </p>
<br />Posted in Framework, Web Services Tagged: Serialize, WCF, Web Services, Xml, XmlSerializerFormat <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetheory.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetheory.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetheory.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetheory.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetheory.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetheory.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetheory.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetheory.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetheory.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetheory.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetheory.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetheory.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetheory.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetheory.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=10&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetheory.wordpress.com/2008/12/30/returning-xmldocument-objects-from-a-wcf-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6a2096345594ed3a3efbb3ff7e7e5130?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>
	</item>
		<item>
		<title>Install ADAM on Vista</title>
		<link>http://codetheory.wordpress.com/2007/05/14/install-adam-on-vista/</link>
		<comments>http://codetheory.wordpress.com/2007/05/14/install-adam-on-vista/#comments</comments>
		<pubDate>Mon, 14 May 2007 17:06:00 +0000</pubDate>
		<dc:creator>Greg Ebert</dc:creator>
				<category><![CDATA[ADAM]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://codetheory.wordpress.com/2007/05/14/install-adam-on-vista</guid>
		<description><![CDATA[I am looking to integrate an ADAM instance as a security provider for my framework.&#160; My current contract could leverage its use.&#160; But I found that there are issues in getting ADAM installed on Vista, so I can build out a demonstration integration. I found a simple article to get ADAM up and running on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=9&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am looking to integrate an ADAM instance as a security provider for my framework.&#160; My current contract could leverage its use.&#160; But I found that there are issues in getting ADAM installed on Vista, so I can build out a demonstration integration.</p>
<p>I found a simple article to get ADAM up and running on your Vista box, because I wanted to adapt my framework to LDAP.&#160; You can find it <a href="http://dunnry.com/blog/InstallingADAMOnVista.aspx">here</a>. Its a good article, but it only got me so far. I also modified the instructions slightly. Here is what I did, which is very similar to the blog reference.</p>
<ul>
<li>Install ADAM on a non-Vista machine. I installed this on a Window Server 2003 SP2 machine I already had running. </li>
<li>Copy the %WINDIR%\ADAM folder from the installed box to the same location on your Vista machine. </li>
<li>Create a new registry key called HKLM\Software\Microsoft\Windows\CurrentVersion\ADAM_Shared </li>
<li>Under this key, create a new Multi-String value called &quot;SharedFolders&quot; </li>
<li>Now, run adaminstall.exe from your %WINDIR%\ADAM directory and follow the wizard. Make sure you use an account that has Admin rights or the LDIF imports will fail. </li>
<li>If the LDIF imports do fail, you can run a manual import using the ldifed.exe application in the ADAM directory for manual imports. </li>
<li>Copy over and repaint the Menu items so you have the proper shortcuts </li>
<li>In addition, you should also copy over the %WINDIR%\Help\adam.chm file to the same location on the Vista box. </li>
</ul>
<p>This should cover the basics for getting the ADAM instance on the box. But it was running in the <strong>MMC could not create the snap-in</strong> error message when I tried to run the ADSI Edit mmc snap-in. This is caused by the ADAM-ADSIEdit.dll file not being registered with windows under the Admin account. Do the following to get this running.</p>
<ul>
<li>Click startmenu/All Programs/Accessories </li>
<li>Right-click the &quot;Command Prompt&quot; and choose to &quot;Run as Administrator&quot; </li>
<li>In the command window change to the %WINDIR%\ADAM folder </li>
<li>run regsvr32 -s ADAM-ADSIEdit.dll </li>
</ul>
<p>This will register the assembly as administrator and give it the proper rights to create the snap-in. If you follow these steps you will have a working ADAM environment on Vista.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/codetheory.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/codetheory.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetheory.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetheory.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetheory.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetheory.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetheory.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetheory.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetheory.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetheory.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetheory.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetheory.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetheory.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetheory.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetheory.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetheory.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetheory.wordpress.com&amp;blog=10710333&amp;post=9&amp;subd=codetheory&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetheory.wordpress.com/2007/05/14/install-adam-on-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6a2096345594ed3a3efbb3ff7e7e5130?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>
	</item>
	</channel>
</rss>
