<?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>Gary Devenay</title>
	<atom:link href="http://garydevenay.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://garydevenay.com</link>
	<description>Web Development</description>
	<lastBuildDate>Fri, 23 Oct 2009 18:23:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Spotiworld &#8211; The online spotify playlist portal</title>
		<link>http://garydevenay.com/spotiworld/</link>
		<comments>http://garydevenay.com/spotiworld/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 22:27:03 +0000</pubDate>
		<dc:creator>Gary Devenay</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Spotify]]></category>

		<guid isPermaLink="false">http://garydevenay.com/?p=95</guid>
		<description><![CDATA[This weekend I started modeling the database for my up and coming project. SpotiWorld.
SpotiWorld is an online spotify portal which allows a user to create a library of their playlists and share them with other users. Each playlist will have a rating and feedback can be provided.
In order to create this I have two options. [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend I started modeling the database for my up and coming project. SpotiWorld.</p>
<p>SpotiWorld is an online spotify portal which allows a user to create a library of their playlists and share them with other users. Each playlist will have a rating and feedback can be provided.</p>
<p>In order to create this I have two options. I can either implement a third party API (third party is needed as spotify have not yet released a C# API) or I can simplify the system down and depend on the user to enter a URL for the playlist and a Title.</p>
<p>At first glance, using the API will deffinently produce a much better and friendly system. Though I do not feel too much for using a third party&#8217;s API.</p>
<p>On the other hand using my own methods and incresingly building upon the system could be an easier more reasonable method until the community grows and a C# API is released.</p>
<p>I will try to keep updating with the progress of this project and get some feedback on features that you would like to see within SpotiWorld.    </p>
]]></content:encoded>
			<wfw:commentRss>http://garydevenay.com/spotiworld/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic Lambda Expressions Using ASP.NET 3.5 and C#</title>
		<link>http://garydevenay.com/basic-lambda-expressions-using-asp-net-3-5-and-c/</link>
		<comments>http://garydevenay.com/basic-lambda-expressions-using-asp-net-3-5-and-c/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 18:14:23 +0000</pubDate>
		<dc:creator>Gary Devenay</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Anonymous Methods]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Lambda Expressions]]></category>

		<guid isPermaLink="false">http://garydevenay.com/?p=83</guid>
		<description><![CDATA[One of many new features introduced into the .NET 3.5 framework are Lambda Expressions.
Lambda Expressions are a method of programmatically assigning Event Handlers to Events. There are a few ways that this can be acheived though Lambda Expressions prove to be the quickest, cleanest and most effective way of doing so.
Lambda Expressions are similar to [...]]]></description>
			<content:encoded><![CDATA[<p>One of many new features introduced into the .NET 3.5 framework are Lambda Expressions.</p>
<p>Lambda Expressions are a method of programmatically assigning Event Handlers to Events. There are a few ways that this can be acheived though Lambda Expressions prove to be the quickest, cleanest and most effective way of doing so.</p>
<p>Lambda Expressions are similar to anonymous methods only taken one step further. For instance if you had a button on your page and an event in your code behind which you wished to wire up programmatically using an anonymous method it would look similar to the following:</p>
<p><strong>Anonymous Method</strong></p>

<div class="wp_syntax"><div class="code"><pre class="langauge" style="font-family:monospace;">protected void Page_Init(object sender, EventArgs e)
{
	btnGo.Click += delegate(object sender, EventArgs e)
		         {
			lblDate.Text = DateTime.Now.ToString();
		         }
}</pre></div></div>

<p><span id="more-83"></span><br />
This is all very nice and tidy yes? But a Lambda Expression can make this ten times easier to write and look ten times more tidy.</p>
<p>This example does the exact same as our anonymous method example only using Lambda Expressions</p>
<p><strong>Lambda Expression</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="langauge" style="font-family:monospace;">protected void Page_Init(object sender, EventArgs e)
{
	btnGo.Click += (object sender, EventArgs e) =&gt; lblDate.Text = DateTime.Now.ToString();
}</pre></td></tr></table></div>

<p>If we break this statement down and explain each individual part it will become easier to understand</p>
<ul>
<li><strong>btnGo.Click</strong> &#8211; This is the Event that when takes place, the remaining statement will be executed.</li>
<li><strong>(object sender, EventArgs e) </strong>- This is the parameters of the EventHandler you are creating.</li>
<li><strong>=&gt;</strong> &#8211; This stands for &#8220;Goes Into&#8221; and is used to seperate a list of method parameters from the method itself.</li>
<li><strong>lblDate.Text</strong> &#8211; This is the label control of which we will amend the Text property.</li>
<li><strong>DateTime.Now.ToString()</strong> &#8211; This represents the current date in a string format.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://garydevenay.com/basic-lambda-expressions-using-asp-net-3-5-and-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Google Maps to get directions based on a postal code</title>
		<link>http://garydevenay.com/using-google-maps-to-get-directions-based-on-a-postal-code/</link>
		<comments>http://garydevenay.com/using-google-maps-to-get-directions-based-on-a-postal-code/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 18:10:41 +0000</pubDate>
		<dc:creator>Gary Devenay</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Directions System]]></category>
		<category><![CDATA[Google Maps]]></category>

		<guid isPermaLink="false">http://garydevenay.com/?p=25</guid>
		<description><![CDATA[Adding Google maps to your website to show where your business is located is becoming quite a popular feature of many websites. It enables the user to see where you are located and give them a vague idea on how to get to that location. Though wouldn’t it be nice if we could give specific [...]]]></description>
			<content:encoded><![CDATA[<p>Adding Google maps to your website to show where your business is located is becoming quite a popular feature of many websites. It enables the user to see where you are located and give them a vague idea on how to get to that location. Though wouldn’t it be nice if we could give specific directions depending on the viewer’s location?</p>
<p>In this article I will explain a basic technique that will allow you to create a customized directions system that will plug directly in to Google Maps to output directions based on a users address or postcode.</p>
<p>To start off, we need a Google Maps url to integrate into our system.</p>
<p><span id="more-25"></span></p>
<ol>
<li>In the Google Maps interface, search for your destination (Business address or postcode). For this example I am going to use Glasgow Central Station.</li>
<li>When your result is returned you should see the speech bubble appear above your destination. This contains various information such as the address and some options. From the list of options click &#8216;Get Directions&#8217;, this should bring up a textbox asking for your stating location.</li>
<li>Ensure that &#8216;To Here&#8217; is selected from the &#8216;Get Directions&#8217; options. In the &#8216;Start Address&#8217; box, insert &#8220;XXXXXX&#8221; (this is purely to make the address easy to locate within the query string that will be generated) and hit GO.</li>
<li>Now if we click the link button at the top right of the Google Maps window we are faced with two options. &#8220;Paste link in email or IM&#8221; and &#8220;Paste HTML to embed in website&#8221; copy the &#8220;Paste link in email or IM&#8221; to your clipboard and paste it into notepad or any other text editor.</li>
</ol>
<p>My url looks as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="langauge" style="font-family:monospace;">&lt;a href=&quot;http://maps.google.com/maps?daddr=Central+Station,+Glasgow,+Lanarkshire+G1,+UK&amp;geocode=CTL7KUd6bMgcFWBYVAMdcAa__w&amp;dirflg=&amp;saddr=XXXXXX&amp;f=d&amp;sll=55.859296,-4.258192&amp;sspn=0.008586,0.01929&amp;ie=UTF8&amp;z=11&quot;&gt;http://maps.google.com/maps?daddr=Central+Station,+Glasgow,+Lanarkshire+G1,+UK&amp;geocode=CTL7KUd6bMgcFWBYVAMdcAa__w&amp;dirflg=
&amp;saddr=XXXXXX&amp;f=d&amp;sll=55.859296,-4.258192&amp;sspn=0.008586,0.01929&amp;ie=UTF8&amp;z=11&lt;/a&gt;</pre></td></tr></table></div>

<p>As you can see I have &#8220;<strong>saddr=XXXXXX</strong>&#8221; included in the query string. saddr stands for Start Address and the XXXXXX is the physical address that you wish to start from.</p>
<p>We now need an ASP.NET project to include this code in. I have created a page that consists of a TextBox and a Button.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="langauge" style="font-family:monospace;">&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head runat=&quot;server&quot;&gt;
&lt;title&gt;&lt;/title&gt;
&lt;meta name=&quot;Description&quot; content=&quot;&quot; /&gt;
&lt;meta name=&quot;Keywords&quot; content=&quot;&quot; /&gt;&lt;/head&gt;
&lt;body&gt;
&nbsp;
&lt;asp:TextBox ID=&quot;txtAddress&quot; runat=&quot;server&quot; /&gt;
&lt;asp:Button ID=&quot;btnSubmit&quot; Text=&quot;Submit&quot; runat=&quot;server&quot; /&gt;
&nbsp;
&lt;/body&gt;
&lt;/html&gt;
&nbsp;
&lt;form id=&quot;form1&quot;&gt; &lt;/form&gt;</pre></td></tr></table></div>

<p>The aim of this page is to allow a user to insert a postcode or address into the textbox and when the button is clicked, they are redirected to Google Maps and the directions from the inserted address to your destination will be shown in the Google Maps interface. To allow this to happen we have to take the following steps after the button is clicked</p>
<p>1) Get the address from the value of the textbox (txtAddress)<br />
2) Insert the address into the query string that we collected on Google Maps<br />
3) Redirect the user to the URL that we have built up using the address and the Google Maps query string.</p>
<p>The code for this should look similar to the following</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="langauge" style="font-family:monospace;">protected void btnSubmit_Click(object sender, EventArgs e)
{
string address = txtAddress.Text;
string url = &quot;http://maps.google.com/maps?daddr=Central+Station,+Glasgow,+Lanarkshire+G1,+UK&amp;geocode=CTL7KUd6bMgcFWBYVAMdcAa__w&amp;dirflg=&amp;saddr&quot;&gt;http://maps.google.com/maps?daddr=Central+Station,+Glasgow,+Lanarkshire+G1,+UK&amp;geocode=
CTL7KUd6bMgcFWBYVAMdcAa__w&amp;dirflg=&amp;saddr=&quot; + address +
&quot;&amp;f=d&amp;sll=55.859296,-4.258192&amp;sspn=0.008586,0.01929&amp;ie=
UTF8&amp;z=11&quot;;
&nbsp;
Response.Redirect(url);
}</pre></td></tr></table></div>

<p>After this, don&#8217;t forget to link up your method to your button</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="langauge" style="font-family:monospace;">&lt;asp:Button ID=&quot;btnSubmit&quot; Text=&quot;Submit&quot; onClick=&quot;btnSubmit_Click&quot; runat=&quot;server&quot; /&gt;</pre></td></tr></table></div>

<p>Inspired by <a href="http://www.wduffy.co.uk" target="_blank">WDuffy</a></p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fgarydevenay.com%2fusing-google-maps-to-get-directions-based-on-a-postal-code%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fgarydevenay.com%2fusing-google-maps-to-get-directions-based-on-a-postal-code%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://garydevenay.com/using-google-maps-to-get-directions-based-on-a-postal-code/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Random Image User Control</title>
		<link>http://garydevenay.com/random-image-user-control/</link>
		<comments>http://garydevenay.com/random-image-user-control/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 16:16:27 +0000</pubDate>
		<dc:creator>Gary Devenay</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[User Control]]></category>

		<guid isPermaLink="false">http://garydevenay.com/?p=21</guid>
		<description><![CDATA[Displaying random images through JavaScript is becoming a bit &#8216;old hat&#8217;. If your are regularly updating your images and find yourself updating your JavaScript file each time, I don&#8217;t need to tell you that it gets a bit boring.
With ASP.NET using a custom user control can simply eliminate this problem. We can create a control [...]]]></description>
			<content:encoded><![CDATA[<p>Displaying random images through JavaScript is becoming a bit &#8216;old hat&#8217;. If your are regularly updating your images and find yourself updating your JavaScript file each time, I don&#8217;t need to tell you that it gets a bit boring.</p>
<p>With ASP.NET using a custom user control can simply eliminate this problem. We can create a control that will look into the images folder, select all of the images, find a random one and display it on an asp:image control.</p>
<p>The code for this is shown below:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">using System;
using System.IO;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
&nbsp;
Protected void Page_Load(object sender, EventArgs e)
{
    //Show the path to the folder which contains the files you wish to randomly select from
    string directory = &quot;/common/images/random/&quot;;
&nbsp;
    //Create a string array to contain the images
    string[] images = Directory.GetFiles(HttpContext.Current.Server.MapPath(directory));
&nbsp;
    //Check to see if any images exist and if so display a random one
    if (images.Length &gt; 0)
    {
        int rnd = new Random().Next(0, images.Length);
        imgRandom.ImageUrl = directory + Path.GetFileName{images[rnd]);
    }
}</pre></td></tr></table></div>

<p><span id="more-21"></span><br />
To display the random images, I have inserted an asp:Image on the control as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;%@ Page Language=&quot;C#&quot; MasterPageFile=&quot;~/web.master&quot; AutoEventWireup=&quot;true&quot; CodeFile=&quot;random.aspx.cs&quot; Inherits=&quot;random&quot; Title=&quot;Untitled Page&quot; %&gt;
&nbsp;
&lt;asp:Image ID=&quot;imgImage&quot; runat=&quot;server&quot; /&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://garydevenay.com/random-image-user-control/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Basics of ASP.NET linq C#</title>
		<link>http://garydevenay.com/basics-of-linq/</link>
		<comments>http://garydevenay.com/basics-of-linq/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 18:28:30 +0000</pubDate>
		<dc:creator>Gary Devenay</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[data access]]></category>
		<category><![CDATA[linq]]></category>

		<guid isPermaLink="false">http://garydevenay.com/?p=5</guid>
		<description><![CDATA[Until now data access has been a tedious task, creating data, entity and service layers grows old after the 400th time. Even when using NHibernate this task can chew up the majority of your development time.

In the .NET 3.5 framework Microsoft have developed a new form of data access, somthing that can free us from our masses of SQL and service layers. Linq.

Linq is a language that resembles SQL script to and immitates SQL script (so your thinking "then isn't it SQL?") but there is one major difference... It's written in C# (or VB if you choose)!]]></description>
			<content:encoded><![CDATA[<p>Until now data access has been a tedious task, creating data, entity and service layers grows old after the 400th time. Even when using NHibernate this task can chew up the majority of your development time.</p>
<p>In the .NET 3.5 framework Microsoft have developed a new form of data access, somthing that can free us from our masses of SQL and service layers. Linq.</p>
<p>Linq is a language that resembles SQL script to and immitates SQL script (so your thinking &#8220;then isn&#8217;t it SQL?&#8221;) but there is one major difference&#8230; It&#8217;s written in C# (or VB if you choose)!</p>
<p>By using linq you completely eleminate stored procedures and data layers and keep one little layer to keep your methods nice and tidy.</p>
<p><span id="more-5"></span></p>
<p>Not only can linq be used to access data in a database. It can be used to access XML, Datasets and anything that inherits the IEnumerable interface. Using the IEnumberable is the most basic way of using linq to manipulate data as shown below:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="langauge" style="font-family:monospace;">using System;
using System.Collection.Generic;
using System.Linq;
using System.Text;
&nbsp;
public static QueryOverStrings()
{
string[] list = {   &quot;Crysis&quot;, &quot;Call Of Duty: Modern Warefare&quot;, &quot;Halo 3&quot;, &quot;Sonic&quot;, &quot;Bioshock 2&quot; };
&nbsp;
var subset = from games in list
where games.Contains(&quot;C&quot;);
orderby games
select games;
&nbsp;
foreach (var  s in subset)
Response.Write(&quot;Item: {0}&quot;, s);
}
&nbsp;
public static Page_Load(object sender, EventArgs e)
{
QueryOverStrings();
}</pre></td></tr></table></div>

<p>This should return a list that looks like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="langauge" style="font-family:monospace;">Item: Crysis
Item: Call Of Duty: Modern Warefare
Item: Sonic
Item: Bioshock 2</pre></td></tr></table></div>

<p>The method above shows how a simple few lines of linq can select all items from within an array that cotains the letter &#8220;C&#8221;. This shows how simple data access can become by using linq.</p>
<p>Further will be posted on linq as my knowledge progresses.</p>
]]></content:encoded>
			<wfw:commentRss>http://garydevenay.com/basics-of-linq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
