<?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>Random Findings as a Developer</title>
	<atom:link href="http://blog.andrewjudd.ca/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.andrewjudd.ca</link>
	<description>Information and random ramblings found in day-to-day life.</description>
	<lastBuildDate>Tue, 27 Dec 2011 05:51:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Day 2 &#8211; D2Plug &#8211; The Setup</title>
		<link>http://blog.andrewjudd.ca/2011/12/day-2-d2plug-setup/</link>
		<comments>http://blog.andrewjudd.ca/2011/12/day-2-d2plug-setup/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 05:49:39 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[D2Plug]]></category>
		<category><![CDATA[Global Scale Servers]]></category>

		<guid isPermaLink="false">http://blog.andrewjudd.ca/?p=113</guid>
		<description><![CDATA[After my first night of playing with the D2Plug, I read more of the instruction manual and realized that I didn&#8217;t actually need to use the JTAG port in order to connect to the console window for the server.  It turns out there is a port conveniently labeled &#8220;Console&#8221; which when a Micro-B USB port [...]]]></description>
			<content:encoded><![CDATA[<p>After my first night of playing with the D2Plug, I read more of the instruction manual and realized that I didn&#8217;t actually need to use the JTAG port in order to connect to the console window for the server.  It turns out there is a port conveniently labeled &#8220;Console&#8221; which when a Micro-B USB port is inserted, this becomes your serial console.  So much for the JTAG board I got with my Guruplug.</p>
<p>It came more or less set up with everything I needed on it built in and ready for me to use.  After an hour and a half of software updates (yay for updating Ubuntu 10.04) and another hour of installation, the system was set up and ready for me to use as a media server (the original reason why I got the Guruplug).</p>
<p>The snag was where to put it.  I tried to take the unit apart at the power supply unit (PSU) and use the plastic pieces to cover it, but that didn&#8217;t work too well, the pieces of plastic that came with it to cover this piece of hardware was insanely difficult to get on to the point that I thought that if I were to need to remove it, I would not be able to.  Instead, I ended up just mounting the D2Plug on the wall of the shelf where it will live.</p>
<p>Man was that a much needed swap.  The Guruplug was originally placed in my basement due to the fact that the server sounded like a hair dryer that was constantly going.  Now when I walk downstairs, all I hear is silence.</p>
<p>Both of these products have been great thus far, I look forward to their future releases <img src='http://blog.andrewjudd.ca/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewjudd.ca/2011/12/day-2-d2plug-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Day 1 &#8211; D2Plug</title>
		<link>http://blog.andrewjudd.ca/2011/12/day-1-d2plug/</link>
		<comments>http://blog.andrewjudd.ca/2011/12/day-1-d2plug/#comments</comments>
		<pubDate>Mon, 26 Dec 2011 05:09:35 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[D2Plug]]></category>
		<category><![CDATA[Global Scale Servers]]></category>

		<guid isPermaLink="false">http://blog.andrewjudd.ca/?p=109</guid>
		<description><![CDATA[So I got the D2Plug for Christmas and I immediately started playing with it.  Aside from reading the online PDF, I found it relatively hard to figure out what the default password for the &#8220;ubuntu&#8221; account (account that comes automatically enabled on the server). Have no fear, the information is here: Username: ubuntu Password: marvell [...]]]></description>
			<content:encoded><![CDATA[<p>So I got the D2Plug for Christmas and I immediately started playing with it.  Aside from reading the online PDF, I found it relatively hard to figure out what the default password for the &#8220;ubuntu&#8221; account (account that comes automatically enabled on the server).</p>
<p>Have no fear, the information is here:</p>
<p>Username: ubuntu</p>
<p>Password: marvell</p>
<p>Reference Manual: <a href="http://www.globalscaletechnologies.com/download/D2Plug_QSG_20111011.pdf" target="_blank">http://www.globalscaletechnologies.com/download/D2Plug_QSG_20111011.pdf</a></p>
<p>Now to get the JTag port working as well as my other external keyboard <img src='http://blog.andrewjudd.ca/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewjudd.ca/2011/12/day-1-d2plug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio &#8211; Toolbox Missing Selections</title>
		<link>http://blog.andrewjudd.ca/2011/09/visual-studio-toolbox-missing-selections/</link>
		<comments>http://blog.andrewjudd.ca/2011/09/visual-studio-toolbox-missing-selections/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 14:08:23 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://blog.andrewjudd.ca/?p=101</guid>
		<description><![CDATA[Yesterday I noticed that my list of tools to use in Visual Studio was more or less reduced to none.  This concerned me since SSIS packages are all tools based and well, I can&#8217;t really do much if I can only run a backup database task. After googling it for a bit, I found the [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I noticed that my list of tools to use in Visual Studio was more or less reduced to none.  This concerned me since SSIS packages are all tools based and well, I can&#8217;t really do much if I can only run a backup database task.</p>
<p><a href="http://blog.andrewjudd.ca/wp-content/uploads/2011/09/VS-Toolbox-Broken.png"><img class="alignleft size-full wp-image-102" title="Visual Studio - Broken Toolbox" src="http://blog.andrewjudd.ca/wp-content/uploads/2011/09/VS-Toolbox-Broken.png" alt="Visual Studio - Broken Toolbox" width="349" height="526" /></a></p>
<p>After googling it for a bit, I found the post that explained exactly what to do. The cached toolbox files were screwed up and needed to be regenerated. I started by right clicking and saying &#8220;Reset Toolbox&#8221; but no luck.</p>
<p>In the end I had to kill all of the tbd files that were created automatically by Visual Studio (<a href="http://connect.microsoft.com/VisualStudio/feedback/details/322223/no-usable-controls-in-toolbox-when-developing-for-compact-framework">more information</a>).</p>
<p>The paths in that post are for Vista and XP, so I found another one that actually defined where to find them in Windows 7 (<a href="http://blogs.telerik.com/blogs/posts/08-12-23/visual_studio_ldquo_error_creating_control_rdquo.aspx">Visual Studio Application Data Folder</a>).</p>
<p>Make sure to close Visual Studio before trying this or who knows what will happen &#8230;</p>
<p>Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewjudd.ca/2011/09/visual-studio-toolbox-missing-selections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gzip &#8211; Extract file without killing the zipped file</title>
		<link>http://blog.andrewjudd.ca/2011/09/gzip-extract-file-without-killing-the-zipped-file/</link>
		<comments>http://blog.andrewjudd.ca/2011/09/gzip-extract-file-without-killing-the-zipped-file/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 20:00:28 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://blog.andrewjudd.ca/?p=98</guid>
		<description><![CDATA[In a data load, we receive some zipped files (*.gz) I found that when you use the regular extraction: gzip.exe -d -f "foo.csv.gz" The &#8220;foo.csv.gz&#8221; file will automatically be deleted by gzip and replace it with &#8220;foo.csv&#8221; However, if we are archiving these csv files it will take up a fair bit more space, so [...]]]></description>
			<content:encoded><![CDATA[<p>In a data load, we receive some zipped files (*.gz) I found that when you use the regular extraction:</p>
<pre>gzip.exe -d -f "foo.csv.gz"</pre>
<p>The &#8220;foo.csv.gz&#8221; file will automatically be deleted by gzip and replace it with &#8220;foo.csv&#8221;</p>
<p>However, if we are archiving these csv files it will take up a fair bit more space, so we wanted to just store the archived version of the flat file.</p>
<p>Originally I thought that I was going to need to unzip them, then rezip all of the files at the end of the process to get the files ready for archival but this took was just a lot of extra processing.</p>
<p>Finally I came across a way to avoid the deletion of the file If you output the file to standard out you are able to then redirect that output stream into your output file (without affecting the original .gz file).</p>
<p>Verdict:</p>
<pre>gzip.exe -d -f -c "foo.csv.gz" &gt; foo.csv</pre>
<p>This will take all of the contents from the gz file and push it to STDOUT and then with using the &gt;, we redirect the information written to STDOUT to the CSV file where we need it.</p>
<p>Hope this helps <img src='http://blog.andrewjudd.ca/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Information based on post from a member on Stack Overflow: http://stackoverflow.com/questions/7351887/gzip-extracting-without-deleting-zip-file</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewjudd.ca/2011/09/gzip-extract-file-without-killing-the-zipped-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Import Ignoring the last line of a CSV file</title>
		<link>http://blog.andrewjudd.ca/2011/09/import-ignoring-line-csv-file/</link>
		<comments>http://blog.andrewjudd.ca/2011/09/import-ignoring-line-csv-file/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 15:05:13 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">http://blog.andrewjudd.ca/?p=93</guid>
		<description><![CDATA[I ran into a weird issue this morning when trying to load some segment files. Data File Preview returns the 58 rows which I expected. Data Viewer returns 57 rows which was not expected. I tried to redirect any error rows to a flat file, but no success, there were no rows being emitted to [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a weird issue this morning when trying to load some segment files.</p>
<p>Data File Preview returns the 58 rows which I expected.<br />
Data Viewer returns 57 rows which was not expected.</p>
<p>I tried to redirect any error rows to a flat file, but no success, there were no rows being emitted to the flat file.</p>
<p>I checked in the warnings and saw the following:<br />
[File Connection [1]] Warning: There is a partial row at the end of the file.</p>
<p>I double and triple checked that it had all of the columns (or commas) available. They were all there (why wouldn&#8217;t it be? Excel makes valid CSV files).</p>
<p>When I tried to add an empty row in (a row with 13 commas) it was attaching it to the last column which seemed very odd to me. However when I gave it some text, it would capture it as a new row (which is the removed because of the last row vanishing).</p>
<p>It turns out that the row delimiter was messed up. It said &#8220;_x003C_none_x003E_&#8221; instead of the normal &#8220;&lt;none&gt;&#8221;.</p>
<p>After changing it back to &#8220;&#8221; it worked as expected. Very weird.</p>
<p>Hopefully this will stop you from scratching your head and wondering why a single row is randomly being removed from the dataset without rhyme / reason.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewjudd.ca/2011/09/import-ignoring-line-csv-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objects Remaining in Memory</title>
		<link>http://blog.andrewjudd.ca/2011/08/objects-remaining-memory/</link>
		<comments>http://blog.andrewjudd.ca/2011/08/objects-remaining-memory/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 21:37:54 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://blog.andrewjudd.ca/?p=88</guid>
		<description><![CDATA[I was implementing an image resizer and I kept running into a problem where I kept getting error messages saying that the image file was in use even after I disposed of the object in memory (the last step was to remove the unresized image). Calling object.Dispose() is just a suggestion to say &#8220;whenever you [...]]]></description>
			<content:encoded><![CDATA[<p>I was implementing an image resizer and I kept running into a problem where I kept getting error messages saying that the image file was in use even after I disposed of the object in memory (the last step was to remove the unresized image).</p>
<p>Calling object.Dispose() is just a suggestion to say &#8220;whenever you want, we don&#8217;t need this in memory anymore&#8221;.  However, because it doesn&#8217;t get rid of it immediately, meaning that it is still being referenced which means that the file won&#8217;t be able to be deleted immediately.</p>
<p>In order to get around this, you need to call the garbage collector yourself to force the application to get rid of the object from memory.</p>
<p>The Code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">string</span> dest <span style="color: #008000;">=</span> <span style="color: #666666;">@&quot;C:\&quot;</span><span style="color: #008000;">;</span>
FileInfo imageFile <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> FileInfo<span style="color: #008000;">&#40;</span>file<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
Image image <span style="color: #008000;">=</span> ResizeImage<span style="color: #008000;">&#40;</span>Image<span style="color: #008000;">.</span><span style="color: #0000FF;">FromFile</span><span style="color: #008000;">&#40;</span>file<span style="color: #008000;">&#41;</span>,size<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// Save the file to the file system</span>
SaveAsJpeg<span style="color: #008000;">&#40;</span>image, dest <span style="color: #008000;">+</span> imageFile<span style="color: #008000;">.</span><span style="color: #0000FF;">Name</span>, <span style="color: #FF0000;">100</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// We don't need the image in memory any more (suggest it to be deleted)</span>
image<span style="color: #008000;">.</span><span style="color: #0000FF;">Dispose</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// Call the garbage collector</span>
GC<span style="color: #008000;">.</span><span style="color: #0000FF;">Collect</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
GC<span style="color: #008000;">.</span><span style="color: #0000FF;">WaitForPendingFinalizers</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// Delete the old file</span>
imageFile<span style="color: #008000;">.</span><span style="color: #0000FF;">Delete</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.andrewjudd.ca/2011/08/objects-remaining-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Backup</title>
		<link>http://blog.andrewjudd.ca/2011/08/windows-backup/</link>
		<comments>http://blog.andrewjudd.ca/2011/08/windows-backup/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 21:09:38 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Microsoft Windows]]></category>

		<guid isPermaLink="false">http://blog.andrewjudd.ca/?p=85</guid>
		<description><![CDATA[I started using Windows 7 a lot more recently (due to work) and I found that my system would go down every so often after installing a Windows update (the most recent happened today, the day after I installed the update). The only saving grace now is Windows Backup. I have set it to run [...]]]></description>
			<content:encoded><![CDATA[<p>I started using Windows 7 a lot more recently (due to work) and I found that my system would go down every so often after installing a Windows update (the most recent happened today, the day after I installed the update).</p>
<p>The only saving grace now is Windows Backup.  I have set it to run every Sunday night and it basically takes an image of all modifications to my C:\ drive and backs it to my secondary drive.  Now when a Windows update chooses to have it&#8217;s way with my computer, I am able to pop in the recovery CD and have it restore.  Yes, it takes a while to run, but I don&#8217;t need to format and re-install everything again (a few days worth of installing different versions of Visual Studio and SQL Server).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewjudd.ca/2011/08/windows-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t use File when you mean Directory</title>
		<link>http://blog.andrewjudd.ca/2011/07/file-directory/</link>
		<comments>http://blog.andrewjudd.ca/2011/07/file-directory/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 17:49:21 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blog.andrewjudd.ca/?p=77</guid>
		<description><![CDATA[I was working on a small archiving task for a project and one of the steps is to move a folder from one location to another. Not thinking anything of it, I tried to use File.Exists(archiveFullPath) assuming that a directory would also be considered a file. But for every folder I tried it kept returning [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on a small archiving task for a project and one of the steps is to move a folder from one location to another. Not thinking anything of it, I tried to use File.Exists(archiveFullPath) assuming that a directory would also be considered a file. But for every folder I tried it kept returning false despite them actually existing.</p>
<p>So then I tried switching it over to the similar function but under the Directory object (Directory.Exists(archiveFullPath)) and it worked like a charm, returning true for the specific directories which I knew existed.</p>
<p>To make a long story short, if you are trying to do anything with a directory, use the Directory object instead of the File because directories aren&#8217;t treated the same as files.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #6666cc; font-weight: bold;">string</span> path <span style="color: #008000;">=</span> <span style="color: #666666;">@&quot;C:\testing\&quot;</span><span style="color: #008000;">;</span>
    <span style="color: #6666cc; font-weight: bold;">string</span> working <span style="color: #008000;">=</span> path <span style="color: #008000;">+</span> <span style="color: #666666;">@&quot;Working\&quot;</span><span style="color: #008000;">;</span>
    <span style="color: #6666cc; font-weight: bold;">string</span> archive <span style="color: #008000;">=</span> path <span style="color: #008000;">+</span> <span style="color: #666666;">@&quot;Archive\&quot;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">// Outputs: false</span>
    Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>File<span style="color: #008000;">.</span><span style="color: #0000FF;">Exists</span><span style="color: #008000;">&#40;</span>path<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">// Outputs: false</span>
    Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>File<span style="color: #008000;">.</span><span style="color: #0000FF;">Exists</span><span style="color: #008000;">&#40;</span>working<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">// Outputs: true</span>
    Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>Directory<span style="color: #008000;">.</span><span style="color: #0000FF;">Exists</span><span style="color: #008000;">&#40;</span>path<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">// Outputs: true</span>
    Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>Directory<span style="color: #008000;">.</span><span style="color: #0000FF;">Exists</span><span style="color: #008000;">&#40;</span>working<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">// Put the thread to sleep temporarily</span>
    Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">Sleep</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">100000</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> 
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.andrewjudd.ca/2011/07/file-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determining Long Running Queries Programmatically</title>
		<link>http://blog.andrewjudd.ca/2011/07/determining-long-running-queries-programmatically/</link>
		<comments>http://blog.andrewjudd.ca/2011/07/determining-long-running-queries-programmatically/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 17:25:04 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://blog.andrewjudd.ca/?p=71</guid>
		<description><![CDATA[I recently needed to figure out what queries were taking the longest to run. I could complete this by using the Execution Plan, however if the slow running query is part of a data load, that is a little harder to do (it requires you to stop the data load to run the steps manually). [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to figure out what queries were taking the longest to run. I could complete this by using the Execution Plan, however if the slow running query is part of a data load, that is a little harder to do (it requires you to stop the data load to run the steps manually).</p>
<p>Luckily I found a nice set of 2 queries that help to filter out which are the slow queries. They are as follows:</p>
<p>This first query just provides information about some of the queries which are currently being run on the server along with their specific process ids so that we can dig deeper into them later on.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span>  p<span style="color: #66cc66;">.</span>spid <span style="color: #66cc66;">,</span>
        <span style="color: #993333; font-weight: bold;">RIGHT</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">CONVERT</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">,</span> DATEADD<span style="color: #66cc66;">&#40;</span>ms<span style="color: #66cc66;">,</span>
                                       DATEDIFF<span style="color: #66cc66;">&#40;</span>ms<span style="color: #66cc66;">,</span> P<span style="color: #66cc66;">.</span>last_batch<span style="color: #66cc66;">,</span> GETDATE<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
                                       <span style="color: #ff0000;">'1900-01-01'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">121</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'batch_duration'</span> <span style="color: #66cc66;">,</span>
        P<span style="color: #66cc66;">.</span>program_name <span style="color: #66cc66;">,</span>
        P<span style="color: #66cc66;">.</span>hostname <span style="color: #66cc66;">,</span>
        P<span style="color: #66cc66;">.</span>loginame
<span style="color: #993333; font-weight: bold;">FROM</span>    master<span style="color: #66cc66;">.</span>dbo<span style="color: #66cc66;">.</span>sysprocesses P
<span style="color: #993333; font-weight: bold;">WHERE</span>   P<span style="color: #66cc66;">.</span>spid <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">50</span>
        <span style="color: #993333; font-weight: bold;">AND</span> P<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">STATUS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'background'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'sleeping'</span> <span style="color: #66cc66;">&#41;</span>
        <span style="color: #993333; font-weight: bold;">AND</span> P<span style="color: #66cc66;">.</span>cmd <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'AWAITING COMMAND'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'MIRROR HANDLER'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'LAZY WRITER'</span><span style="color: #66cc66;">,</span>
                           <span style="color: #ff0000;">'CHECKPOINT SLEEP'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'RA MANAGER'</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> batch_duration <span style="color: #993333; font-weight: bold;">DESC</span></pre></div></div>

<p>After running the first query, you are able to retrieve the process id and then pass that into the following query to receive the actual body of the query being executed (replacing XXX with the actual process id).</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">DECLARE</span> @spid <span style="color: #993333; font-weight: bold;">INT</span> <span style="color: #66cc66;">,</span>
    @stmt_start <span style="color: #993333; font-weight: bold;">INT</span> <span style="color: #66cc66;">,</span>
    @stmt_end <span style="color: #993333; font-weight: bold;">INT</span> <span style="color: #66cc66;">,</span>
    @sql_handle <span style="color: #993333; font-weight: bold;">BINARY</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- Fill this in</span>
<span style="color: #993333; font-weight: bold;">SET</span> @spid <span style="color: #66cc66;">=</span> XXX
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span> TOP <span style="color: #cc66cc;">1</span>
        @sql_handle <span style="color: #66cc66;">=</span> sql_handle <span style="color: #66cc66;">,</span>
        @stmt_start <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">CASE</span> stmt_start
                        <span style="color: #993333; font-weight: bold;">WHEN</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #cc66cc;">0</span>
                        <span style="color: #993333; font-weight: bold;">ELSE</span> stmt_start <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>
                      <span style="color: #993333; font-weight: bold;">END</span> <span style="color: #66cc66;">,</span>
        @stmt_end <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">CASE</span> stmt_end
                      <span style="color: #993333; font-weight: bold;">WHEN</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span>
                      <span style="color: #993333; font-weight: bold;">ELSE</span> stmt_end <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>
                    <span style="color: #993333; font-weight: bold;">END</span>
<span style="color: #993333; font-weight: bold;">FROM</span>    master<span style="color: #66cc66;">.</span>dbo<span style="color: #66cc66;">.</span>sysprocesses
<span style="color: #993333; font-weight: bold;">WHERE</span>   spid <span style="color: #66cc66;">=</span> @spid
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> ecid
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span>  <span style="color: #993333; font-weight: bold;">SUBSTRING</span><span style="color: #66cc66;">&#40;</span>text<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">COALESCE</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULLIF</span><span style="color: #66cc66;">&#40;</span>@stmt_start<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
                  <span style="color: #993333; font-weight: bold;">CASE</span> @stmt_end
                    <span style="color: #993333; font-weight: bold;">WHEN</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">THEN</span> DATALENGTH<span style="color: #66cc66;">&#40;</span>text<span style="color: #66cc66;">&#41;</span>
                    <span style="color: #993333; font-weight: bold;">ELSE</span> <span style="color: #66cc66;">&#40;</span> @stmt_end <span style="color: #66cc66;">-</span> @stmt_start <span style="color: #66cc66;">&#41;</span>
                  <span style="color: #993333; font-weight: bold;">END</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">FROM</span>    ::
        fn_get_sql<span style="color: #66cc66;">&#40;</span>@sql_handle<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>I hope that this helps you as much as it helped me!</p>
<p>Source: <a title="Source" href="http://stackoverflow.com/questions/941763/list-the-queries-running-on-sql-server">http://stackoverflow.com/questions/941763/list-the-queries-running-on-sql-server</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewjudd.ca/2011/07/determining-long-running-queries-programmatically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hosting ASP.NET projects on a Linux Server</title>
		<link>http://blog.andrewjudd.ca/2011/06/hosting-asp-net-projects-on-a-linux-server/</link>
		<comments>http://blog.andrewjudd.ca/2011/06/hosting-asp-net-projects-on-a-linux-server/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 22:47:50 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blog.andrewjudd.ca/?p=67</guid>
		<description><![CDATA[The other day, I was bored and was curious if whether or not I was able to host an ASP.NET on my home desktop&#8217;s  Ubuntu box.  After researching, I found out that there was an entire open source project pertaining to this exact thing. I won&#8217;t go into much detail about it, but if you [...]]]></description>
			<content:encoded><![CDATA[<p>The other day, I was bored and was curious if whether or not I was able to host an ASP.NET on my home desktop&#8217;s  Ubuntu box.  After researching, I found out that there was an entire open source project pertaining to this exact thing.</p>
<p>I won&#8217;t go into much detail about it, but if you are curious search for the <a title="ASP.NET Mono Project" href="http://www.mono-project.com/ASP.NET" target="_blank">ASP.NET Mono Project</a> for more details.</p>
<p>The major issue that I had when setting it up was getting MonoDevelop to install and run.  The other issue was that the JavaScript postback when I was trying to host an ASP.NET 4.0 MVC project however when I went to a ASP 3.5 project, everything worked perfectly.  I will have to look more into why the ASP.NET 4.0 MVC application wasn&#8217;t working, but so far I&#8217;m happy with it <img src='http://blog.andrewjudd.ca/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewjudd.ca/2011/06/hosting-asp-net-projects-on-a-linux-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

