<?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>Mind Gravy &#187; Programming</title>
	<atom:link href="http://www.mindgravy.net/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mindgravy.net</link>
	<description>Slather Your Mind</description>
	<lastBuildDate>Thu, 10 Jun 2010 04:27:13 +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>How to Verify Your Stored Procedures</title>
		<link>http://www.mindgravy.net/2010/05/05/how-to-verify-your-stored-procedures/</link>
		<comments>http://www.mindgravy.net/2010/05/05/how-to-verify-your-stored-procedures/#comments</comments>
		<pubDate>Wed, 05 May 2010 16:56:51 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.mindgravy.net/2010/05/05/how-to-verify-your-stored-procedures/</guid>
		<description><![CDATA[One of the things I’ve been trying to do is to eliminate the unnecessary stored procedures from our project.&#160; Currently, we have about 150 left, but a lot of them are still used.&#160; Some of them are still left over and no longer are called from our application.&#160; As I was building a new SQL [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I’ve been trying to do is to eliminate the unnecessary stored procedures from our project.&#160; Currently, we have about 150 left, but a lot of them are still used.&#160; Some of them are still left over and no longer are called from our application.&#160; As I was building a new SQL install script, I was trying to run a script of all stored procedures in one database and create them all in a new one.&#160; I found that some of them no longer would work because of changes we’ve made to the database that have broken these stored procedures without even knowing.&#160; </p>
<p>I asked on twitter how this could be done and Argenis Fernandez (<a href="http://twitter.com/afernandez">@afernandez</a>) suggested that I look into a Powershell script to verify stored procedures still work.</p>
<p>After some investigation on how Powershell and SQL work together, I scraped together this script:</p>
<pre class="brush:powershell">$server = "localhost";		# The SQL Server instance name
$database = "MyDatabase";		# The database name

# Load the SMO assembly
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null

# Create the SMO objects
$srv = New-Object "Microsoft.SqlServer.Management.SMO.Server" $server;
$db = New-Object ("Microsoft.SqlServer.Management.SMO.Database");

# Get the database
$db = $srv.Databases[$database];

# For each stored procedure in the database
foreach($proc in $db.StoredProcedures)
{
    # NOTE: my stored procedures are all prefixed with "web_"
    if ($proc.Name.StartsWith("web_"))
	{
        $proc.TextBody = $proc.TextBody;
        $proc.Alter();
    }
}</pre>
<p>If any error occurs, it will display which procedure name did not get altered properly.</p>
<p>In my application, all my stored procedures that I use in the websites are prefixed with “web_”.&#160; This made it easy to check if the procedures used still work.&#160; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindgravy.net/2010/05/05/how-to-verify-your-stored-procedures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Query Madness</title>
		<link>http://www.mindgravy.net/2010/04/15/sql-query-madness/</link>
		<comments>http://www.mindgravy.net/2010/04/15/sql-query-madness/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 15:48:09 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.mindgravy.net/2010/04/15/sql-query-madness/</guid>
		<description><![CDATA[I would consider myself to be pretty good with database design and queries, but this one has me stumped. Our application allows administrators to add “User Properties” in order for them to be able to tailor the system to match their own HR systems.&#160; For example, if your company has departments, you can define “Departments” [...]]]></description>
			<content:encoded><![CDATA[<p>I would consider myself to be pretty good with database design and queries, but this one has me stumped.</p>
<p>Our application allows administrators to add “User Properties” in order for them to be able to tailor the system to match their own HR systems.&#160; For example, if your company has departments, you can define “Departments” in the Properties table and then add values that correspond to “Departments” such as “Jewelry”, “Electronics” etc…&#160; You are then able to assign a department to users.</p>
<p>Here is the schema:</p>
<p><a href="http://www.mindgravy.net/wp-content/uploads/2010/04/image.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="281" alt="image" src="http://www.mindgravy.net/wp-content/uploads/2010/04/image_thumb.png" width="632" border="0" /></a> </p>
<p>In this schema, a user can have only one UserPropertyValue per Property, but doesn’t have to have a value for the property.</p>
<p>I am trying to build a query that can use the PropertyValues as the filter for users.&#160; My query looks like this (SQL Server 2005):</p>
<pre class="brush:sql">SELECT UserLogin, FirstName, LastName
FROM Users U
LEFT OUTER JOIN UserPropertyValues UPV
	ON U.ID = UPV.UserID
WHERE UPV.PropertyValueID IN (1, 5)</pre>
<p>When I run this, if the user has ANY of the property values, they are returned.&#160; What I would like to have is where this query will return users that have values BY PROPERTY.</p>
<p>So if PropertyValueID = 1 is of Department (Jewelry), and PropertyValueID = 5 is of EmploymentType (Full Time), I want to return all users that are in Department Jewelry that are EmployeeType of Full Time, can this be done?</p>
<p>I’m not sure how this can be accomplished without building dynamic SQL, so I thought I would throw this out to see what I could find.</p>
<hr />
<p><strong>UPDATE:</strong></p>
<p>I posted this question on StackOverflow to see if there are any more ideas</p>
<p><a href="http://stackoverflow.com/questions/2647570/where-clause-on-joined-table-used-for-user-defined-key-value-pairs">http://stackoverflow.com/questions/2647570/where-clause-on-joined-table-used-for-user-defined-key-value-pairs</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindgravy.net/2010/04/15/sql-query-madness/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>My First Rails Application</title>
		<link>http://www.mindgravy.net/2010/04/02/my-first-rails-application/</link>
		<comments>http://www.mindgravy.net/2010/04/02/my-first-rails-application/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 05:38:49 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[heroku]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.mindgravy.net/2010/04/02/my-first-rails-application/</guid>
		<description><![CDATA[After CodeMash, I decided it was time to see what the hubub was about with rails, so I picked up a Mac, a few books and a lot of beer.&#160; The result is my first website built using rails and Heroku.&#160; There’s not much to it right now other than my resume, but I’m looking [...]]]></description>
			<content:encoded><![CDATA[<p>After CodeMash, I decided it was time to see what the hubub was about with rails, so I picked up a Mac, a few books and a lot of beer.&#160; The result is my first website built using rails and <a href="http://heroku.com">Heroku</a>.&#160; There’s not much to it right now other than my resume, but I’m looking at building a contact form as well.&#160;&#160; So it’s not much of an application other than an HTML page rendered using rails, but at least it’s the start of something new.</p>
<p align="center"><a href="http://stephenwright.name" target="_blank">stephenwright.name</a></p>
<p><a href="http://www.stephenwright.name"><img title="stephenwright.name" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="358" alt="stephenwright.name" src="http://www.mindgravy.net/wp-content/uploads/2010/04/sw_resume_site.png" width="604" border="0" /></a></p>
<p>&#160;</p>
<p>Here’s to learning more in the coming months!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindgravy.net/2010/04/02/my-first-rails-application/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Laptop &#8211; I&#8217;m a Mac</title>
		<link>http://www.mindgravy.net/2010/02/01/new-laptop-im-a-mac/</link>
		<comments>http://www.mindgravy.net/2010/02/01/new-laptop-im-a-mac/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 04:04:39 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[macbook]]></category>

		<guid isPermaLink="false">http://www.mindgravy.net/2010/02/01/new-laptop-im-a-mac/</guid>
		<description><![CDATA[After going back and forth between getting a Dell, HP Envy or Asus, I decided to go outside of my comfort zone and bought a Macbook. The reason I got it was because I wanted to learn a new programming language and to see how the other side lives.&#160; Codemash taught me that if I [...]]]></description>
			<content:encoded><![CDATA[<p><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="Macbook" border="0" alt="Macbook" align="right" src="http://www.mindgravy.net/wp-content/uploads/2010/02/image.png" width="244" height="137" /> After going back and forth between getting a Dell, HP Envy or Asus, I decided to go outside of my comfort zone and bought a Macbook.</p>
<p>The reason I got it was because I wanted to learn a new programming language and to see how the other side lives.&#160; Codemash taught me that if I want to get better as a programmer, I have to widen my experiences to more than just .NET.&#160; </p>
<p>So this is the first step to jump start my learning.&#160; I hope to upgrade it so a better hard drive (SSD), more memory and to get the new Speck soft satin case (and a travel case too).&#160; I will be blogging more about the experience of OS-X vs Windows along with attempting to learn Ruby on Rails.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindgravy.net/2010/02/01/new-laptop-im-a-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeMash 2.0.1.0.</title>
		<link>http://www.mindgravy.net/2010/01/12/codemash-2-0-1-0/</link>
		<comments>http://www.mindgravy.net/2010/01/12/codemash-2-0-1-0/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 15:15:27 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[codemash]]></category>
		<category><![CDATA[conference]]></category>

		<guid isPermaLink="false">http://www.mindgravy.net/2010/01/12/codemash-2-0-1-0/</guid>
		<description><![CDATA[CodeMash is just around the corner and thanks to the good folks at telerik, I will be one of about 700 people attending the conference.&#160; I will be tweeting from the conference and posting recaps of sessions and happenings with an occasional picture or two.&#160; I might blog from the lazy river, who knows! As [...]]]></description>
			<content:encoded><![CDATA[<p><img title="CodeMash" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="204" alt="CodeMash" src="http://www.mindgravy.net/wp-content/uploads/2010/01/Oz.png" width="204" align="right" border="0" /> <a href="http://codemash.org" target="_blank">CodeMash</a> is just around the corner and thanks to the good folks at <a href="http://www.telerik.com" target="_blank">telerik</a>, I will be one of about 700 people attending the conference.&#160; I will be <a href="http://twitter.com/underwhelmed" target="_blank">tweeting</a> from the conference and posting recaps of sessions and happenings with an occasional picture or two.&#160; I might blog from the lazy river, who knows!</p>
<p>As of now, here is the list of sessions I would like to attend, along with backup sessions:</p>
<h1>Thursday Sessions</h1>
<p><strong>9:45 AM</strong>: <a href="http://codemash.org/Sessions#What+Makes+Ruby+Different" target="_blank">What Makes Ruby Different</a> (Joe O’Brien, Mark Peabody &amp; Leon Gersing) or <a href="http://codemash.org/Sessions#Agile+Iteration+0" target="_blank">Agile Iteration 0</a> (Ken Sipe)</p>
<p><strong>11:00 AM:</strong> <a href="http://codemash.org/Sessions#Maintainable+ASP.NET+MVC" target="_blank">Maintainable ASP.NET MVC</a> (Chris Patterson) or <a href="http://codemash.org/Sessions#User+Stories%3a+Closing+the+Agile+Loop" target="_blank">User Stories: Closing the Agile Look</a> (Barry Hawkins)</p>
<p><strong>1:45 PM:</strong> <a href="http://codemash.org/Sessions#Ruby+and+Rails+for+the+.Net+Developer+" target="_blank">Ruby and Rails for the .NET Developer</a> (Matt Yoho) or <a href="http://codemash.org/Sessions#Seeing+Constraints%2c+Kanban+Explained" target="_blank">Seeing Constraints: Kanban Explained</a> (Jon Stahl)</p>
<p><strong>3:35 PM:</strong> <a href="http://codemash.org/Sessions#Domain-Driven+Design%3a+An+Introduction" target="_blank">Domain Driven Design: An Introduction</a> (Barry Hawkins) or <a href="http://codemash.org/Sessions#Refactoring+the+Programmer" target="_blank">Refactoring the Programmer</a> (Joe O’Brien)</p>
<p><strong>4:45 PM:</strong> <a href="http://codemash.org/Sessions#Testing+ASP.net+applications+using+Ruby" target="_blank">Testing ASP.NET Applications Using Ruby</a> (Ben Hall)</p>
<h1>Friday Sessions</h1>
<p><strong>9:30 AM:</strong> <a href="http://codemash.org/Sessions#Software+Design+and+Testability" target="_blank">Software Design and Testability</a> (Jeremy D. Miller) or <a href="http://codemash.org/Sessions#Testing+the+Enterprise" target="_blank">Testing the Enterprise</a> (Leon Gersing &amp; Charlie Baker)</p>
<p><strong>10:45 AM:</strong> <a href="http://codemash.org/Sessions#0-60+with+Fluent+NHibernate" target="_blank">0-60 with Fluent NHibernate</a> (Hudson Akridge) or <a href="http://codemash.org/Sessions#Leadership+101" target="_blank">Leadership 101</a> (Jim Holmes)</p>
<p><strong>1:45 PM:</strong> <a href="http://codemash.org/Sessions#IronPython+with+ASP.NET" target="_blank">IronPython with ASP.NET</a> (Chris Sutton) OR <a href="http://codemash.org/Sessions#Credit+Crunch+Code+%E2%80%93+Time+to+Pay+Back+the+Technical+Debt" target="_blank">Credit Crunch Code: Time to Pay Back the Technical Debt</a> (Gary Short)</p>
<p><strong>3:35 PM:</strong> <a href="http://codemash.org/Sessions#Analyze+and+Optimize+your+.NET+Web+Application" target="_blank">Analyze and Optimize your .NET Web Application</a> (James Avery) or <a href="http://codemash.org/Sessions#SOLID+Ruby" target="_blank">SOLID Ruby</a> (Jim Weirich)</p>
<p>This will be my first large conference.&#160; I’ve attended a few other conferences like the Iowa Code Camp and Chicago Code Camp.&#160; This will be a new experience for me and I hope that I will get a lot out of it.&#160; I am looking forward to meeting the people I follow on twitter too.&#160; This should be a great time.</p>
<p>See you in Sandusky!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindgravy.net/2010/01/12/codemash-2-0-1-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
