<?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/"
		xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Headspring &#187; Kurt Schindler</title>
	<atom:link href="http://www.headspring.com/author/kschindler/feed" rel="self" type="application/rss+xml" />
	<link>http://www.headspring.com</link>
	<description>Custom software... Done right the first time.</description>
	<lastBuildDate>Wed, 16 May 2012 18:27:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<copyright>Copyright © Headspring 2012 </copyright>
	<managingEditor>marketing@headspring.com (Jeffrey Palermo and Kevin Hurwitz)</managingEditor>
	<webMaster>marketing@headspring.com (Jeffrey Palermo and Kevin Hurwitz)</webMaster>
	<ttl>1440</ttl>
	<image>
		<url>http://www.headspring.com/wp-content/uploads/2012/05/HeadspringFlair144.jpg</url>
		<title>Headspring</title>
		<link>http://www.headspring.com</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle>We believe there is a better way</itunes:subtitle>
	<itunes:summary>Are you a lifelong learner?  Are you always searching for better ways to develop and maintain software?  So are we!  A passion for learning and growth is a core value at Headspring.  In this podcast, Headspring consultants, programmers, software developers, managers, and executives share the skills, techniques, patterns, and tools that have proven effective on clients&#039; consulting projects.  Headspring is a software consulting company in Austin, TX and has been recognized on the Inc 500 list and the Austin Business Journal&#039;s Best Place to Work award.</itunes:summary>
	<itunes:keywords>headspring, software, line, business, enterprise, applications, custom, MVC, Net, C, database, SQL</itunes:keywords>
	<itunes:category text="Technology" />
	<itunes:category text="Business" />
	<itunes:category text="Education">
		<itunes:category text="Training" />
	</itunes:category>
	<itunes:author>Jeffrey Palermo and Kevin Hurwitz</itunes:author>
	<itunes:owner>
		<itunes:name>Jeffrey Palermo and Kevin Hurwitz</itunes:name>
		<itunes:email>marketing@headspring.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.headspring.com/wp-content/uploads/2012/05/HeadspringFlair600.jpg" />
		<item>
		<title>Why isn&#8217;t software as reliable as a car?</title>
		<link>http://www.headspring.com/2012/03/why-isnt-software-as-reliable-as-a-car</link>
		<comments>http://www.headspring.com/2012/03/why-isnt-software-as-reliable-as-a-car#comments</comments>
		<pubDate>Fri, 02 Mar 2012 12:24:18 +0000</pubDate>
		<dc:creator>Kurt Schindler</dc:creator>
				<category><![CDATA[What the tech?]]></category>
		<category><![CDATA[Mythical Man-Month]]></category>
		<category><![CDATA[reliability]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=3874</guid>
		<description><![CDATA[According to this is a popular question on Programmers – Stack Exchange, ...]]></description>
			<content:encoded><![CDATA[<p>According to this is a popular <a href="http://programmers.stackexchange.com/questions/41050/why-isnt-software-as-reliable-as-a-car">question</a> on Programmers – Stack Exchange, a user once asked a programmer the innocent question, “Why isn’t software as reliable as a car”?</p>
<p>The highest voted and overly pedantic answer is, “it isn’t: cars themselves have software that is far more reliable than the mechanical parts of the car”. I guess that’s what you get when you leave it to programmers to answer such a question.</p>
<p>Maybe some software is reliable, but I bet you’ve used a custom software system that was far less reliable than your car, haven’t you? I know I have. I’ve built a few them in my past. I’ll take my Honda over some custom software systems any day!</p>
<h2>Why is my custom software system so unreliable?</h2>
<p>Of course, there <em>are </em>several answers, and I <em>am</em> a programmer, so can’t just answer this with a single sweeping generalization. The reason software can be unreliable is as complex as unreliable software is – and therein lies the answer!</p>
<p>At Headspring, we’re big fans of the book “<a href="http://en.wikipedia.org/wiki/The_Mythical_Man-Month">The Mythical Man-Month</a>” by Fred Brooks. It’s one of the most important and influential works on the human elements of software engineering. Even our sales and marketing folks have read it – ask them about it!</p>
<p>There are two passages in the Mythical Man-Month that I believe best answer this question.</p>
<h2>Plan to throw one away</h2>
<p>You don’t need to be a vehicle manufacturing expert to understand that to successfully build a new car, you need to go through multiple rounds of designing, prototyping, and testing. Early prototypes are “thrown away” each time until eventually the manufacturer has produced a car that meets all of the design, safety and performance goals. Your Camry is so reliable because it wasn’t the first thing Toyota bolted together.</p>
<p>Yet custom software is often treated differently. “Project after project designs a set of algorithms and then plunges into construction of customer-deliverable software on a schedule that demands delivery of the first thing built. …In most projects, the first system built is barely usable. It may be too slow, too big, awkward to user, or all three.” (Brooks, p.116) You’d never buy a car that was the first prototype out of the design shop, but I bet you’ve purchased or used software that is.</p>
<p>One reason the custom software system you use is less reliable than a car is because its creators likely never planned to throw one away. <em>They delivered the throwaway product to you</em>.</p>
<h2>Complexity and maintenance difficulty</h2>
<p>The other reason software can be unreliable is complexity and maintenance difficulty. “Software entities are more complex for their size than perhaps any other human construct, because no two parts are alike. …software systems differ profoundly from computers, buildings, or automobiles, where repeated elements abound.” (Brooks, p.182)</p>
<p>It may not seem like it, but in some ways software is orders of magnitude more complex than a car. The mechanics of a car engine are constrained by the physical world in ways that software is not. This complexity also makes it hard to maintain systems.</p>
<p>When a mechanic is changing your car’s oil, you can be confident he’s not introducing a defect in your windshield wipers. When you are repairing a flat, it’s unlikely that you’re going to inadvertently cause your radio to lose its station presets. Because software can be so complex, fixing it is far less reassuring: Brooks suggests that fixing a defect has a substantial (20-50%) chance of introducing another. (p.122)</p>
<h2>Reliable custom software</h2>
<p>If you have a custom software system that you don’t trust as much as your car, I wouldn’t be surprised. Software can be immensely complex and built in a way the nearly ensures a lack of reliability. And for every bug fixed, another one might be introduced. Custom software isn’t for the faint of heart.</p>
<p>At Headspring, reliable custom software is our specialty. We employ <a href="http://www.headspring.com/services/software-consulting/our-processes-and-tools">agile and test-driven development methods</a> to mitigate the challenges of custom software development. Most importantly, we understand that our job isn’t just to build software, but to deliver satisfaction to our clients. A reliable system is worth little if it isn’t the right one for the job.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2012/03/why-isnt-software-as-reliable-as-a-car/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customizing Visual Studio With External Tools, Part 3</title>
		<link>http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-3</link>
		<comments>http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-3#comments</comments>
		<pubDate>Mon, 30 Jan 2012 08:30:27 +0000</pubDate>
		<dc:creator>Kurt Schindler</dc:creator>
				<category><![CDATA[Developer Deep Dive]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=3127</guid>
		<description><![CDATA[In my previous posts (part 1, part 2) I showed you how ...]]></description>
			<content:encoded><![CDATA[<p>In my previous posts (<a title="Customizing Visual Studio With External Tools, Part 1" href="http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-1">part 1</a>, <a title="Customizing Visual Studio With External Tools, Part 2" href="http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-2">part 2</a>) I showed you how to create external tools and add them to a custom tool bar. In this post we will go the next logical step and add them to the context menu, so when you right-click on a file in the solution explorer (or other places) you’re tools are right there for use.</p>
<p>If you’ve been following along, you’ll have noticed that customizing Visual Studio in these ways is a bit cumbersome. Creating context menus are no better considering there are a ton of <em>different</em> menus depending on the <em>context</em> that you’ll have to independently configure.</p>
<p><span id="more-3127"></span></p>
<h2>Creating a right-click, Open in Notepad context menu</h2>
<p>Lets start with a simple example: creating a new context menu to open the selected document in Notepad++ by using the external tool we previously created to open files in Notepad++. Here’s what we’re going to create:</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0pt none;" src="http://www.headspring.com/wp-content/uploads/2012/01/image9.png" alt="Visual Studio open in notepad context menu" width="358" height="126" border="0" /></p>
<p>Go to Tools &gt; Customize, or right-click in the toolbar area and click “Customize…” to open the familiar customization dialog. Go to the “Commands” tab and select the radio button for Context menu and expand the drop down list. Brace yourself, because what you’ll see is <em>every single context menu and sub-menu</em> in Visual Studio. And herein lies the pain of creating a context menu – you have to configure it for each <em>context</em> it may need to be used in. You’ll see the menus are separated by the symbol “|” which denotes a sub-menu.</p>
<p>If you select “Project and Solution Context Menus” the “Controls:” list will show all of the context menus related to Projects and Solutions (a Project menu, Solution Folder menu, and so on). The Project menu is thus in the drop down list as “Project and Solution Context Menus | Project” and it has a controls and sub-menus itself. It’s a little confusing but once you poke around you’ll get the hang of it.</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0pt none;" src="http://www.headspring.com/wp-content/uploads/2012/01/image10.png" alt="List of context menus" width="421" height="354" border="0" /></p>
<p>Above I have highlighted the “Project and Solution Context Menus | Item” menu, which is the context menu that appears when you right click a file in the solution explorer. Once this is selected, click “Add Command…” and find the external tool associated with the command you previously created in <a title="Customizing Visual Studio With External Tools, Part 1" href="http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-1">part 1</a>. It will be in the “Tools” category. You can then click on “Modify Selection” and rename the command.</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0pt none;" src="http://www.headspring.com/wp-content/uploads/2012/01/image11.png" alt="Adding commands to a context menu" width="398" height="270" border="0" /></p>
<p>A final, optional step is to create a new “group” for you command(s). Select the command just under the one you added (“Open” in this case) and click “Modify Selection” on it and the “Begin a Group” selection will be available. Click it and a group separator will be created under your command:</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0pt none;" src="http://www.headspring.com/wp-content/uploads/2012/01/image12.png" alt="Context menu command in a group" width="265" height="66" border="0" /></p>
<p>You’re done! Close out all the dialogs and right click on a file in the solution explorer and it’ll open up in Notepad++ for editing.</p>
<h2>Creating a context sub-menu</h2>
<p>You can create a sub-menu much the same way. Select the menu it belongs in and instead of adding a command, click the “Add New Menu” button. You can rename it the same way you renamed your external command above. Once renamed and placed in the order you wish, it’s time to add commands to it. Because I just added a new menu to the “Project and Solution Context Menus | Item” menu, it will now appear in the context menu drop down list, and we have to select it there in order to add commands to it:</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0pt none;" src="http://www.headspring.com/wp-content/uploads/2012/01/image13.png" alt="Creating a sub-menu within a context menu" width="370" height="92" border="0" /></p>
<p>I’ve added the Explorer and Notepad++ commands that I created in <a title="Customizing Visual Studio With External Tools, Part 1" href="http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-1">part 1</a> in the “My Menu” I created. Now I have these commands available to files in the Solution Explorer in their own sub-menu!</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0pt none;" src="http://www.headspring.com/wp-content/uploads/2012/01/image14.png" alt="A custom context menu" width="476" height="101" border="0" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customizing Visual Studio With External Tools, Part 2</title>
		<link>http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-2</link>
		<comments>http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-2#comments</comments>
		<pubDate>Mon, 23 Jan 2012 08:30:00 +0000</pubDate>
		<dc:creator>Kurt Schindler</dc:creator>
				<category><![CDATA[Developer Deep Dive]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=3118</guid>
		<description><![CDATA[In my previous post I showed you how to configure your own ...]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-1">previous post</a> I showed you how to configure your own External Tools in Visual Studio, such as a command that opens up the current document in an external text editor, or a tool that launches a custom deployment executable. External Tools by default are accessed through the Tools menu, but this is lame. In this post I’ll show you to create your own toolbar to contain your tools so they are no more than one click away.<span id="more-3118"></span></p>
<h2>Creating a custom toolbar</h2>
<p>To create a custom toolbar, click Tools &gt; Customize&#8230; or right-click in the open space in the toolbar area and select “Customize…” at the very bottom of this context menu. Click “New…” to create a new toolbar and give it a name and click OK, then close this dialog box.</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0px;" src="http://www.headspring.com/wp-content/uploads/2012/01/image4.png" alt="Creating a new toolbar" width="445" height="456" border="0" /></p>
<p>It may appear that nothing has happened, but your toolbar has been added, it’s just empty. Look closely at your toolbars and you should be able to spot it:</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0px;" src="http://www.headspring.com/wp-content/uploads/2012/01/image5.png" alt="Customize your toolbar" width="204" height="77" border="0" /></p>
<p>Click on the arrow, then “Add or Remove Buttons” then “Customize”. From this dialog, click “Add Command…”. Here you’ll see two lists, one for categories and another for the commands associated with the selected category.  Find and select the “Tools” category, then select the “External Command 1” command.</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0px;" src="http://www.headspring.com/wp-content/uploads/2012/01/image6.png" alt="Add commands to your toolbar" width="494" height="355" border="0" /></p>
<p>The process is certainly a little cumbersome, but you’ll get the hang of it after doing it once or twice. The “External Commands” listed in the Commands window correspond with the external tools you have [previously configured –link to post #1]. It’s not magical enough to know the name of the external tools you’ve configured, so you’ll have to keep track of what you’ve created and the order they are in. In my example, I have three external tools configured, and I’m going to add each of them to my toolbar: External Command 1, External Command 2, and External Command 3.</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0px;" src="http://www.headspring.com/wp-content/uploads/2012/01/image7.png" alt="External Commands correspond to the External Tools you have, in order" width="324" height="229" border="0" /></p>
<p>When you are done, close out any remaining open dialogs and your custom toolbar should be all set!</p>
<p><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border: 0px;" src="http://www.headspring.com/wp-content/uploads/2012/01/image8.png" alt="A custom toolbar!" width="266" height="42" border="0" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-2/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Customizing Visual Studio With External Tools, Part 1</title>
		<link>http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-1</link>
		<comments>http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-1#comments</comments>
		<pubDate>Mon, 16 Jan 2012 15:00:26 +0000</pubDate>
		<dc:creator>Kurt Schindler</dc:creator>
				<category><![CDATA[Developer Deep Dive]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=3105</guid>
		<description><![CDATA[Visual Studio has some deep customization options and extensibility points that many ...]]></description>
			<content:encoded><![CDATA[<p>Visual Studio has some deep customization options and extensibility points that many of us just ignore. Once such option is “External Tools” which allow you to create a menu item (and optional toolbar) that can run any external program you wish.</p>
<p>I recently had to set up a couple of new computing environments so I went through my typical routine of setting up <em>Explorer.exe</em> as an external tool, and while doing so I pondered a few other tools that might be useful. In this and subsequent posts, I’ll describe how to set up some simple external tools, create a custom tool bar for them and even add them to the context menu.<span id="more-3105"></span></p>
<p>In your menu, go to <strong>Tools &gt; External Tools</strong>. You may already have some present like Dotfuscator or a Guid generator.</p>
<p><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border-style: initial;border-color: initial;border-width: 0px" src="http://www.headspring.com/wp-content/uploads/2012/01/image2.png" alt="Visual Studio External Tools" width="371" height="362" border="0" /></p>
<p>Setting up a tool is fairly simple: You can see above I have Windows Explorer configured with the /select argument to select the file based on the $(ItemPath) variable. More on this on <a href="http://msdn.microsoft.com/en-us/library/ekbzk5f8.aspx" target="_blank">MSDN – Arguments for External Tools</a>. When you launch this tool it will open Explorer to the currently active/selected file (either in your editor or the one selected in your solution explorer). I find it a handy shortcut when I need to explore to a file deep within a solution.</p>
<h2>Other External Tools</h2>
<p>I recently added my other favorite editor, <em>Notepad++,</em> to my tools.  Instead of exploring to the currently active file, it will open it up in Notepad++ which is where I find myself editing project files, csv files and other documents that I don’t need to edit with Visual Studio. You can configure Notepad++ with:</p>
<p><strong>Title</strong>: Notepad++ (or anything you wish)</p>
<p><strong>Command</strong>: C:\Program Files (x86)\Notepad++\notepad++.exe (location of the exe)</p>
<p><strong>Arguments</strong>: $(ItemPath)</p>
<p>At Headspring, we use the open-source <a href="https://bitbucket.org/headspringlabs/tarantino/wiki/Home" target="_blank">Tarantino Project</a> to deploy many of our applications. On some projects the deployer executable resides somewhere in a <em>lib</em> folder within the project which means you have to walk through at least a few directories to get to it. I recently made a batch file to launch it straight from the command line from the root of a project, and so I went ahead and turned this .bat file into an external tool while I was at it.</p>
<p><strong>Title</strong>: Tarantino Deployer</p>
<p><strong>Command</strong>: $(SolutionDir)..\Deploy.bat</p>
<p><strong>Arguments</strong>: /min (this hides the cmd window)</p>
<p>The Deploy.bat file sites in the same folder as the .sln file does and simply points to the relative location of the deployer exe:</p>
<p>@echo off<br />
Start /D.\lib\deployer\ .\lib\deployer\Tarantino.Deployer.exe</p>
<h2>Launching External Tools</h2>
<p>Once you’ve set up your tools in the dialog shown above, they will appear in your tools menu like so:</p>
<p><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border-style: initial;border-color: initial;border-width: 0px" src="http://www.headspring.com/wp-content/uploads/2012/01/image3.png" alt="Visual Studio Tools Menu" width="238" height="383" border="0" /></p>
<p>Stay tuned for more! In the next post I’ll walk you through making your own custom Visual Studio toolbar to contain your tools.</p>
<p><a title="Customizing Visual Studio With External Tools, Part 2" href="http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-2">Part 2: Creating a custom toolbar</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2012/01/customizing-visual-studio-with-external-tools-part-1/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Office Plants and Employee Productivity</title>
		<link>http://www.headspring.com/2011/12/office-plants-and-employee-productivity</link>
		<comments>http://www.headspring.com/2011/12/office-plants-and-employee-productivity#comments</comments>
		<pubDate>Mon, 19 Dec 2011 22:02:26 +0000</pubDate>
		<dc:creator>Kurt Schindler</dc:creator>
				<category><![CDATA[Bonus!]]></category>
		<category><![CDATA[frontpage]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=2641</guid>
		<description><![CDATA[Do you have live potted plants in your office? Or a view ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.headspring.com/2011/12/office-plants-and-employee-productivity/istock_000012541472small" rel="attachment wp-att-2645"><img class="alignleft size-medium wp-image-2645" title="iStock_000012541472Small" src="http://www.headspring.com/wp-content/uploads/2011/12/iStock_000012541472Small-300x236.jpg" alt="" width="300" height="236" /></a>Do you have live potted plants in your office? Or a view out the window that is more scenic than an asphalt parking lot? If not, you could be leaving creativity behind.</p>
<p>I&#8217;ve been reading &#8220;<a href="http://www.amazon.com/59-Seconds-Little-Change-Borzoi/dp/0307273407">59 Seconds: Think a Little, Change a Lot</a>&#8221; by Psychologist and author Richard Wiseman. The book contains a firehose of fascinating research studies and conclusions aimed to help change your life in under a minute. One passage goes on to detail how much of an impact greenery can have on your workplace productivity.</p>
<blockquote><p>&#8220;An eight-month study of creativity in the workplace conducted by Robert Ulrich at Texas A&amp;M University showed that adding flowers and plants to an office resulted in a 15 percent increase in ideas from male employees and more flexible solutions to problems from their female counterparts.&#8221;<span id="more-2641"></span></p></blockquote>
<p>Mr. Wiseman (what a name, huh?) goes on to discuss several other studies including one done by Andrew Elliot at the University of Rochester that compared creativity levels of people in rooms of different color, where green walls were a clear winner over red. If you don&#8217;t want to read the book, a quick Google search will yield a plentiful amount of information on the benefits of plants and the color green (like this <a href="http://www.dailymail.co.uk/health/article-2002499/Stressed-work-Put-pot-plants-desk.html">one</a>).</p>
<p>So now that you&#8217;re convinced, why does greenery  have such an effect? According to Wiseman, evolutionary psychologiests suggest that centuries ago when humans lived amid healthy trees and plants it resulted in a sense of comfort and calm because it meant food was nearby. And pleasant feelings make people more helpful, happy and creative. Hard to argue that.</p>
<p>Whatever the cause, several studies agree: a plant in your office would do you some good. Do you have plants in your office? Why or why not?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2011/12/office-plants-and-employee-productivity/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Glimpse plugin to log SQL generated by NHibernate</title>
		<link>http://www.headspring.com/2011/07/creating-a-glimpse-plugin-to-log-sql-generated-by-nhibernate</link>
		<comments>http://www.headspring.com/2011/07/creating-a-glimpse-plugin-to-log-sql-generated-by-nhibernate#comments</comments>
		<pubDate>Fri, 29 Jul 2011 18:45:31 +0000</pubDate>
		<dc:creator>Kurt Schindler</dc:creator>
				<category><![CDATA[Developer Deep Dive]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[glimpse]]></category>
		<category><![CDATA[nhibernate]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=1021</guid>
		<description><![CDATA[Glimpse has generated a lot of buzz since it was unveiled earlier ...]]></description>
			<content:encoded><![CDATA[<p>Glimpse has generated a lot of buzz since it was <a href="http://channel9.msdn.com/Shows/HanselminutesOn9/Hanselminutes-on-9-Glimpse-at-the-Mix11-Open-Source-Fest" target="_blank">unveiled</a> earlier this year during the “Open Source Fest” at the Mix 2011 conference. If you’re not already using it to debug your ASP.NET Web Forms or MVC application, you should be. Glimpse allows you to inspect several server-side diagnostic and request related information with a UI just like Firebug. Here’s some resources to get you started if you need an intro:</p>
<ul>
<li><a href="http://getglimpse.com/" target="_blank">GetGlimpse.com</a></li>
<li><a href="http://www.hanselman.com/blog/NuGetPackageOfTheWeek5DebuggingASPNETMVCApplicationsWithGlimpse.aspx" target="_blank">NuGet Package of the Week – Glimpse</a></li>
</ul>
<p>There are several <a href="http://getglimpse.com/Help" target="_blank">built-in plugins</a> for Web Forms and MVC that will serve many needs, and you can even create your own. This tutorial will demonstrate how to create a plugin that will display the SQL generated by NHibernate.</p>
<h2>Glimpse Plugins</h2>
<p>Plugins are implemented by a simple class that implements the IGlimpsePlugin interface. There are a couple of great “hello world” example plugins on the Glimpse <a href="http://getglimpse.com/Help/CreatingPlugins" target="_blank">creating plugins page</a>. Besides setting the name and some optional start-up code, a plugin’s main job is just to return some set of data that will be rendered to the Glimpse UI. What that data is and how we get it is the real magic, so read on below.<span id="more-1021"></span></p>
<p>The actual code for this NHibernate Glimpse plugin is fairly simple. We create a header column, add a row indicating the number of SQL statements that were executed and then add all the actual SQL to the plugin data. The SqlLogger class referenced here is just a static class that acts as a wrapper for the HttpContext.Items collection, which is where we’re logging the SQL itself. You can find a full gist including this class and all of the following code snippets, with comments, <a href="https://gist.github.com/1114503" target="_blank">here</a>.</p>
<div id="gist-1114428" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="na">[Glimpse.Core.Extensibility.GlimpsePluginAttribute()]</span></div><div class='line' id='LC2'><span class="k">public</span> <span class="k">class</span> <span class="nc">NHGlimpsePlugin</span> <span class="p">:</span> <span class="n">IGlimpsePlugin</span></div><div class='line' id='LC3'><span class="p">{</span></div><div class='line' id='LC4'>	<span class="k">public</span> <span class="kt">object</span> <span class="nf">GetData</span><span class="p">(</span><span class="n">HttpContextBase</span> <span class="n">context</span><span class="p">)</span></div><div class='line' id='LC5'>	<span class="p">{</span></div><div class='line' id='LC6'>		<span class="kt">var</span> <span class="n">data</span> <span class="p">=</span> <span class="k">new</span> <span class="n">List</span><span class="p">&lt;</span><span class="kt">object</span><span class="p">[]&gt;</span> <span class="p">{</span> <span class="k">new</span><span class="p">[]</span> <span class="p">{</span> <span class="s">&quot;Key&quot;</span><span class="p">,</span> <span class="s">&quot;Value&quot;</span> <span class="p">}</span> <span class="p">};</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'>		<span class="n">data</span><span class="p">.</span><span class="n">Add</span><span class="p">(</span><span class="k">new</span> <span class="kt">object</span><span class="p">[]</span> <span class="p">{</span> <span class="s">&quot;*count*&quot;</span><span class="p">,</span> <span class="n">SqlLogger</span><span class="p">.</span><span class="n">Count</span> <span class="p">});</span></div><div class='line' id='LC9'><br/></div><div class='line' id='LC10'>		<span class="k">foreach</span> <span class="p">(</span><span class="kt">var</span> <span class="n">sqlString</span> <span class="k">in</span> <span class="n">SqlLogger</span><span class="p">.</span><span class="n">All</span><span class="p">())</span></div><div class='line' id='LC11'>		<span class="p">{</span></div><div class='line' id='LC12'>			<span class="n">data</span><span class="p">.</span><span class="n">Add</span><span class="p">(</span><span class="k">new</span> <span class="kt">object</span><span class="p">[]</span> <span class="p">{</span> <span class="s">&quot;*sql*&quot;</span><span class="p">,</span> <span class="n">sqlString</span> <span class="p">});</span></div><div class='line' id='LC13'>		<span class="p">}</span></div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'>		<span class="k">return</span> <span class="n">data</span><span class="p">;</span></div><div class='line' id='LC16'>	<span class="p">}</span></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'>	<span class="k">public</span> <span class="k">void</span> <span class="nf">SetupInit</span><span class="p">()</span> <span class="p">{</span> <span class="p">}</span></div><div class='line' id='LC19'><br/></div><div class='line' id='LC20'>	<span class="k">public</span> <span class="kt">string</span> <span class="n">Name</span> <span class="p">{</span> <span class="k">get</span> <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;NHibernate&quot;</span><span class="p">;</span> <span class="p">}</span> <span class="p">}</span></div><div class='line' id='LC21'><span class="p">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1114428/51e922a0a4eabeaa97452e904eac6e7bae3f7435/hs-blog-NHGlimpsePlugin.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1114428#file_hs_blog_nh_glimpse_plugin.cs" style="float:right;margin-right:10px;color:#666">hs-blog-NHGlimpsePlugin.cs</a>
            <a href="https://gist.github.com/1114428">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<h2>Logging the SQL generated by NHibernate</h2>
<p>The easiest way to log the SQL generated by NHibernate so it can be pushed up to Glimpse is to create a custom Log4Net appender and configure it in the web.config. It’s as simple as creating a class that extends the AppenderSkeleton base class and implement the Append method, like so:</p>
<div id="gist-1114440" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">public</span> <span class="k">class</span> <span class="nc">NHibernateQueryAppender</span> <span class="p">:</span> <span class="n">AppenderSkeleton</span></div><div class='line' id='LC2'><span class="p">{</span></div><div class='line' id='LC3'>	<span class="k">protected</span> <span class="k">override</span> <span class="k">void</span> <span class="nf">Append</span><span class="p">(</span><span class="n">LoggingEvent</span> <span class="n">loggingEvent</span><span class="p">)</span></div><div class='line' id='LC4'>	<span class="p">{</span></div><div class='line' id='LC5'>		<span class="n">SqlLogger</span><span class="p">.</span><span class="n">AddSql</span><span class="p">(</span><span class="n">loggingEvent</span><span class="p">.</span><span class="n">RenderedMessage</span><span class="p">);</span></div><div class='line' id='LC6'>	<span class="p">}</span></div><div class='line' id='LC7'><span class="p">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1114440/19804874e9f2c897608e9576a76f8d4a78ac17f4/hs-blog-NHibernateQueryAppender.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1114440#file_hs_blog_n_hibernate_query_appender.cs" style="float:right;margin-right:10px;color:#666">hs-blog-NHibernateQueryAppender.cs</a>
            <a href="https://gist.github.com/1114440">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Wiring up the web.config:</p>
<div id="gist-1114446" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nt">&lt;log4net&gt;</span></div><div class='line' id='LC2'>	<span class="nt">&lt;appender</span> <span class="na">name=</span><span class="s">&quot;GlimpseAppender&quot;</span> <span class="na">type=</span><span class="s">&quot;Headspring.Data.NHibernateQueryAppender, Headspring&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC3'>	<span class="nt">&lt;logger</span> <span class="na">name=</span><span class="s">&quot;NHibernate.SQL&quot;</span><span class="nt">&gt;</span></div><div class='line' id='LC4'>		<span class="nt">&lt;level</span> <span class="na">value=</span><span class="s">&quot;DEBUG&quot;</span><span class="nt">/&gt;</span></div><div class='line' id='LC5'>		<span class="nt">&lt;appender-ref</span> <span class="na">ref=</span><span class="s">&quot;GlimpseAppender&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC6'>	<span class="nt">&lt;/logger&gt;</span></div><div class='line' id='LC7'><span class="nt">&lt;/log4net&gt;</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1114446/cc1670cc55cc17f094199cc7233ff44df379b807/hs-blog-log4netGlimpseAppenderConfig.xml" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1114446#file_hs_blog_log4net_glimpse_appender_config.xml" style="float:right;margin-right:10px;color:#666">hs-blog-log4netGlimpseAppenderConfig.xml</a>
            <a href="https://gist.github.com/1114446">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<h2>The hard part</h2>
<p>There is no hard part! We’re done! Drop this into an application that’s using NHibernate, enable Glimpse, click over to the new NHibernate tab, and wonder how you ever lived without this.</p>
<p><a href="http://www.headspring.com/wp-content/uploads/2011/07/GlimpseNhibernate.png"><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" src="http://www.headspring.com/wp-content/uploads/2011/07/GlimpseNhibernate_thumb.png" alt="NHibernate Glimpse Plugin" width="559" height="145" border="0" /></a></p>
<p>The complete source code with comments is available <a href="https://gist.github.com/1114503" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2011/07/creating-a-glimpse-plugin-to-log-sql-generated-by-nhibernate/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.headspring.com @ 2012-05-18 12:48:31 -->
