<?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>2Paths &#187; newbies</title>
	<atom:link href="http://www.2paths.com/tag/newbies/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.2paths.com</link>
	<description>Custom Software Technical Architecture, Design and Development in Vancouver, BC, Canada</description>
	<lastBuildDate>Mon, 27 Sep 2010 01:15:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>C# features &#8211; LINQ primer</title>
		<link>http://www.2paths.com/2009/04/30/c-features-linq-primer/</link>
		<comments>http://www.2paths.com/2009/04/30/c-features-linq-primer/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 19:04:32 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[newbies]]></category>

		<guid isPermaLink="false">http://www.2paths.com/?p=939</guid>
		<description><![CDATA[Language INtegrated Query (LINQ) adds extensions to the .NET framework which provide a domain specific language for querying and transforming collections right within C# (or VB for that matter). It provides syntax similar to other 4GL querying languages such as SQL, HQL or even OQL.
Below is a simple test case showing how to do LINQ [...]]]></description>
			<content:encoded><![CDATA[<p>Language INtegrated Query (<a href="http://msdn.microsoft.com/en-ca/library/bb308959.aspx">LINQ</a>) adds extensions to the .NET framework which provide a domain specific language for querying and transforming collections right within C# (or VB for that matter). It provides syntax similar to other 4GL querying languages such as SQL, HQL or even OQL.</p>
<p>Below is a simple test case showing how to do LINQ operations on a simple array:</p>
<pre class="brush: csharp">
        public void LinqArrayTest()
        {
            String[] names = { &quot;Burke&quot;, &quot;Connor&quot;, &quot;Frank&quot;,
                   &quot;Everett&quot;, &quot;Albert&quot;, &quot;George&quot;,
                   &quot;Harris&quot;, &quot;David&quot; };

            IEnumerable&lt;string&gt; query = from s in names
                               where s.Length == 5
                               orderby s
                               select s;

            List&lt;String&gt; results = query.ToList();

            Assert.AreEqual(3, results.Count);
            String[] expected = new String[] {&quot;Burke&quot;, &quot;David&quot;, &quot;Frank&quot;};
            for (int i = 0; i &lt; results.Count; i++)
            {
                Assert.AreEqual(expected[i], results.ElementAt(i));
            }
        }
</pre>
<p>It is also possible to create runtime LINQ queries using lambda expressions to qualify conditional logic:</p>
<pre class="brush: csharp">
        [TestMethod()]
        public void LinqLambdaTest()
        {
            String[] items = { &quot;cabbage&quot;, &quot;broccoli&quot;, &quot;carrot&quot;, &quot;parsnip&quot;, &quot;cauliflower&quot; };

            IEnumerable&lt;String&gt; query = items;

            // additive query generation using lambda expressions
            query = query.Where(item =&gt; item.StartsWith(&quot;c&quot;));
            query = query.Where(item =&gt; item.Length &lt; 8);
            query = query.OrderByDescending(item =&gt; item.ToLower());

            List&lt;String&gt; results = query.ToList();

            Assert.AreEqual(2, results.Count);
            String[] expected = { &quot;carrot&quot;, &quot;cabbage&quot; };
            for (int i = 0; i &lt; results.Count; i++)
            {
                Assert.AreEqual(expected[i], results.ElementAt(i));
            }
        }
</pre>
<p>LINQ provides a simple, generalised query framework for operating on data collections within the .NET stack. There are framework plugins to support LINQ backed by various datastore technologies, these include: <a href="http://msdn.microsoft.com/en-us/library/bb425822.aspx">LINQ to SQL</a>, <a href="http://msdn.microsoft.com/en-us/library/bb387098.aspx">LINQ to XML</a> and <a href="http://msdn.microsoft.com/en-us/library/bb386964.aspx">LINQ to Entities</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.2paths.com/2009/04/30/c-features-linq-primer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C# features &#8211; question mark syntax</title>
		<link>http://www.2paths.com/2009/04/28/c-features-question-mark-syntax/</link>
		<comments>http://www.2paths.com/2009/04/28/c-features-question-mark-syntax/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 18:27:34 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[newbies]]></category>

		<guid isPermaLink="false">http://www.2paths.com/?p=919</guid>
		<description><![CDATA[Some recent project work in C# unearthed a few grains of syntactic sugar which I thought deserved a quick post. Not necessarily because they are ground breaking discoveries, but more because I found it difficult to find information via the usual channels (google) and wanted to share. I think the poor information discovery is a [...]]]></description>
			<content:encoded><![CDATA[<p>Some recent project work in C# unearthed a few grains of syntactic sugar which I thought deserved a quick post. Not necessarily because they are ground breaking discoveries, but more because I found it difficult to find information via the usual channels (google) and wanted to share. I think the poor information discovery is a result of said features being based on the question mark which is not an easy symbol to use for searches online.</p>
<h3>Single Question Mark &#8211; nullable types</h3>
<p>The single question mark syntax is somewhat obscure. Essentially it is short hand syntax for marking primitives as nullable. <code>System.Nullable</code> is a generic struct that is essentially a <a href="http://msdn.microsoft.com/en-us/library/1t3y8s4s(VS.80).aspx">wrapper to signify nullability</a>. This can be used as shown below:</p>
<pre class="brush: java">
// a nullable type for int
int? thing = 12;

// is syntactically equivalent to
System.Nullable&lt;int&gt; otherThing = 12;

// can be any valid int value OR null
thing = -12;
thing = null;

// usage
//y is set to zero
int y = thing.GetValueOrDefault();
// but this will throw an exception as thing.HasValue == false
y = thing.Value;
</pre>
<h3>Double Question Mark &#8211; non null assignment precedence</h3>
<p>This one is a little obscure but can be quite handy, it is very similar to certain assignment constructs in Perl as it allows one to use precedence to assign a variable from other potential variables and is a nice way to deal with default values.</p>
<pre class="brush: java">
String thing = null;
String defaultThing = &quot;nothing&quot;;

// standard trinary syntax
String otherThing = (thing != null) ? thing : defaultThing;

// syntactic sugar for the above
String sugaredThing = thing ?? defaultThing;

// can also chain things
otherThing = null;

// the first non-null value is the result of the assignment
String anotherThing = thing ?? otherThing ?? defaultThing;

// if all potentials are null, then the assignement is null)
anotherThing = thing ?? otherThing;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.2paths.com/2009/04/28/c-features-question-mark-syntax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Persistence</title>
		<link>http://www.2paths.com/2008/04/11/persistence/</link>
		<comments>http://www.2paths.com/2008/04/11/persistence/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 00:24:34 +0000</pubDate>
		<dc:creator>Lorill</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[newbies]]></category>

		<guid isPermaLink="false">http://blog.2paths.com/persistence.html</guid>
		<description><![CDATA[Any developers working on projects involving databases will need to be aware of persistence strategies, and take these into consideration at design time. Persistence strategies are tailored to specific projects depending on a variety of circumstances such as if they are read-only or read/write, how important the timeliness of data is within the application, and [...]]]></description>
			<content:encoded><![CDATA[<p>Any developers working on projects involving databases will need to be aware of persistence strategies, and take these into consideration at design time. Persistence strategies are tailored to specific projects depending on a variety of circumstances such as if they are read-only or read/write, how important the timeliness of data is within the application, and how likely it is for data-collisions, etc. If coupled units of work involve writes to various tables, the units of work will need to be wrapped in transactions to avoid data corruption, and have proper rollback strategies in place. Optimistic or pessimistic locking strategies need to be put in place where there are possibilities of data collisions.  Appropriate isolation levels need to be associated with the transactions.</p>
<p>These concepts are all database-agnostic, but there are specific tools for use with Java, Hibernate, and Spring to assist in persistence strategy integration. For more information, see the wiki here:<br />
<a href="https://dev.2paths.com/wiki/display/2pathsTECH/Persistence"></p>
<p>https://dev.2paths.com/wiki/display/2pathsTECH/Persistence</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.2paths.com/2008/04/11/persistence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

