<?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>Pearl Tech &#187; Microsoft</title>
	<atom:link href="http://blog.pearltechnology.com/category/microsoft/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pearltechnology.com</link>
	<description></description>
	<lastBuildDate>Thu, 05 Jan 2012 14:47:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Microsoft Certification Prep Tips</title>
		<link>http://blog.pearltechnology.com/microsoft-certification-prep-tips/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/microsoft-certification-prep-tips/#comments</comments>
		<pubDate>Mon, 09 May 2011 16:47:15 +0000</pubDate>
		<dc:creator>Chad Ferguson</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[70-500]]></category>
		<category><![CDATA[70-501]]></category>
		<category><![CDATA[70-502]]></category>
		<category><![CDATA[70-503]]></category>
		<category><![CDATA[70-504]]></category>
		<category><![CDATA[70-505]]></category>
		<category><![CDATA[70-506]]></category>
		<category><![CDATA[70-507]]></category>
		<category><![CDATA[70-508]]></category>
		<category><![CDATA[70-509]]></category>
		<category><![CDATA[70-510]]></category>
		<category><![CDATA[70-511]]></category>
		<category><![CDATA[70-512]]></category>
		<category><![CDATA[70-513]]></category>
		<category><![CDATA[70-514]]></category>
		<category><![CDATA[70-515]]></category>
		<category><![CDATA[70-516]]></category>
		<category><![CDATA[70-517]]></category>
		<category><![CDATA[70-518]]></category>
		<category><![CDATA[70-519]]></category>
		<category><![CDATA[70-520]]></category>
		<category><![CDATA[70-521]]></category>
		<category><![CDATA[70-522]]></category>
		<category><![CDATA[70-523]]></category>
		<category><![CDATA[70-524]]></category>
		<category><![CDATA[70-525]]></category>
		<category><![CDATA[70-526]]></category>
		<category><![CDATA[70-527]]></category>
		<category><![CDATA[70-528]]></category>
		<category><![CDATA[70-529]]></category>
		<category><![CDATA[70-530]]></category>
		<category><![CDATA[70-531]]></category>
		<category><![CDATA[70-532]]></category>
		<category><![CDATA[70-533]]></category>
		<category><![CDATA[70-534]]></category>
		<category><![CDATA[70-535]]></category>
		<category><![CDATA[70-536]]></category>
		<category><![CDATA[70-537]]></category>
		<category><![CDATA[70-538]]></category>
		<category><![CDATA[70-539]]></category>
		<category><![CDATA[70-540]]></category>
		<category><![CDATA[70-541]]></category>
		<category><![CDATA[70-542]]></category>
		<category><![CDATA[70-543]]></category>
		<category><![CDATA[70-544]]></category>
		<category><![CDATA[70-545]]></category>
		<category><![CDATA[70-546]]></category>
		<category><![CDATA[70-547]]></category>
		<category><![CDATA[70-548]]></category>
		<category><![CDATA[70-549]]></category>
		<category><![CDATA[70-550]]></category>
		<category><![CDATA[70-551]]></category>
		<category><![CDATA[70-552]]></category>
		<category><![CDATA[70-553]]></category>
		<category><![CDATA[70-554]]></category>
		<category><![CDATA[70-555]]></category>
		<category><![CDATA[70-556]]></category>
		<category><![CDATA[70-557]]></category>
		<category><![CDATA[70-558]]></category>
		<category><![CDATA[70-559]]></category>
		<category><![CDATA[70-560]]></category>
		<category><![CDATA[70-561]]></category>
		<category><![CDATA[70-562]]></category>
		<category><![CDATA[70-563]]></category>
		<category><![CDATA[70-564]]></category>
		<category><![CDATA[70-565]]></category>
		<category><![CDATA[70-566]]></category>
		<category><![CDATA[70-567]]></category>
		<category><![CDATA[70-568]]></category>
		<category><![CDATA[70-569]]></category>
		<category><![CDATA[70-570]]></category>
		<category><![CDATA[70-571]]></category>
		<category><![CDATA[70-572]]></category>
		<category><![CDATA[70-573]]></category>
		<category><![CDATA[70-574]]></category>
		<category><![CDATA[70-575]]></category>
		<category><![CDATA[70-576]]></category>
		<category><![CDATA[70-577]]></category>
		<category><![CDATA[70-578]]></category>
		<category><![CDATA[70-579]]></category>
		<category><![CDATA[70-580]]></category>
		<category><![CDATA[70-581]]></category>
		<category><![CDATA[70-582]]></category>
		<category><![CDATA[70-583]]></category>
		<category><![CDATA[70-584]]></category>
		<category><![CDATA[70-585]]></category>
		<category><![CDATA[70-586]]></category>
		<category><![CDATA[70-587]]></category>
		<category><![CDATA[70-588]]></category>
		<category><![CDATA[70-589]]></category>
		<category><![CDATA[70-590]]></category>
		<category><![CDATA[70-591]]></category>
		<category><![CDATA[70-592]]></category>
		<category><![CDATA[70-593]]></category>
		<category><![CDATA[70-594]]></category>
		<category><![CDATA[70-595]]></category>
		<category><![CDATA[70-596]]></category>
		<category><![CDATA[70-597]]></category>
		<category><![CDATA[70-598]]></category>
		<category><![CDATA[70-599]]></category>
		<category><![CDATA[certification]]></category>
		<category><![CDATA[MCITP]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[MCPD]]></category>
		<category><![CDATA[MCTS]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1218</guid>
		<description><![CDATA[In recent years I have luckily been very successful with passing a few of Microsoft&#8217;s certification exams. Like many others when I first attempted certification I went out and acquired the typical textbooks and practice exams, spent several months reading and re-reading, and took the practice exams to the point that I didn&#8217;t even have [...]]]></description>
			<content:encoded><![CDATA[<p>In recent years I have luckily been very successful with passing a few of Microsoft&#8217;s certification exams. Like many others when I first attempted certification I went out and acquired the typical textbooks and practice exams, spent several months reading and re-reading, and took the practice exams to the point that I didn&#8217;t even have to read the question before answering. The result: I failed. A lot of the preparatory textbooks out there just do not cut it when helping you to prepare for the exam. Even though exam requirements usually dictate that you should have anywhere from 1-5 years experience in the particular subject matter, the books always seem to be written for an audience that has 0 years of experience. Much of the time leaving you feeling like the book taught you nothing and the exam content was a lot more in-depth than expected. Plus on top of all of that the exam materials are usually written before the exam is released and does not always cover the required materials as exam content is subject to change. Additionally, some of the preparatory material is known for unfortunately having a long list of errata, which just doesn&#8217;t cut it when you are trying to prepare for an exam. </p>
<p>So that brings me to my solution which is simple and free, and no it is not braindumps which will just hurt you in the long run. Microsoft provides you all you need to prepare by giving you the outline. Utilizing the outline and MSDN it is relatively easy, though very time consuming, to essentially frame out your own book that will be current and error free. So for example lets take a look at the outline for exam <a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-573&#038;locale=en-us">70-573: Microsoft SharePoint 2010, Application Development</a>. The first section deals with interacting with the Sharepoint UI via .NET, more specifically in the first bullet point of utilizing the SPWeb and SPSite objects. What I will do is copy the contents of the outline in to my own html file and proceed to seek out links, preferabbly to the MSDN, detailing the content that the bullet point refers to. So for the example of the 1st bullet point in exam 70-573 the outline has as follows: (Content is subject to change at Microsoft&#8217;s discretion)<br /><strong><br />
This objective may include but is not limited to: creating sub webs, referencing SPFiles, manipulating property bag, when to call Update, referencing SPContext, SPSite, SPWeb,  SPSite.OpenWeb, SPWeb.Webs, feature activiation and deactivation</p>
<p>This objective does not include: trivial cases such as setting title and other loose properties of the objects<br />
</strong></p>
<p>I then proceed to build up my content links similar to what I show here:<br />
<br />
<strong>This objective may include but is not limited to:</strong> </p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/ms473633.aspx">Site<br />
		Architecture</a></li>
<li>
		<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.aspx">SPFiles</a></li>
<li>
		<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spcontext.aspx">SPContext</a></li>
<li>
		<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsite.aspx">SPSite</a></li>
<li>
		<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsite.features.aspx"><br />
		SPSite.Features</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms431062.aspx"><br />
		SPFeatureCollection</a></li>
<li>
		<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.aspx">SPWeb</a></li>
<li>
		<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.features.aspx"><br />
		SPWeb.Features</a></li>
<li>
		<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.properties.aspx"><br />
		SPWeb.Properties</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms454879.aspx">SPSite.OpenWeb</a></li>
<li>
		<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.webs.aspx">SPWeb.Webs</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms465759.aspx"><br />
		SPWebCollection</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ee557362.aspx"><br />
		Disposal</a></li>
</ul>
<p>Not only are you getting the content from the source that the exams are based off, but as you delve deeper and deeper into the MSDN you will get a more fuller and rewarding experience then most of the preparatory textbooks will provide. This has become a popular technique for preparation over the past few years, and sometimes you may find bloggers that will post their MSDN linked outlines online, but usually I prefer to create my own since they may have excluded content that they didnt neccesarily need for their own preperation. So hopefully this technique will help you some in your own preparation, and good luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/microsoft-certification-prep-tips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Case Insensitive XML Search</title>
		<link>http://blog.pearltechnology.com/case-insensitive-xml-search/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/case-insensitive-xml-search/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 20:54:23 +0000</pubDate>
		<dc:creator>AaronH</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Case Insensitive]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[Parsing XML]]></category>
		<category><![CDATA[XDocument]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XmlDocument]]></category>
		<category><![CDATA[XPath]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1043</guid>
		<description><![CDATA[Often times you need to be able to search through XML snippets using case insensitivity. You may want to handle variations in user typing or just different system configuration setups (you may not have total control over the XML creation). On my venture to find the best case agnostic XML parsing in .NET, I came [...]]]></description>
			<content:encoded><![CDATA[<p>Often times you need to be able to search through XML snippets using case insensitivity. You may want to handle variations in user typing or just different system configuration setups (<i>you may not have total control over the XML creation</i>). On my venture to find the best case agnostic XML parsing in .NET, I came across only one way to do it using XPath and the translation function. I chose not to use translation since I needed a centralized reusable function to compare two element values. </p>
<p>My first discovery is that XPath in .NET only supports XPath 1.0 &#8211; meaning you don&#8217;t have many native functions to build from. However, Microsoft allows you to extend XPath using <a href="http://msdn.microsoft.com/en-us/library/dd567715.aspx">XSLT Context Extensions</a>. The process of setting up the extensions is quite tedious, but it would seem worth the effort if it can centralize reusable parsing functions. However, about this time I discovered that LINQ to XML would provide a great wrapper on top of the basic XmlDocument operations using XDocument. Here we go through the process used to create a reusable search routine for XML content.</p>
<p>To demonstrate our search process, we created a sample XML document (<a href="http://blog.pearltechnology.com/wp-content/uploads/2011/03/business.xml#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">business.xml</a>). Here is a brief section for reference.</p>
<pre name="code" language="xml">
<?xml version="1.0" encoding="utf-8" ?>
<company id="pt" name="Pearl Technology" description="software, IT support, and security solutions">
  <services count="5">
    <service id="appdev" name="Application Development" description="custom .NET software solutions" cost="350">
<products count="4">
<product id="biztlk" name="BizTalk Server" description="enterprise service bus"></product>
<product id="shrpnt" name="SharePoint Server" description="portal collaboration and Enterprise search"></product>
<product id="sqlsrv" name="SQL Server" description="relation database management system"></product>
<product id="iissrv" name="IIS" description="web application server"></product>
      </products>
    </service>
</services>
</company>
</pre>
<p>We want to now search for all services that match the given product name &#8220;Sharepoint&#8221;. Our first approach is to do the traditional XPath workflow using the XmlDocument class. Here is the snippet.</p>
<pre name="code" language="csharp">
             string searchKey = "Sharepoint"; // search string to find in product name

            // retrieve and load source XML document from output directory
            XmlDocument businessXML = new XmlDocument();
            businessXML.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "business.xml"));

            // parse using strictly XPath (could also use confusing translate function - but needs repeated for each call)
            string xPath = string.Format("/company/services/service[products/product[contains(@name,'{0}')]]", searchKey);
            var services = businessXML.SelectNodes(xPath);
            if (services != null &#038;&#038; services.Count > 0)
            {
                foreach (XmlNode node in services)
                    Console.WriteLine("{0}\n{1}", node.OuterXml, new string('-', 70));
            }
            else
                Console.WriteLine("Could not find search key: {0} using XPath", searchKey);
</pre>
<p>The results that come back demonstrate that we are not matching all possibilities. Pearl provides SharePoint services for both <a href="http://www.pearltechnology.com/services/application-development/app-dev-services/servers">Application Development</a> and <a href="http://www.pearltechnology.com/services/microsoft-services/products-expertise/microsoft-office-sharepoint-server-moss">Microsoft Services</a>. The problem with our basic XPath search is that it is not case agnostic. We have variations of &#8220;Sharepoint&#8221; in our data &#8211; <i>Sharepoint and SharePoint</i>. In order to capture all variations, we now tackle the same problem with LINQ to SQL and extension methods.</p>
<p>Below we see the use of XDocument in place of XmlDocument, now replaced by parsing the original XmlDocument source. We also include a reference to <i>System.Xml.XPath</i> namespace to enable XPath-support within the LINQ to XML statements (using <i>XPathSelectElements</i>). Our LINQ statement is using a similar XPath as before with the exception of the filtering which is now handled by the lambda function <strong>HasValue(searchkey)</strong>.</p>
<pre name="code" language="csharp">
            // simple parse using LINQ to XML and XPath for navigation (easier to understand)
            XElement bizXML = XDocument.Parse(businessXML.OuterXml).Root;
            var items = (from service in bizXML.XPathSelectElements("/company/services/service/products/product")
                         where service.Attributes("name").HasValue(searchKey)
                         select service.Parent.Parent);

            if (items != null &#038;&#038; items.Count() > 0)
            {
                foreach (XElement node in items)
                    Console.WriteLine(string.Format("{0}\n{1}", node.ToString(), new string('-', 70)));
            }
            else
                Console.WriteLine("Could not find search key: {0} using LINQ to XML", searchKey);
</pre>
<p>The lambda function (HasValue) exists in a utility class XMLSearchExtensions &#8211; satisfying our primary goal to create a reusable case agnostic search routine. The extension methods are filtering on XAttributes, but could easily be extended to cover enumerable XElements as well. </p>
<pre name="code" language="csharp">
    /// <summary>
    /// XML Extension Methods for parsing XML using case insensitivity
    /// </summary>
    public static class XMLSearchExtensions
    {
        /// <summary>
        /// Handles case when attribute is missing
        /// </summary>
        public static bool HasValue(this IEnumerable<XAttribute> nodes, string searchKey)
        {
            return nodes.Any(GetValue(searchKey));
        }
        /// <summary>
        /// Search Expression using Case Insensitve Compare (resusable search filter)
        /// </summary>
        public static Func<XAttribute, bool> GetValue(string searchKey)
        {
            return name => name.Value.ToLowerInvariant().Contains(searchKey.ToLowerInvariant());
        }
    }
</pre>
<p>The <strong>HasValue</strong> extension uses the <a href="http://msdn.microsoft.com/en-us/library/bb337697.aspx">Any</a> LINQ command to safely ignore cases when the attribute may not be present in the current enumerable item. This adds greater flexibility if you cannot control the XML source. The <strong>GetValue</strong> delegate is called for each item and by comparing each element using the <i>Contains</i> we can easily support case insensitive filtering with ease. We could also extend this library to support Equals, StartsWith, or other behaviors you want to centrally control.</p>
<p>The entire solution can be <a href="http://blog.pearltechnology.com/wp-content/uploads/2011/03/CaseInsensitiveXPathQuery.zip#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">downloaded here</a>. This exercise demonstrates the importance and sophistication that LINQ-powered applications can provide when working with XML.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/case-insensitive-xml-search/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to start Command Prompt at a designated directory</title>
		<link>http://blog.pearltechnology.com/how-to-start-command-prompt-at-a-designated-directory/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/how-to-start-command-prompt-at-a-designated-directory/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 22:18:59 +0000</pubDate>
		<dc:creator>Geer</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[CMD]]></category>
		<category><![CDATA[Start-up Directory]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=988</guid>
		<description><![CDATA[This article shows you how to start CMD at a designated directory]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong></p>
<p>There are several utility programs that I need to run on a regular basis, but none of them are registered in GAC.  To run those utilities, I have to open a CMD window, and navigate to the directory where they are located.  It starts getting annoying when I have to type cd &#8220;C:\Program Files\ProgramName\Version\bin&#8221; (which is the path to the directory where those utilities are stored) every time that I need to run these utilities.  It would be nice if there is a way to set the start-up directory of CMD so that when I start the CMD it navigates to the desired directory automatically.</p>
<p><strong>Solution 1 (not recommended):</strong></p>
<p>One option to do this is to change windows registry.  Actually, I was searching on Google, and found many on-line resources about this.  Here is one talking about  <a title="How to change the default startup directory for Command Prompt" href="http://windowsxp.mvps.org/autoruncmd.htm">How to change the default startup directory for Command Prompt?</a></p>
<p>However, as the article has mentioned, there may be risks associated with this method, and it may cause problems when I need to run windows or other regular utility programs, so it is not my favorite solution.  I guess the option may be more suitable in other cases, but not in mine.</p>
<p><strong>Solution 2 (my favorite):</strong></p>
<p>After messing around with the CMD.exe and windows shortcut properties, I finally found a much easier way to do what I needed to do.  Windows shortcuts have an option for &#8220;Start in&#8221; location which sets the start-up directory of CMD when it is executed.  So, all I needed to do was to create a shortcut on my desktop to CMD.exe, and set its &#8220;Start in&#8221; location to &#8220;C:\Program Files\ProgramName\Version\bin&#8221;. (See the screen shot below)</p>
<p><img class="aligncenter size-full wp-image-991" title="CMD Shortcut Properties" src="http://blog.pearltechnology.com/wp-content/uploads/2011/02/CMD-Shortcut.JPG" alt="CMD Shortcut Properties" width="386" height="533" /></p>
<p>Now, when I launch the shortcut, it starts a regular CMD window and sets the current directory to the right directory (which is &#8220;C:\Program Files\ProgramName\Version\bin&#8221; in my case).  Easy enough?</p>
<p><img class="aligncenter size-full wp-image-992" title="CMD" src="http://blog.pearltechnology.com/wp-content/uploads/2011/02/CMD.JPG" alt="CMD" width="571" height="288" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/how-to-start-command-prompt-at-a-designated-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Locating a Test Site &#8211; No Dates Found</title>
		<link>http://blog.pearltechnology.com/locating-a-test-site-no-dates-found/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/locating-a-test-site-no-dates-found/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 15:40:00 +0000</pubDate>
		<dc:creator>AaronH</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[certification]]></category>
		<category><![CDATA[microsoft gold partner]]></category>
		<category><![CDATA[microsoft partner]]></category>
		<category><![CDATA[pdi]]></category>
		<category><![CDATA[pinpoint]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=972</guid>
		<description><![CDATA[Being Microsoft Gold Partners we have a strong push to keep ourselves abreast with the latest Microsoft technology offerings. One way we prove our expertise of a given knowledge domain is by taking Microsoft Certification exams. We use Prometric to schedule our Microsoft tests with our local testing center &#8211; ICC&#8217;s Professional Development Institute (PDI). [...]]]></description>
			<content:encoded><![CDATA[<p>Being <a href="http://pinpoint.microsoft.com/en-US/PartnerDetails.aspx?PartnerId=4295809996">Microsoft Gold Partners</a> we have a strong push to keep ourselves abreast with the latest Microsoft technology offerings. One way we prove our expertise of a given knowledge domain is by taking <a href="http://www.microsoft.com/learning/en/us/certification/cert-default.aspx">Microsoft Certification exams</a>. We use <a href="http://prometric.com/Microsoft">Prometric</a> to schedule our Microsoft tests with our local testing center &#8211; ICC&#8217;s <a href="http://www.icc.edu/pdi/">Professional Development Institute (PDI)</a>. However, we began noticing that some of the newer Microsoft tests were not available to be scheduled at PDI &#8211; forcing us to travel outside our local region.</p>
<p>Prometric would provide this error message when trying to schedule the certification exams &#8211; <em>&#8220;No Dates Found &#8211; We&#8217;re sorry. We couldn&#8217;t find any Exam Dates based on the selections you&#8217;ve made. Please try another Test Center&#8221;.</em></p>
<p>After contacting PDI, we discovered that some testing centers may limit their hours of operation and cannot accommodate the longer testing time slots. In this case, PDI was limiting their tests to 3 hours, yet some of the newer Microsoft exams are 3.5+ hours. Thankfully the testing center was willing to change their testing hours to allow us to keep local &#8211; thus saving us travel costs, time, and convenience. Kudos to PDI for their help! Hopefully this will someone else who may have experienced this issue with the Prometric exam scheduling system.</p>
<p>So how long can Microsoft keep us captive in the testing center? According to Microsoft, the maximum test duration is <a href="http://www.microsoft.com/learning/en/us/certification/exam-prep.aspx#tab2">4 hours</a>. Thank goodness for time limits! Now back to the studying&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/locating-a-test-site-no-dates-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Indexing PDF Documents using SQL Server</title>
		<link>http://blog.pearltechnology.com/indexing-pdf-documents-using-sql-server/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/indexing-pdf-documents-using-sql-server/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 14:50:45 +0000</pubDate>
		<dc:creator>AaronH</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Filestream]]></category>
		<category><![CDATA[Full-Text Index]]></category>
		<category><![CDATA[PDF Indexing]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=885</guid>
		<description><![CDATA[SQL Server 2008 now makes it easier than ever to index your stored content. Many businesses are using SQL Server to save important documents and be able to retrieve them based upon their content. Unfortunately, certain file formats are tougher to index than others due to how their files are physically structured or encoded. In [...]]]></description>
			<content:encoded><![CDATA[<p>SQL Server 2008 now makes it easier than ever to index your stored content. Many businesses are using SQL Server to save important documents and be able to retrieve them based upon their content. Unfortunately, certain file formats are tougher to index than others due to how their files are physically structured or encoded. In this article, we will describe how SQL Server can support Full-Text Indexing for the PDF document format.</p>
<p>The first step to enabling PDF indexing is to ensure that the Full-Text Index Daemon service is running. This service is responsible for working with 3rd party iFilters to extract textual content from non-Microsoft formats (<i>PDF iFilter in this case</i>).</p>
<p><center><br />
<a href="http://blog.pearltechnology.com/wp-content/uploads/2010/12/sql-server-pdf-indexing-service.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img src="http://blog.pearltechnology.com/wp-content/uploads/2010/12/sql-server-pdf-indexing-service-300x32.png" alt="sql server pdf indexing - service" title="sql server pdf indexing - service" width="300" height="32" class="aligncenter size-medium wp-image-886" /></a><br />
</center></p>
<p>Once we&#8217;ve verified that the Filter Index is enabled, we need to install the <a href="http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025">PDF iFilter </a> from Adobe. Depending on which SQL Edition you have, you need to download the x86 or x64 version of the PDF iFilter. </p>
<p>After the iFilter has been installed, you need to <a href="http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/69535dbc-c7ef-402d-a347-d3d3e4860d72/#405d534f-1a4a-493b-ba68-77370bc28f7d">setup a system Environment Path variable</a> which helps SQL locate the newly installed indexing filter. Below we show that the PATH variable has been modified to include our installation path of the Adobe iFilter (<i>C:\Program Files\Adobe\Adobe PDF iFilter 9 for 64-bit platforms\bin\</i> in our case)</p>
<p><center><br />
<a href="http://blog.pearltechnology.com/wp-content/uploads/2010/12/sql-server-pdf-indexing-environment-variable.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img src="http://blog.pearltechnology.com/wp-content/uploads/2010/12/sql-server-pdf-indexing-environment-variable-300x161.png" alt="sql server pdf indexing - environment variable" title="sql server pdf indexing - environment variable" width="300" height="161" class="aligncenter size-medium wp-image-888" /></a><br />
</center></p>
<p>After we have the Adobe iFilter configured, we can configure our SQL Database to make use of this new component. Our next step is to tell SQL Server we have a new iFilter that needs to be registered. After running the commands below, you should see a list of the active iFilters appear in SSMS &#8211; you should verify that you see PDF listed.</p>
<pre name="code" language="sql">
-- reloading filters/3rd party components
EXEC sp_fulltext_service @action='load_os_resources', @value=1; -- update os resources
EXEC sp_fulltext_service 'verify_signature', 0 -- don't verify signatures
EXEC sp_fulltext_service 'update_languages'; -- update language list
EXEC sp_fulltext_service 'restart_all_fdhosts'; -- restart daemon
EXEC sp_help_fulltext_system_components 'filter'; -- view active filters
</pre>
<p>SQL Server is now prepared to handle PDF content, however we need to create the Full-Text Catalog and Index to enable query support. We are assuming you already have a VARBINARY(MAX) field setup &#8211; hopefully backed using a <a href="http://technet.microsoft.com/en-us/library/bb933993.aspx">FILESTREAM</a>. If your SQL Table stores multiple file formats, you should also create a column in your table that tells the indexer what iFilter it should use to index the content (<i>the TYPE COLUMN indicator</i>). The following SQL statements will create the SQL Catalog (ftCatalog), Full-Text Index with system stop list, and a file extension column for the CardImages table that has a BLOB field ThumbImage.</p>
<pre name="code" language="sql">
-- creatae full-text catalog
CREATE FULLTEXT CATALOG ftCatalog AS DEFAULT

-- create file extension column
ALTER TABLE dbo.CardImages add FileExtension varchar(4) not null default('pdf') 

-- create fulltext index
CREATE FULLTEXT INDEX  ON dbo.CardImages (ThumbImage TYPE COLUMN FileExtension LANGUAGE 'English')
KEY INDEX PK_CardImages on ftCatalog -- unique index
WITH STOPLIST = SYSTEM -- default system index
</pre>
<p>Once we have the index defined for our SQL table, we can check the index status or re-index using the following commands. If our indexing status value is &#8216;0&#8242;, SQL Server is ready to respond to PDF searches.</p>
<pre name="code" language="sql">
ALTER FULLTEXT INDEX ON dbo.CardImages START FULL POPULATION; -- re-index
select FULLTEXTCATALOGPROPERTY('ftCatalog', 'PopulateStatus') -- 1 indicates running
</pre>
<p>To issue a standard SQL search queries we can use CONTAINS or FREETEXT depending on what our intentions are. Below are some examples on how to query the newly generated index. </p>
<pre name="code" language="sql">
-- contains search
select * from CardImages where contains(ThumbImage, 'pearl technology rocks')

-- freetext search - searches for meaning of words
select * from CardImages where freetext(ThumbImage, 'cardinals')
</pre>
<p>One of the issues that this SQL Server search approach does not solve is providing context around your search terms (<i>&#8216;pearl technology rocks&#8217; and &#8216;cardinals&#8217; above.</i>). We will be reviewing this gap in the future and hopefully providing some insights into how we can find the paragraph or sentence where the search term was located in the text &#8211; instead of merely returning the matching rows. </p>
<p>There were many sites that helped in troubleshooting issues during this process, but StackOverflow has some <a href="http://stackoverflow.com/questions/272694/using-full-text-search-with-pdf-files-in-sql-server-2005<br />
">good steps to follow</a> if you run into any trouble.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/indexing-pdf-documents-using-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting more out of visual studio 2010</title>
		<link>http://blog.pearltechnology.com/getting-more-out-of-visual-studio-2010/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/getting-more-out-of-visual-studio-2010/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 14:16:34 +0000</pubDate>
		<dc:creator>GregO</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=836</guid>
		<description><![CDATA[Although extensions have been available for visual studio for quite a while, the addition of the extension manager in visual studio 2010 has made it easier to install and keep your extensions up-to-date.

The manager makes it much easier to see what extensions are available and allows easy access to detailed information about each extension. It [...]]]></description>
			<content:encoded><![CDATA[<p>Although extensions have been available for visual studio for quite a while, the addition of the extension manager in visual studio 2010 has made it easier to install and keep your extensions up-to-date.</p>
<p style="text-align: center"><img class="size-full wp-image-837 aligncenter" src="http://blog.pearltechnology.com/wp-content/uploads/2010/10/EMMenu.jpg" alt="EMMenu" width="247" height="265" /></p>
<p>The manager makes it much easier to see what extensions are available and allows easy access to detailed information about each extension. It also helps you keep you installed extensions up to date by notifying you of any changes.</p>
<p style="text-align: center"><img class="size-full wp-image-838 aligncenter" src="http://blog.pearltechnology.com/wp-content/uploads/2010/10/ExtensionManager.jpg" alt="ExtensionManager" width="563" height="391" /></p>
<p>Two of my favorite extensions are PowerCommands and the Productivity Power Tools. PowerCommands adds the “Open Containing Folder” command to the solution explorer. This allows you to quickly navigate to the folder that contains your source code.  This feature alone makes it worth installing. There are several other handy features that enhance copy and paste as well as document management. You can find more info <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/e5f41ad9-4edc-4912-bca3-91147db95b99">here</a>.</p>
<p style="text-align: center"><img class="size-full wp-image-839 aligncenter" src="http://blog.pearltechnology.com/wp-content/uploads/2010/10/PowerCommandMenu.jpg" alt="PowerCommandMenu" width="233" height="233" /></p>
<p>The Productivity Power Tools extension is one of the most useful extensions available. Some of the best features include auto brace competition, a searchable Add Reference Dialog, Column Guides, Solution Navigator (which is a much improved version of the solution explorer), and tons of improvements to the document tabs. You can find more info <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef">here</a>.</p>
<p>Take a few minutes to look through the extension gallery. You might be surprised what features you never knew you were missing from Visual Studio 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/getting-more-out-of-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying MVC 2 Applications using .NET 4.0</title>
		<link>http://blog.pearltechnology.com/deploying-mvc-2-applications-using-net-4-0/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/deploying-mvc-2-applications-using-net-4-0/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 07:28:24 +0000</pubDate>
		<dc:creator>AaronH</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=742</guid>
		<description><![CDATA[We just began working with the new MVC 2 framework that is now included in Visual Studio 2010. MVC 2 leverages .NET 4.0 and is a commonly used design pattern in other developer communities. 
To deploy MVC 2 applications, you just right click on your visual studio project and click &#8220;Publish&#8221;. 



A wizard pops open [...]]]></description>
			<content:encoded><![CDATA[<p>We just began working with the new <a href="http://www.asp.net/mvc">MVC 2</a> framework that is now included in Visual Studio 2010. MVC 2 leverages .NET 4.0 and is a commonly used design pattern in other developer communities. </p>
<p>To deploy MVC 2 applications, you just right click on your visual studio project and click &#8220;Publish&#8221;. </p>
<p><center><br />
<a href="http://blog.pearltechnology.com/wp-content/uploads/2010/05/mvc-publish-menu.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img src="http://blog.pearltechnology.com/wp-content/uploads/2010/05/mvc-publish-menu-300x156.png" alt="mvc publish menu" title="mvc publish menu" width="300" height="156" class="aligncenter size-medium wp-image-744" /></a><br />
</center></p>
<p>A wizard pops open and allows you to assign where you want to publish your site to. In our case, we just used the filesystem so we could cleanup the folders prior to copying them to the server.</p>
<p><center><br />
<a href="http://blog.pearltechnology.com/wp-content/uploads/2010/05/mvc-publish-wizard.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img src="http://blog.pearltechnology.com/wp-content/uploads/2010/05/mvc-publish-wizard-300x283.png" alt="mvc publish wizard" title="mvc publish wizard" width="300" height="283" class="aligncenter size-medium wp-image-745" /></a><br />
</center></p>
<p>The first gotcha we ran into when deploying our MVC application was not having .NET 4.0 installed on the Windows Server 2008 standard. A quick 50MB download of the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0a391abd-25c1-4fc0-919f-b21f31ab88b7&#038;displaylang=en">.NET 4.0 Redistributable</a> from Microsoft and a brief install and reboot corrected this issue. </p>
<p>After reboot, we created our website in IIS and assigned the physical directory path. When we tried browsing to the website we discovered this error message &#8211; &#8220;Unrecognized attribute targetFramework&#8221; from the web.config. </p>
<p><center><br />
<a href="http://blog.pearltechnology.com/wp-content/uploads/2010/05/mvc-targetFramework-error.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img src="http://blog.pearltechnology.com/wp-content/uploads/2010/05/mvc-targetFramework-error-300x156.png" alt="mvc targetFramework error" title="mvc targetFramework error" width="300" height="156" class="aligncenter size-medium wp-image-753" /></a><br />
</center></p>
<p>With help from <a href="http://elegantcode.com/2009/11/10/unrecognized-attribute-targetframework-asp-net-4-0/">this article</a>, we correctly assigned the Application Pool to run as a .NET 4.0 application. </p>
<p><center><br />
<a href="http://blog.pearltechnology.com/wp-content/uploads/2010/05/mvc-app-pool-setup.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img src="http://blog.pearltechnology.com/wp-content/uploads/2010/05/mvc-app-pool-setup-273x300.png" alt="mvc app pool setup" title="mvc app pool setup" width="273" height="300" class="aligncenter size-medium wp-image-747" /></a><br />
</center></p>
<p>With the recent release of .NET 4.0, a new CLR was created to handle the dynamic languages integration. Previously, the only CLR&#8217;s available for ASP.NET applications were .NET 1.1 and .NET 2.0. With .NET 4.0, we now have a new target framework to be aware of.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/deploying-mvc-2-applications-using-net-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enterprise Library Logger.Write Not Working?</title>
		<link>http://blog.pearltechnology.com/enterprise-library-logger-write-not-working/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/enterprise-library-logger-write-not-working/#comments</comments>
		<pubDate>Mon, 17 May 2010 21:29:50 +0000</pubDate>
		<dc:creator>Geer</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Enterprise Library]]></category>
		<category><![CDATA[Logger]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=697</guid>
		<description><![CDATA[Using Logging Application Block provided by Enterprise Library is a common way of logging exceptions in .NET applications.  It&#8217;s easy to setup and to use.  One problem I had a while ago was that it worked while on my development PC, but stopped working once it&#8217;s deployed.
What I was doing was to use it to [...]]]></description>
			<content:encoded><![CDATA[<p>Using Logging Application Block provided by Enterprise Library is a common way of logging exceptions in .NET applications.  It&#8217;s easy to setup and to use.  One problem I had a while ago was that it worked while on my development PC, but stopped working once it&#8217;s deployed.</p>
<p>What I was doing was to use it to write event entries in windows event log as part of the exception handling in an ASP.NET web application.  Nothing fancy.  It worked fine on my PC, but it didn&#8217;t write anything to the event log when Logger.Write is executed. No exception was thrown from that line of code either.  The program just went through as if that line of code was skipped.</p>
<p>It turned out to be a permission issue. When I debug the application in Visual Studio, it was running under my windows account credential which had permission to create Event Source in the system.  However, when the application was deployed to the server, it was running under the default account which was &#8220;NT Authority\Network Service&#8221; in my case.  By default, that account doesn&#8217;t have permission to create new Event Source in the system.  It does have permission to write event entries though.  So, when Logger.Write was executed, it couldn&#8217;t proceed because the Event Source wasn&#8217;t there, and the program didn&#8217;t have permission to create one.  Actually, it makes sense to not throw any exception on this line, because people like me usually use this to log exceptions, and if the logging process itself throws exceptions, there is probably nowhere else we can handle and/or log them.</p>
<p>Now, how this can be resolve?  The solution is quite simple.  As long as the Event Source is created ahead of time, it will be no problem.  What I did was to create required Event Source(s) on server through CMD.exe.  Here is a sample command:</p>
<p><span style="color: #0000ff"><code>eventcreate /ID 1 /L Application /T information /SO "My Event Source" /D "My Event Source is created."</code></span></p>
<p>This command will create an event entry in the Application log.  If the Event Source doesn&#8217;t exist, it will be created during the process.  This is only required when the application is deployed to the server first time.  So, I usually do it manually on server.  However, if that&#8217;s not the case, you can build it into the installation package, and when the application is installed, the Event Source is created as well.  Of course, you can use .NET to create Event Source in your installer too.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/enterprise-library-logger-write-not-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exception Handling in ASP.NET Web Application</title>
		<link>http://blog.pearltechnology.com/exception-handling-in-asp-net-web-application/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/exception-handling-in-asp-net-web-application/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 22:14:09 +0000</pubDate>
		<dc:creator>Geer</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Exception Handling]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=687</guid>
		<description><![CDATA[In web application development, we should always think about returning some kind of message to users when an exception is raised in the program.  Sometimes, it can be very specific, while in other cases it can be generic.  A common thought is to capture and possibly handle exceptions where they are raised, re-throw exceptions or [...]]]></description>
			<content:encoded><![CDATA[<p>In web application development, we should always think about returning some kind of message to users when an exception is raised in the program.  Sometimes, it can be very specific, while in other cases it can be generic.  A common thought is to capture and possibly handle exceptions where they are raised, re-throw exceptions or raise custom exceptions as needed so they can propagate up to higher level tiers in the application, handle/log exceptions at a central place in the highest tier of the application, and finally display an error message to the end-users or redirect them to a customized error page.</p>
<p>This pattern works, but sometimes it is tricky to generate a meaningful message.  The problem is that the exception can be thrown anywhere in your application, and the exception message may not always be appropriate or meaningful to end-users.  If you blindly display all exception messages you finally get, users may see something like &#8220;Object reference not set to an instance of an object&#8221; which doesn&#8217;t mean much to them.  So, in the final step of exception handling (where the program displays error messages or redirect users to an error page), you will see all kinds of exceptions which include .NET originated exceptions, exceptions raised by the program on purpose, and custom exceptions.  Some of them are appropriate to show to users, while others aren&#8217;t.  So, the question is how you can distinguish among them.</p>
<p>A lot of people suggest that if the original .NET exception message isn&#8217;t meaningful to users, and you can&#8217;t provide more specific message either, then a generic message such as &#8220;An error has occurred&#8230;  Please contact the technical support team for help&#8221; can be used.  I agree too.  You may do this where you know an exception can be thrown, and re-throw the exception with customized message (whether specific or generic) and with the original exception embedded as the inner exception of the new exception.  However, you don&#8217;t want to just put try/catch blocks in every piece of your code, and catch and re-throw every exception the program may possibly encounter.  It&#8217;s labor intensive and inefficient.  Also, there will always be something you can&#8217;t think of or look over, so there are still chances you can get unexpected exceptions in the end.</p>
<p>So, my solution is to let the program only catch and re-throw .NET originated exceptions when they are predictable and additional meaningful information can be provided, and let all other exceptions bubble up to the top tier.  Then in the final step of exception handling, identify the exceptions that are re-thrown, and retrieve the error message directly from these exceptions; use a generic error message for all other exceptions.  The question is how to identify these exceptions that are re-thrown.  For this purpose, I usually create a custom exception class which is inherited from System.Exception.  Use this class whenever I need to throw new exceptions or re-throw .NET originated exceptions.  So, in the final step, I check the type of the exception, and decide whether to use it as the error message or use a generic one instead.</p>
<p>Here is the custom exception class:</p>
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2.5em;padding: 0 0 0 5px">
<li><span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">ExceptionBase</span> : <span style="color:#2b91af">Exception</span></li>
<li>{</li>
<li><span style="color:#0000ff">public</span> ExceptionBase(<span style="color:#0000ff">string</span> msg, <span style="color:#2b91af">Exception</span> innerEx)</li>
<li>: <span style="color:#0000ff">base</span>(msg, innerEx)</li>
<li>{</li>
<li>}</li>
<li><span style="color:#0000ff">public</span> ExceptionBase(<span style="color:#0000ff">string</span> msg)</li>
<li>: <span style="color:#0000ff">base</span>(msg)</li>
<li>{</li>
<li>}</li>
<li>}</li>
</ol>
</div>
</div>
<p>The ExceptionBase class has two constructors which give you the options to create an instance of exception with customized error message and with/without inner exception.</p>
<p>Here is how to use it in code:</p>
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color:#0000ff">throw</span> <span style="color:#0000ff">new</span> <span style="color:#2b91af">ExceptionBase</span>(<span style="color:#a31515">&#8220;Error has occurred in accessing database.&#8221;</span>);</li>
</ol>
</div>
</div>
<p>Or</p>
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color:#0000ff">try</span></li>
<li>{</li>
<li><span style="color:#008000">// Data access operations</span></li>
<li>}</li>
<li><span style="color:#0000ff">catch</span> (<span style="color:#2b91af">Exception</span> ex)</li>
<li>{</li>
<li><span style="color:#0000ff">throw</span> <span style="color:#0000ff">new</span> <span style="color:#2b91af">ExceptionBase</span>(<span style="color:#a31515">&#8220;Error has occurred in accessing database.&#8221;</span>, ex);</li>
<li>}</li>
</ol>
</div>
</div>
<p>The central location I handle all exceptions is in global.asax, and here is what it looks like:</p>
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2.5em;padding: 0 0 0 5px">
<li><span style="color:#0000ff">protected</span> <span style="color:#0000ff">void</span> Application_Error(<span style="color:#0000ff">object</span> sender, <span style="color:#2b91af">EventArgs</span> e)</li>
<li>{</li>
<li><span style="color:#2b91af">Exception</span> ex = Server.GetLastError();</li>
<li><span style="color:#0000ff">string</span> msg = <span style="color:#a31515">&#8220;Unexpected error has occurred.&#8221;</span>;</li>
<li><span style="color:#0000ff">if</span> (ex != <span style="color:#0000ff">null</span>)</li>
<li>{</li>
<li><span style="color:#2b91af">LoggingUtility</span>.LogException(ex);</li>
<li><span style="color:#008000">// Remove the HttpUnhandledException wrapper if there is one</span></li>
<li><span style="color:#0000ff">if</span> (ex.GetType() == <span style="color:#0000ff">typeof</span>(<span style="color:#2b91af">HttpUnhandledException</span>) &amp;&amp; ex.InnerException != <span style="color:#0000ff">null</span>)</li>
<li>{</li>
<li>ex = ex.InnerException;</li>
<li>}</li>
<li><span style="color:#008000">// If this is a custom exception, change the message.</span></li>
<li><span style="color:#0000ff">if</span> (ex <span style="color:#0000ff">is</span> <span style="color:#2b91af">ExceptionBase</span>)</li>
<li>msg = ex.Message;</li>
<li>Server.ClearError();</li>
<li>}</li>
<li><span style="color:#008000">// Try to redirect user.</span></li>
<li>Response.Redirect(<span style="color:#0000ff">string</span>.Format(<span style="color:#a31515">&#8220;~/Error.htm?aspxerrorpath={0}&amp;error={1}&#8221;</span>, <span style="color:#2b91af">HttpUtility</span>.UrlEncodeUnicode(Request.Url.PathAndQuery), msg), <span style="color:#0000ff">true</span>);</li>
<li>}</li>
</ol>
</div>
</div>
<p>One note for this is that ASP.NET may put a wrapper exception (HttpUnhandledException) around the original exception.  In the code above, it is simply removed because it doesn&#8217;t contain any useful information.</p>
<p>You can also create more custom exception classes based on the ExceptionBase class to improve consistency in your application, and the code above will still work.  One example is:</p>
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">BadUrlException</span> : <span style="color:#2b91af">ExceptionBase</span></li>
<li>{</li>
<li><span style="color:#0000ff">public</span> BadUrlException(<span style="color:#2b91af">Exception</span> innerEx)</li>
<li>: <span style="color:#0000ff">base</span>(<span style="color:#a31515">&#8220;Bad URL has been detected. Request could not be processed.&#8221;</span>, innerEx)</li>
<li>{</li>
<li>}</li>
<li>}</li>
</ol>
</div>
</div>
<p>This way the error messages for one type of exception are consistent across the application.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/exception-handling-in-asp-net-web-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Use Microsoft Device Emulator in VS2008</title>
		<link>http://blog.pearltechnology.com/how-to-use-microsoft-device-emulator-in-vs2008/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/how-to-use-microsoft-device-emulator-in-vs2008/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 13:37:18 +0000</pubDate>
		<dc:creator>Geer</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Device Emulator]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[visual studio 2008]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=658</guid>
		<description><![CDATA[Microsoft Device Emulator is a great tool for testing your mobile web applications without utilizing any real mobile device.  Because it can use the same network that your computer is on, you can use it to test your mobile web applications hosted on development computers or test servers before the applications are published to the internet.  [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft Device Emulator is a great tool for testing your mobile web applications without utilizing any real mobile device.  Because it can use the same network that your computer is on, you can use it to test your mobile web applications hosted on development computers or test servers before the applications are published to the internet.  It is part of the Visual Studio 2008, so you can set it up with very minimal work, if you already have VS2008 installed.  It can also be installed separately.  In the rest of this post, I will demonstrate how to set it up, to use your local network and access your mobile web applications.</p>
<p>Here are a few things you will need to have on your computer to continue.</p>
<ol>
<li>Windows Virtual PC 2007.  This is required, if you would like to connect the Device Emulator to your local network.  The software can be downloaded from <a title="Download Virutal PC 2007" href="http://www.microsoft.com/windows/virtual-pc/download.aspx" target="_blank">Microsoft website</a>.</li>
<li>Microsoft Visual Studio 2008.</li>
<li>Microsoft Device Emulator (which comes with VS2008).</li>
</ol>
<p>With all the above requirements available on your computer, you can follow the steps below to configure your Device Emulator.</p>
<ol>
<li>Start VS 2008 IDE.</li>
<li>On the menu, go to Tools &gt;&gt; Device Emulator Manager
<div id="attachment_659" class="wp-caption alignnone" style="width: 310px"><img class="size-medium wp-image-659" src="http://blog.pearltechnology.com/wp-content/uploads/2010/03/IDE1-300x233.jpg" alt="Start Device Emulator Manager" width="300" height="233" /><p class="wp-caption-text">Start Device Emulator Manager</p></div></li>
<li>Right-click on a device you would like to use, and choose Connect option.
<p><div id="attachment_660" class="wp-caption alignnone" style="width: 310px"><img class="size-medium wp-image-660" src="http://blog.pearltechnology.com/wp-content/uploads/2010/03/Connect-to-a-mobile-device-300x222.jpg" alt="Connect to A Mobile Device" width="300" height="222" /><p class="wp-caption-text">Connect to A Mobile Device</p></div></li>
<li>After the device is connected, right-click on the connected device again, and choose Cradle.
<p><div id="attachment_661" class="wp-caption alignnone" style="width: 310px"><img class="size-medium wp-image-661" src="http://blog.pearltechnology.com/wp-content/uploads/2010/03/Cradle-Device-300x214.jpg" alt="Cradle the Connected Device" width="300" height="214" /><p class="wp-caption-text">Cradle the Connected Device</p></div></li>
<li>Go to the device window.  On the menu, choose File &gt;&gt; Configure
<p><div id="attachment_662" class="wp-caption alignnone" style="width: 310px"><img class="size-medium wp-image-662" src="http://blog.pearltechnology.com/wp-content/uploads/2010/03/Configure-Device-300x209.jpg" alt="Configure Device" width="300" height="209" /><p class="wp-caption-text">Configure Device</p></div></li>
<li>Go to the Network tab, and select the options as shown in the screen shot below.  And then click OK to close the window.
<p><div id="attachment_663" class="wp-caption alignnone" style="width: 310px"><img class="size-medium wp-image-663" src="http://blog.pearltechnology.com/wp-content/uploads/2010/03/Choose-Network-Card-300x223.jpg" alt="Choose Network Card" width="300" height="223" /><p class="wp-caption-text">Choose Network Card</p></div></li>
<li>In the device window, on the menu, choose File &gt;&gt; Reset &gt;&gt; Soft.  And wait until the device is restarted.</li>
<li>Now you need to configure the internet connection in the mobile device.  (The process could be different depending on what device you have picked.)  Normally, you would find the Settings option in the main menu, and then go to the Connections section to choose/define an internet connection.  Here below I use the device I chose as an example.</li>
<li>Choose Settings &gt;&gt; Connections &gt;&gt; Advanced &gt;&gt; Select Networks, and then choose My ISP for both Internet and Private Network connections.
<p><div id="attachment_668" class="wp-caption alignnone" style="width: 190px"><img class="size-medium wp-image-668" src="http://blog.pearltechnology.com/wp-content/uploads/2010/03/Settings-180x300.jpg" alt="Choose Settings" width="180" height="300" /><p class="wp-caption-text">Choose Settings</p></div>
<div id="attachment_667" class="wp-caption alignnone" style="width: 189px"><img class="size-medium wp-image-667" src="http://blog.pearltechnology.com/wp-content/uploads/2010/03/Connections-179x300.jpg" alt="Choose Connections" width="179" height="300" /><p class="wp-caption-text">Choose Connections</p></div>
<div id="attachment_665" class="wp-caption alignnone" style="width: 190px"><img class="size-medium wp-image-665" src="http://blog.pearltechnology.com/wp-content/uploads/2010/03/Advanced-Settings-180x300.jpg" alt="Choose Advanced Settings" width="180" height="300" /><p class="wp-caption-text">Choose Advanced Settings</p></div>
<p><div id="attachment_666" class="wp-caption alignnone" style="width: 190px"><img class="size-medium wp-image-666" src="http://blog.pearltechnology.com/wp-content/uploads/2010/03/Choose-My-ISP-180x300.jpg" alt="Choose My ISP" width="180" height="300" /><p class="wp-caption-text">Choose My ISP</p></div></li>
<li>After confirming all these changes, you can now visit your mobile web application or internet using this Device Emulator.  Task accomplished!
<p><div id="attachment_669" class="wp-caption alignnone" style="width: 190px"><img class="size-medium wp-image-669" src="http://blog.pearltechnology.com/wp-content/uploads/2010/03/Mobile-Website-180x300.jpg" alt="Your Mobile Website" width="180" height="300" /><p class="wp-caption-text">Your Mobile Website</p></div></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/how-to-use-microsoft-device-emulator-in-vs2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

