<?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>Buddy Lindsey &#187; Programming</title>
	<atom:link href="http://buddylindsey.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://buddylindsey.com</link>
	<description>because reading textbooks gets boring</description>
	<lastBuildDate>Mon, 30 Aug 2010 01:34:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Store Azure Connection Information in Web.Config ConnectionString</title>
		<link>http://buddylindsey.com/store-azure-connection-information-in-web-config-connectionstring/</link>
		<comments>http://buddylindsey.com/store-azure-connection-information-in-web-config-connectionstring/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 19:18:05 +0000</pubDate>
		<dc:creator>Buddy Lindsey</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[BLOB]]></category>

		<guid isPermaLink="false">http://buddylindsey.com/?p=353</guid>
		<description><![CDATA[Working with most data storage technologies requires us to connect to some other source be it a database, or in the last few years, some sort of cloud based storage. As I was working through my latest project I decided to give Azure storage a shot for all of my images, and it was a [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>
Working with most data storage technologies requires us to connect to some other source be it a database, or in the last few years, some sort of cloud based storage. As I was working through my latest project I decided to give Azure storage a shot for all of my images, and it was a quite a fun experience. However, most concerning was having to have a magic string inside my code somewhere. Here is how I solved the problem, but using the web.config connection string, it is super simple.
</p>
<p>
We are going to be using blob storage example for this case, but I am sure it will work for tables and queues. I will have to say that I haven&#8217;t worked with tables or queues yet so I am not sure how their connection string looks.
</p>
<p>
First, we need to set a connection string in the web.config file. It is just like a connection string for anything else and since it is all based on strings, in the web.config, it is simple for Azure connection information too.
</p>
<pre class="brush: xml;">
&lt;add name=&quot;AzureBlob&quot; connectionString=&quot;DefaultEndpointsProtocol=http;AccountName=someAccountName;AccountKey=accountKeyGoesHere&quot; /&gt;
</pre>
<p>
Lets look at the BLOB connection string here is an example.
</p>
<p>
DefaultEndpointsProtocol=http;AccountName=someName;AccountKey=accountKeyHere
</p>
<p><strong>Notice there are 3 parts</strong></p>
<ul>
<li><strong>DefaultEndpointsProtocol</strong> &#8211; this is the protocol to use <em>http</em> or <em>https</em> to make the connection</li>
<li><strong>AccountName</strong> &#8211; you set this for your specific account you wish to access that you created</li>
<li><strong>AccountKey</strong> &#8211; this is a really long key that is generated for you that acts like a password</li>
</ul>
<p>
Here is a piece of code that I use to get my container from my BLOB storage account.
</p>
<pre class="brush: csharp;">
private CloudBlobContainer GetContainer()
{
    return CloudStorageAccount
        .Parse(this.connString)
        .CreateCloudBlobClient()
        .GetContainerReference(containter);
}
</pre>
<p>
The key to this piece of code is the <em>Parse()</em> method. Using that method you can pass in a connection string and use that to connect if you connecting to azure outside of a webrole or a workerrole. If you are using a webrole or workerrole you will probably be running it inside an Azure project which comes with its own configuration information. If you are using the Azure configuration you can use the <em>FromConfigurationSetting()</em> method instead of <em>Parse()</em>, which is much more convenient.
</p>
<p>
I set out to figure this particular thing out because all I could seem to find were examples using the <em>FromConfigurationSetting()</em> method, but I wasn&#8217;t using an Azure project so I need a way to go outside of Azure. Most example code I saw was like this:
</p>
<pre class="brush: csharp;">
var storageAccount = CloudStorageAccount.FromConfigurationSetting(&quot;DataConnectionString&quot;);
</pre>
<p>
I actually setup a custom class since the images are only a small part of my project, so here is a little bit of it as an example
</p>
<pre class="brush: csharp;">
public class AzureHelper
{
    private string connString;
    private string containter;

    public AzureHelper(string connectionString, string con)
    {
        this.connString = connectionString;
        this.containter = con;
    }

    private CloudBlobContainer GetContainer()
    {
        return CloudStorageAccount
            .Parse(this.connString)
            .CreateCloudBlobClient()
            .GetContainerReference(containter);
    }
}
</pre>
<p>If you know of any other good ways to do this please let me know.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li>No Related Posts</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buddylindsey.com/store-azure-connection-information-in-web-config-connectionstring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Planning a WordPress Plugin</title>
		<link>http://buddylindsey.com/planning-a-wordpress-plugin/</link>
		<comments>http://buddylindsey.com/planning-a-wordpress-plugin/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 22:00:44 +0000</pubDate>
		<dc:creator>Buddy Lindsey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[series]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://buddylindsey.com/?p=334</guid>
		<description><![CDATA[This isn&#8217;t going to be your normal wordpress plugin tutorial series. We are actually going to build a useful wordpress plugin most bloggers probably would need. Especially bloggers who program. Some of the most common reasons people build plugins are: WordPress functionality Doesn&#8217;t exist Plugin doesn&#8217;t exist Don&#8217;t like how existing plugin works Unable to [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img class="alignright" title="Wordpress Logo" src="http://s.wordpress.org/about/images/logo-grey/grey-l.png" alt="Wordpress Logo" width="150" height="150" /></p>
<p>This isn&#8217;t going to be your normal wordpress plugin tutorial series. We are actually going to build a useful wordpress plugin most bloggers probably would need. Especially bloggers who program.</p>
<p>Some of the most common reasons people build plugins are:</p>
<ul>
<li>WordPress functionality Doesn&#8217;t exist</li>
<li>Plugin doesn&#8217;t exist</li>
<li>Don&#8217;t like how existing plugin works</li>
<li>Unable to find the plugin you need</li>
<li>Want to create it yourself for experience</li>
</ul>
<p>For this plugin it falls into, probably, most of those above.</p>
<h2>What is the Plugin</h2>
<p>By now you probably want to know what the plug-in is going to be. I&#8217;ll quote the concept so its better to understand it.</p>
<blockquote><p>This is a plugin to allow you to manage your list of posts in the series you are writing. Instead of managing the list at the top of all your posts you can add a simple line to your page to manage it in the admin section of your site in one spot. So it is a table of contents for series.</p></blockquote>
<p>The great thing about this plugin is it is simple enough to do a series on, but touches a lot of what other plugins do so you get a good feeling of how to do many different parts writing a plugin. Now we have what the plugin is for and will do, lets look at the steps. I like to do this by stepping through workflow of how you would work with this plugin, so we only get what we need.</p>
<h2>Workflow of Using the Plugin</h2>
<p>This is the workflow I would probably use if I had this plug-in.</p>
<ol>
<li>Make a post</li>
<li>Make second post</li>
<li>Get links to both posts</li>
<li>Open the plugin admin panel in the admin section of wordpress</li>
<li>Create new ID for the series ex: 1, 2, 3</li>
<li>Make an easy to remember title for the series</li>
<li>Add Links to the posts in a text field</li>
<li>Save it</li>
<li>Add string to top of the two posts with the id of the Table of Contents ex: [toc=2]</li>
<li>Update the posts</li>
<li>View the post to confirm it is there</li>
<li>Make another post and add the string to the top</li>
<li>Go back to admin panel for plugin</li>
<li>Choose the title we created earlier for that series</li>
<li>Add link to the existing ones</li>
<li>Save updates</li>
<li>Confirm it all worked by opening up the post</li>
</ol>
<p>That is probably the longest way to use this plugin, but probably the best way to figure out what is needed by figuring out the robust usage. These steps make sure you walk through your the usage instead of just thinking you know what is needed. Now lets figure out what needs to be coded up.</p>
<h2>What to code</h2>
<ul>
<li>Add Link to the Admin Panel in Settings section of admin panel</li>
<li>Create page for editing settings and adding new table of contents
<ul>
<li>have a list of existing TOC listed by title with an edit button and id number</li>
<li>have text field for &#8220;title&#8221;, &#8220;ID&#8221;, and &#8220;all the links&#8221;</li>
<li>have save button for new entries and updates</li>
</ul>
</li>
<li>Every time the post is displayed it reads the code with the ID, and injects the links in</li>
<li>On display options where it only shows summaries the TOC doesn&#8217;t show up</li>
</ul>
<p>Those are essentially all the elements we have to code up. Though, doing it might be a bit more complicated than listed. As mentioned before this series will cover a lot of topics; below are some of the topics we are going to cover in this series.</p>
<h2>Topics</h2>
<p>There are several of topics with doing a wordpress plugin here is a list of the bigger ones we will discuss</p>
<ul>
<li>The Loop</li>
<li>Creating Admin Section</li>
<li>Getting Plugin to Show-up in Plugin section</li>
<li>WordPress Database Access</li>
<li>Plugin Hooks</li>
<li>Plus more&#8230;</li>
</ul>
<h2>Conclusion</h2>
<p>This hopefully is a good overview of what we are going to be doing in this series. Obviously once the plugin is done it is going to have an immediate benefit of using it on this series.</p>
<p>This is a good starting place for this plugin. In the course of writing this I have thought of many additional features which can be added to make life a whole lot easier and this plugin better. However, it would tack on a lot of extra posts, and would detract with the concept of this series; which is to hit many of the topics other plugins use without writing HUGE complex plugins.</p>
<p>I hope you enjoy this and any feedback is welcome and encouraged.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://buddylindsey.com/ionics-isapi-rewrite-module-with-code-igniter/' title='Ionics ISAPI Rewrite module with Code Igniter'>Ionics ISAPI Rewrite module with Code Igniter</a></li>
<li><a href='http://buddylindsey.com/php-and-tdd-environment/' title='PHP and TDD Environment'>PHP and TDD Environment</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buddylindsey.com/planning-a-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Agree and Disagree with Hearding Code Podcast</title>
		<link>http://buddylindsey.com/agree-and-disagree-with-hearding-code-podcast/</link>
		<comments>http://buddylindsey.com/agree-and-disagree-with-hearding-code-podcast/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 00:32:29 +0000</pubDate>
		<dc:creator>Buddy Lindsey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[development concepts]]></category>
		<category><![CDATA[opinion]]></category>
		<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://buddylindsey.com/blog/?p=13</guid>
		<description><![CDATA[Was looking at the lazycoder blog and saw a post on Herding Code podcast, sounding cool, I saw he posted on a &#8220;Back to the Basics&#8221; episode. I just want to be clear as I start this. I am a beginnermediate (not quite a beginner, but definitely not an intermediate developer) developer. I look and [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Was looking at the <a href="http://www.lazycoder.com/">lazycoder</a> blog and saw a post on <a href="http://herdingcode.com/" title="Herding Code">Herding Code podcast</a>, sounding cool, I saw <a href="http://www.lazycoder.com/weblog/2008/08/15/herding-code-13-back-to-basicsbut-which-ones/">he posted</a> on a &#8220;<a href="http://herdingcode.com/?p=33" title="Hearding Code - Back to the Basics">Back to the Basics</a>&#8221; episode. I just want to be clear as I start this. I am a beginnermediate (not quite a beginner, but definitely not an intermediate developer) developer. I look and listen in my world at that level and base my conclusions on my skill level. The purpose of this post is to show a bit of the discrepancy between what an advanced developer would consider basics and what a beginner would consider basics. I do agree these are all basics, but I believe there are levels to them that should be clarified.</p>
<p>Below, I have categorized things the podcast hit on as basics.&nbsp; I tried my best to put it in a linear fashion as what you should learn first to last.&nbsp; I have also included a short opinion on each of these. </p>
<p><font size="4"><strong>Beginner</strong></font></p>
<p><em><font size="2">Memory Management</font></em></p>
<blockquote><p>
This is defintely something a beginner _needs_ to know.&nbsp; Not necessarily every part, but have a good idea of what is going on.
</p></blockquote>
<p><font size="2"><em>References (pointers)</em></font></p>
<blockquote><p>
This I agree is another thing to learn so you get a better idea of what is going with Memory Management.
</p></blockquote>
<p><em><font size="2">Requirements</font></em></p>
<blockquote><p>
Here is the gold of what a beginner needs to learn.&nbsp; If you don&#39;t know the requirements or can&#39;t translate those requirements to code then you will most likely fail as a developer.
</p></blockquote>
<p><font size="4"><strong>Beginnermediate</strong></font></p>
<p><em><font size="2">Floating Point Math</font></em></p>
<blockquote><p>
This is one thing that should be learned and is important, but not quite as important as not knowing the above. This tends to be an extensive thing to figure out and to really grok so I put it in the beginnermediate area once you know the beginner level and the general basics of developing like: if, then, for, variables and the like.
</p></blockquote>
<p><font size="2"><em>OOP</em></font></p>
<blockquote><p>
This is one thing that is a basic to learn. However, it is HARD to learn for the real world. I learned OOP in a college class in one semester no problem. It has taken me well over a year to translate, effectively, that knowledge into real world applications, that aren&#8217;t games. This is a big must, but can be put on hold to learn whats above first.
</p></blockquote>
<p><em>Source Control</em></p>
<blockquote><p>
To me this is kind of a debateable topic as when to learn.&nbsp; I think before you move to intermediate level programming level you should learn the basics of source control because it is at this point that you are going to be writing more sophisticated programs that are going to need Source Control.
</p></blockquote>
<p><font size="4"><strong>Intermediate</strong></font> </p>
<p><font size="2"><em>Data Structures</em></font></p>
<blockquote><p>
Data Structures being an intermediate skill to learn is kind of misnomer. I think you should learn 2 to 3 basic data structures like an array or in .net generic List<>. Just something to get you by then later once you understand more and more go back and really learn other data structures. I believe this really would work out well because then you have probably coded quite a bit and will learn the data structures quicker and really know when and where to use them.
</p></blockquote>
<p><font size="2"><em>Design Patterns</em></font></p>
<blockquote><p>
This is most definitely an intermediate skill to learn. Design patterns are important to writing smooth pretty and effective software, but until you learn OOP really well or a few other things you are stuck in the land of &#8220;please just work&#8221;. Understanding and using design patterns from what I have seen just takes time and writing quite a bit of code before they make sense. I saw this because I have yet to be able to use them effectively and really understand when and where.
</p></blockquote>
<p><em><font size="2">Dependency Injection</font></em></p>
<blockquote><p>
I put this in intermediate because I still don&#8217;t know what it is and everytime I ask I just get confused which means it is something beyond my skill level so I am defaulting it to the top of the list. Because of the not understanding problem I personally don&#8217;t think this is a basic, but I will listen to those more experienced than me and consider it a basic.
</p></blockquote>
<p><strong><font size="5">Concolusion</font></strong></p>
<p>I guess I mostly wanted to do this post to kind of come up with a way to organize what and when to learn the basics. From reading and research ALL of the above basics are things that are used daily and very important to know, but not all of it is easy and can be learned quickly so it is good to break it down. I really loved this podcast episode because it is honestly not often I get to hear pro&#8217;s talk about the basics. The basics are something I strive to help people understand because it isn&#8217;t taught a lot online usually and _most_ of the time not well.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://buddylindsey.com/use-examples-in-your-applications/' title='Use Examples in your Applications'>Use Examples in your Applications</a></li>
<li><a href='http://buddylindsey.com/bdd-story-chat-what-is-bdd/' title='BDD story chat &#8211; What is BDD?'>BDD story chat &#8211; What is BDD?</a></li>
<li><a href='http://buddylindsey.com/tdd-for-beginners-pt4-unit-tests/' title='TDD for Beginners pt4 &#8211; Unit Tests'>TDD for Beginners pt4 &#8211; Unit Tests</a></li>
<li><a href='http://buddylindsey.com/tdd-for-beginners-pt3-the-application/' title='TDD for Beginners pt3 &#8211; The Application'>TDD for Beginners pt3 &#8211; The Application</a></li>
<li><a href='http://buddylindsey.com/ci/' title='CI'>CI</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buddylindsey.com/agree-and-disagree-with-hearding-code-podcast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Can Browse a Network Share</title>
		<link>http://buddylindsey.com/powershell-can-browse-a-network-share/</link>
		<comments>http://buddylindsey.com/powershell-can-browse-a-network-share/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 00:54:39 +0000</pubDate>
		<dc:creator>Buddy Lindsey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://buddylindsey.com/blog/?p=26</guid>
		<description><![CDATA[If you follow me on twitter then you probably know that I like Anime. If you don&#8217;t follow me, you should, then to let you know. I like Anime. Recently, a friend in #alt.net channel on freenode. Was helping me with a script to do some specific renaming to strip out extra crap from anime [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>If you follow me on <a href="http://twitter.com/">twitter</a> then you probably know that I like <a href="http://en.wikipedia.org/wiki/Anime">Anime</a>. If you don&#8217;t follow me, <a href="http://twitter.com/BuddyLindsey">you should</a>, then to let you know. I like <a href="http://en.wikipedia.org/wiki/Anime">Anime</a>. Recently, a friend in <a href="irc://irc.freenode.net/#alt.net">#alt.net</a> channel on <a href="http://www.freenode.net">freenode</a>. Was helping me with a script to do some specific renaming to strip out extra crap from <a href="http://en.wikipedia.org/wiki/Anime">anime</a> I download.</p>
<p>Anyway, I have a network share on my <a href="http://en.wikipedia.org/wiki/Anime">anime</a> folder so I can access it from anywhere on my network and watch. Well last night without thinking I just opened up <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">PowerShell</a> <a href="http://en.wikipedia.org/wiki/Cd_%28command%29">CD&#8217;d</a> to the network share and ran the script, since I have full control set on the share. After the shows were renamed I closed it and went about finishing <a href="http://en.wikipedia.org/wiki/Bamboo_blade" title="Bamboo Blade">Bamboo Blade</a>.</p>
<p>Later I realized I browsed a <a href="http://en.wikipedia.org/wiki/Network_share">network share</a> in <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">PowerShell</a>. That is SOOOOO freaking cool that you can do that.&nbsp; Here is an image proving it:</p>
<p><a href="/wp-content/uploads/WindowsLiveWriter/PowerShellCanBrowseaNetworkShare_1092D/powershellNetworkShare.jpg"><img style="border-width: 0px" src="/wp-content/uploads/WindowsLiveWriter/PowerShellCanBrowseaNetworkShare_1092D/powershellNetworkShare_thumb.jpg" border="0" alt="powershellNetworkShare" width="627" height="215" /></a> </p>
<p>Basically, I am starting in my &#8220;<a href="http://en.wikipedia.org/wiki/My_Documents">My Documents</a>&#8221; folder on my computer and <a href="http://en.wikipedia.org/wiki/Cd_%28command%29">CD&#8217;ing</a> to the <a href="http://en.wikipedia.org/wiki/Remote_computer">remote computer</a> and it works. Then I do a <a href="http://en.wikipedia.org/wiki/Pwd">pwd</a> for the path, and viola it works.</p>
<p>This is cool to me and might allow some cool scripts to be run for copying local files to remote servers with a simple click.</p>
<p>When I get the script a little more refined I&#8217;ll go ahead and post it up with a blog post.</p>
<p>Here is a silverlight video of it in action.</p>
<p><em>Update: unfortuneatly in server move I lost the video. <img src='http://buddylindsey.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  sorry.</em><br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://buddylindsey.com/powershell-hello-world-script/' title='PowerShell Hello World Script'>PowerShell Hello World Script</a></li>
<li><a href='http://buddylindsey.com/change-pirate-4x4-colors-with-greasemonkey/' title='Change Pirate 4&#215;4 Colors with Greasemonkey'>Change Pirate 4&#215;4 Colors with Greasemonkey</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buddylindsey.com/powershell-can-browse-a-network-share/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Email Account Activation with ASP.NET Membership part 1</title>
		<link>http://buddylindsey.com/email-account-activation-with-asp-net-membership-part-1/</link>
		<comments>http://buddylindsey.com/email-account-activation-with-asp-net-membership-part-1/#comments</comments>
		<pubDate>Sat, 22 Mar 2008 01:02:10 +0000</pubDate>
		<dc:creator>Buddy Lindsey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://buddylindsey.com/blog/?p=30</guid>
		<description><![CDATA[This is something that a lot of sites have to verify that the user&#8217;s e-mail is valid and seems like it would be complex, but there is a very easy way to do it.&#160; This is going to be a 2 part series, maybe a 3rd still thinking about it.&#160; First, I will give you [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>This is something that a lot of sites have to verify that the user&#8217;s e-mail is valid and seems like it would be complex, but there is a very easy way to do it.&nbsp; This is going to be a 2 part series, maybe a 3rd still thinking about it.&nbsp; First, I will give you the resources to learn about and setup the asp.net membership system and explain the concept of how we are going to activate the account.&nbsp; Part 2 will be a re-explanation along with code.</p>
<h3>Membership System</h3>
<p>I wanted to actually explain all the steps to doing the membership system setup, but I just can&#8217;t beat <a title="4 Guys From Rolla" href="http://4guysfromrolla.com/">4guysfromrolla.com</a>. Here are the links to there multi-part series on most everything about the membership system.&nbsp; I use it every time I need to get started with the membership system.</p>
<blockquote><p><b>Examining ASP.NET 2.0&#8242;s Membership, Roles, and Profile</b>:</p>
<li><a href="http://aspnet.4guysfromrolla.com/articles/120705-1.aspx">Part 1</a> &#8211; learn about how the membership features make providing user accounts on your website a breeze. This article covers the basics of membership, including why it is needed, along with a look at the <code>SqlMembershipProvider</code> and the security Web controls.
<li><a href="http://aspnet.4guysfromrolla.com/articles/121405-1.aspx">Part 2</a> &#8211; master how to create roles and assign users to roles. This article shows how to setup roles, using role-based authorization, and displaying output on a page depending upon the visitor&#8217;s roles.
<li><a href="http://aspnet.4guysfromrolla.com/articles/040506-1.aspx">Part 3</a> &#8211; see how to add the membership-related schemas to an existing database using the ASP.NET SQL Server Registration Tool (<code>aspnet_regsql.exe</code>).
<li><a href="http://aspnet.4guysfromrolla.com/articles/050306-1.aspx">Part 4</a> &#8211; improve the login experience by showing more informative messages for users who log on with invalid credentials; also, see how to keep a log of invalid login attempts.
<li><a href="http://aspnet.4guysfromrolla.com/articles/060706-1.aspx">Part 5</a> &#8211; learn how to customize the Login control. Adjust its appearance using properties and templates; customize the authentication logic to include a <a href="http://en.wikipedia.org/wiki/Captcha">CAPTCHA</a>.
<li><a href="http://aspnet.4guysfromrolla.com/articles/101106-1.aspx">Part 6</a> &#8211; capture additional user-specific information using the Profile system. Learn about the built-in <code>SqlProfileProvider</code>.
<li><a href="http://aspnet.4guysfromrolla.com/articles/101806-1.aspx">Part 7</a> &#8211; the Membership, Roles, and Profile systems are all build using the <a href="http://aspnet.4guysfromrolla.com/articles/101905-1.aspx">provider model</a>, which allows for their implementations to be highly customized. Learn how to create a custom Profile provider that persists user-specific settings to XML files.
<li><a href="http://aspnet.4guysfromrolla.com/articles/010307-1.aspx">Part 8</a> &#8211; learn how to use the Microsoft Access-based providers for the Membership, Roles, and Profile systems. With these providers, you can use an Access database instead of SQL Server.
<li><a href="http://aspnet.4guysfromrolla.com/articles/091207-1.aspx">Part 9</a> &#8211; when working with Membership, you have the option of using .NET&#8217;s APIs or working directly with the specified provider. This article examines the pros and cons of both approaches and examines the SqlMembershipProvider in more detail.</li>
</blockquote>
<h3>Email Activation Concept</h3>
<p>The overall concept is fairly simple.&nbsp; You register then receive an e-mail that you have registered along with an activation URL.&nbsp; When you click on the URL it goes to the site and activates your account proving that you are real and there is a real e-mail address.</p>
<p>The easiest way to do this is the following.</p>
<ol>
<li>User Registers</li>
<li>Once registration guid is created</li>
<li>guid is put into a table associated with a username</li>
<li>E-Mail is sent to user with a url based on the GUID something like ( http://example.com/Activate.aspx?key=1234-1234-1234 )</li>
<li>User Opens Email and click link</li>
<li>Person comes to activation page</li>
<li>Activation page reads querystring and associates the string with guid in db.&nbsp; If a match executes code to &#8220;approve&#8221; account for use</li>
<li>User can login.</li>
</ol>
<p>There are a few key things:</p>
<ol>
<li>You need an association table.&nbsp; Something that will hold the guid and username for later verification. </li>
<li>Create the GUID and get username _after_ account has been created and commit to above table. </li>
<li>Build the activation URL and Send the e-mail</li>
<li>On the activation page read the query string and find association in association table and retrieve the username if association exists between username and guid.</li>
<li>if a username is returned call the membership api and activate the account.</li>
</ol>
<p>Remember though that when building the site be sure to set the property where when the user registers the account is not automatically approved.</p>
<h3></h3>
<h3></h3>
<h3>Conclusion</h3>
<p>This is a very useful and needed feature in some respects and highly used.&nbsp; The concept is fairly simple and with the membership system it continues to stay fairly simple.&nbsp; Please feel free to try this on your own and report back any issues you came across and how you overcame them.&nbsp; </p>
<p>I will post part to in a couple of days.&nbsp; I am hoping on Sunday as a present to you all on my Birthday though we will see how that turns out.</p>
<p>&nbsp;</p>
<p>Happy Coding</p>
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://buddylindsey.com/week-1-on-ror-it-is-like-asp-net/' title='Week 1 on RoR: It is like ASP.NET'>Week 1 on RoR: It is like ASP.NET</a></li>
<li><a href='http://buddylindsey.com/tulsa-tech-fest-2008-moving-from-code-behind-to-multilayerd-architecture-with-oop/' title='Tulsa Tech Fest 2008 &#8220;Moving from Code Behind to Multilayerd Architecture with OOP&#8221;'>Tulsa Tech Fest 2008 &#8220;Moving from Code Behind to Multilayerd Architecture with OOP&#8221;</a></li>
<li><a href='http://buddylindsey.com/web-config-basics-pt-1/' title='Web.Config Basics pt 1'>Web.Config Basics pt 1</a></li>
<li><a href='http://buddylindsey.com/eval-in-datalist-datagrid-and-repeater/' title='Eval in DataList, DataGrid, and Repeater'>Eval in DataList, DataGrid, and Repeater</a></li>
<li><a href='http://buddylindsey.com/quick-note-about-master-pages/' title='Quick note about Master Pages'>Quick note about Master Pages</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buddylindsey.com/email-account-activation-with-asp-net-membership-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BDD story chat &#8211; What is BDD?</title>
		<link>http://buddylindsey.com/bdd-story-chat-what-is-bdd/</link>
		<comments>http://buddylindsey.com/bdd-story-chat-what-is-bdd/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 01:05:48 +0000</pubDate>
		<dc:creator>Buddy Lindsey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Agile Development]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[development concepts]]></category>

		<guid isPermaLink="false">http://buddylindsey.com/blog/?p=34</guid>
		<description><![CDATA[At work me and a friend are about to start a new project and since both of us like agile methodologies we are wanting use our project as a test case.&#160; Joseph knows more about agile than I do; so he is kind of my coach on it.&#160; One of the things we are planning [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>
At work me and a friend are about to start a new project and since both of us like agile methodologies we are wanting use our project as a test case.&nbsp; <a href="http://wp.josephholsten.com/" title="Joseph Holsten">Joseph</a> knows more about agile than I do; so he is kind of my coach on it.&nbsp; One of the things we are planning on using is <a href="http://behaviour-driven.org" title="BDD">BDD</a>.&nbsp; Since I am not to familiar with it I engaged in a conversation with him about it and this is the log of the conversation.&nbsp; I hope others find it useful.&nbsp; In some respects it is _using_ <a href="http://behaviour-driven.org">BDD</a> to learn about <a href="http://behaviour-driven.org">BDD</a>, in an abstract theoretical way that is.
</p>
<blockquote>
<p>
	<strong>me:</strong> yo I was thinking it would be cool to try and use our project as maybe a test case for agile dev work and if successful maybe other projects can move to a more agile dev process.&nbsp; Like it would be cool to have a CI solution going
	</p>
<p>
	<strong>josephholsten:</strong> yes
	</p>
<p>
	also, <a href="http://behaviour-driven.org">behaviour-driven.org</a> is perhaps better than the alternatives
	</p>
<p>
	<strong>me:</strong> yeah.&nbsp; Is there like a 2 paragraph what is BDD so i can understand that more going into reading the site because i am getting confused right now and am only in the intro.
	</p>
<p>
	or maybe i just need to read the intro page 2 or 3 more times
	</p>
<p>
	<strong>josephholsten:</strong> say that again?
	</p>
<p>
	<strong>me:</strong> sorry, stream of thought typing isn&#39;t really a good idea hehe.
	</p>
<p>
	Was curios if there is like a 2 paragraph description of BDD.&nbsp; I am reading the intro page and running in circles because I don&#39;t get it to well.&nbsp; Was thinking if i could get a really high level overview i could understand the intro more.
	</p>
<p>
	<strong>josephholsten:</strong> ah. BDD is a pattern language, which is why you feel that way.
	</p>
<p>
	You&#39;ll have that same difficulty with <br />
	&quot;Pragmatic Programmers&quot; and all those other pattern languages
	</p>
<p>
	So, where to begin?
	</p>
<p>
	<strong>me:</strong> so should I read something on pragmatic programming first?
	</p>
<p>
	<strong>josephholsten:</strong> no, I was referring to a book with a similar style
	</p>
<p>
	<strong>me:</strong> ah
	</p>
<p>
	gotcha
	</p>
<p>
	<strong>josephholsten:</strong> BDD is a process to go from hopes &amp; dreams to a product that fulfils them
	</p>
<p>
	you might call it a design process, but it&#39;s also a style of specification, implementation, and verification
	</p>
<p>
	The idea is to start with a sense of what&#39;s wrong. Then write some stories of how to solve that problem
	</p>
<p>
	there is a suggested template for the stories
	</p>
<p>
	<strong>me:</strong> so like literal stories?
	</p>
<p>
	<strong>josephholsten:</strong> once you have stories, you can look at all of them and say: this one&#39;s more important than that one. it should come first
	</p>
<p>
	well, yes.
	</p>
<p>
	but there tends to be a more rigid format, to help turn them into an implementation
	</p>
<p>
	<strong>me:</strong> ah
	</p>
<p>
	<strong>josephholsten:</strong> here&#39;s the page on stories
	</p>
<p>
	<a href="http://behaviour-driven.org/Story">http://behaviour-driven.org/Story</a>
	</p>
<p>
	but don&#39;t worry about it much, they use a lot of terms without explaining
	</p>
<p>
	so you want to have a product that can make these stories real
	</p>
<p>
	but you can&#39;t do everything at once, so you pick a few to start with
	</p>
<p>
	(it doesn&#39;t matter which. some people will tell you it does, and if they&#39;re paying you, listen. otherwise: smile, nod, and start where you think you should)
	</p>
<p>
	Once you have a few stories, you want to look at them in more detail
	</p>
<p>
	<strong>josephholsten:</strong> you write down examples of their behavior. You write examples so detailed that you can be <em>certain</em> of whether the product behaves properly or not
	</p>
<p>
	these are acceptance tests
	</p>
<p>
	<strong>josephholsten:</strong> they call them acceptance criteria
	</p>
<p>
	you with me?
	</p>
<p>
	<strong>me:</strong> sorta
	</p>
<p>
	<strong>josephholsten:</strong> okay
	</p>
<p>
	perhaps I should go slower?
	</p>
<p>
	Ah, right you don&#39;t see the point yet, or know where I&#39;m going
	</p>
<p>
	sorry
	</p>
<p>
	<strong>me:</strong> <img src='http://buddylindsey.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
	</p>
<p>
	<strong>josephholsten:</strong> so, you start with a hope, then you turn that into a story, then you turn that into acceptance criteria, then you turn that into a behavior specification, then you implement the behavior
	</p>
<p>
	<strong>me:</strong> sooo turn the behavior into code? just want to be sure.
	</p>
<p>
	<strong>josephholsten:</strong> sorta
	</p>
<p>
	<strong>josephholsten:</strong> the thing about bdd is that it emphasizes <em>working implementations</em> over all else
	</p>
<p>
	so very often, every last thing I said you would write would not be as prose, but code
	</p>
<p>
	I write stories, acceptance criteria, and behavior specifications as code
	</p>
<p>
	that way I know if it
	</p>
<p>
	I know if it is real or still being developed
	</p>
<p>
	<strong>me:</strong> so lets see if i can repeat this how I understand it.l
	</p>
<p>
	<strong>josephholsten:</strong> sure
	</p>
<p>
	<strong>me:</strong> So first you start with the idea of your project.&nbsp; What you want it to be.
	</p>
<p>
	Next you write some stories of how to use and not to use the idea.&nbsp; Then follow that with what specifically do we need to have to accomplish our stories
	</p>
<p>
	<strong>josephholsten:</strong> yes
	</p>
<p>
	preferably only spec&#39;ing a little at a time
	</p>
<p>
	<strong>josephholsten:</strong> then implement
	</p>
<p>
	so while you&#39;ve got the theory in your head, let&#39;s make it real
	</p>
<p>
	&#39;behavior specification&#39; is another name for a unit test
	</p>
<p>
	<strong>me:</strong> so kind of like we want to be able to copy multiple lines of text would be a concept/theory then we would break that down into how it works as a behavior spec?
	</p>
<p>
	<strong>josephholsten:</strong> exactly
	</p>
<p>
	your spec begins as a description
	</p>
<p>
	<strong>me:</strong> so can we expand of the idea above as an example maybe?
	</p>
<p>
	<strong>josephholsten:</strong> &quot;should print the text &#39;hello world&#39; to the console&quot;
	</p>
<p>
	<strong>me:</strong> ok
	</p>
<p>
	<strong>josephholsten:</strong> then you turn it into a test
	</p>
<p>
	<strong>me:</strong> gotcha.&nbsp; so the ShouldUpdateProfileDataOverWebService
	</p>
<p>
	is the story in a unit tests and once we develop that we write the code to accomplish that story?
	</p>
<p>
	<strong>josephholsten:</strong>&nbsp;<a href="http://pastie.caboo.se/153892">http://pastie.caboo.se/153892</a>
	</p>
<p>
	it is a test, but it&#39;s of more than a single unit
	</p>
<p>
	<strong>josephholsten:</strong> working&#8230;
	</p>
<p>
	<strong>me:</strong> k
	</p>
<p>
	i&#39;m still reading on the BDD site
	</p>
<p>
	<strong>josephholsten:</strong> so look at the updated pastie, and it&#39;s just a interaction behavior specification
	</p>
<p>
	you specify the state behavior or interaction behavior before you write the implementation
	</p>
<p>
	the same is true for stories
	</p>
<p>
	you start with a literal story
	</p>
<p>
	start with a title
	</p>
<p>
	&quot;should greet the user&quot;
	</p>
<p>
	then give it a defined narrative:
	</p>
<p>
	as an &lt;English speaking user&gt;,
	</p>
<p>
	I want &lt;to be greeted when the program starts&gt;,
	</p>
<p>
	so that &lt;I know I can start using the program&gt;
	</p>
<p>
	that&#39;s a role, feature, and benefit. respectively
	</p>
<p>
	<strong>me:</strong> ok that makes more sense now
	</p>
<p>
	<strong>josephholsten:</strong> like it?
	</p>
<p>
	<strong>me:</strong> yeah
	</p>
<p>
	i do that in my head just not so formally
	</p>
<p>
	<strong>josephholsten:</strong> exactly!
	</p>
<p>
	that&#39;s what I&#39;ve been telling BJ for months
	</p>
<p>
	<strong>me:</strong> LOL I do that in all parts of my life actually.
	</p>
<p>
	Like when I want to go on a camp out.&nbsp; I walk through a typical weekend and pack for each &quot;event&quot; that is going to happen like Getup so i need xyz clothing wise then pack everything.&nbsp; Then I pack for the extreme cases just in case
	</p>
<p>
	<strong>josephholsten:</strong> the only reason to do it formally is when you aren&#39;t sure what the next step is, you can just do what the framework says
	</p>
<p>
	me: yeah I like it actually. <img src="http://mail.google.com/mail/images/cleardot.gif" alt="[smile]" width="13" height="12" />
	</p>
<p>
	<strong>josephholsten:</strong> and hopefully not waste energy on things you don&#39;t need yet
	</p>
<p>
	<strong>me:</strong> yeah. and later you can maybe go back and cover the various use cases that are rare if time permits
	</p>
<p>
	<strong>josephholsten:</strong> which is more what we need from bdd
	</p>
<p>
	<strong>me:</strong> yeah.&nbsp; It makes sense to me now.&nbsp; Do you mind if I make this chat log a blog post?
	</p>
<p>
	<strong>josephholsten:</strong> well, not necessarily rare, but not as valuable
	</p>
<p>
	yes, please do
	</p>
<p>
	I&#39;m planning on turning it into a presentation for tonight
	</p>
<p>
	<strong>me:</strong> k <img src="http://mail.google.com/mail/images/cleardot.gif" alt="[smile]" width="13" height="12" /> sweet it is a great walk through i think so if it helps someone all the better.
	</p>
<p>
	sweet
	</p>
<p>
	so i guess we helped each other. <img src="http://mail.google.com/mail/images/cleardot.gif" alt="[smile]" width="13" height="12" />
	</p>
<p>
	do you have some info about your presentation I can maybe post on my blog so people in Tulsa if any are reading can go?
	</p>
</blockquote>
<p>
If you are in Tulsa and would like to here Joseph&#39;s talk here is the information on it.
</p>
<p>
<a href="http://tulsarb.org/">http://tulsarb.org/</a><br />
Bank of America building, 24th floor<br />
Vidoop offices <br />
6pm
</p>
<p>
<strong>Address:</strong>
</p>
<p>
15 W 6th St Suite 2400<br />
Tulsa, OK 74119
</p>
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://buddylindsey.com/tdd-for-beginners-pt4-unit-tests/' title='TDD for Beginners pt4 &#8211; Unit Tests'>TDD for Beginners pt4 &#8211; Unit Tests</a></li>
<li><a href='http://buddylindsey.com/tdd-for-beginners-pt3-the-application/' title='TDD for Beginners pt3 &#8211; The Application'>TDD for Beginners pt3 &#8211; The Application</a></li>
<li><a href='http://buddylindsey.com/tdd-test-driven-development-for-beginners-pt1/' title='TDD Test Driven Development for Beginners pt1'>TDD Test Driven Development for Beginners pt1</a></li>
<li><a href='http://buddylindsey.com/agree-and-disagree-with-hearding-code-podcast/' title='Agree and Disagree with Hearding Code Podcast'>Agree and Disagree with Hearding Code Podcast</a></li>
<li><a href='http://buddylindsey.com/use-examples-in-your-applications/' title='Use Examples in your Applications'>Use Examples in your Applications</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buddylindsey.com/bdd-story-chat-what-is-bdd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web.Config Basics pt 1</title>
		<link>http://buddylindsey.com/web-config-basics-pt-1/</link>
		<comments>http://buddylindsey.com/web-config-basics-pt-1/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 01:52:52 +0000</pubDate>
		<dc:creator>Buddy Lindsey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[basics]]></category>

		<guid isPermaLink="false">http://buddylindsey.com/blog/?p=41</guid>
		<description><![CDATA[One things that has always been utterly confusing in ASP.NET is the dang Web.Config file.&#160; For the beginner to ASP.NET it makes next to no sense and Visual Studio adds a whole bunch of stuff to it that I have no idea what it does.&#160; It is also so odd and confusing if I want [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>
One things that has always been utterly confusing in ASP.NET is the dang Web.Config file.&nbsp; For the beginner to ASP.NET it makes next to no sense and Visual Studio adds a whole bunch of stuff to it that I have no idea what it does.&nbsp; It is also so odd and confusing if I want to do basic config stuff in my application I have no idea how in the world to go about it.&nbsp;
</p>
<p>
Partly out of necessity and partly to rid myself of not knowing how the web.config works I have been spending time learning about it.&nbsp; I am first starting out with the basics.&nbsp; Getting something to work.
</p>
<h2>Getting Started</h2>
<p>
With most things I want to learn I completely bypass the &quot;how&quot; at first and get something basic to work, which is usually a &quot;Hello World&quot;.&nbsp; That is what we are going to work on in this post.&nbsp; Lets just see something work.&nbsp; So these are the two objectives:
</p>
<p>
1) Set a configuration option we can use in our code<br />
2) Allow for debugging our ASP.NET application
</p>
<p>
Now, we don&#39;t &quot;need&quot; a web.config to run basic .aspx pages, but if you want to anything more advanced than a one page site then you will need one.
</p>
<h3>Web.Config</h3>
<p>
Here is our web.config that we are going to look at today.
</p>
<p>
<img style="border: 0px none " src="/Blog/wp-content/uploads/WindowsLiveWriter/Web.ConfigBasicspt1_EEE5/CropperCapture%5B45%5D_1.png" border="0" alt="CropperCapture[45]" width="327" height="205" />
</p>
<p>
This is really all we need to set a configuration option to access in code and to allow for debugging our application.&nbsp; Please notice that everything is wrapped in:
</p>
<blockquote>
<p>
	&lt;configuration&gt;<br />
	&lt;/configuration&gt;
	</p>
</blockquote>
<p>
That is important to note because all your config information should be under the root configuration node.
</p>
<h3>Custom Application Configuration</h3>
<p>
Next we have where we will set configuration options.
</p>
<blockquote>
<p>
	&lt;appSettings&gt;<br />
	&nbsp;&nbsp;&nbsp;&nbsp; &lt;add key=&quot;Hello&quot; value=&quot;World&quot; /&gt;<br />
	&lt;/appSettings&gt;
	</p>
</blockquote>
<p>
In the appSettings is where you will put configuration options that are like global variables to your WHOLE asp.net application.&nbsp; So in this case you will access the Hello key and it will return the world as its value.&nbsp; So the code you would use to access the config options is:
</p>
<p>
<img style="border: 0px none " src="/Blog/wp-content/uploads/WindowsLiveWriter/Web.ConfigBasicspt1_EEE5/CropperCapture%5B48%5D_1.png" border="0" alt="CropperCapture[48]" width="553" height="68" />
</p>
<p>
You will use ConfigurationManager object which access all the information in your web.config file.&nbsp; Since the Hello key is in the &lt;appSettings&gt; node then you would use AppSettings collection to access what key value pair you need.&nbsp; In this case accessing hello and it returns world.
</p>
<p>
Why would you ever need to use this? Well one things comes to mind.&nbsp; You might have a membership system that you want to turn on and off so you could have in the web.config:
</p>
<blockquote>
<p>
	&lt;appSettings&gt;<br />
	&nbsp;&nbsp;&nbsp; &lt;add key=&quot;Membership&quot; value=&quot;false&quot; /&gt;<br />
	&lt;/appSettings&gt;
	</p>
</blockquote>
<p>
In your code you might have it check to see if it is true or false if true then it displays login stuff for people to register and login if false it doesn&#39;t display it. It might look something like:
</p>
<blockquote>
<p>
	If(ConfigurationManager.AppSettings[&quot;Membership&quot;] == &quot;true&quot;)<br />
	&nbsp;&nbsp;&nbsp; //display login control
	</p>
</blockquote>
<p>
This is just a possibility of something you might want to do.
</p>
<h3>Debug</h3>
<blockquote>
<p>
	&lt;system.web&gt;<br />
	&nbsp;&nbsp;&nbsp; &lt;compilation debug=&quot;false&quot; /&gt;<br />
	&lt;/system.web&gt;
	</p>
</blockquote>
<p>
Here we set whether we want to debug our application or not.&nbsp; I usually set this to yes as I have yet to write a bunch of code with out a bug.&nbsp; All you need to do is to change false to true and you will enable debugging in your asp.net application.
</p>
<h2>Conclusion</h2>
<p>
The web.config file is actually a little more simple than it appears once you understand more of what is going on with it.&nbsp; If you take learning it slowly and one little step at a time it is quite possible.&nbsp; I hope to cover a little bit at a time of the web.config as I learn more and more since it is quite important to learn.
</p>
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://buddylindsey.com/week-1-on-ror-it-is-like-asp-net/' title='Week 1 on RoR: It is like ASP.NET'>Week 1 on RoR: It is like ASP.NET</a></li>
<li><a href='http://buddylindsey.com/tulsa-tech-fest-2008-moving-from-code-behind-to-multilayerd-architecture-with-oop/' title='Tulsa Tech Fest 2008 &#8220;Moving from Code Behind to Multilayerd Architecture with OOP&#8221;'>Tulsa Tech Fest 2008 &#8220;Moving from Code Behind to Multilayerd Architecture with OOP&#8221;</a></li>
<li><a href='http://buddylindsey.com/subtitles-for-video/' title='Subtitles for Video'>Subtitles for Video</a></li>
<li><a href='http://buddylindsey.com/email-account-activation-with-asp-net-membership-part-1/' title='Email Account Activation with ASP.NET Membership part 1'>Email Account Activation with ASP.NET Membership part 1</a></li>
<li><a href='http://buddylindsey.com/eval-in-datalist-datagrid-and-repeater/' title='Eval in DataList, DataGrid, and Repeater'>Eval in DataList, DataGrid, and Repeater</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buddylindsey.com/web-config-basics-pt-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eval in DataList, DataGrid, and Repeater</title>
		<link>http://buddylindsey.com/eval-in-datalist-datagrid-and-repeater/</link>
		<comments>http://buddylindsey.com/eval-in-datalist-datagrid-and-repeater/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 02:54:19 +0000</pubDate>
		<dc:creator>Buddy Lindsey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://buddylindsey.com/blog/?p=43</guid>
		<description><![CDATA[Yesterday in the &#34;Coolness of SubSonic&#34; post I had a bit of asp.net markup (as I call it) that would display data in a data list from the data source.&#160; It specifically used. &#60;%# Eval(&#34;Name&#34;) %&#62; For a long time I have wondered how that worked I could never seem to figure it out until [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>
Yesterday in the &quot;<a href="/Blog/post/Coolness-of-SubSonic.aspx" title="Coolness of SubSonic">Coolness of SubSonic</a>&quot; post I had a bit of asp.net markup (as I call it) that would display data in a data list from the data source.&nbsp; It specifically used.
</p>
<blockquote>
<p>
	&lt;%# Eval(&quot;Name&quot;) %&gt;
	</p>
</blockquote>
<p>
For a long time I have wondered how that worked I could never seem to figure it out until yesterday.&nbsp; Basically, you have an object that you bind to the data control like a datalist.&nbsp; In the case yesterday it was a Product class Object:
</p>
<p><img src="/Blog/wp-content/uploads/WindowsLiveWriter/CoolnessofSubSonic_13987/CropperCapture%5B44%5D_1.png" alt="" width="341" height="96" /> </p>
<p>
Well in the asp.net markup that we have below:
</p>
<p><img src="/Blog/wp-content/uploads/WindowsLiveWriter/CoolnessofSubSonic_13987/CropperCapture%5B42%5D.png" alt="" width="617" height="137" /> </p>
<p>
Notice in the Eval part it uses Name also notice from the product class above there is a name property.&nbsp; What ever property the object has you can use that in the Eval and it will display the data in there that comes from our collection of objects.&nbsp; In this case the Name property of our collection of Product Objects.
</p>
<p>
I know this wasn&#39;t a &quot;cool&quot; post, but it is something I was excited to finally understand so I thought I would post on it to help others understand hopefully.
</p>
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://buddylindsey.com/css-and-asp-net-2-0/' title='CSS and ASP.NET 2.0'>CSS and ASP.NET 2.0</a></li>
<li><a href='http://buddylindsey.com/msdn-launch-party/' title='MSDN Launch party'>MSDN Launch party</a></li>
<li><a href='http://buddylindsey.com/datareader-w00t/' title='DataReader w00t'>DataReader w00t</a></li>
<li><a href='http://buddylindsey.com/ado-net%e2%80%99s-dataset-is-cool/' title='ADO.NET’s DataSet is cool'>ADO.NET’s DataSet is cool</a></li>
<li><a href='http://buddylindsey.com/week-1-on-ror-it-is-like-asp-net/' title='Week 1 on RoR: It is like ASP.NET'>Week 1 on RoR: It is like ASP.NET</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buddylindsey.com/eval-in-datalist-datagrid-and-repeater/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coolness of SubSonic</title>
		<link>http://buddylindsey.com/coolness-of-subsonic/</link>
		<comments>http://buddylindsey.com/coolness-of-subsonic/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 02:55:22 +0000</pubDate>
		<dc:creator>Buddy Lindsey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://buddylindsey.com/blog/?p=45</guid>
		<description><![CDATA[From my last post SQL Parameters in C# I mentioned that I wanted to learn an ORM package.&#160; Well I took a quick glance at NHibernate and got overwhelmed and decided to take a look at SubSonic as I have heard a lot of good things about it.&#160; Well I am happy to say I [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>
From my last post <a href="/Blog/post/SQL-Parameters-in-C.aspx" title="SQL Parameters in C#">SQL Parameters in C#</a> I mentioned that I wanted to learn an ORM package.&nbsp; Well I took a quick glance at <a href="http://www.hibernate.org/343.html" title="NHibernate">NHibernate</a> and got overwhelmed and decided to take a look at <a href="http://subsonicproject.com/">SubSonic</a> as I have heard a lot of good things about it.&nbsp; Well I am happy to say I doubt I will EVER do database access by hand ever again if I can help it.&nbsp; As such I figured I would make a code post on some <a href="http://subsonicproject.com/" title="SubSonic">SubSonic</a> code.&nbsp; I am not really going to explain it just want to show you how easy, cool and simple it is.&nbsp; I&#39;ll show the code starting with my .aspx main aspx page code, the code behind then the data access layer code.
</p>
<p>
<a href="/Blog/wp-content/uploads/WindowsLiveWriter/CoolnessofSubSonic_13987/CropperCapture%5B42%5D.png"><img style="border: 0px" src="/Blog/wp-content/uploads/WindowsLiveWriter/CoolnessofSubSonic_13987/CropperCapture%5B42%5D_thumb.png" border="0" alt=".aspx Code" width="617" height="137" /></a>
</p>
<p>
<a href="/Blog/wp-content/uploads/WindowsLiveWriter/CoolnessofSubSonic_13987/CropperCapture%5B41%5D.png"><img style="border: 0px" src="/Blog/wp-content/uploads/WindowsLiveWriter/CoolnessofSubSonic_13987/CropperCapture%5B41%5D_thumb.png" border="0" alt="Code Behind" width="481" height="156" /></a>
</p>
<p>
<img style="border: 0px" src="/Blog/wp-content/uploads/WindowsLiveWriter/CoolnessofSubSonic_13987/CropperCapture%5B43%5D_1.png" border="0" alt="DataAccess Class" width="754" height="442" />
</p>
<p>
<img style="border: 0px" src="/Blog/wp-content/uploads/WindowsLiveWriter/CoolnessofSubSonic_13987/CropperCapture%5B44%5D_1.png" border="0" alt="Product Class" width="341" height="96" />
</p>
<p>
I am also including the project I used too.&nbsp; Be sure you have Northwind database.
</p>
<p>
I suggest you download, install, and start using <a href="http://subsonicproject.com/" title="SubSonic">SubSonic</a>.&nbsp; It is a great framework to help generate and create your DAL.&nbsp; Once you have it I suggest you watch the screencast on the using the <a href="http://www.wekeroad.com/query1.htm" title="Query Tool">Query Tool</a>.&nbsp; If you would like me to explain this code i&#39;d be more than happy to just let me know and I&#39;ll make another post.
</p>
<p>
<a rel="enclosure" href="/Blog/wp-content/uploads/SubSonicTest.zip">SubSonicTest.zip (188.54 kb)</a>
</p>
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://buddylindsey.com/adventureworks-database-download/' title='AdventureWorks Database download'>AdventureWorks Database download</a></li>
<li><a href='http://buddylindsey.com/msdn-launch-party/' title='MSDN Launch party'>MSDN Launch party</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buddylindsey.com/coolness-of-subsonic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Parameters in C#</title>
		<link>http://buddylindsey.com/sql-parameters-in-c/</link>
		<comments>http://buddylindsey.com/sql-parameters-in-c/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 14:37:38 +0000</pubDate>
		<dc:creator>Buddy Lindsey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://buddylindsey.com/blog/?p=51</guid>
		<description><![CDATA[Until I figure out how to use an ORM package, which might be soon, I will continue to do direct database CRUD code.&#160; One thing I have heard which helps make code more secure is using SQL Parameters.&#160; Well this was a good idea until I tried to figure it out.&#160; Over the last couple [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>
<img src="/Blog/wp-content/uploads/3_NET_logo.jpg.png" alt="" width="164" height="106" align="right" />Until I figure out how to use an ORM package, which might be soon, I will continue to do direct database CRUD code.&nbsp; One thing I have heard which helps make code more secure is using SQL Parameters.&nbsp; Well this was a good idea until I tried to figure it out.&nbsp; Over the last couple of years I have just tried to find the code to get it to work.&nbsp; With a project I just started yesterday it I decided to figure out what was going on and now I want others to know as some stuff on the web, tutorial wise, can be quite confusing.
</p>
<p>
&nbsp;
</p>
<h2>Getting Started&nbsp;</h2>
<p>
I am only going to show you them method that was used to do the database stuff and for the sake of this blog post I am going to assume you know how to use the data reader.&nbsp; If you don&#39;t please let me know and I will make a post on it specifically.&nbsp; There are basically 3 lines I want to cover with you and explain what they are doing to help you understand what is going on and how to use parameters in your SQL Queries.&nbsp; First though the code.
</p>
<p>
&nbsp;
</p>
<p>
<img src="/Blog/wp-content/uploads/CropperCapture%5b1%5d.Png" alt="" /><br />
Now that you have had a chance to review the code a bit lets take a look out our query.
</p>
<blockquote>
<p>
	&nbsp;string query = &quot;SELECT * FROM TestTable WHERE ID = @id&quot;;
	</p>
</blockquote>
<p>
This is a normal select statement but notice the <em>WHERE ID = @id</em> this the <em>@id </em>signifies it is a parameter to be used and what ever is passed to it will be like normal query without it.&nbsp; Think of it as a variable that you would use.
</p>
<blockquote>
<p>
	&nbsp;SqlCommand command = new SqlCommand(query, conn);
	</p>
</blockquote>
<p>
This is an object we use that will help us build up our query and execute it against the database.
</p>
<blockquote>
<p>
	&nbsp;command.Parameters.Add(&quot;id&quot;, SqlDbType.Int).Value = id;
	</p>
</blockquote>
<p>
This here is the main part of what we are after.&nbsp; First, we are using the SqlCommand object and in the object it has a Parameters collection that holds all the parameters a query might have.&nbsp; Since it is a collection we can just call the Add method and the first parameter that metho takes tells the object the parameter name is id for the @id in our query string.&nbsp; The second parameter the method takes is they datatype which it uses a Struct called SqlDbType to help you fill that it so it is fairly easy to do.&nbsp; Next we can give the sql parameter a value in this case the id we passed to the method.
</p>
<p>
Please take a moment to really compare and look at what is going on by understanding what it is doing you can better know how to use it so you don&#39;t need to look it up everytime.
</p>
<h2>Wrap-Up&nbsp;</h2>
<p>
This was meant to be quick so you can get an idea of what is going on.&nbsp; I am including a sample project with the post please feel free to download it.&nbsp; I have included sql scripts to create the database, create the table and add data to the table.&nbsp; Please just run those scripts then edit the connString variable with the write server name for you sql server.&nbsp; Just to note I did this in .NET 3.5.
</p>
<div align="left">
<blockquote></blockquote>
</div>
<p>
<a rel="enclosure" href="/Blog/wp-content/uploads/DatabaseParameter.zip">DatabaseParameter.zip (7.41 kb)</a>
</p>
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://buddylindsey.com/tdd-for-beginners-pt4-unit-tests/' title='TDD for Beginners pt4 &#8211; Unit Tests'>TDD for Beginners pt4 &#8211; Unit Tests</a></li>
<li><a href='http://buddylindsey.com/tdd-for-beginners-pt3-the-application/' title='TDD for Beginners pt3 &#8211; The Application'>TDD for Beginners pt3 &#8211; The Application</a></li>
<li><a href='http://buddylindsey.com/delete-data-from-xml-file-using-c/' title='Delete Data from XML File Using C#'>Delete Data from XML File Using C#</a></li>
<li><a href='http://buddylindsey.com/reading-data-from-xml-file-using-c/' title='Reading Data from XML File Using C#'>Reading Data from XML File Using C#</a></li>
<li><a href='http://buddylindsey.com/eval-in-datalist-datagrid-and-repeater/' title='Eval in DataList, DataGrid, and Repeater'>Eval in DataList, DataGrid, and Repeater</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buddylindsey.com/sql-parameters-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
