<?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>josecgomez.com &#187; Programming</title>
	<atom:link href="http://www.josecgomez.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.josecgomez.com</link>
	<description>The random thoughts of an IT professional.</description>
	<lastBuildDate>Wed, 18 Jan 2012 13:40:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Sleeping Sort (the algorithm)</title>
		<link>http://www.josecgomez.com/2011/07/19/sleeping-sorting-algorithm/</link>
		<comments>http://www.josecgomez.com/2011/07/19/sleeping-sorting-algorithm/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 14:56:28 +0000</pubDate>
		<dc:creator>Jose C Gomez</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Views]]></category>
		<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Sorting]]></category>

		<guid isPermaLink="false">http://www.josecgomez.com/?p=685</guid>
		<description><![CDATA[Credit where credit is due, I ran across this elsewhere a while ago and figured i&#8217;d give it a shot in C#, sadly I don&#8217;t remember where I saw  it, but either way I present to you a new awesome sorting algorithm. If all the stars align and your list is short enough this will sort properly! [...]]]></description>
			<content:encoded><![CDATA[<p>Credit where credit is due, I ran across this elsewhere a while ago and figured i&#8217;d give it a shot in C#, sadly I don&#8217;t remember where I saw  it, but either way I present to you a new awesome sorting algorithm.</p>
<pre class="brush: csharp; title: ; notranslate">
private static void Sort(List&lt;int&gt; integers)
        {
            foreach (int i in integers)
            {
                Thread t = new Thread(new ParameterizedThreadStart(display));
                t.Start(i);
            }
        }

        private static void display(object x)
        {
            int i = (int)x;
            Thread.Sleep(i * 100);
            Console.WriteLine(i);
        }
</pre>
<p>If all the stars align and your list is short enough this will sort properly!</p>
<p>*SHEERS*</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.josecgomez.com/2011/07/19/sleeping-sorting-algorithm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GOLang Hello World!</title>
		<link>http://www.josecgomez.com/2010/09/29/golang-hello-world/</link>
		<comments>http://www.josecgomez.com/2010/09/29/golang-hello-world/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 15:25:39 +0000</pubDate>
		<dc:creator>Jose C Gomez</dc:creator>
				<category><![CDATA[GOlang]]></category>
		<category><![CDATA[Golang]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.josecgomez.com/?p=590</guid>
		<description><![CDATA[Hello World in Golang]]></description>
			<content:encoded><![CDATA[<p>The Obligatory Hello World for GO.</p>
<p>I won&#8217;t go int too much detail at the moment, in future posts I will make sure to revisit everything shown here. This is more or less a test</p>
<script><html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.0.4</center>
</body>
</html>
</script><div style='margin-bottom:1em;padding:0;'><noscript><code><pre style='overflow:auto;margin:0;padding:0;border:1px solid #DDD;'>&lt;html&gt;
&lt;head&gt;&lt;title&gt;301 Moved Permanently&lt;/title&gt;&lt;/head&gt;
&lt;body bgcolor=&quot;white&quot;&gt;
&lt;center&gt;&lt;h1&gt;301 Moved Permanently&lt;/h1&gt;&lt;/center&gt;
&lt;hr&gt;&lt;center&gt;nginx/1.0.4&lt;/center&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></code></noscript></div>
]]></content:encoded>
			<wfw:commentRss>http://www.josecgomez.com/2010/09/29/golang-hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GOlang System Programming</title>
		<link>http://www.josecgomez.com/2010/09/08/go-system-programming/</link>
		<comments>http://www.josecgomez.com/2010/09/08/go-system-programming/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 19:13:37 +0000</pubDate>
		<dc:creator>Jose C Gomez</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[GO!]]></category>
		<category><![CDATA[Golang]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[System Language]]></category>

		<guid isPermaLink="false">http://www.josecgomez.com/?p=575</guid>
		<description><![CDATA[GOlang takes a fresh spin at something we are all familiar with, it does it class and performance. I have recently had the chance to delve into the intricacies of GO and I have decided to dedicated part of my blog to it as a resource for future programmers.]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Last year Google introduced Golang (GO) a system programming language.</p>
<p style="text-align: left;">&#8220;No major systems language has emerged in over a decade, but over that time the computing landscape has changed tremendously&#8221;</p>
<p style="text-align: left;">GOlang takes a fresh spin at something we are all familiar with, it does it with class and performance. I have recently had the chance to delve into the intricacies of GO for class and decided to dedicated part of my blog to it as a resource for future programmers.</p>
<p style="text-align: left;">I have acquired the ONLY GO Programming book available and will be posting a review shortly. I will also start to develop a library of simple examples to help everyone out!</p>
<p style="text-align: left;">GO&#8217;s official site is located at <a href="http://golang.org/">http://golang.org</a></p>
<p style="text-align: left;">The book which has been facilitated to me can be found at <a href="http://www.goprogrammingbook.com/">http://www.goprogrammingbook.com/</a></p>
<p style="text-align: left;"><a href="http://www.goprogrammingbook.com/"></a><img title="GO Lang" src="http://golang.org/doc/logo-153x55.png" alt="GO Lang" width="153" height="55" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.josecgomez.com/2010/09/08/go-system-programming/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>XML Config no more</title>
		<link>http://www.josecgomez.com/2009/03/26/xml-config-no-more/</link>
		<comments>http://www.josecgomez.com/2009/03/26/xml-config-no-more/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 19:33:56 +0000</pubDate>
		<dc:creator>Jose C Gomez</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Views]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[object oriented]]></category>
		<category><![CDATA[serialization]]></category>
		<category><![CDATA[wikipedia]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.josecgomez.com/?p=262</guid>
		<description><![CDATA[This may make me sound like I am antiquated and behind the times, and in this aspect you are probably right. Since I started messing with programming quite a few years ago, I&#8217;ve tried to make the programs I write as user friendly and as easy to maintain as possible. Recently I have adopted a few [...]]]></description>
			<content:encoded><![CDATA[<p>This may make me sound like I am antiquated and behind the times, and in this aspect you are probably right. Since I started messing with programming quite a few years ago, I&#8217;ve tried to make the programs I write as user friendly and as easy to maintain as possible. Recently I have adopted a few things I&#8217;ve picked up from others like making the methods in my programs accessible through web services when it has merit and things of the sort.</p>
<p>One of the things I have always done is provide extensive config files in XML format in order to alleviate having to modify the code when simple things change such as passwords, database names, host addresses etc. This has in my opinion always been a great venue to ensure maintainability and stability. But the big issue always was XML..</p>
<blockquote><p>XML (Extensible Markup Language) is a general-purpose specification for creating custom markup languages.[1] It is classified as an extensible language, because it allows the user to define the mark-up elements. XML&#8217;s purpose is to aid information systems in sharing structured data, especially via the Internet, [2] to encode documents, and to serialize data; in the last context, it compares with text-based serialization languages such as JSON, YAML and S-Expressions. [3] <br />
<a href="http://en.wikipedia.org/wiki/XML" target="_blank">more&#8230;</a></p>
</blockquote>
<p><br class="spacer_" />The problem I&#8217;ve always had with XML is parsing the file; although the support for it and the built in tools have improved greatly over the past few years it still requires considerable amount of code in order to gather the data in some languages (C#), and another considerable amount of code in order to update or change the data in the file. When I was learning Object Oriented programming a while back we were introduced to the concept of Serialization</p>
<blockquote><p>In computer science, in the context of data storage and transmission, serialization is the process of converting an object into a sequence of bits so that it can be stored on a storage medium (such as a file, or a memory buffer) or transmitted across a network connection link. When the resulting series of bits is reread according to the serialization format, it can be used to create a semantically identical clone of the original object. For many complex objects, such as those that make extensive use of references, this process is not straightforward.<br />
<a href="http://en.wikipedia.org/wiki/Serialization" target="_blank">more&#8230;</a></p>
</blockquote>
<p>But like the Wikipedia definition above says &#8220;this process is not straightforward&#8221;, you used to have to define Interfaces and formats and if your object had any kind of list or array in it, you couldn&#8217;t use it unless you wanted to spend a considerable amount of time making it work.</p>
<p>While I was working on the practice projects I grew to hate Serialization and had not used it since. Yesterday in a fit of rage, because my XML config file was being stubborn I stumbled across an implementation that used a Serialized object for storing configuration. I was baffled by the ease in which this was accomplished and I immediately implemented it. Now it its extremely easy to add and remove config parameters from my program and at the same time I don&#8217;t have to worry about someone deleting or changing the config file since it is stored in binary and gets re-created if deleted.</p>
<p>In order to serialize an object your class must be declared as <span style="font-size: x-small;">[</span><span style="font-size: x-small; color: #2b91af;">Serializable</span><span style="font-size: x-small;">] . After you have done this, the below example will take care of the serialization for you.</span></p>
<p><span style="font-size: x-small;"><span style="font-size: x-small; color: #008000;">//Serialize an Object<br />
</span><span style="font-size: x-small; color: #2b91af;">FileStream</span><span style="font-size: x-small;">fs = </span><span style="font-size: x-small; color: #0000ff;">new</span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #2b91af;">FileStream</span><span style="font-size: x-small;">(</span><span style="font-size: x-small; color: #a31515;">@&#8221;prog.conf&#8221;</span><span style="font-size: x-small;">, </span><span style="font-size: x-small; color: #2b91af;">FileMode</span><span style="font-size: x-small;">.Create); <span style="color: #008000;">//Create new File where the object will live</span><br />
</span><span style="font-size: x-small; color: #2b91af;">BinaryFormatter</span><span style="font-size: x-small;"> bf = </span><span style="font-size: x-small; color: #0000ff;">new</span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #2b91af;">BinaryFormatter</span><span style="font-size: x-small;">(); <span style="color: #008000;">//Create new BinaryFormatter to Serilize Object</span><br />
bf.Serialize(fs, YOUROBJECT); <span style="color: #008000;">//Serialize Object</span><br />
fs.Close(); <span style="color: #008000;">//Close File</span><br />
</span></span></p>
<p><span style="color: #008000;">//Deserialize<br />
</span><span style="color: #2b91af;">FileStream</span>fs = <span style="color: #0000ff;">new</span><span style="color: #2b91af;">FileStream</span>(<span style="color: #a31515;">@&#8221;prog.conf&#8221;</span>,<span style="font-size: x-small; color: #2b91af;">FileMode</span><span style="font-size: x-small;">.Open);  <span style="color: #008000;">//Open File Containing Serialized Object</span><br />
</span><span style="font-size: x-small;"><span style="color: #2b91af;">YOUROBJECT</span> obj = (<span style="color: #2b91af;">YOUROBJECT</span></span><span style="font-size: x-small;">) (</span><span style="font-size: x-small; color: #0000ff;">new</span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #2b91af;">BinaryFormatter</span><span style="font-size: x-small;">().Deserialize(fs));<br />
fs.Close(); <span style="color: #008000;">//Close File</span></span></p>
<p>Remember to include the System.IO and System.Runtime.Serialization.Formatters.Binary libraries.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.josecgomez.com/2009/03/26/xml-config-no-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

