<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Michael E. Chancey Jr. &#187; Code</title>
	<atom:link href="http://michael.chanceyjr.com/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://michael.chanceyjr.com</link>
	<description></description>
	<lastBuildDate>Fri, 20 May 2011 03:43:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Generic License Generation and Validation</title>
		<link>http://michael.chanceyjr.com/useful-code/generic-license-generation-and-validation/</link>
		<comments>http://michael.chanceyjr.com/useful-code/generic-license-generation-and-validation/#comments</comments>
		<pubDate>Fri, 20 May 2011 03:43:18 +0000</pubDate>
		<dc:creator>Michael E. Chancey Jr.</dc:creator>
				<category><![CDATA[Useful Code]]></category>
		<category><![CDATA[Activate]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C-Sharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Generic]]></category>
		<category><![CDATA[License]]></category>
		<category><![CDATA[License Key]]></category>
		<category><![CDATA[RegEx]]></category>
		<category><![CDATA[Regular Expressions]]></category>
		<category><![CDATA[SHA256]]></category>
		<category><![CDATA[String]]></category>

		<guid isPermaLink="false">http://michael.chanceyjr.com/?p=696</guid>
		<description><![CDATA[This was thrown together to see how quickly I could come up with something simple to allow for offline license validation. Up until now I previously used an online system. As well as this works it requires that the user access the internet in order to validate the key (which opens itself to traffic sniffing [...]]]></description>
			<content:encoded><![CDATA[<p>This was thrown together to see how quickly I could come up with something simple to allow for offline license validation.  Up until now I previously used an online system.  As well as this works it requires that the user access the internet in order to validate the key (which opens itself to traffic sniffing and server simulation in order to hack).  This is by no means a perfect system but it should stump people long enough that they will feel better off just buying a key.</p>
<h3>//Code To Generate A License Key</h3>
<hr />
<pre class="brush: csharp;">
/// &lt;summary&gt;
/// GENERATE A UNIQUE KEY THAT CAN BE REVERESED TO VALIDATE WITHOUT INTERNET CONNECTION
/// &lt;/summary&gt;
/// &lt;param name=&quot;AppID&quot;&gt;APPLIATION GUID THE KEY SHOULD BE GERNEATED FOR&lt;/param&gt;
/// &lt;returns&gt;STRING VALUE REPRESENTING A VALID KEY&lt;/returns&gt;
static string GenerateKey(string AppID)
{
    int curSegment = 1;
    string newLicense = &quot;&quot;;
    string License = new string(Guid.NewGuid().ToString().Replace(&quot;-&quot;, &quot;&quot;).ToUpper().ToCharArray().Take(12).ToArray());

    //GENERATE 4 BYTE SEGMENTS WHICH ARE [HASH,HASH][KEY,KEY]
    //VALUES ARE TAKEN FROM THE HASH AT A MATHIMATICALLY COMPUTED LOCATION [(FIRST CHAR ASCII VALUE + SEGMENT) % 32] TO MAKE IT DEPENDENT ON SEGMENT LOCATION AND VALUE
    //THIS SHOULD MAKE IT HARDER TO &quot;GUESS&quot; A KEY OR BRUTE FORCE ONE OUT OF THE SYSTEM
    foreach (Match tmpMatch in Regex.Matches(License, &quot;[a-zA-Z0-9]{2}&quot;))
        newLicense += (newLicense != &quot;&quot; ? &quot;-&quot; : &quot;&quot;) + BitConverter.ToString(SHA256.Create().ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(tmpMatch.Value + AppID)).Skip((tmpMatch.Value.ToCharArray()[0] + curSegment++) % 32).Take(1).ToArray()).Replace(&quot;-&quot;, &quot;&quot;) + tmpMatch.Value;

    //RETURN THE NEW LICENSE VALUE TO THE CALLING FUNCTION
    return newLicense;
}
</pre>
<h3>//Code To Validate A License Key</h3>
<hr />
<pre class="brush: csharp;">
/// &lt;summary&gt;
/// VALIDATES A KEY THAT HAS BEEN GENERATED FOR THE GIVEN APPLICATION ID
/// &lt;/summary&gt;
/// &lt;param name=&quot;AppID&quot;&gt;APPLICATION THE KEY SHOULD BE VALIDATED AGAINST&lt;/param&gt;
/// &lt;param name=&quot;Key&quot;&gt;UNIQUE KEY TO COMPARE AGAINST&lt;/param&gt;
/// &lt;returns&gt;TRUE OR FALSE REPRESENTING THE VALIDATION OF THE GIVEN KEY AND APPLICATION ID&lt;/returns&gt;
public static bool ValidateKey(string Key)
{
    try
    {
        int curSegment = 1;
        string[] segments = Key.ToUpper().Split(new char[] { '-' });
        string AppID = ((GuidAttribute)Assembly.GetCallingAssembly().GetCustomAttributes(typeof(GuidAttribute), false)[0]).Value;

        foreach (string segment in segments)
        {
            //SPLIT THE SEGMENT INTO HASH VALUE AND KEY VALUE
            string hashedValue = segment.Substring(0, 2);
            string keyValue = segment.Substring(2, 2);

            //COMPUTE THE HASH USING THE REVERSE ALGORITHM FROM CREATING A HASH
            string hash = BitConverter.ToString(SHA256.Create().ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(keyValue + AppID)).Skip((keyValue.ToCharArray()[0] + curSegment++) % 32).Take(1).ToArray());

            //IF THE HASH DOES NOT MATCH WHAT IS BELIEVED SHOULD BE A MATCH THEN DROP OUT BECAUSE THE KEY IS INVALID
            if (hash != hashedValue)
                return false;
        }

        //IF WE MADE IT THIS FAR THEN THE KEY IS VALID
        return true;
    }
    catch
    {
        //IF THERE WAS AN ERROR WHILE ATTEMPTING TO VALIDATE THEN THE KEY MUST BE INVALID
        return false;
    }
}
</pre>



Share


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Generic%20License%20Generation%20and%20Validation%20-%20http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fgeneric-license-generation-and-validation%2F" title="Twitter"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fgeneric-license-generation-and-validation%2F&amp;title=Generic%20License%20Generation%20and%20Validation&amp;bodytext=This%20was%20thrown%20together%20to%20see%20how%20quickly%20I%20could%20come%20up%20with%20something%20simple%20to%20allow%20for%20offline%20license%20validation.%20%20Up%20until%20now%20I%20previously%20used%20an%20online%20system.%20%20As%20well%20as%20this%20works%20it%20requires%20that%20the%20user%20access%20the%20internet%20in%20order" title="Digg"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fgeneric-license-generation-and-validation%2F&amp;title=Generic%20License%20Generation%20and%20Validation" title="StumbleUpon"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fgeneric-license-generation-and-validation%2F&amp;title=Generic%20License%20Generation%20and%20Validation&amp;notes=This%20was%20thrown%20together%20to%20see%20how%20quickly%20I%20could%20come%20up%20with%20something%20simple%20to%20allow%20for%20offline%20license%20validation.%20%20Up%20until%20now%20I%20previously%20used%20an%20online%20system.%20%20As%20well%20as%20this%20works%20it%20requires%20that%20the%20user%20access%20the%20internet%20in%20order" title="del.icio.us"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://michael.chanceyjr.com/useful-code/generic-license-generation-and-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TCP Message Framework</title>
		<link>http://michael.chanceyjr.com/useful-code/tcp-message-framework/</link>
		<comments>http://michael.chanceyjr.com/useful-code/tcp-message-framework/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 03:33:25 +0000</pubDate>
		<dc:creator>Michael E. Chancey Jr.</dc:creator>
				<category><![CDATA[Useful Code]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[Binary]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C-Sharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Compression]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Extension]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[Message]]></category>
		<category><![CDATA[Serialize]]></category>
		<category><![CDATA[Stream]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[TCP]]></category>
		<category><![CDATA[TCP/IP]]></category>

		<guid isPermaLink="false">http://michael.chanceyjr.com/?p=692</guid>
		<description><![CDATA[TCP Message Framework is a simple framework built to make transport of TCP messages via C# a little easier. I have devised a method of sending messages and unpacking them on the other side that requires no additional coding to handle any new message type a programmer might come up with. Need to create a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://michael.chanceyjr.com/site/wp-content/uploads/2010/12/MessageFramework.png"><img src="http://michael.chanceyjr.com/site/wp-content/uploads/2010/12/MessageFramework-150x109.png" alt="" title="MessageFramework" width="150" height="109" class="alignleft size-thumbnail wp-image-689" /></a><br />
TCP Message Framework is a simple framework built to make transport of TCP messages via C# a little easier.  I have devised a method of sending messages and unpacking them on the other side that requires no additional coding to handle any new message type a programmer might come up with.  Need to create a keep-alive packet.  Simply inherit the message class, write the server side and client side code and you are done.  The transport and unwrapping of the message is all handled by the framework.</p>
<p>I used a very similar method when writing my instant messenger client/server.  There is some overhead but when weighed out against it&#8217;s simplcity its very minimal.  If you would like you can download the entire sample project or view the code through this website.<br />
<h3><a href="http://michael.chanceyjr.com/site/wp-content/uploads/2010/12/MessageFramework.zip">Download Sample Project</a> &#8211; <a href="http://michael.chanceyjr.com/free-stuff/tcp-message-framework/">View Code</a></h3>



Share


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=TCP%20Message%20Framework%20-%20http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Ftcp-message-framework%2F" title="Twitter"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Ftcp-message-framework%2F&amp;title=TCP%20Message%20Framework&amp;bodytext=%0D%0ATCP%20Message%20Framework%20is%20a%20simple%20framework%20built%20to%20make%20transport%20of%20TCP%20messages%20via%20C%23%20a%20little%20easier.%20%20I%20have%20devised%20a%20method%20of%20sending%20messages%20and%20unpacking%20them%20on%20the%20other%20side%20that%20requires%20no%20additional%20coding%20to%20handle%20any%20new%20messa" title="Digg"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Ftcp-message-framework%2F&amp;title=TCP%20Message%20Framework" title="StumbleUpon"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Ftcp-message-framework%2F&amp;title=TCP%20Message%20Framework&amp;notes=%0D%0ATCP%20Message%20Framework%20is%20a%20simple%20framework%20built%20to%20make%20transport%20of%20TCP%20messages%20via%20C%23%20a%20little%20easier.%20%20I%20have%20devised%20a%20method%20of%20sending%20messages%20and%20unpacking%20them%20on%20the%20other%20side%20that%20requires%20no%20additional%20coding%20to%20handle%20any%20new%20messa" title="del.icio.us"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://michael.chanceyjr.com/useful-code/tcp-message-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CompilePad v1.0 Released</title>
		<link>http://michael.chanceyjr.com/free-stuff/compilerpad-v1-0-released/</link>
		<comments>http://michael.chanceyjr.com/free-stuff/compilerpad-v1-0-released/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 05:48:17 +0000</pubDate>
		<dc:creator>Michael E. Chancey Jr.</dc:creator>
				<category><![CDATA[Free Stuff]]></category>
		<category><![CDATA[Application]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C-Sharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Free]]></category>

		<guid isPermaLink="false">http://michael.chanceyjr.com/?p=646</guid>
		<description><![CDATA[Have you ever created a &#8220;Test&#8221; application for the sole purpose of just testing a few lines of code? This app makes creating 1 line test applications a thing of the past. With this app you can create an application on the fly for testing 1 line of code or an entire class worth of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://michael.chanceyjr.com/site/wp-content/uploads/2010/08/CompilePadFull.png"><img src="http://michael.chanceyjr.com/site/wp-content/uploads/2010/08/CompilePad-150x120.png" alt="" title="CompilePad" width="150" height="120" class="alignleft size-thumbnail wp-image-642" /></a>Have you ever created a &#8220;Test&#8221; application for the sole purpose of just testing a few lines of code?  This app makes creating 1 line test applications a thing of the past.  With this app you can create an application on the fly for testing 1 line of code or an entire class worth of code.<br/><br/>It supports anything your normal C Sharp compiler supports with the exception of it uses a single file for all of the code.  The only requirements to run are the namespace CompilePad and a Class called Program with a Main public function.  It even allows you to create a simple Hello, World app simply by clicking the &#8220;New Document&#8221; link.</p>
<p><a href="http://michael.chanceyjr.com/free-stuff/">More</a></p>



Share


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=CompilePad%20v1.0%20Released%20-%20http%3A%2F%2Fmichael.chanceyjr.com%2Ffree-stuff%2Fcompilerpad-v1-0-released%2F" title="Twitter"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmichael.chanceyjr.com%2Ffree-stuff%2Fcompilerpad-v1-0-released%2F&amp;title=CompilePad%20v1.0%20Released&amp;bodytext=Have%20you%20ever%20created%20a%20%22Test%22%20application%20for%20the%20sole%20purpose%20of%20just%20testing%20a%20few%20lines%20of%20code%3F%20%20This%20app%20makes%20creating%201%20line%20test%20applications%20a%20thing%20of%20the%20past.%20%20With%20this%20app%20you%20can%20create%20an%20application%20on%20the%20fly%20for%20testing%201%20line%20of%20" title="Digg"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmichael.chanceyjr.com%2Ffree-stuff%2Fcompilerpad-v1-0-released%2F&amp;title=CompilePad%20v1.0%20Released" title="StumbleUpon"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmichael.chanceyjr.com%2Ffree-stuff%2Fcompilerpad-v1-0-released%2F&amp;title=CompilePad%20v1.0%20Released&amp;notes=Have%20you%20ever%20created%20a%20%22Test%22%20application%20for%20the%20sole%20purpose%20of%20just%20testing%20a%20few%20lines%20of%20code%3F%20%20This%20app%20makes%20creating%201%20line%20test%20applications%20a%20thing%20of%20the%20past.%20%20With%20this%20app%20you%20can%20create%20an%20application%20on%20the%20fly%20for%20testing%201%20line%20of%20" title="del.icio.us"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://michael.chanceyjr.com/free-stuff/compilerpad-v1-0-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>List Of Objects To XMLNodes</title>
		<link>http://michael.chanceyjr.com/useful-code/list-of-objects-to-xmlnodes/</link>
		<comments>http://michael.chanceyjr.com/useful-code/list-of-objects-to-xmlnodes/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 15:11:31 +0000</pubDate>
		<dc:creator>Michael E. Chancey Jr.</dc:creator>
				<category><![CDATA[Useful Code]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C-Sharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Collections]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Extension]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[Serialize]]></category>

		<guid isPermaLink="false">http://michael.chanceyjr.com/?p=627</guid>
		<description><![CDATA[This is an extension to create an XML representation of an array of classes or structures. Currently it only supports basic types which are not nested. This could be adapted to accomodate nested classes with fairly minimal changes. //Code /// &#60;summary&#62; /// RETURNS AN XML NODE WHICH CONTAINS ALL THE PROPERTIES FOR A LIST OF [...]]]></description>
			<content:encoded><![CDATA[<p>This is an extension to create an XML representation of an array of classes or structures.  Currently it only supports basic types which are not nested.  This could be adapted to accomodate nested classes with fairly minimal changes.</p>
<h3>//Code</h3>
<hr />
<pre class="brush: csharp;">
/// &lt;summary&gt;
/// RETURNS AN XML NODE WHICH CONTAINS ALL THE PROPERTIES FOR A LIST OF BASIC TYPES
/// &lt;/summary&gt;
/// &lt;typeparam name=&quot;t&quot;&gt;PARAMETER TYPE WITHIN THE LIST&lt;/typeparam&gt;
/// &lt;param name=&quot;obj&quot;&gt;INCOMING LIST TO ITERATE THROUGH&lt;/param&gt;
/// &lt;param name=&quot;ElementName&quot;&gt;ROOT ELEMENT NAME TO CREATE&lt;/param&gt;
/// &lt;returns&gt;AN XML NODE WHICH CONTAINS ALL THE PROPERTIES FOR A LIST OF BASIC TYPES&lt;/returns&gt;
public static XElement CreateXMLNode&lt;t&gt;(this IEnumerable&lt;t&gt; obj, string ElementName)
{
    //NODE WHICH WILL BE RETURNED TO THE CALLING FUNCTION
    XElement tmpReturn = new XElement(ElementName);

    //LOOP THROUGH ALL THE INTERNAL OBJECTS TO ADD NODES TO THE ROOT
    foreach (object tmpObj in obj)
    {
        //TEMP NODE REPRESENTING THE PROPERTY ELEMENT
        XElement tmpNode = new XElement(tmpObj.GetType().Name.ToString());

        //LOOP THROUGH ALL THE FIELDS WHICH ARE PUBLIC
        foreach (FieldInfo tmpField in tmpObj.GetType().GetFields())
        {
            XElement tmpElement = new XElement(tmpField.Name);

            //IF THE FIELD IS PUBLIC THEN ADD THE FIELD TO THE NODE
            if (tmpField.IsPublic)
            {
                tmpElement.Value = tmpField.GetValue(tmpObj).ToString();
                tmpNode.Add(tmpElement);
            }
        }

        //LOOP THROUGH ALL THE PROPERTIES WHICH ARE PUBLIC
        foreach (PropertyInfo tmpProp in tmpObj.GetType().GetProperties())
        {
            XElement tmpElement = new XElement(tmpProp.Name);

            //ADD THE ELEMENT TO THE NODE
            tmpElement.Value = tmpProp.GetValue(tmpObj, null).ToString();
            tmpNode.Add(tmpElement);
        }

        //RETURN THE ROOT NODE TO THE CALLING FUNCTION
        tmpReturn.Add(tmpNode);
    }

    return tmpReturn;
}
</pre>
<h3>//Usage</h3>
<hr />
<pre class="brush: csharp;">
class Program
{
    static void Main(string[] args)
    {
        //CREATE A LIST OF CLASSES
        List&lt;MyClass&gt; tmpList1 = new List&lt;MyClass&gt;();
        tmpList1.Add(new MyClass() { EmployeeName = &quot;Emp 1&quot;, Address = &quot;Add 1&quot;, Salary = 100000 });
        tmpList1.Add(new MyClass() { EmployeeName = &quot;Emp 2&quot;, Address = &quot;Add 2&quot;, Salary = 50000 });
        tmpList1.Add(new MyClass() { EmployeeName = &quot;Emp 3&quot;, Address = &quot;Add 3&quot;, Salary = 65000 });
        tmpList1.Add(new MyClass() { EmployeeName = &quot;Emp 4&quot;, Address = &quot;Add 4&quot;, Salary = 80000 });

        //CREATE A LIST OF STRUCTS
        List&lt;MyStruct&gt; tmpList2 = new List&lt;MyStruct&gt;();
        tmpList2.Add(new MyStruct() { EmployeeName = &quot;Emp 1&quot;, Address = &quot;Add 1&quot;, Salary = 100000 });
        tmpList2.Add(new MyStruct() { EmployeeName = &quot;Emp 2&quot;, Address = &quot;Add 2&quot;, Salary = 50000 });
        tmpList2.Add(new MyStruct() { EmployeeName = &quot;Emp 3&quot;, Address = &quot;Add 3&quot;, Salary = 65000 });
        tmpList2.Add(new MyStruct() { EmployeeName = &quot;Emp 4&quot;, Address = &quot;Add 4&quot;, Salary = 80000 });

        //CREATE XML NODE CONTAINING THE LIST OF OBJECTS CREATED ABOVE
        XElement root1 = tmpList1.CreateXMLNode(&quot;MyList_Of_Classes&quot;);
        XElement root2 = tmpList2.CreateXMLNode(&quot;MyList_Of_Structs&quot;);
    }
}

//BASIC CLASS CONTAINING PUBLIC PROPERTIES
class MyClass
{
    public string EmployeeName { get; set; }
    public string Address { get; set; }
    public double Salary { get; set; }
}

//BASIC STRUCTURE CONTAINING PUBLIC FIELDS
struct MyStruct
{
    public string EmployeeName;
    public string Address;
    public double Salary;
}
</pre>
<h3>//Output</h3>
<hr />
<pre class="brush: xml;">
&lt;MyList_Of_Classes&gt;
  &lt;MyClass&gt;
    &lt;EmployeeName&gt;Emp 1&lt;/EmployeeName&gt;
    &lt;Address&gt;Add 1&lt;/Address&gt;
    &lt;Salary&gt;100000&lt;/Salary&gt;
  &lt;/MyClass&gt;
  &lt;MyClass&gt;
    &lt;EmployeeName&gt;Emp 2&lt;/EmployeeName&gt;
    &lt;Address&gt;Add 2&lt;/Address&gt;
    &lt;Salary&gt;50000&lt;/Salary&gt;
  &lt;/MyClass&gt;
  &lt;MyClass&gt;
    &lt;EmployeeName&gt;Emp 3&lt;/EmployeeName&gt;
    &lt;Address&gt;Add 3&lt;/Address&gt;
    &lt;Salary&gt;65000&lt;/Salary&gt;
  &lt;/MyClass&gt;
  &lt;MyClass&gt;
    &lt;EmployeeName&gt;Emp 4&lt;/EmployeeName&gt;
    &lt;Address&gt;Add 4&lt;/Address&gt;
    &lt;Salary&gt;80000&lt;/Salary&gt;
  &lt;/MyClass&gt;
&lt;/MyList_Of_Classes&gt;

&lt;MyList_Of_Structs&gt;
  &lt;MyStruct&gt;
    &lt;EmployeeName&gt;Emp 1&lt;/EmployeeName&gt;
    &lt;Address&gt;Add 1&lt;/Address&gt;
    &lt;Salary&gt;100000&lt;/Salary&gt;
  &lt;/MyStruct&gt;
  &lt;MyStruct&gt;
    &lt;EmployeeName&gt;Emp 2&lt;/EmployeeName&gt;
    &lt;Address&gt;Add 2&lt;/Address&gt;
    &lt;Salary&gt;50000&lt;/Salary&gt;
  &lt;/MyStruct&gt;
  &lt;MyStruct&gt;
    &lt;EmployeeName&gt;Emp 3&lt;/EmployeeName&gt;
    &lt;Address&gt;Add 3&lt;/Address&gt;
    &lt;Salary&gt;65000&lt;/Salary&gt;
  &lt;/MyStruct&gt;
  &lt;MyStruct&gt;
    &lt;EmployeeName&gt;Emp 4&lt;/EmployeeName&gt;
    &lt;Address&gt;Add 4&lt;/Address&gt;
    &lt;Salary&gt;80000&lt;/Salary&gt;
  &lt;/MyStruct&gt;
&lt;/MyList_Of_Structs&gt;
</pre>



Share


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=List%20Of%20Objects%20To%20XMLNodes%20-%20http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Flist-of-objects-to-xmlnodes%2F" title="Twitter"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Flist-of-objects-to-xmlnodes%2F&amp;title=List%20Of%20Objects%20To%20XMLNodes&amp;bodytext=This%20is%20an%20extension%20to%20create%20an%20XML%20representation%20of%20an%20array%20of%20classes%20or%20structures.%20%20Currently%20it%20only%20supports%20basic%20types%20which%20are%20not%20nested.%20%20This%20could%20be%20adapted%20to%20accomodate%20nested%20classes%20with%20fairly%20minimal%20changes.%0D%0A%0D%0A%2F%2FCode%0D%0A%0D%0A%5Bcs" title="Digg"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Flist-of-objects-to-xmlnodes%2F&amp;title=List%20Of%20Objects%20To%20XMLNodes" title="StumbleUpon"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Flist-of-objects-to-xmlnodes%2F&amp;title=List%20Of%20Objects%20To%20XMLNodes&amp;notes=This%20is%20an%20extension%20to%20create%20an%20XML%20representation%20of%20an%20array%20of%20classes%20or%20structures.%20%20Currently%20it%20only%20supports%20basic%20types%20which%20are%20not%20nested.%20%20This%20could%20be%20adapted%20to%20accomodate%20nested%20classes%20with%20fairly%20minimal%20changes.%0D%0A%0D%0A%2F%2FCode%0D%0A%0D%0A%5Bcs" title="del.icio.us"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://michael.chanceyjr.com/useful-code/list-of-objects-to-xmlnodes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Read File From FTP Using C#</title>
		<link>http://michael.chanceyjr.com/useful-code/read-file-from-ftp-using-c/</link>
		<comments>http://michael.chanceyjr.com/useful-code/read-file-from-ftp-using-c/#comments</comments>
		<pubDate>Tue, 18 May 2010 15:30:36 +0000</pubDate>
		<dc:creator>Michael E. Chancey Jr.</dc:creator>
				<category><![CDATA[Useful Code]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C-Sharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Stream]]></category>
		<category><![CDATA[TCP/IP]]></category>

		<guid isPermaLink="false">http://michael.chanceyjr.com/?p=624</guid>
		<description><![CDATA[Here is a small snippet on reading a text file from an FTP server. This could be replaced with a binary file or any other type; I just used a text file to keep it simple. Code //CREATE AN FTP REQUEST WITH THE DOMAIN AND CREDENTIALS System.Net.FtpWebRequest tmpReq = (System.Net.FtpWebRequest)System.Net.FtpWebRequest.Create(&#34;ftp://domain.com/file.txt&#34;); tmpReq.Credentials = new System.Net.NetworkCredential(&#34;userName&#34;, &#34;Password&#34;); [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a small snippet on reading a text file from an FTP server.  This could be replaced with a binary file or any other type; I just used a text file to keep it simple.</p>
<h3>Code</h3>
<hr/>
<pre class="brush: csharp;">
            //CREATE AN FTP REQUEST WITH THE DOMAIN AND CREDENTIALS
            System.Net.FtpWebRequest tmpReq = (System.Net.FtpWebRequest)System.Net.FtpWebRequest.Create(&quot;ftp://domain.com/file.txt&quot;);
            tmpReq.Credentials = new System.Net.NetworkCredential(&quot;userName&quot;, &quot;Password&quot;);

            //GET THE FTP RESPONSE
            using (System.Net.WebResponse tmpRes = tmpReq.GetResponse())
            {
                //GET THE STREAM TO READ THE RESPONSE FROM
                using (System.IO.Stream tmpStream = tmpRes.GetResponseStream())
                {
                    //CREATE A TXT READER (COULD BE BINARY OR ANY OTHER TYPE YOU NEED)
                    using (System.IO.TextReader tmpReader = new System.IO.StreamReader(tmpStream))
                    {
                        //STORE THE FILE CONTENTS INTO A STRING
                        string fileContents = tmpReader.ReadToEnd();

                        //DO SOMETHING WITH SAID FILE CONTENTS
                    }
                }
            }
</pre>



Share


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Read%20File%20From%20FTP%20Using%20C%23%20-%20http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fread-file-from-ftp-using-c%2F" title="Twitter"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fread-file-from-ftp-using-c%2F&amp;title=Read%20File%20From%20FTP%20Using%20C%23&amp;bodytext=Here%20is%20a%20small%20snippet%20on%20reading%20a%20text%20file%20from%20an%20FTP%20server.%20%20This%20could%20be%20replaced%20with%20a%20binary%20file%20or%20any%20other%20type%3B%20I%20just%20used%20a%20text%20file%20to%20keep%20it%20simple.%0D%0A%0D%0ACode%0D%0A%0D%0A%5Bcsharp%5D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2FCREATE%20AN%20FTP%20REQUEST%20WITH%20THE%20DOMAIN%20AND%20C" title="Digg"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fread-file-from-ftp-using-c%2F&amp;title=Read%20File%20From%20FTP%20Using%20C%23" title="StumbleUpon"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fread-file-from-ftp-using-c%2F&amp;title=Read%20File%20From%20FTP%20Using%20C%23&amp;notes=Here%20is%20a%20small%20snippet%20on%20reading%20a%20text%20file%20from%20an%20FTP%20server.%20%20This%20could%20be%20replaced%20with%20a%20binary%20file%20or%20any%20other%20type%3B%20I%20just%20used%20a%20text%20file%20to%20keep%20it%20simple.%0D%0A%0D%0ACode%0D%0A%0D%0A%5Bcsharp%5D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2FCREATE%20AN%20FTP%20REQUEST%20WITH%20THE%20DOMAIN%20AND%20C" title="del.icio.us"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://michael.chanceyjr.com/useful-code/read-file-from-ftp-using-c/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ini File Processing</title>
		<link>http://michael.chanceyjr.com/useful-code/ini-file-processing/</link>
		<comments>http://michael.chanceyjr.com/useful-code/ini-file-processing/#comments</comments>
		<pubDate>Thu, 13 May 2010 16:38:40 +0000</pubDate>
		<dc:creator>Michael E. Chancey Jr.</dc:creator>
				<category><![CDATA[Useful Code]]></category>
		<category><![CDATA[.ini]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C-Sharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Ini File]]></category>

		<guid isPermaLink="false">http://michael.chanceyjr.com/?p=611</guid>
		<description><![CDATA[This is a class which will allow you to read old style .ini files. Sometimes you have an app which uses .ini and you need to read it in for whatever reason. Or perhaps you are looking to store your own apps settings in a .ini file because its what people are used to. In [...]]]></description>
			<content:encoded><![CDATA[<p>This is a class which will allow you to read old style .ini files.  Sometimes you have an app which uses .ini and you need to read it in for whatever reason.  Or perhaps you are looking to store your own apps settings in a .ini file because its what people are used to.  In any event here is a sample .ini file this class will process.</p>
<h3>Ini File</h3>
<hr/>
<blockquote><p>
[Section 1]<br />
Test = 1<br />
Test2 = 1</p>
<p>[Section 2]<br />
blah = foo<br />
foo = blah</p>
<p>[Section 3]<br />
var = more settings<br />
test = this will handle = signs as part of the value also
</p></blockquote>
<h3>Sample Code</h3>
<hr/>
<pre class="brush: csharp;">
            IniFileReaderLib.IniFile tmpIni = new IniFileReaderLib.IniFile(&quot;Settings.ini&quot;);
            Console.WriteLine(tmpIni.Section[&quot;Section 1&quot;][&quot;test&quot;]);
</pre>
<h3>Code</h3>
<hr/>
<pre class="brush: csharp;">
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Linq;

namespace IniFileReaderLib
{
    /// &lt;summary&gt;
    /// PROVIDES ROUTINES FOR READING AND PROCESSING A .INI FILE
    /// &lt;/summary&gt;
    public class IniFile
    {
        /// &lt;summary&gt;
        /// HOLDS ALL THE VARIABLES LISTED IN THE INI FILE BASED ON obj[&quot;Section&quot;][&quot;Setting&quot;]
        /// &lt;/summary&gt;
        public Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt; Section { get; set; }

        /// &lt;summary&gt;
        /// DID THE FILE CONTAIN ERRORS WHEN ATTEMPTING TO LOAD
        /// &lt;/summary&gt;
        public bool HasErrors { get; set; }

        /// &lt;summary&gt;
        /// WHAT WERE THE ERRORS CONTAINED IN THE FILE
        /// &lt;/summary&gt;
        public List&lt;string&gt; Errors { get; set; }

        /// &lt;summary&gt;
        /// FILENAME OF THE INI FILE WE ARE PROCESSING
        /// &lt;/summary&gt;
        public string FileName { get; set; }

        /// &lt;summary&gt;
        /// CLASS INITIALIZER
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;FileName&quot;&gt;FILENAME TO PROCESS&lt;/param&gt;
        public IniFile(string FileName)
        {
            //STORE THE NAME OF THE FILE WE ARE TO PROCESS
            this.FileName = FileName;

            //PROCESS THE FILE
            ReloadFile();
        }

        /// &lt;summary&gt;
        /// RELOAD THE INI FILE INCASE IT HAS CHANGED SINCE THIS CLASS WAS CREATED
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;FileName&quot;&gt;FILENAME OF THE INIFILE TO PROCESS&lt;/param&gt;
        public void ReloadFile()
        {
            //CLEAR OUT ALL THE VALUES BY RELEASING THE OBJECT
            Section = new Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt;(StringComparer.CurrentCultureIgnoreCase);
            Errors = new List&lt;string&gt;();

            //CREATE A TEXT READER TO READ THE INI FILE
            using (TextReader tmpReader = (TextReader)File.OpenText(FileName))
            {
                string tmpLine = null;
                string curSection = null;

                //LOOP THROUGH THE ENTIRE FILE ADDING VARIABLES TO THE SECTION
                while ((tmpLine = tmpReader.ReadLine()) != null)
                {
                    //IF THE LINE IS A SECTION THEN ADD IT TO THE SECTIONS AND START ADDING VARIABLES TO THE SECTION
                    if (Regex.Match(tmpLine, @&quot;[[].*[]]&quot;).Success)
                    {
                        //PARSE THE SECTION OUT OF THE STRING AND APPEND IT TO THE LIST OF SECTIONS
                        curSection = Regex.Match(tmpLine, @&quot;[[](?&lt;Section&gt;.*)[]]&quot;).Groups[&quot;Section&quot;].Value;
                        Section[curSection] = new Dictionary&lt;string, string&gt;(StringComparer.CurrentCultureIgnoreCase);
                    }
                    else
                    {
                        try
                        {
                            //IF THERE IS DATA ON THE LINE THEN TRY TO PROCESS IT
                            if (!string.IsNullOrEmpty(tmpLine) &amp;&amp; tmpLine.Contains(&quot;=&quot;))
                            {
                                //SPLIT THE STRING UP SO WE CAN GET THE VAR TO THE LEFT OF THE = SIGN
                                string[] curPair = tmpLine.Split('=');

                                //ADD THE ITEM TO THE COLLECTION AND MAKE SURE TO PIECE ANYTHING BACK TOGETHER ON THE RIGHT OF THE FIRST = SIGN
                                Section[curSection].Add(curPair[0].Trim(), string.Join(&quot;=&quot;, curPair.Skip(1).ToArray()).Trim());
                            }
                        }
                        catch(Exception e)
                        {
                            //TRACK THAT AN ERROR WAS THROWN
                            HasErrors = true;

                            //ADD THE MESSAGE TO THE ERROR LIST
                            Errors.Add(e.Message);
                        }
                    }
                }
            }
        }
    }
}
</pre>



Share


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Ini%20File%20Processing%20-%20http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fini-file-processing%2F" title="Twitter"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fini-file-processing%2F&amp;title=Ini%20File%20Processing&amp;bodytext=This%20is%20a%20class%20which%20will%20allow%20you%20to%20read%20old%20style%20.ini%20files.%20%20Sometimes%20you%20have%20an%20app%20which%20uses%20.ini%20and%20you%20need%20to%20read%20it%20in%20for%20whatever%20reason.%20%20Or%20perhaps%20you%20are%20looking%20to%20store%20your%20own%20apps%20settings%20in%20a%20.ini%20file%20because%20its%20what%20" title="Digg"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fini-file-processing%2F&amp;title=Ini%20File%20Processing" title="StumbleUpon"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fini-file-processing%2F&amp;title=Ini%20File%20Processing&amp;notes=This%20is%20a%20class%20which%20will%20allow%20you%20to%20read%20old%20style%20.ini%20files.%20%20Sometimes%20you%20have%20an%20app%20which%20uses%20.ini%20and%20you%20need%20to%20read%20it%20in%20for%20whatever%20reason.%20%20Or%20perhaps%20you%20are%20looking%20to%20store%20your%20own%20apps%20settings%20in%20a%20.ini%20file%20because%20its%20what%20" title="del.icio.us"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://michael.chanceyjr.com/useful-code/ini-file-processing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Keywords and Description Meta Tags</title>
		<link>http://michael.chanceyjr.com/useful-code/wordpress-keywords-and-description-meta-tags/</link>
		<comments>http://michael.chanceyjr.com/useful-code/wordpress-keywords-and-description-meta-tags/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 15:15:20 +0000</pubDate>
		<dc:creator>Michael E. Chancey Jr.</dc:creator>
				<category><![CDATA[Useful Code]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://michael.chanceyjr.com/?p=550</guid>
		<description><![CDATA[The code below allows you to add keywoards and description meta tags to any wordpress theme. Simple copy the below code and insert it into the header.php of your theme somewhere inside of the &#60;head&#62;&#60;/head&#62; tag. You could also simply download the plugin I wrote for this as well. Although I have submitted it to [...]]]></description>
			<content:encoded><![CDATA[<p>The code below allows you to add keywoards and description meta tags to any wordpress theme.  Simple copy the below code and insert it into the header.php of your theme somewhere inside of the &lt;head&gt;&lt;/head&gt; tag.</p>
<p>You could also simply download the plugin I wrote for this as well.  Although I have submitted it to WordPress.org they have not posted it yet so here is a link in the mean time.  Please note the plugin is a little more customizable then the code below.</p>
<p><a href="http://michael.chanceyjr.com/free-stuff/auto-keywords-and-description-generator/">-Auto Keywords and Description Generator-</a></p>
<h3>//Code</h3>
<hr/>
<pre class="brush: php;">
&lt;?php
$keywords = &quot;&quot;;
$description = &quot;&quot;;

if(is_home() || is_front_page())
{
	//LOAD KEYWORDS FROM USER SPECIFIED STRING
	$keywords = &quot;Insert your homepage keywords here&quot;;

	//LOAD DESCRIPTION FROM BLOGINFO
	$description = bloginfo('description');
}
elseif(is_single())
{
	//LOAD POST TITLE AS DESCRIPTION
	$description = $post-&gt;post_title;

	//BUILD LIST OF KEYWORDS FROM TAGS
	$tags = wp_get_post_tags($post-&gt;ID);
	foreach($tags as $tag)
		$keywords = $keywords . $tag-&gt;name . &quot;, &quot;;
}
elseif(is_category())
{
	//LOAD CATEGORY DESCRIPTION
	$keywords = single_cat_title('', false);
	$description = category_description();
}
?&gt;
&lt;meta name=&quot;keywords&quot; content=&quot;&lt;?php echo $keywords ?&gt;&quot; /&gt;
&lt;meta name=&quot;description&quot; content=&quot;&lt;?php echo $description ?&gt;&quot; /&gt;
</pre>



Share


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Wordpress%20Keywords%20and%20Description%20Meta%20Tags%20-%20http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fwordpress-keywords-and-description-meta-tags%2F" title="Twitter"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fwordpress-keywords-and-description-meta-tags%2F&amp;title=Wordpress%20Keywords%20and%20Description%20Meta%20Tags&amp;bodytext=The%20code%20below%20allows%20you%20to%20add%20keywoards%20and%20description%20meta%20tags%20to%20any%20wordpress%20theme.%20%20Simple%20copy%20the%20below%20code%20and%20insert%20it%20into%20the%20header.php%20of%20your%20theme%20somewhere%20inside%20of%20the%20%26lt%3Bhead%26gt%3B%26lt%3B%2Fhead%26gt%3B%20tag.%0D%0A%0D%0AYou%20could%20also%20simply%20d" title="Digg"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fwordpress-keywords-and-description-meta-tags%2F&amp;title=Wordpress%20Keywords%20and%20Description%20Meta%20Tags" title="StumbleUpon"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fwordpress-keywords-and-description-meta-tags%2F&amp;title=Wordpress%20Keywords%20and%20Description%20Meta%20Tags&amp;notes=The%20code%20below%20allows%20you%20to%20add%20keywoards%20and%20description%20meta%20tags%20to%20any%20wordpress%20theme.%20%20Simple%20copy%20the%20below%20code%20and%20insert%20it%20into%20the%20header.php%20of%20your%20theme%20somewhere%20inside%20of%20the%20%26lt%3Bhead%26gt%3B%26lt%3B%2Fhead%26gt%3B%20tag.%0D%0A%0D%0AYou%20could%20also%20simply%20d" title="del.icio.us"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://michael.chanceyjr.com/useful-code/wordpress-keywords-and-description-meta-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>String Truncating Extension</title>
		<link>http://michael.chanceyjr.com/useful-code/string-truncating-extension/</link>
		<comments>http://michael.chanceyjr.com/useful-code/string-truncating-extension/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 10:12:00 +0000</pubDate>
		<dc:creator>Michael E. Chancey Jr.</dc:creator>
				<category><![CDATA[Useful Code]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C-Sharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Extension]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Truncate]]></category>

		<guid isPermaLink="false">http://michael.chanceyjr.com/?p=539</guid>
		<description><![CDATA[This is a simple extension to truncate strings on whole words. If it can not find a whole word to truncate on then it will fall back to breaking a word up. You can also pass a string to append to the end of the truncated string. Other then that there is not a whole [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple extension to truncate strings on whole words.  If it can not find a whole word to truncate on then it will fall back to breaking a word up.  You can also pass a string to append to the end of the truncated string.  Other then that there is not a whole lot to say about this one.</p>
<h3>//Code</h3>
<hr/>
<pre class="brush: csharp;">
        /// &lt;summary&gt;
        /// TRUNCATES A STRING PREFERRING WHOLE WORD OVER NON WHOLE WORD
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;s&quot;&gt;INCOMING STRING TO TRUNCATE&lt;/param&gt;
        /// &lt;param name=&quot;len&quot;&gt;LENGTH IN WHICH TO TRUNCATE TO&lt;/param&gt;
        /// &lt;param name=&quot;postTruncate&quot;&gt;ANYTHING TO ADD TO A TRUNCATED STRING SUCH AS ...&lt;/param&gt;
        /// &lt;returns&gt;TRUNCATED STRING WITH POST TRUNCATE ADDED TO IT&lt;/returns&gt;
        public static string Truncate(this string s, int len, string postTruncate)
        {
            //IF THE STRING IS SMALLER THEN THE LENGTH JUST RETURN THE STRING
            if (s == null || s.Length &lt; len)
                return s;
            else
            {
                //INCASE NULL HAS BEEN PASSED IN CHANGE IT TO EMPTY STRING SO IT HAS A COUNT
                if (postTruncate == null)
                    postTruncate = string.Empty;

                //RETURN THE TRUNCATED STRING BACK TO CALLING FUNCTION
                string tmpReturn = string.Concat(Regex.Match(String.Concat(s, &quot; &quot;), string.Format(&quot;^(?&lt;tmpMatch&gt;.{{0,{0}}})\\s&quot;, len)).Groups[&quot;tmpMatch&quot;].Value, postTruncate);

                //IF THE WHOLE WORD TRUNCATE WORKED THEN USE IT OTHERWISE USE NON WHOLE WORD TRUNCATE
                if (tmpReturn != postTruncate)
                    return tmpReturn;
                else
                    return string.Concat(Regex.Match(String.Concat(s, &quot; &quot;), string.Format(&quot;^(?&lt;tmpMatch&gt;.{{0,{0}}})&quot;, len)).Groups[&quot;tmpMatch&quot;].Value, postTruncate);
            }
        }
</pre>
<h3>//Usage</h3>
<hr/>
<pre class="brush: csharp;">
    class Program
    {
        static void Main(string[] args)
        {
            //OUTPUT WILL BE &quot;Hello, World...&quot;
            Console.WriteLine(&quot;Hello, World this is some long text to truncate&quot;.Truncate(15, &quot;...&quot;));
            Console.ReadLine();
        }
    }
</pre>



Share


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=String%20Truncating%20Extension%20-%20http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fstring-truncating-extension%2F" title="Twitter"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fstring-truncating-extension%2F&amp;title=String%20Truncating%20Extension&amp;bodytext=This%20is%20a%20simple%20extension%20to%20truncate%20strings%20on%20whole%20words.%20%20If%20it%20can%20not%20find%20a%20whole%20word%20to%20truncate%20on%20then%20it%20will%20fall%20back%20to%20breaking%20a%20word%20up.%20%20You%20can%20also%20pass%20a%20string%20to%20append%20to%20the%20end%20of%20the%20truncated%20string.%20%20Other%20then%20that%20th" title="Digg"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fstring-truncating-extension%2F&amp;title=String%20Truncating%20Extension" title="StumbleUpon"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fstring-truncating-extension%2F&amp;title=String%20Truncating%20Extension&amp;notes=This%20is%20a%20simple%20extension%20to%20truncate%20strings%20on%20whole%20words.%20%20If%20it%20can%20not%20find%20a%20whole%20word%20to%20truncate%20on%20then%20it%20will%20fall%20back%20to%20breaking%20a%20word%20up.%20%20You%20can%20also%20pass%20a%20string%20to%20append%20to%20the%20end%20of%20the%20truncated%20string.%20%20Other%20then%20that%20th" title="del.icio.us"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://michael.chanceyjr.com/useful-code/string-truncating-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Password Complexity</title>
		<link>http://michael.chanceyjr.com/useful-code/testing-password-complexity/</link>
		<comments>http://michael.chanceyjr.com/useful-code/testing-password-complexity/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 05:15:17 +0000</pubDate>
		<dc:creator>Michael E. Chancey Jr.</dc:creator>
				<category><![CDATA[Useful Code]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C-Sharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Password Complexity]]></category>
		<category><![CDATA[RegEx]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://michael.chanceyjr.com/?p=534</guid>
		<description><![CDATA[Password complexity is a huge deal when a company is applying for its compliance so below is a simple function to test for password complexity based on a rule set passed in. The following code allows for any of the following rules to be applied to a password. You can elect to require any or [...]]]></description>
			<content:encoded><![CDATA[<p>Password complexity is a huge deal when a company is applying for its compliance so below is a simple function to test for password complexity based on a rule set passed in.  The following code allows for any of the following rules to be applied to a password.  You can elect to require any or all of the following 1 upper case character, 1 lower case character, 1 numeric character and 1 special character.</p>
<h3>//Function</h3>
<hr/>
<pre class="brush: csharp;">
        /// &lt;summary&gt;
        /// FUNCTION FOR TESTING PASSWORD COMPLEXITY
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;s&quot;&gt;INCOMING PASSWORD TO TEST&lt;/param&gt;
        /// &lt;param name=&quot;minLength&quot;&gt;MIN LENGTH OF PASSWORD&lt;/param&gt;
        /// &lt;param name=&quot;maxLength&quot;&gt;MAX LENGTH OF PASSWORD&lt;/param&gt;
        /// &lt;param name=&quot;rule&quot;&gt;COMPARISON FLAGS CAN BE ANY COMBINATION OF THE FOLLOWING - UPPER, LOWER, NUMERIC, SPECIAL&lt;/param&gt;
        /// &lt;returns&gt;TRUE OR FALSE IF THE PASSWORD PASSES OR NOT&lt;/returns&gt;
        static bool ValidatePasswordComplexity(string s, int minLength, int maxLength, PasswordRules rule)
        {
            //CONSTANTS FOR COMPARISON GROUPS
            const string UPPER = &quot;(?=.*[A-Z])&quot;;
            const string LOWER = &quot;(?=.*[a-z])&quot;;
            const string NUMERIC = &quot;(?=.*[0-9])&quot;;
            const string SPECIAL = &quot;(?=.*[!@#$%^&amp;*()&lt;&gt;])&quot;;

            //CREATE A NEW VAR TO HOLD THE COMPARE STRING WHILE ITS ASSEMBLED
            StringBuilder tmpCompare = new StringBuilder(&quot;^&quot;);

            //CHECK IF UPPER IS A REQUIREMENT
            if ((rule &amp; PasswordRules.Upper) == PasswordRules.Upper)
                tmpCompare.Append(UPPER);

            //CHECK IF LOWER IS A REQUIREMENT
            if ((rule &amp; PasswordRules.Lower) == PasswordRules.Lower)
                tmpCompare.Append(LOWER);

            //CHECK IF NUMERIC IS A REQUIREMENT
            if ((rule &amp; PasswordRules.Numeric) == PasswordRules.Numeric)
                tmpCompare.Append(NUMERIC);

            //CHECK IF SPECIAL IS A REQUIREMENT
            if ((rule &amp; PasswordRules.Special) == PasswordRules.Special)
                tmpCompare.Append(SPECIAL);

            //APPEND THE LENGTH REQUIREMENTS
            tmpCompare.Append(string.Format(&quot;.{{{0},{1}}}&quot;, minLength, maxLength));

            //RETURN THE RESULT OF THE COMPARISON
            return Regex.Match(s, tmpCompare.ToString()).Success;
        }

        /// &lt;summary&gt;
        /// ERNUMERATIONS FOR PASSWORD COMPLEXITY TESTING
        /// &lt;/summary&gt;
        [Flags]
        public enum PasswordRules
        {
            Upper = 1,
            Lower = 2,
            Numeric = 4,
            Special = 8,
        }
</pre>
<h3>//Usage</h3>
<hr/>
<pre class="brush: csharp;">
        /// &lt;summary&gt;
        /// MAIN APPLICATION ENTRY POINT
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;args&quot;&gt;&lt;/param&gt;
        static void Main(string[] args)
        {
            //SOMETHING TO COMPARE
            string pwd = &quot;Password1&quot;;

            //TWO DIFFERENT SAMPLES TO SHOW THE PASSWORD MEETS THE REQUIREMENTS IF YOU ARE NOT LOOKING FOR A SPECIAL CHARACTER
            //BUT FAILS ONCE THE SPECIAL REQUIREMENT IS ADDED TO THE PARAMETER
            Console.WriteLine(&quot;{0}: {1}&quot;, pwd, ValidatePasswordComplexity(pwd, 6, 15, PasswordRules.Upper | PasswordRules.Lower | PasswordRules.Numeric));
            Console.WriteLine(&quot;{0}: {1}&quot;, pwd, ValidatePasswordComplexity(pwd, 6, 15, PasswordRules.Upper | PasswordRules.Lower | PasswordRules.Numeric | PasswordRules.Special));

            //WAIT FOR USER INPUT
            Console.ReadLine();
        }
</pre>



Share


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Testing%20Password%20Complexity%20-%20http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Ftesting-password-complexity%2F" title="Twitter"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Ftesting-password-complexity%2F&amp;title=Testing%20Password%20Complexity&amp;bodytext=Password%20complexity%20is%20a%20huge%20deal%20when%20a%20company%20is%20applying%20for%20its%20compliance%20so%20below%20is%20a%20simple%20function%20to%20test%20for%20password%20complexity%20based%20on%20a%20rule%20set%20passed%20in.%20%20The%20following%20code%20allows%20for%20any%20of%20the%20following%20rules%20to%20be%20applied%20to%20a" title="Digg"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Ftesting-password-complexity%2F&amp;title=Testing%20Password%20Complexity" title="StumbleUpon"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Ftesting-password-complexity%2F&amp;title=Testing%20Password%20Complexity&amp;notes=Password%20complexity%20is%20a%20huge%20deal%20when%20a%20company%20is%20applying%20for%20its%20compliance%20so%20below%20is%20a%20simple%20function%20to%20test%20for%20password%20complexity%20based%20on%20a%20rule%20set%20passed%20in.%20%20The%20following%20code%20allows%20for%20any%20of%20the%20following%20rules%20to%20be%20applied%20to%20a" title="del.icio.us"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://michael.chanceyjr.com/useful-code/testing-password-complexity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Human Readable Size Formatting Extension</title>
		<link>http://michael.chanceyjr.com/useful-code/human-readable-size-formatting-extension/</link>
		<comments>http://michael.chanceyjr.com/useful-code/human-readable-size-formatting-extension/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 09:34:17 +0000</pubDate>
		<dc:creator>Michael E. Chancey Jr.</dc:creator>
				<category><![CDATA[Useful Code]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C-Sharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Extension]]></category>
		<category><![CDATA[Numeric]]></category>

		<guid isPermaLink="false">http://michael.chanceyjr.com/?p=521</guid>
		<description><![CDATA[This is a simple extension to turn unreadable sizes into something that makes more sense to the human eye. This will convert 1024 into 1KB or 1099511627776 into 1GB. This is by no means perfect, some additions could be made such as adding ,&#8217;s to separate the digits into proper grouping. Having said that most [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple extension to turn unreadable sizes into something that makes more sense to the human eye.  This will convert 1024 into 1KB or 1099511627776 into 1GB.  This is by no means perfect, some additions could be made such as adding ,&#8217;s to separate the digits into proper grouping.  Having said that most of the time grouping will be removed because numbers which should be grouped soon fall into the next sizing segment, meaning 1,000B becomes 1KB after only 24 more bytes.</p>
<h3>//Code</h3>
<hr/>
<pre class="brush: csharp;">
        /// &lt;summary&gt;
        /// MAIN TO HUMAN READABLE FUNCTION TO CONVERT DOUBLES INTO XB, XKB, XMB, XGB
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;x&quot;&gt;INCOMING NUMBER TO MAKE READABLE&lt;/param&gt;
        /// &lt;returns&gt;HUMAN READABLE SIZE FORMAT SUCH AS 1MB&lt;/returns&gt;
        public static string ToHumanReadable(this double x)
        {
            //CONSTANTS FOR SIZING
            double KB = 1024;
            double MB = 1024 * KB;
            double GB = 1024 * MB;

            if (x &lt; KB)
                return string.Format(&quot;{0}B&quot;, x);
            else if (x &lt; MB)
            {
                return string.Format(&quot;{0:0.##}KB&quot;, x / KB);
            }
            else if (x &lt; GB)
            {
                return string.Format(&quot;{0:0.##}MB&quot;, x / MB);
            }
            else if (x &gt;= GB)
            {
                return string.Format(&quot;{0:0.##}GB&quot;, x / GB);
            }
            else
            {
                //HACK: GET RID OF COMPILER ERROR BECAUSE IT BELEIVES NOT ALL PATHS RETURN A VALUE
                return null;
            }
        }

        /// &lt;summary&gt;
        /// EXTENSION FOR LONG TO MAKE HUMAN READABLE
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;x&quot;&gt;INCOMING NUMBER TO MAKE READABLE&lt;/param&gt;
        /// &lt;returns&gt;HUMAN READABLE SIZE FORMAT SUCH AS 1MB&lt;/returns&gt;
        public static string ToHumanReadable(this long x)
        {
            return ToHumanReadable((double)x);
        }

        /// &lt;summary&gt;
        /// EXTENSION FOR INT TO MAKE HUMAN READABLE
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;x&quot;&gt;INCOMING NUMBER TO MAKE READABLE&lt;/param&gt;
        /// &lt;returns&gt;HUMAN READABLE SIZE FORMAT SUCH AS 1MB&lt;/returns&gt;
        public static string ToHumanReadable(this int x)
        {
            return ToHumanReadable((double)x);
        }

        /// &lt;summary&gt;
        /// EXTENSION FOR SINGLE TO MAKE HUMAN READABLE
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;x&quot;&gt;INCOMING NUMBER TO MAKE READABLE&lt;/param&gt;
        /// &lt;returns&gt;HUMAN READABLE SIZE FORMAT SUCH AS 1MB&lt;/returns&gt;
        public static string ToHumanReadable(this Single x)
        {
            return ToHumanReadable((double)x);
        }
</pre>



Share


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Human%20Readable%20Size%20Formatting%20Extension%20-%20http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fhuman-readable-size-formatting-extension%2F" title="Twitter"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fhuman-readable-size-formatting-extension%2F&amp;title=Human%20Readable%20Size%20Formatting%20Extension&amp;bodytext=This%20is%20a%20simple%20extension%20to%20turn%20unreadable%20sizes%20into%20something%20that%20makes%20more%20sense%20to%20the%20human%20eye.%20%20This%20will%20convert%201024%20into%201KB%20or%201099511627776%20into%201GB.%20%20This%20is%20by%20no%20means%20perfect%2C%20some%20additions%20could%20be%20made%20such%20as%20adding%20%2C%27s%20to%20se" title="Digg"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fhuman-readable-size-formatting-extension%2F&amp;title=Human%20Readable%20Size%20Formatting%20Extension" title="StumbleUpon"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmichael.chanceyjr.com%2Fuseful-code%2Fhuman-readable-size-formatting-extension%2F&amp;title=Human%20Readable%20Size%20Formatting%20Extension&amp;notes=This%20is%20a%20simple%20extension%20to%20turn%20unreadable%20sizes%20into%20something%20that%20makes%20more%20sense%20to%20the%20human%20eye.%20%20This%20will%20convert%201024%20into%201KB%20or%201099511627776%20into%201GB.%20%20This%20is%20by%20no%20means%20perfect%2C%20some%20additions%20could%20be%20made%20such%20as%20adding%20%2C%27s%20to%20se" title="del.icio.us"><img src="http://michael.chanceyjr.com/site/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://michael.chanceyjr.com/useful-code/human-readable-size-formatting-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

