<?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-Genesis</title>
	<atom:link href="http://codetaco.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codetaco.wordpress.com</link>
	<description>Programming, gaming, martial arts, physics, existentialism, and other the typical geek stuff.</description>
	<lastBuildDate>Sat, 18 Jun 2011 08:51:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codetaco.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Code-Genesis</title>
		<link>http://codetaco.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codetaco.wordpress.com/osd.xml" title="Code-Genesis" />
	<atom:link rel='hub' href='http://codetaco.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Script to rescan your disks via DiskPart.</title>
		<link>http://codetaco.wordpress.com/2010/03/27/script-to-rescan-your-disks-via-diskpart/</link>
		<comments>http://codetaco.wordpress.com/2010/03/27/script-to-rescan-your-disks-via-diskpart/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 20:50:49 +0000</pubDate>
		<dc:creator>wind0</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codetaco.wordpress.com/?p=185</guid>
		<description><![CDATA[If you own a SATA HDD dock and tend to switch HDDs around or power them off when not in use.  Depending on your SATA controller on your motherboard it may or may not automatically detect a HDD when you switch your SATA HDD dock back on without rebooting the machine.  Windows 7 allows for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=185&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you own a SATA HDD dock and tend to switch HDDs around or power them off when not in use.  Depending on your SATA controller on your motherboard it may or may not automatically detect a HDD when you switch your SATA HDD dock back on without rebooting the machine.  Windows 7 allows for this plug and play capability of SATA controllers, but some controllers don&#8217;t play nice.  I find myself having to open the Computer Management Console and navigating to the Disk Management to rescan the disks so they can be accessible.  After a year+ of this I finally decided to not be lazy and just write a script to do this via DISKPART.  I essentially used the diskpart /s argument to pass in the diskpart RESCAN command.</p>
<p><strong>RescanDisks.bat:</strong><br />
@ECHO OFF<br />
TITLE Diskpart &#8211; Rescan DISKS<br />
Diskpart /s RescanDisks.txt<br />
ECHO.  Rescanning HDDs&#8230;</p>
<p><strong>RescanDisks.txt:</strong><br />
RESCAN<br />
EXIT</p>
<p>The EXIT may not be necessary, but it shouldn&#8217;t hurt.  Both files should be in the same directory.</p>
<p>I haven&#8217;t been able to blog much since I&#8217;m working at a full-time gig as a build engineer/developer/tester and also developing additional features for the Inventory Tool for <a title="Interconnection" href="http://http://www.interconnection.org/" target="_blank">InterConnection </a>in Seattle.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetaco.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetaco.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetaco.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetaco.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetaco.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetaco.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetaco.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetaco.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetaco.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetaco.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetaco.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetaco.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetaco.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetaco.wordpress.com/185/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=185&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetaco.wordpress.com/2010/03/27/script-to-rescan-your-disks-via-diskpart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d663bd38acb45c74611f330955f22adc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wind0</media:title>
		</media:content>
	</item>
		<item>
		<title>Two methods to query SQL from C#.</title>
		<link>http://codetaco.wordpress.com/2009/11/10/two-methods-to-query-sql-from-c/</link>
		<comments>http://codetaco.wordpress.com/2009/11/10/two-methods-to-query-sql-from-c/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 23:35:38 +0000</pubDate>
		<dc:creator>wind0</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codetaco.wordpress.com/?p=179</guid>
		<description><![CDATA[Below are two methods to query the database for multiple parameters/values.  The first method consists of creating a SQL connection then issuing a SQL command that calls a stored procedure.  The SQL  command parameters are defined and the return values are cast into the appropriate datatypes. Note that the SqlCommand.ExecuteScalar() is used instead of SqlCommand.ExecuteNonQuery().  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=179&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Below are two methods to query the database for multiple parameters/values.  The first method consists of creating a SQL connection then issuing a SQL command that calls a stored procedure.  The SQL  command parameters are defined and the return values are cast into the appropriate datatypes.</p>
<pre class="brush: csharp;">
 public static bool GetCheckin2(CheckinInfo returnCheckinInfo)
 {
 // Handling errors from calling method.

 SqlCommand sqlCmdGetCheckin = new SqlCommand(&quot;GetCheckin&quot;, dbConnection);
 sqlCmdGetCheckin.CommandType = CommandType.StoredProcedure;

 // Preparing input value parameter.
 sqlCmdGetCheckin.Parameters.Add(&quot;@Checkin_ID&quot;, SqlDbType.Int);
 sqlCmdGetCheckin.Parameters[&quot;@Checkin_ID&quot;].Value = returnCheckinInfo.CheckinID;

 // Preparing return/output parameters.
 sqlCmdGetCheckin.Parameters.Add(&quot;@DateSubmitted&quot;, SqlDbType.DateTime);
 sqlCmdGetCheckin.Parameters.Add(&quot;@DateCreated&quot;, SqlDbType.DateTime);
 sqlCmdGetCheckin.Parameters.Add(&quot;@DescriptionOfProblem&quot;, SqlDbType.NVarChar, 4000);
 sqlCmdGetCheckin.Parameters.Add(&quot;@DescriptionOfFix&quot;, SqlDbType.NVarChar, 4000);
 sqlCmdGetCheckin.Parameters.Add(&quot;@Changelist&quot;, SqlDbType.Int);
 sqlCmdGetCheckin.Parameters.Add(&quot;@OwnerAlias&quot;, SqlDbType.NVarChar, 30);
 sqlCmdGetCheckin.Parameters.Add(&quot;@AutoCheckin&quot;, SqlDbType.Bit);
 sqlCmdGetCheckin.Parameters.Add(&quot;@MailCC&quot;, SqlDbType.NVarChar, 4000);
 sqlCmdGetCheckin.Parameters.Add(&quot;@TestedBy&quot;, SqlDbType.NVarChar, 30);

 // Setting output parameter direction.
 sqlCmdGetCheckin.Parameters[&quot;@DateSubmitted&quot;].Direction = ParameterDirection.Output;
 sqlCmdGetCheckin.Parameters[&quot;@DateCreated&quot;].Direction = ParameterDirection.Output;
 sqlCmdGetCheckin.Parameters[&quot;@DescriptionOfProblem&quot;].Direction = ParameterDirection.Output;
 sqlCmdGetCheckin.Parameters[&quot;@DescriptionOfFix&quot;].Direction = ParameterDirection.Output;
 sqlCmdGetCheckin.Parameters[&quot;@Changelist&quot;].Direction = ParameterDirection.Output;
 sqlCmdGetCheckin.Parameters[&quot;@OwnerAlias&quot;].Direction = ParameterDirection.Output;
 sqlCmdGetCheckin.Parameters[&quot;@AutoCheckin&quot;].Direction = ParameterDirection.Output;
 sqlCmdGetCheckin.Parameters[&quot;@MailCC&quot;].Direction = ParameterDirection.Output;
 sqlCmdGetCheckin.Parameters[&quot;@TestedBy&quot;].Direction = ParameterDirection.Output;

 // Run Query
 sqlCmdGetCheckin.ExecuteScalar();

 returnCheckinInfo.DateSubmitted = (DateTime)sqlCmdGetCheckin.Parameters[&quot;@DateSubmitted&quot;].Value;
 returnCheckinInfo.DateCreated = (DateTime)sqlCmdGetCheckin.Parameters[&quot;@DateCreated&quot;].Value;
 returnCheckinInfo.DescProb = (string)sqlCmdGetCheckin.Parameters[&quot;@DescriptionOfProblem&quot;].Value;
 returnCheckinInfo.DescFix = (string)sqlCmdGetCheckin.Parameters[&quot;@DescriptionOfFix&quot;].Value;

 if (sqlCmdGetCheckin.Parameters[&quot;@Changelist&quot;].Value == DBNull.Value)
 returnCheckinInfo.Changelist = -1;
 else
 returnCheckinInfo.Changelist = (int)sqlCmdGetCheckin.Parameters[&quot;@Changelist&quot;].Value;

 returnCheckinInfo.Username = (string)sqlCmdGetCheckin.Parameters[&quot;@OwnerAlias&quot;].Value;
 returnCheckinInfo.AutoCheckin = (bool)sqlCmdGetCheckin.Parameters[&quot;@AutoCheckin&quot;].Value;
 returnCheckinInfo.MailCC = (string)sqlCmdGetCheckin.Parameters[&quot;@MailCC&quot;].Value;
 returnCheckinInfo.TestedBy = (string)sqlCmdGetCheckin.Parameters[&quot;@TestedBy&quot;].Value;

 dbConnection.Close();
 return true;
 }
</pre>
<p>Note that the SqlCommand.ExecuteScalar() is used instead of SqlCommand.ExecuteNonQuery().  The former is appropriate for queries while the latter is for other actions such as DELETE, INSERT, and UPDATE.  You may get an exception if you use the later for a SELECT type statement or if the SPROC doesn&#8217;t return a value.</p>
<pre class="brush: sql;">
ALTER PROCEDURE dbo.GetCheckin
(
 @Checkin_ID                int,
 @DateSubmitted            datetime OUTPUT,
 @DateCreated            datetime OUTPUT,
 @DescriptionOfProblem    nvarchar(4000) OUTPUT,
 @DescriptionOfFix        nvarchar(4000) OUTPUT,
 @Changelist                int OUTPUT,
 @OwnerAlias                varchar(30) OUTPUT,
 @AutoCheckin            bit OUTPUT,
 @MailCC                    nvarchar(2000) OUTPUT,
 @TestedBy                nvarchar(30) OUTPUT

) AS

BEGIN
 -- Select values:
 SELECT @DateSubmitted=DateSubmitted FROM Checkin WHERE Checkin_ID = @Checkin_ID
 SELECT @DateCreated=DateCreated FROM Checkin WHERE Checkin_ID = @Checkin_ID
 SELECT @DescriptionOfProblem=DescriptionOfProblem FROM Checkin WHERE Checkin_ID = @Checkin_ID
 SELECT @DescriptionOfFix=DescriptionOfFix FROM Checkin WHERE Checkin_ID = @Checkin_ID
 SELECT @Changelist=Changelist FROM Checkin WHERE Checkin_ID = @Checkin_ID
 SELECT @OwnerAlias=OwnerAlias FROM Checkin WHERE Checkin_ID = @Checkin_ID
 SELECT @AutoCheckin=AutoCheckin FROM Checkin WHERE Checkin_ID = @Checkin_ID
 SELECT @MailCC=MailCC FROM Checkin WHERE Checkin_ID = @Checkin_ID
 SELECT @TestedBy=TestedBy FROM Checkin WHERE Checkin_ID = @Checkin_ID

END
</pre>
<p>Note if any dataypes are incorrectly defined in the SPROC or DAL, you may get a String[n]: the Size property has an invalid size of 0. Below is the second method, which uses a SqlDataReader object to store all the return values from the locally defined SELECT statement.</p>
<pre class="brush: csharp;">
 public static bool GetCheckin(CheckinInfo returnCheckinInfo)
 {
 string sqlStatement = &quot;Select * FROM Checkin WHERE Checkin_ID = @Checkin_ID&quot;;

 SqlCommand sqlCmdGetCheckin = new SqlCommand(sqlStatement, dbConnection);
 sqlCmdGetCheckin.CommandType = CommandType.Text;
 sqlCmdGetCheckin.Parameters.Add(&quot;@Checkin_ID&quot;, SqlDbType.Int);
 sqlCmdGetCheckin.Parameters[&quot;@Checkin_ID&quot;].Value = returnCheckinInfo.CheckinID;

 SqlDataReader objSqlDR = sqlCmdGetCheckin.ExecuteReader();
 objSqlDR.Read();

 returnCheckinInfo.DateSubmitted = (DateTime)objSqlDR[&quot;DateSubmitted&quot;];
 returnCheckinInfo.DateCreated = (DateTime)objSqlDR[&quot;DateCreated&quot;];
 returnCheckinInfo.DescProb = (string)objSqlDR[&quot;DescriptionOfProblem&quot;];
 returnCheckinInfo.DescFix = (string)objSqlDR[&quot;DescriptionOfFix&quot;];
 string s = objSqlDR[&quot;Changelist&quot;].ToString();
 if (objSqlDR[&quot;Changelist&quot;] == DBNull.Value)
 returnCheckinInfo.Changelist = -1;
 else
 returnCheckinInfo.Changelist = (int)objSqlDR[&quot;Changelist&quot;];

 returnCheckinInfo.Username = (string)objSqlDR[&quot;OwnerAlias&quot;];

 returnCheckinInfo.AutoCheckin = (bool)objSqlDR[&quot;AutoCheckin&quot;];

 returnCheckinInfo.MailCC = (string)objSqlDR[&quot;MailCC&quot;];
 returnCheckinInfo.TestedBy = (string)objSqlDR[&quot;TestedBy&quot;];

 dbConnection.Close();
 return true;
 }
</pre>
<p>The second method is much less code and doesn&#8217;t require a stored procedure.  The SqlReader object must have its Read() method called to populate the object with the return values of the SQL command.  The second method may be used if the stored procedure called does more than just SELECT statements.  The NVarchar SQL datatype is implicitly cast to the String C# datatype as long as the object is less than 4000 characters.  Also it is interesting what the actual difference (performance and implementation) is between the NText/Text and the NVarChar/Varchar SQL datatypes, described <a href="http://geekswithblogs.net/johnsPerfBlog/archive/2008/04/16/ntext-vs-nvarcharmax-in-sql-2005.aspx">here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetaco.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetaco.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetaco.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetaco.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetaco.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetaco.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetaco.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetaco.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetaco.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetaco.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetaco.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetaco.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetaco.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetaco.wordpress.com/179/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=179&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetaco.wordpress.com/2009/11/10/two-methods-to-query-sql-from-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d663bd38acb45c74611f330955f22adc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wind0</media:title>
		</media:content>
	</item>
		<item>
		<title>Calling a SPROC from C#.</title>
		<link>http://codetaco.wordpress.com/2009/11/10/calling-a-sproc-from-c/</link>
		<comments>http://codetaco.wordpress.com/2009/11/10/calling-a-sproc-from-c/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 23:09:00 +0000</pubDate>
		<dc:creator>wind0</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Coding for Fun]]></category>

		<guid isPermaLink="false">http://codetaco.wordpress.com/?p=163</guid>
		<description><![CDATA[I’ve been investigating a few ways to select values from a row in a SQL table.  In the past I’ve used SQL statements executed directly from the ASP.NET code behind, but a more organized option is to have the code behind or Business Logic Layer (BLL) call a separate Data Access Layer (DAL) to perform [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=163&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’ve been investigating a few ways to select values from a row in a SQL table.  In the past I’ve used SQL statements executed directly from the ASP.NET code behind, but a more organized option is to have the code behind or Business Logic Layer (BLL) call a separate Data Access Layer (DAL) to perform the database actions.  The following code calls a stored procedure for inserting the specified parameters and then returning the Checkin_ID which is the identity column of that table.</p>
<pre class="brush: csharp;">
public static bool InsertCheckin(CheckinInfo checkinInfo)
 {
 // Handling errors from calling method.

 SqlCommand insertCheckin = new SqlCommand(&quot;InsertCheckin&quot;, dbConnection);
 insertCheckin.CommandType = CommandType.StoredProcedure;

 // Preparing return value parameter.
 insertCheckin.Parameters.Add(&quot;@Checkin_ID&quot;, SqlDbType.Int);
 insertCheckin.Parameters[&quot;@Checkin_ID&quot;].Direction = ParameterDirection.ReturnValue;

 // Preparing insert parameters.
 insertCheckin.Parameters.Add(&quot;@DateSubmitted&quot;, SqlDbType.DateTime);
 insertCheckin.Parameters[&quot;@DateSubmitted&quot;].Value = DateTime.Now;
 insertCheckin.Parameters.Add(&quot;@DateCreated&quot;, SqlDbType.DateTime);
 insertCheckin.Parameters[&quot;@DateCreated&quot;].Value = checkinInfo.DateCreated;
 insertCheckin.Parameters.Add(&quot;@DescriptionOfProblem&quot;, SqlDbType.NVarChar, 4000);
 insertCheckin.Parameters[&quot;@DescriptionOfProblem&quot;].Value = checkinInfo.DescProb;
 insertCheckin.Parameters.Add(&quot;@DescriptionOfFix&quot;, SqlDbType.NVarChar, 4000);
 insertCheckin.Parameters[&quot;@DescriptionOfFix&quot;].Value = checkinInfo.DescFix;
 insertCheckin.Parameters.Add(&quot;@Changelist&quot;, SqlDbType.Int);
 if (checkinInfo.Changelist &lt;= 0)
 insertCheckin.Parameters[&quot;@Changelist&quot;].Value = DBNull.Value;
 else
 insertCheckin.Parameters[&quot;@Changelist&quot;].Value = checkinInfo.Changelist;

 insertCheckin.Parameters.Add(&quot;@OwnerAlias&quot;, SqlDbType.VarChar, 30);
 insertCheckin.Parameters[&quot;@OwnerAlias&quot;].Value = checkinInfo.Username;
 insertCheckin.Parameters.Add(&quot;@AutoCheckin&quot;, SqlDbType.Bit);
 insertCheckin.Parameters[&quot;@AutoCheckin&quot;].Value = checkinInfo.AutoCheckin;
 insertCheckin.Parameters.Add(&quot;@MailCC&quot;, SqlDbType.NVarChar, 2000);
 insertCheckin.Parameters[&quot;@MailCC&quot;].Value = checkinInfo.MailCC;
 insertCheckin.Parameters.Add(&quot;@TestedBy&quot;, SqlDbType.NVarChar, 30);
 insertCheckin.Parameters[&quot;@TestedBy&quot;].Value = checkinInfo.TestedBy;

 insertCheckin.ExecuteNonQuery();

 checkinInfo.CheckinID = (int)insertCheckin.Parameters[&quot;@Checkin_ID&quot;].Value;

 dbConnection.Close();
 return true;
 }
</pre>
<p>Below is the stored procedure that is called:</p>
<pre class="brush: sql;">
ALTER PROCEDURE dbo.InsertCheckin
(
--    @Checkin_ID                int,
 @DateSubmitted            datetime,
 @DateCreated            datetime,
 @DescriptionOfProblem    nvarchar(4000),
 @DescriptionOfFix        nvarchar(4000),
 @Changelist                int,
 @OwnerAlias                varchar(30),
 @AutoCheckin            bit,
 @MailCC                    nvarchar(2000),
 @TestedBy                nvarchar(30)

) AS

-- Begining whole transaction.
--BEGIN TRANSACTION

-- INSERT the new Checkin
INSERT INTO Checkin(DateSubmitted, DateCreated, DescriptionOfProblem, DescriptionOfFix, Changelist, OwnerAlias, AutoCheckin, MailCC, TestedBy)
VALUES(@DateSubmitted, @DateCreated, @DescriptionOfProblem, @DescriptionOfFix, @Changelist, @OwnerAlias, @AutoCheckin, @MailCC, @TestedBy)

-- Rollback the transaction if there were any errors
--IF @@ERROR &lt;&gt; 0
--    BEGIN
 -- Rollback the transaction
--        ROLLBACK

 -- Raise an error and return
--        RAISERROR('Error in inserting Checkin.', 16, 1)
--END

-- Return the Checkin_ID of the newly inserted record
RETURN SCOPE_IDENTITY()

--COMMIT
</pre>
</pre>
<p>The commented out code is for additional actions if needed, which should be carried out via transaction.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetaco.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetaco.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetaco.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetaco.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetaco.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetaco.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetaco.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetaco.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetaco.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetaco.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetaco.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetaco.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetaco.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetaco.wordpress.com/163/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=163&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetaco.wordpress.com/2009/11/10/calling-a-sproc-from-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d663bd38acb45c74611f330955f22adc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wind0</media:title>
		</media:content>
	</item>
		<item>
		<title>Refurbisher Inventory Tool</title>
		<link>http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/</link>
		<comments>http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 01:09:49 +0000</pubDate>
		<dc:creator>wind0</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Coding for Fun]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://codetaco.wordpress.com/?p=139</guid>
		<description><![CDATA[I was recently contacted by a local non-profit PC refurbisher, that I used to work with in my last group.  I developed a tool that helped to inventory the PCs that they were refurbishing.  I called it the Refurbisher Inventory Tool.  It consisted of pulling hardware information like processor type/speed, RAM, HDD size, and a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=139&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was recently contacted by a local non-profit PC refurbisher, that I used to work with in my last group.  I developed a tool that helped to inventory the PCs that they were refurbishing.  I called it the Refurbisher Inventory Tool.  It consisted of pulling hardware information like processor type/speed, RAM, HDD size, and a lot of other WMI retrievable information from barebones PCs and uploading that information to a backend.  The inventory was managed and tracked through an ASP.NET site.  It had authentication and authorization configurations, custom business functions, and reporting.  Essentially, a technician boots from CD or flash drive then serializes all hardware information to xml which is then uploaded to a intermediate server that does other business functions.  Some scripts run on the intermediate server that uploads the information to the inventory database.  The whole project was proof of concept, but it does address an inventory need that all refurbishers have.</p>
<p>The refubisher had wanted to share this tool with other non-profit refurbishers.  I told the owner that he could try a couple of contacts, but I doubt that the company had any plans to bring this particular tool to the market.</p>
<p>It would be a nice feature add to have machines boot via network and be inventoried.</p>
<p>Here is a sample of what hardware information is pulled:</p>
<pre class="brush: xml;">&lt;/pre&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
&lt;Computer SerialNumber=&quot;R000037250&quot;&gt;
 &lt;Audio&gt;
 &lt;/Audio&gt;
 &lt;HDD&gt;
 &lt;BytesPerSector&gt;512&lt;/BytesPerSector&gt;
 &lt;Capabilities&gt;3, 4&lt;/Capabilities&gt;
 &lt;CapabilityDescriptions&gt;&lt;/CapabilityDescriptions&gt;
 &lt;Description&gt;QUANTUM FIREBALLlct10 10&lt;/Description&gt;
 &lt;InterfaceType&gt;&lt;/InterfaceType&gt;
 &lt;Manufacturer&gt;&lt;/Manufacturer&gt;
 &lt;Model&gt;&lt;/Model&gt;
 &lt;SectorsPerTrack&gt;63&lt;/SectorsPerTrack&gt;
 &lt;Size&gt;10256924160&lt;/Size&gt;
 &lt;TotalCylinders&gt;1247&lt;/TotalCylinders&gt;
 &lt;TotalHeads&gt;255&lt;/TotalHeads&gt;
 &lt;TotalSectors&gt;20033055&lt;/TotalSectors&gt;
 &lt;TotalTracks&gt;317985&lt;/TotalTracks&gt;
 &lt;TracksPerCylinder&gt;255&lt;/TracksPerCylinder&gt;
 &lt;InstallDate&gt;&lt;/InstallDate&gt;
 &lt;PNPDeviceID&gt;IDE\DISKQUANTUM_FIREBALLLCT10_10________________A03.0900\3738303230313233343030322020202020202020&lt;/PNPDeviceID&gt;
 &lt;DeviceID&gt;\\.\PHYSICALDRIVE0&lt;/DeviceID&gt;
 &lt;/HDD&gt;
 &lt;RAM&gt;
 &lt;TotalPhysicalMemory&gt;132620288&lt;/TotalPhysicalMemory&gt;
 &lt;DIMMCapacity&gt;134217728&lt;/DIMMCapacity&gt;
 &lt;Caption&gt;Physical Memory&lt;/Caption&gt;
 &lt;DataWidth&gt;64&lt;/DataWidth&gt;
 &lt;Description&gt;Physical Memory&lt;/Description&gt;
 &lt;DeviceLocator&gt;A0&lt;/DeviceLocator&gt;
 &lt;FormFactor&gt;8&lt;/FormFactor&gt;
 &lt;InterleaveDataDepth&gt;0&lt;/InterleaveDataDepth&gt;
 &lt;InterleavePosition&gt;0&lt;/InterleavePosition&gt;
 &lt;Manufacturer&gt;&lt;/Manufacturer&gt;
 &lt;MemoryType&gt;0&lt;/MemoryType&gt;
 &lt;Model&gt;&lt;/Model&gt;
 &lt;Name&gt;Physical Memory&lt;/Name&gt;
 &lt;PartNumber&gt;&lt;/PartNumber&gt;
 &lt;RAMSerialNumber&gt;&lt;/RAMSerialNumber&gt;
 &lt;Speed&gt;&lt;/Speed&gt;
 &lt;Tag&gt;Physical Memory 0&lt;/Tag&gt;
 &lt;TotalWidth&gt;64&lt;/TotalWidth&gt;
 &lt;TypeDetail&gt;0&lt;/TypeDetail&gt;
 &lt;InstallDate&gt;&lt;/InstallDate&gt;
 &lt;/RAM&gt;
 &lt;Motherboard&gt;
 &lt;Manufacturer&gt; &lt;/Manufacturer&gt;
 &lt;Caption&gt;Base Board&lt;/Caption&gt;
 &lt;Model&gt;&lt;/Model&gt;
 &lt;Name&gt;Base Board&lt;/Name&gt;
 &lt;PartNumber&gt;&lt;/PartNumber&gt;
 &lt;Product&gt;i815-W83627&lt;/Product&gt;
 &lt;MBSerialNumber&gt; &lt;/MBSerialNumber&gt;
 &lt;Version&gt; &lt;/Version&gt;
 &lt;BIOSCharacteristics&gt;4 ,7 ,9 ,10 ,11 ,12 ,14 ,15 ,16 ,17 ,19 ,22 ,23 ,24 ,25 ,26 ,27 ,28 ,29 ,30 ,32 ,33 ,34 ,36 ,37&lt;/BIOSCharacteristics&gt;
 &lt;BIOSVersion1&gt;IntelR - 42302e31 ,Award Modular BIOS v6.00PG&lt;/BIOSVersion1&gt;
 &lt;BIOSVersion2&gt;IntelR - 42302e31&lt;/BIOSVersion2&gt;
 &lt;BIOSCaption&gt;Award Modular BIOS v6.00PG&lt;/BIOSCaption&gt;
 &lt;CurrentLanguage&gt;n|US|iso8859-1&lt;/CurrentLanguage&gt;
 &lt;Description&gt;Award Modular BIOS v6.00PG&lt;/Description&gt;
 &lt;BIOSManufacturer&gt;Award Software International, Inc.&lt;/BIOSManufacturer&gt;
 &lt;BIOSName&gt;Award Modular BIOS v6.00PG&lt;/BIOSName&gt;
 &lt;ReleaseDate&gt;20011006******.******+***    --Unexpected WMI date format--&lt;/ReleaseDate&gt;
 &lt;BIOSSerialNumber&gt; &lt;/BIOSSerialNumber&gt;
 &lt;SMBIOSBIOSVersion&gt;6.00 PG&lt;/SMBIOSBIOSVersion&gt;
 &lt;SMBIOSMajorVersion&gt;2&lt;/SMBIOSMajorVersion&gt;
 &lt;SMBIOSMinorVersion&gt;2&lt;/SMBIOSMinorVersion&gt;
 &lt;SMBIOSPresent&gt;True&lt;/SMBIOSPresent&gt;
 &lt;TargetOperatingSystem&gt;0&lt;/TargetOperatingSystem&gt;
 &lt;InstallDate&gt;&lt;/InstallDate&gt;
 &lt;/Motherboard&gt;
 &lt;Optical&gt;
 &lt;/Optical&gt;
 &lt;Processor&gt;
 &lt;Caption&gt;x86 Family 6 Model 8 Stepping 10&lt;/Caption&gt;
 &lt;DataWidth&gt;32&lt;/DataWidth&gt;
 &lt;Description&gt;x86 Family 6 Model 8 Stepping 10&lt;/Description&gt;
 &lt;Architecture&gt;0&lt;/Architecture&gt;
 &lt;MaxClockSpeed&gt;851&lt;/MaxClockSpeed&gt;
 &lt;Family&gt;17&lt;/Family&gt;
 &lt;L2CacheSize&gt;256&lt;/L2CacheSize&gt;
 &lt;L2CacheSpeed&gt;851&lt;/L2CacheSpeed&gt;
 &lt;Level&gt;6&lt;/Level&gt;
 &lt;Manufacturer&gt;GenuineIntel&lt;/Manufacturer&gt;
 &lt;Name&gt;Intel(R) Pentium(R) III processor&lt;/Name&gt;
 &lt;PowerManagementSupported&gt;False&lt;/PowerManagementSupported&gt;
 &lt;ProcessorId&gt;0383F9FF0000068A&lt;/ProcessorId&gt;
 &lt;ProcessorType&gt;3&lt;/ProcessorType&gt;
 &lt;Revision&gt;2058&lt;/Revision&gt;
 &lt;Role&gt;CPU&lt;/Role&gt;
 &lt;SocketDesignation&gt;Socket 370&lt;/SocketDesignation&gt;
 &lt;Stepping&gt;10&lt;/Stepping&gt;
 &lt;UniqueId&gt;&lt;/UniqueId&gt;
 &lt;UpgradeMethod&gt;8&lt;/UpgradeMethod&gt;
 &lt;Version&gt;Model 8, Stepping 10&lt;/Version&gt;
 &lt;ExtClock&gt;100&lt;/ExtClock&gt;
 &lt;InstallDate&gt;&lt;/InstallDate&gt;
 &lt;/Processor&gt;
 &lt;Video&gt;
 &lt;AcceleratorCapabilities&gt;&lt;/AcceleratorCapabilities&gt;
 &lt;CapabilityDescriptions&gt;&lt;/CapabilityDescriptions&gt;
 &lt;AdapterCompatibility&gt;(Standard display types)&lt;/AdapterCompatibility&gt;
 &lt;AdapterDACType&gt;8 bit&lt;/AdapterDACType&gt;
 &lt;AdapterRAM&gt;1048576&lt;/AdapterRAM&gt;
 &lt;Description&gt;Standard VGA Graphics Adapter&lt;/Description&gt;
 &lt;MaxMemorySupported&gt;&lt;/MaxMemorySupported&gt;
 &lt;Name&gt;Standard VGA Graphics Adapter&lt;/Name&gt;
 &lt;VideoArchitecture&gt;5&lt;/VideoArchitecture&gt;
 &lt;VideoMemoryType&gt;2&lt;/VideoMemoryType&gt;
 &lt;VideoProcessor&gt;Intel(R) 815 Chipset Video BIOS&lt;/VideoProcessor&gt;
 &lt;InstallDate&gt;&lt;/InstallDate&gt;
 &lt;PNPDeviceID&gt;PCI\VEN_8086&amp;amp;DEV_1132&amp;amp;SUBSYS_11328086&amp;amp;REV_04\3&amp;amp;13C0B0C5&amp;amp;0&amp;amp;10&lt;/PNPDeviceID&gt;
 &lt;DeviceID&gt;VideoController1&lt;/DeviceID&gt;
 &lt;/Video&gt;
&lt;/Computer&gt;
</pre>
<p>Here are some screenshots:</p>

<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-admin/' title='RIT-Admin'><img width="119" height="150" src="http://codetaco.files.wordpress.com/2009/11/rit-admin.jpg?w=119&#038;h=150" class="attachment-thumbnail" alt="RIT-Admin" title="RIT-Admin" /></a>
<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-inventory/' title='RIT-Inventory'><img width="136" height="150" src="http://codetaco.files.wordpress.com/2009/11/rit-inventory.jpg?w=136&#038;h=150" class="attachment-thumbnail" alt="RIT-Inventory" title="RIT-Inventory" /></a>
<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-labels/' title='RIT-Labels'><img width="150" height="119" src="http://codetaco.files.wordpress.com/2009/11/rit-labels.jpg?w=150&#038;h=119" class="attachment-thumbnail" alt="RIT-Labels" title="RIT-Labels" /></a>
<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-login/' title='RIT-Login'><img width="150" height="81" src="http://codetaco.files.wordpress.com/2009/11/rit-login.jpg?w=150&#038;h=81" class="attachment-thumbnail" alt="RIT-Login" title="RIT-Login" /></a>
<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-management/' title='RIT-Management'><img width="84" height="150" src="http://codetaco.files.wordpress.com/2009/11/rit-management.jpg?w=84&#038;h=150" class="attachment-thumbnail" alt="RIT-Management" title="RIT-Management" /></a>
<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-pallets/' title='RIT-Pallets'><img width="150" height="137" src="http://codetaco.files.wordpress.com/2009/11/rit-pallets.jpg?w=150&#038;h=137" class="attachment-thumbnail" alt="RIT-Pallets" title="RIT-Pallets" /></a>
<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-refurbishers/' title='RIT-Refurbishers'><img width="150" height="87" src="http://codetaco.files.wordpress.com/2009/11/rit-refurbishers.jpg?w=150&#038;h=87" class="attachment-thumbnail" alt="RIT-Refurbishers" title="RIT-Refurbishers" /></a>
<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-reports_devices/' title='RIT-Reports_Devices'><img width="150" height="95" src="http://codetaco.files.wordpress.com/2009/11/rit-reports_devices.jpg?w=150&#038;h=95" class="attachment-thumbnail" alt="RIT-Reports_Devices" title="RIT-Reports_Devices" /></a>
<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-reports_pallets/' title='RIT-Reports_Pallets'><img width="130" height="150" src="http://codetaco.files.wordpress.com/2009/11/rit-reports_pallets.jpg?w=130&#038;h=150" class="attachment-thumbnail" alt="RIT-Reports_Pallets" title="RIT-Reports_Pallets" /></a>
<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-reports_refurbishers/' title='RIT-Reports_Refurbishers'><img width="132" height="150" src="http://codetaco.files.wordpress.com/2009/11/rit-reports_refurbishers.jpg?w=132&#038;h=150" class="attachment-thumbnail" alt="RIT-Reports_Refurbishers" title="RIT-Reports_Refurbishers" /></a>
<a href='http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/rit-sales/' title='RIT-Sales'><img width="150" height="98" src="http://codetaco.files.wordpress.com/2009/11/rit-sales.jpg?w=150&#038;h=98" class="attachment-thumbnail" alt="RIT-Sales" title="RIT-Sales" /></a>

<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetaco.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetaco.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetaco.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetaco.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetaco.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetaco.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetaco.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetaco.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetaco.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetaco.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetaco.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetaco.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetaco.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetaco.wordpress.com/139/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=139&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetaco.wordpress.com/2009/11/04/refurbishers-inventory-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d663bd38acb45c74611f330955f22adc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wind0</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-admin.jpg?w=119" medium="image">
			<media:title type="html">RIT-Admin</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-inventory.jpg?w=136" medium="image">
			<media:title type="html">RIT-Inventory</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-labels.jpg?w=150" medium="image">
			<media:title type="html">RIT-Labels</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-login.jpg?w=150" medium="image">
			<media:title type="html">RIT-Login</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-management.jpg?w=84" medium="image">
			<media:title type="html">RIT-Management</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-pallets.jpg?w=150" medium="image">
			<media:title type="html">RIT-Pallets</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-refurbishers.jpg?w=150" medium="image">
			<media:title type="html">RIT-Refurbishers</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-reports_devices.jpg?w=150" medium="image">
			<media:title type="html">RIT-Reports_Devices</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-reports_pallets.jpg?w=130" medium="image">
			<media:title type="html">RIT-Reports_Pallets</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-reports_refurbishers.jpg?w=132" medium="image">
			<media:title type="html">RIT-Reports_Refurbishers</media:title>
		</media:content>

		<media:content url="http://codetaco.files.wordpress.com/2009/11/rit-sales.jpg?w=150" medium="image">
			<media:title type="html">RIT-Sales</media:title>
		</media:content>
	</item>
		<item>
		<title>Malevich &#8211; Web-based Code Review</title>
		<link>http://codetaco.wordpress.com/2009/11/03/malevich-web-based-code-review/</link>
		<comments>http://codetaco.wordpress.com/2009/11/03/malevich-web-based-code-review/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 22:06:24 +0000</pubDate>
		<dc:creator>wind0</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://codetaco.wordpress.com/?p=136</guid>
		<description><![CDATA[My team and I have been working on a workflow tool and one of the features is code review.  We’ll be leveraging existing code review tools and leaning towards Malevich .  It is based off Google’s code review tool named, Mondrian (created  by Guido van Rossum – also the creator of Python).  The creator of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=136&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My team and I have been working on a workflow tool and one of the features is code review.  We’ll be leveraging existing code review tools and leaning towards Malevich .  It is based off Google’s code review tool named, Mondrian (created  by Guido van Rossum – also the creator of Python).  The creator of Malevich (Sergey Solyanik) has made it available <a href="http://malevich.codeplex.com/">here</a>.  One wonders why code review hasn’t been integrated into Visual Studio or TFS…</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetaco.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetaco.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetaco.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetaco.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetaco.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetaco.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetaco.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetaco.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetaco.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetaco.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetaco.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetaco.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetaco.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetaco.wordpress.com/136/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=136&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetaco.wordpress.com/2009/11/03/malevich-web-based-code-review/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d663bd38acb45c74611f330955f22adc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wind0</media:title>
		</media:content>
	</item>
		<item>
		<title>Casting with &#8216;AS&#8217; operator.</title>
		<link>http://codetaco.wordpress.com/2009/10/29/casting-with-as-operator/</link>
		<comments>http://codetaco.wordpress.com/2009/10/29/casting-with-as-operator/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 23:56:53 +0000</pubDate>
		<dc:creator>wind0</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://codetaco.wordpress.com/?p=123</guid>
		<description><![CDATA[I’m surprised that there isn’t a TryCast() in C#.  I am trying to cast an object to either a Button or RadioTabButton and decide what to do in the method from there.  I could use a try-catch block, but that would mean an exception must occur for the other condition, which is a performance hit. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=123&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’m surprised that there isn’t a TryCast() in C#.  I am trying to cast an object to either a Button or RadioTabButton and decide what to do in the method from there.  I could use a try-catch block, but that would mean an exception must occur for the other condition, which is a performance hit.</p>
<pre class="brush: csharp;">
private void PromptToSave(object sender, EventArgs e)
{
   Button thisSender = sender as Button;  // TryCast to see who sender is.
   promptToSaveAtTabChange = false;
   DialogResult result = MessageBox.Show(&quot;Save Checkin?&quot;, &quot;Confirm&quot;, MessageBoxButtons.YesNoCancel);
if (result == DialogResult.Yes)
{

SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath).ToString();
saveFileDialog1.Filter = &quot;Averen Checkin Configuration Files (*.xml)|*.xml&quot;;
saveFileDialog1.FilterIndex = 1;
saveFileDialog1.RestoreDirectory = true;
DateTime dt = new DateTime();
dt = DateTime.Now.ToUniversalTime();
string parsedDT = String.Format(&quot;{0:s}&quot;, dt);
parsedDT = parsedDT.Replace(&quot;-&quot;, &quot;&quot;);
parsedDT = parsedDT.Replace(&quot;:&quot;, &quot;&quot;);
parsedDT = parsedDT.Replace(&quot;T&quot;, &quot;_&quot;);
saveFileDialog1.FileName = CurrentBranchName + &quot;_&quot; + parsedDT + &quot;-UTC&quot;;

if (saveFileDialog1.ShowDialog() == DialogResult.OK)

{
//All Serialize();
workflowPage.Serialize(saveFileDialog1.FileName);
if (thisSender != null)
this.Close();
else
newRadioButton_Clicked(sender, e);
}

}
if (result == DialogResult.Cancel)
{
TabRadioButton newRadioButton = (TabRadioButton)oldSender;
promptToSaveAtTabChange = true;
newRadioButton.Checked = true;
tlpCurrentPage.Controls[0].Focus();  // So user can scroll after cancel without clicking.
}

if (result == DialogResult.No)
{
if (thisSender != null)
this.Close();
else
newRadioButton_Clicked(oldSender, e);
}

}
</pre>
<p>Here the condition is based off whether or not a valid cast has occurred with</p>
<pre class="brush: csharp;">
Button thisSender = sender as Button;
if (thisSender != null)
 //Do stuff
</pre>
<p>At the the beginning of the method.  The ‘as’ operator will try to cast the expression (in this case the object sender) as the specified type (Button).  If it fails to do so, null is returned.  You do have to becareful with how the operator is used since a failed cast in this form will not throw an exception, but something like this will:</p>
<pre class="brush: csharp;">
Button thisSender = sender as Button;
if ( (sender as Button).Text != “Button Text”)
 //Do stuff
</pre>
<p>This would throw a NullReferenceException where as a normal cast – (Button)sender would throw a InvalidCastException.  So depending on which cast method you use, it may make it more difficult to debug your code if there is a cast exception.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetaco.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetaco.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetaco.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetaco.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetaco.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetaco.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetaco.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetaco.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetaco.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetaco.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetaco.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetaco.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetaco.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetaco.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=123&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetaco.wordpress.com/2009/10/29/casting-with-as-operator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d663bd38acb45c74611f330955f22adc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wind0</media:title>
		</media:content>
	</item>
		<item>
		<title>Assemblies and Reflection</title>
		<link>http://codetaco.wordpress.com/2009/10/28/119/</link>
		<comments>http://codetaco.wordpress.com/2009/10/28/119/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 17:45:07 +0000</pubDate>
		<dc:creator>wind0</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://codetaco.wordpress.com/?p=119</guid>
		<description><![CDATA[In the last two weeks I’ve been getting some good experience with Reflection, Serialization, Events and Delegates, and OOP programming. Haven&#8217;t had time to update this blog. One interesting issue I’ve ran into concerns a base class that has a virtual function which is intended to be overridden by a method in a derived class. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=119&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the last two weeks I’ve been getting some good experience with Reflection, Serialization, Events and Delegates, and OOP programming.  Haven&#8217;t had time to update this blog.  </p>
<p>One interesting issue I’ve ran into concerns a base class that has a virtual function which is intended to be overridden by a method in a derived class.  That class is in a separate dynamically loaded assembly.  When loading the assembly, it is cast into the base class and held in a container of that class.</p>
<pre class="brush: csharp;">
    public class WorkflowModule : UserControl
    {
        public virtual XmlDocument ()
        {
            throw new NotImplementedException();
        }
    }

    public partial class Foo : WorkflowModule
    {
        public override XmlDocument ()
        {
            XmlDocument doc = new XmlDocument();
            // Encoding = null;  Will default UTF8
            XmlDeclaration dec = doc.CreateXmlDeclaration(&quot;1.0&quot;, null, null);
            doc.AppendChild(dec);
            XmlElement root = doc.CreateElement(&quot;Foo&quot;);
            doc.AppendChild(root);
            XmlElement file = doc.CreateElement(&quot;File&quot;);
            XmlElement filePath = doc.CreateElement(&quot;FilePath&quot;);
            file.SetAttribute(&quot;Type&quot;, &quot;Boolean&quot;);
            filePath.SetAttribute(&quot;Type&quot;, &quot;String&quot;);

            if (rbUsePackFile.Checked)
            {
                file.Value = &quot;true&quot;;
                filePath.Value = txtPackFile.Text;
            }
            else
            {
                file. InnerText = &quot;false&quot;;
                filePath. InnerText = null;
            }

            doc.AppendChild(file);
            doc.AppendChild(filePath);

            return doc;
        }
</pre>
<p>It seems when I call the Serialize() it is calling the base class implementation since the class that actually calls the Serialize function implements a foreach loop on a WorkflowModule containers.  I spent an hour trying to figure out how to upcast the WorkflowModule object to the derived type.  One method I tried was to store the child type in the WorkflowModule object when the derived class was loaded.   I also tried Convert.ChangeType().   It wasn’t until I double checked if the assembly of the derived class was built correctly or not.  It was building, but there was also an older version in the same load directory that did not have the Serialize() defined.  The application was probably loading that one first and trying to call Serialize() which was not defined in that assembly.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetaco.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetaco.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetaco.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetaco.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetaco.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetaco.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetaco.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetaco.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetaco.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetaco.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetaco.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetaco.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetaco.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetaco.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=119&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetaco.wordpress.com/2009/10/28/119/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d663bd38acb45c74611f330955f22adc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wind0</media:title>
		</media:content>
	</item>
		<item>
		<title>09142009-Interviews</title>
		<link>http://codetaco.wordpress.com/2009/09/17/09142009-interviews/</link>
		<comments>http://codetaco.wordpress.com/2009/09/17/09142009-interviews/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 03:46:54 +0000</pubDate>
		<dc:creator>wind0</dc:creator>
				<category><![CDATA[Interviews]]></category>

		<guid isPermaLink="false">http://codetaco.wordpress.com/?p=115</guid>
		<description><![CDATA[I had an interview on Monday with a shared services team at Microsoft. I did not sleep well at all the night before. I faced a bunch of technical questions ranging from SQL, C#, networking, and security. I was surprised that there was no whiteboard coding questions. Last I heard was that the manager was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=115&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had an interview on Monday with a shared services team at Microsoft.  I did not sleep well at all the night before.  I faced a bunch of technical questions ranging from SQL, C#, networking, and security.  I was surprised that there was no whiteboard coding questions.  Last I heard was that the manager was on the fence.</p>
<p>Today&#8217;s interview with the lead build engineer/PM for the Windows Live team consisted of previous work experience questions.  There were no technical questions what so ever.  The role consists of part support/dev/test/build engineer.  It seemed a perfect fit for me as I have the support/dev/test experience and would love to get more into build engineering before taking on more involved SDE/STE/SDET roles.  The hiring manager was pretty laid back and did a good job explaining the responsibilities.  I felt a little disappointed that there were no coding or technical questions.  Since the development in this project is for internal use, the coding for efficiency (O(n)) type questions were less relevant, but part of me wanted to illustrate my thought process in breaking down and coding a problem.  The other part of me was thankful since coding questions vary in difficulty.  I think he mostly wanted to see me due to the role&#8217;s fit to my job experience and my track history of learning new technologies.  I also communicated my resourcefulness when it comes troubleshooting and developing automation/applications.  For effort, I later received an offer.</p>
<p>I have a planned interview with Intel next week in Oregon.  I plan to hear them out and just so I can say I interviewed with Intel.  I also look forward to drinking with my ex-boss.  I also received notification today that there is a government job dealing with UI automation testing for a ASP.NET website and that the hiring manager wants an interview.  Additional perk, they are willing to go with $60/hr.  Downside, its in Austin, TX.  </p>
<p>I am most likely going to take the SDET position with Windows Live since it offers varied challenges and great build engineering experience with MSBuild, Magellian, CoreXT, BuildTracker, TFS, and other technologies.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetaco.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetaco.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetaco.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetaco.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetaco.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetaco.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetaco.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetaco.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetaco.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetaco.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetaco.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetaco.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetaco.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetaco.wordpress.com/115/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=115&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetaco.wordpress.com/2009/09/17/09142009-interviews/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d663bd38acb45c74611f330955f22adc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wind0</media:title>
		</media:content>
	</item>
		<item>
		<title>Test Harness:  Email Alert</title>
		<link>http://codetaco.wordpress.com/2009/09/17/test-harness-email-alert/</link>
		<comments>http://codetaco.wordpress.com/2009/09/17/test-harness-email-alert/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 03:25:03 +0000</pubDate>
		<dc:creator>wind0</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Coding for Fun]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://codetaco.wordpress.com/?p=111</guid>
		<description><![CDATA[After some research on UI test automation frameworks for ASP.NET pages I got side tracked and wondered how you could send email alerts if a test failed or if you want to send a test summary, below is my first attempt at sending an email for a failed test case: This hasn&#8217;t been tested since [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=111&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After some research on UI test automation frameworks for ASP.NET pages I got side tracked and wondered how you could send email alerts if a test failed or if you want to send a test summary, below is my first attempt at sending an email for a failed test case:</p>
<pre class="brush: csharp;">
    public static class Email_Alert
    {
        public static bool Email(string subject, TestCase tc)
        {
            try
            {
                MailMessage email = new MailMessage();
                email.From = &quot;RIT Automation Test Harness&quot;;  //Customize for product.
                email.To = &quot;test@microsoft.com&quot;;   //Customize to test alias.
                email.Subject = subject;

                email.BodyFormat = MailFormat.Html;
                email.BodyEncoding = System.Text.Encoding.UTF8;
                email.Priority = MailPriority.High;

                //Add other needed information.
                email.Body = tc.ID + &quot; failed!&quot;
                                   + Environment.NewLine
                                   + tc.description;

                SmtpMail.SmtpServer = &quot;10.0.0.1&quot;;  //Change to correct SMTP Server.
                SmtpMail.Send(email);
            }
            catch (Exception ex)
            {
                Console.WriteLine(&quot;Fatal error in sending email:  &quot; + ex.Message);
            }
        }
    }
</pre>
<p>This hasn&#8217;t been tested since I don&#8217;t have a private SMTP server available.  Should be as simple as inputting the IP of the exchange server, but additional issues could pop up over an enterprise network.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetaco.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetaco.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetaco.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetaco.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetaco.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetaco.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetaco.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetaco.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetaco.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetaco.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetaco.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetaco.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetaco.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetaco.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=111&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetaco.wordpress.com/2009/09/17/test-harness-email-alert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d663bd38acb45c74611f330955f22adc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wind0</media:title>
		</media:content>
	</item>
		<item>
		<title>Batch Script &#8211; Sorting Numbers</title>
		<link>http://codetaco.wordpress.com/2009/09/10/batch-script-sorting-numbers/</link>
		<comments>http://codetaco.wordpress.com/2009/09/10/batch-script-sorting-numbers/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 23:41:55 +0000</pubDate>
		<dc:creator>wind0</dc:creator>
				<category><![CDATA[Batch Script]]></category>

		<guid isPermaLink="false">http://codetaco.wordpress.com/?p=106</guid>
		<description><![CDATA[One of the reasons why I invested time in C# and C++ was due how god awful difficult it is sometimes to complete even the simplest task with batch script. Sometimes we have no choice but to use batch scripting such as running in WinPE or some other limited environment. I was posed with an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=106&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the reasons why I invested time in C# and C++ was due how god awful difficult it is sometimes to complete even the simplest task with batch script.  Sometimes we have no choice but to use batch scripting such as running in WinPE or some other limited environment.  I was posed with an interesting question:</p>
<p><strong>Given a list of numbers, write a batch script that can sort them in ascending order.</strong></p>
<p>If this were a programming language, I&#8217;d use an array to store the list of numbers.  Compare the first one to the next number.  If first is smaller than next then next becomes the current number and the next the one after next.  If the current number is larger than the next number, then I&#8217;d swap the two numbers in the array.  Continue until end of list.  This is known as the bubble sort algorithm and it is much harder than it looks to accomplish via batch script.  For one, there are no array structures in batch script.  It did occur to me to store the variables in text files, but the whole looping thing in batch threw me.</p>
<p>Here is a functional and complete <a href="http://www.codeproject.com/KB/winsdk/Batch_File_Bubble_Sort.aspx">bubble sort batch script</a> which had shed more light on batch scripting.</p>
<p>New to me:<br />
For /L (start, increment, end) &#8211; actual for loop<br />
SHIFT &#8211; increments to next argument<br />
TYPE &#8211; Reads directly from file<br />
Read in number from text file &#8211; set /p out_num=&lt;number%1.var</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetaco.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetaco.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codetaco.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codetaco.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codetaco.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codetaco.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codetaco.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codetaco.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codetaco.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codetaco.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codetaco.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codetaco.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codetaco.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codetaco.wordpress.com/106/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetaco.wordpress.com&amp;blog=9268008&amp;post=106&amp;subd=codetaco&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetaco.wordpress.com/2009/09/10/batch-script-sorting-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d663bd38acb45c74611f330955f22adc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wind0</media:title>
		</media:content>
	</item>
	</channel>
</rss>
