<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-34067319</id><updated>2011-08-07T09:58:05.737-05:00</updated><category term='Code Snippets'/><category term='Windows Forms'/><category term='Notification Services'/><category term='Books'/><title type='text'>.Net Tips and Tricks</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://nettipsandtricks.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://nettipsandtricks.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Garick Newtzie</name><uri>http://www.blogger.com/profile/06061442251996138704</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-34067319.post-7339144896054084324</id><published>2006-10-12T20:29:00.000-05:00</published><updated>2006-10-12T20:31:27.333-05:00</updated><title type='text'>New Blog Location http://www.nootz.net</title><content type='html'>Well after using blogger for a while I've decided to move this blog to it's own domain.&lt;br /&gt;&lt;br /&gt;Please update your bookmarks to the new location.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.nootz.net"&gt;http://www.nootz.net&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34067319-7339144896054084324?l=nettipsandtricks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nettipsandtricks.blogspot.com/feeds/7339144896054084324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34067319&amp;postID=7339144896054084324' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/7339144896054084324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/7339144896054084324'/><link rel='alternate' type='text/html' href='http://nettipsandtricks.blogspot.com/2006/10/new-blog-location-httpwwwnootznet.html' title='New Blog Location http://www.nootz.net'/><author><name>Garick Newtzie</name><uri>http://www.blogger.com/profile/06061442251996138704</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34067319.post-7908620627541403580</id><published>2006-09-21T07:28:00.000-05:00</published><updated>2006-09-21T07:35:32.182-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Snippets'/><title type='text'>Visual Studio Code Snippets Editor</title><content type='html'>I recently stumbled across this little program for managing your code snippets in Visual Studio. The program is called Snippy the Visual Studio Code Snippet Editor. It made creating common code snippets for my company a breeze. Check it out at &lt;a href="http://blogs.msdn.com/vseditor/archive/2005/10/03/476594.aspx"&gt;&lt;span style="text-decoration: underline;"&gt;Snippy.&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34067319-7908620627541403580?l=nettipsandtricks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nettipsandtricks.blogspot.com/feeds/7908620627541403580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34067319&amp;postID=7908620627541403580' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/7908620627541403580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/7908620627541403580'/><link rel='alternate' type='text/html' href='http://nettipsandtricks.blogspot.com/2006/09/visual-studio-code-snippets-editor.html' title='Visual Studio Code Snippets Editor'/><author><name>Garick Newtzie</name><uri>http://www.blogger.com/profile/06061442251996138704</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34067319.post-6008457378241065678</id><published>2006-09-15T09:16:00.000-05:00</published><updated>2006-09-15T09:37:29.184-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Notification Services'/><title type='text'>Sql Server 2005 Notification Services and Remoted Service calls</title><content type='html'>I've recently have been working on a custom delivery protocol for notification services.  I needed a way for sql server 2005 to call a remoted service when a trigger fired, to try and avoid polling the database for changes or using a SQLDependency that would need to be wired back up after each firing.&lt;br /&gt;&lt;br /&gt;The delivery protocol takes 2 parameters from the instance config file: Service Contract Type (IServiceContract) and  MethodName (The method to call).&lt;br /&gt;&lt;br /&gt;On intialization I load the contract assembly in and reflect on the type to get the MethodInfo for later usage. It currently does not support overloaded methods and will only grab the first method match.&lt;br /&gt;&lt;br /&gt;if (channelArgs.Count == 2)&lt;br /&gt;            {&lt;br /&gt;                string service = channelArgs["ServiceType"];&lt;br /&gt;                methodName = channelArgs["MethodName"];&lt;br /&gt;                Type t = TypeLoader.LoadType(service);&lt;br /&gt;&lt;br /&gt;                    //I'm using windows security on my remoted object hosted in IIS, so setting the current principal is necessary.&lt;br /&gt;                Thread.CurrentPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());&lt;br /&gt;                MethodInfo[] myMethodInfos = t.GetMethods();&lt;br /&gt;                foreach (MethodInfo Mi in myMethodInfos)&lt;br /&gt;                {&lt;br /&gt;                    if (Mi.Name == methodName)&lt;br /&gt;                    {&lt;br /&gt;                        myMethodInfo = Mi;&lt;br /&gt;                             //Store the parameters for later usage.&lt;br /&gt;                        info = myMethodInfo.GetParameters();&lt;br /&gt;                              break;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                throw new ArgumentException(&lt;br /&gt;                    "Inadequate number of arguments supplied.");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;When a delivery notification comes in, I take the list of ProtocolFields and match them to the method parameters and invoke the method.&lt;br /&gt;&lt;br /&gt;            bool successfulDelivery = false;&lt;br /&gt;            Exception failureException = null;&lt;br /&gt;&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                foreach (NotificationHeaders header in headersList)&lt;br /&gt;                {&lt;br /&gt;                    object[] param = null;&lt;br /&gt;                    // Set the method parameters.&lt;br /&gt;                    if (null != header.ProtocolFields)&lt;br /&gt;                    {&lt;br /&gt;                        param = new object[header.ProtocolFields.Count];&lt;br /&gt;                        int idx = 0;&lt;br /&gt;                        foreach (string protocolField in header.ProtocolFields.Values)&lt;br /&gt;                        {&lt;br /&gt;                            Type tp = info[idx].ParameterType;&lt;br /&gt;                            object o = Convert.ChangeType(protocolField, tp);&lt;br /&gt;                            param[idx] = o;&lt;br /&gt;                            idx++;&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                   &lt;br /&gt;                    object obj = ServiceFactory.CreateInstance(t, service);&lt;br /&gt;                    myMethodInfo.Invoke(obj, param);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                failureException = ex;&lt;br /&gt;                // Handle any exceptions here; for instance,&lt;br /&gt;                // write exception information to the event log.&lt;br /&gt;            }&lt;br /&gt;            finally&lt;br /&gt;            {&lt;br /&gt;                SendStatus(headersList, successfulDelivery,&lt;br /&gt;                           body, failureException);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;You will need to make sure RemotingServices.Configure has been called before the method is invoked. Also the ServiceFactory is a helper to extract the particulars of creating the object away from any client code to allow for future support of Windows Communication Foundation (WCF) or any other communication protocol. SendStatus returns the message status to Notification Services.&lt;br /&gt;&lt;br /&gt;There is certainly some cleanup that needs to occur but the jist is there. This allows Sql Server 2005 to call back to any service when an event occurs in the database.  Next I'll post the application config files to setup the service.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34067319-6008457378241065678?l=nettipsandtricks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nettipsandtricks.blogspot.com/feeds/6008457378241065678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34067319&amp;postID=6008457378241065678' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/6008457378241065678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/6008457378241065678'/><link rel='alternate' type='text/html' href='http://nettipsandtricks.blogspot.com/2006/09/sql-server-2005-notification-services.html' title='Sql Server 2005 Notification Services and Remoted Service calls'/><author><name>Garick Newtzie</name><uri>http://www.blogger.com/profile/06061442251996138704</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34067319.post-115773759521625031</id><published>2006-09-08T12:34:00.000-05:00</published><updated>2006-09-08T12:46:35.226-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Forms'/><title type='text'>DesignMode and Checking Design Mode on a WinForm</title><content type='html'>DesignMode checking can be troublesome with form inheritance. An example would be a base form has an OnLoad that does something&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;private void OnLoad(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;if (!DesignMode)&lt;br /&gt;{&lt;br /&gt;    //Do something here.&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt; Where the trouble starts is when the derived form is loaded in the visual studio designer. DesignMode solving to true in the base form is not always guaranteed, therefore an acceptable solution would be the following:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;///&lt;br /&gt;/// Indicates if the current view is being utilized in the VS.NET IDE or not.&lt;br /&gt;///&lt;br /&gt;public new bool DesignMode&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;    return (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34067319-115773759521625031?l=nettipsandtricks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nettipsandtricks.blogspot.com/feeds/115773759521625031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34067319&amp;postID=115773759521625031' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/115773759521625031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/115773759521625031'/><link rel='alternate' type='text/html' href='http://nettipsandtricks.blogspot.com/2006/09/designmode-and-checking-design-mode-on.html' title='DesignMode and Checking Design Mode on a WinForm'/><author><name>Garick Newtzie</name><uri>http://www.blogger.com/profile/06061442251996138704</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34067319.post-115772527689840264</id><published>2006-09-08T09:10:00.000-05:00</published><updated>2006-09-08T09:55:23.380-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Books'/><title type='text'>Framework Design Guidelines</title><content type='html'>First things first, I'm a strong advocate that every .Net developer should read the book &lt;a href="http://www.amazon.com/gp/redirect.html?link_code=ur2&amp;tag=nettipsandtri-20&amp;amp;amp;camp=1789&amp;creative=9325&amp;amp;location=%2Fgp%2Fproduct%2F0321246756%2Fref%3Dpd_rvi_gw_1%3Fie%3DUTF8"&gt;Framework Design Guidelines by Krzysztof Cwalina and Brad Abrams. (ISBN: 0321246756)&lt;/a&gt; I've read it 3 times from front to back and refer to it on almost a daily basis. As this reviewer puts it, "Nothing less than wisdom distilled".&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;img src="http://ec1.images-amazon.com/images/G/01/x-locale/common/customer-reviews/stars-5-0.gif" border="0" height="12" width="64" /&gt; &lt;b&gt;Nothing less than wisdom distilled&lt;/b&gt;, November 7, 2005&lt;br /&gt;                                          &lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top"&gt;Reviewer:&lt;/td&gt;&lt;td&gt;&lt;a href="http://www.amazon.com/gp/pdp/profile/A1QP8ITW5CW06L/ref=cm_cr_auth/104-3210277-7713507?ie=UTF8"&gt;&lt;span style="font-weight: bold;"&gt;John Gossman&lt;/span&gt;&lt;/a&gt; (Seattle, wa USA)  - &lt;a href="http://www.amazon.com/gp/cdp/member-reviews/A1QP8ITW5CW06L/ref=cm_cr_auth/104-3210277-7713507?ie=UTF8"&gt;See all my reviews&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/gp/help/customer/display.html/ref=cm_rn_bdg_help/104-3210277-7713507?ie=UTF8&amp;nodeId=14279681&amp;amp;pop-up=1#RN" target="AmazonHelp" onclick="return amz_js_PopWin('/gp/help/customer/display.html/ref=cm_rn_bdg_help/104-3210277-7713507?ie=UTF8&amp;nodeId=14279681&amp;pop-up=1#RN','AmazonHelp','width=340,height=340,resizable=1,scrollbars=1,toolbar=1,status=1');"&gt;&lt;img src="http://ec1.images-amazon.com/images/G/01/x-locale/communities/reputation/c7y_badge_rn_1.gif" alt="(REAL NAME)" align="absmiddle" border="0" height="15" width="70" /&gt;&lt;/a&gt;      &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;At Microsoft I work on a development team that has been using the guidelines from this book for nearly 4 years. I am not always a fan of coding standards, thinking they are a necessary evil, often simply arbitrary choices made for consistency.&lt;br /&gt;&lt;br /&gt;The Framework Design Guidelines are different. These ensure deep consistency across not just source code, but more importantly the public classes themselves. They include critical, not to be ignored rules on security, cross-language access and localization, as well as the usual good practice type guidelines. But even these "good" practices are always backed with well reasoned argument and examples. As an added bonus FxCop provides a static analysis tool that enforces the guidelines.&lt;br /&gt;&lt;br /&gt;Finally, the Framework Design Guidelines provide deep insight into how the .NET Frameworks are designed and used. With the guidelines in mind it is far easier to remember or even guess what classes are provided and how they should be used. This just makes the libraries that much more productive.&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;The insights enclosed show the trials and tribulations Microsoft had developing the .NET Framework and will surely help  you  prevent the same problems in your software designs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34067319-115772527689840264?l=nettipsandtricks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nettipsandtricks.blogspot.com/feeds/115772527689840264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34067319&amp;postID=115772527689840264' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/115772527689840264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/115772527689840264'/><link rel='alternate' type='text/html' href='http://nettipsandtricks.blogspot.com/2006/09/framework-design-guidelines.html' title='Framework Design Guidelines'/><author><name>Garick Newtzie</name><uri>http://www.blogger.com/profile/06061442251996138704</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34067319.post-115772440157282780</id><published>2006-09-08T09:02:00.000-05:00</published><updated>2006-09-08T09:09:58.916-05:00</updated><title type='text'>First Impressions</title><content type='html'>Well I said to myself for years that I would never get involved in "Blogging" but here I am coming into the 21st century. I've created this blog to post some of the tips and tricks I've found over the years to .Net and any interesting articles I find. I'm hoping to help others avoid some of the pitfalls I've had trying new technologies. So check back often and maybe we'll just learn something.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34067319-115772440157282780?l=nettipsandtricks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nettipsandtricks.blogspot.com/feeds/115772440157282780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34067319&amp;postID=115772440157282780' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/115772440157282780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34067319/posts/default/115772440157282780'/><link rel='alternate' type='text/html' href='http://nettipsandtricks.blogspot.com/2006/09/first-impressions.html' title='First Impressions'/><author><name>Garick Newtzie</name><uri>http://www.blogger.com/profile/06061442251996138704</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
