<?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>Matt J. Wilson &#187; C#</title>
	<atom:link href="http://www.mattjwilson.com/blog/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattjwilson.com/blog</link>
	<description>General ramblings, programming frustrations, and complete randomness.  Have questions? E-mail me.</description>
	<lastBuildDate>Tue, 19 Jan 2010 19:37:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Central Error Tracking for Deployed Systems</title>
		<link>http://www.mattjwilson.com/blog/2010/01/11/central-error-tracking-for-deployed-systems/</link>
		<comments>http://www.mattjwilson.com/blog/2010/01/11/central-error-tracking-for-deployed-systems/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 20:35:26 +0000</pubDate>
		<dc:creator>Matt J. Wilson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Metrics]]></category>

		<guid isPermaLink="false">http://www.mattjwilson.com/blog/?p=54</guid>
		<description><![CDATA[At one of my previous employers, we had several remote deployments (hundreds, actually) and a need to track remote errors in a central location; we utilized an ASP site to visually display this combined collection of errors.
I&#8217;ve taken the time to rewrite my own central error tracking mechanism from scratch.  This module includes text [...]]]></description>
			<content:encoded><![CDATA[<p>At one of my previous employers, we had several remote deployments (hundreds, actually) and a need to track remote errors in a central location; we utilized an ASP site to visually display this combined collection of errors.</p>
<p>I&#8217;ve taken the time to rewrite my own central error tracking mechanism from scratch.  This module includes text logs that automatically rotate themselves once a file reaches a certain size (no more trying to have someone email you a 3 GB text file), useful information about what type of error occurred, and a SQL CE database that stores these errors in a local database, counting the number of incidences and whether there is fresh information to report on a schedule to the central database.</p>
<p>There is also a central web service that accepts these exception reporting requests and inserts them into a central SQL database for you to do with what you will (ASP website, Excel sheets with queries, etc., etc.).  You can find a copy of this solution (Visual Studio 2005 written in C#) <a href="http://www.mattjwilson.com/Sample%20Work/Error%20Metrics.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjwilson.com/blog/2010/01/11/central-error-tracking-for-deployed-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Address Pattern Regular Expression</title>
		<link>http://www.mattjwilson.com/blog/2009/07/14/address-pattern-regular-expression/</link>
		<comments>http://www.mattjwilson.com/blog/2009/07/14/address-pattern-regular-expression/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 17:28:12 +0000</pubDate>
		<dc:creator>Matt J. Wilson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[RegEx]]></category>

		<guid isPermaLink="false">http://www.mattjwilson.com/blog/?p=38</guid>
		<description><![CDATA[So I searched the internet for quite a while to find a street address regex that actually worked (and worked well).  I didn&#8217;t manage to accomplish this, so I wrote my own.  I&#8217;m keeping the address extraction algorithms and logic private, but I figured I could at least share the first part of the Regex:
Regex [...]]]></description>
			<content:encoded><![CDATA[<p>So I searched the internet for quite a while to find a street address regex that actually worked (and worked well).  I didn&#8217;t manage to accomplish this, so I wrote my own.  I&#8217;m keeping the address extraction algorithms and logic private, but I figured I could at least share the first part of the Regex:</p>
<p>Regex addressPattern = new Regex(@&quot;(?&lt;city&gt;[A-Za-z',.\s]+) (?&lt;state&gt;([A-Za-z]{2}|[A-Za-z]{2},))\s*(?&lt;zip&gt;\d{5}(-\d{4})|\d{5})&quot;);</p>
<p>MatchCollection matches = addressPattern.Matches(text);</p>
<p>for (int mc = 0; mc &lt; matches.Count; mc++)<br />
{<br />
string city =  matches[mc].Groups[&quot;city&quot;].Value;<br />
string state =  matches[mc].Groups[&quot;state&quot;].Value;<br />
string zip =  matches[mc].Groups[&quot;zip&quot;].Value;<br />
}</p>
<p>[/c-sharp]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjwilson.com/blog/2009/07/14/address-pattern-regular-expression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Posting a File using the WebBrowser Class</title>
		<link>http://www.mattjwilson.com/blog/2009/02/12/posting-a-file-using-the-webbrowser-class/</link>
		<comments>http://www.mattjwilson.com/blog/2009/02/12/posting-a-file-using-the-webbrowser-class/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 16:07:17 +0000</pubDate>
		<dc:creator>Matt J. Wilson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WebBrowser]]></category>

		<guid isPermaLink="false">http://www.mattjwilson.com/blog/?p=5</guid>
		<description><![CDATA[So you have a WebBrowser object in .NET that you would like to use to automatically post a file to a given location?  You can probably figure out how to set values on this page:
&#60;input type=&#34;text&#34; name=&#34;myTextField&#34;&#62;
// Update myTextField with a value
webBrowser.Document.All[&#34;myTextField&#34;].SetAttribute(&#34;value&#34;, &#34;I set your value&#34;);
But how do you update this?
&#60;input type=&#34;file&#34; name=&#34;myFileField&#34;&#62;
You can&#8217;t simply [...]]]></description>
			<content:encoded><![CDATA[<p>So you have a WebBrowser object in .NET that you would like to use to automatically post a file to a given location?  You can probably figure out how to set values on this page:</p>
<pre class="brush: xml;">&lt;input type=&quot;text&quot; name=&quot;myTextField&quot;&gt;</pre>
<pre class="brush: xml;">// Update myTextField with a value
webBrowser.Document.All[&quot;myTextField&quot;].SetAttribute(&quot;value&quot;, &quot;I set your value&quot;);</pre>
<p>But how do you update this?</p>
<pre class="brush: xml;">&lt;input type=&quot;file&quot; name=&quot;myFileField&quot;&gt;</pre>
<p>You can&#8217;t simply use the SetAttribute function, as there is no attribute to correctly set; this was done intentionally to prevent users from using shady Javascript to automatically capture and send files from a page.  So how do you do it?  Something even more shady:</p>
<pre class="brush: csharp;">HtmlElement element = webBrowser.Document.GetElementById(&quot;myFileField&quot;);
element.Focus();
System.Threading.Thread.Sleep(1000);

// Perform SendKeys to fake the browser into setting the file name
SendKeys.SendWait(@&quot;C:\Path To My File\test.txt&quot;);
SendKeys.Flush();</pre>
<p>I hope that Google picks this up and saves someone else the thirty minutes worth of their life that I wasted attempting to figure out a solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjwilson.com/blog/2009/02/12/posting-a-file-using-the-webbrowser-class/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

