<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Sumit Amar</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/samar/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/samar/feed.xml</link>
    <description>Research and Development</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:51:08 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>JavaScript: Getter/Setter Properties with native JavaScript</title>
      <link>https://docs.microsoft.com/archive/blogs/samar/javascript-gettersetter-properties-with-native-javascript</link>
      <pubDate>Fri, 19 Oct 2012 05:22:14 GMT</pubDate>
      <dc:creator><![CDATA[Volcanic]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samar/2012/10/19/javascript-gettersetter-properties-with-native-javascript/</guid>
      <description><![CDATA[The following is a rudimentary 'iterator' (not to be confused with JavaScript 1.7...]]></description>
      <content:encoded><![CDATA[<p>The following is a rudimentary 'iterator' (not to be confused with JavaScript 1.7 iterator)&nbsp;that contains 'next' and 'previous' getter properties that range between 0 and 100, and the 'force' setter forces the iterator's value.<br />&nbsp; &lt;script&gt; <br />&nbsp; var I = {<br />&nbsp; <strong>get</strong> next() {<br />&nbsp; return this.counter &lt; 100 ? ++this.counter : this.counter;<br />&nbsp; },<br />&nbsp; get previous() {<br />&nbsp; return this.counter &gt; 0 ? --this.counter : this.counter;<br />&nbsp; },<br />&nbsp; <strong>set</strong> forced(c) {<br />&nbsp; this.counter = c;<br />&nbsp; },<br />&nbsp; counter: 0<br />&nbsp; }<br /> <br />&nbsp; alert(I.next);<br />&nbsp; alert(I.previous);<br />&nbsp; I.forced = 4;<br />&nbsp; alert(I.next);<br />&nbsp; //obviously there's no member hiding in this context, so you could even set I.counter = 4, however this setter could be home to data sanitization etc. <br />&nbsp; &lt;/script&gt;</p>]]></content:encoded>
    </item>
    <item>
      <title>[Closed] Job Opening: Software Development Engineer (Microsoft, Bellevue, WA)</title>
      <link>https://docs.microsoft.com/archive/blogs/samar/closed-job-opening-software-development-engineer-microsoft-bellevue-wa</link>
      <pubDate>Fri, 30 Apr 2010 14:44:00 GMT</pubDate>
      <dc:creator><![CDATA[Volcanic]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samar/2010/04/30/closed-job-opening-software-development-engineer-microsoft-bellevue-wa/</guid>
      <description><![CDATA[Do you like dynamic challenges in rich internet application (RIA) development? A large scale...]]></description>
      <content:encoded><![CDATA[<p>Do you like dynamic challenges in rich internet application (RIA) development? A large scale internet application on the world&rsquo;s top commercial web site sounds interesting to you? Do you want to work on cutting edge web application using state of the art Web 2.0 and 3.0 technologies? If you answer yes to any of the above questions, here is an opportunity for you.<br /><br />Microsoft adCenter UI development team is looking for a self-motivated and seasoned web UI developer. This UI team builds user interfaces using cutting edge technologies such as ASP.NET MVC and Silverlight for advertisers, agencies, and publishers that want to advertise on our ads networks including Bing and MSN etc. In addition to the current features developed in Silverlight and ASP.NET MVC, the next generation system includes rich UX and interactive workflows via Silverlight, and integration with semantic search engines. The UI is build using plug-n-play controls in Silverlight and AJAX and can be used in other adCenter, Microsoft.com and Bing.com properties. This is a great opportunity to impact the external customers with first hand code written in some state-of-the-art technologies. Some of the highlights of the project includes Web UI instrumentation for analyzing user&rsquo;s cognitive behavior and collecting usage, performance and error data directly from the client side XMLHTTP and WCF calls. The developer is expected to build custom controls in XAML (using flexible content controls, client data binding, and MVVM for segregating UI from code behind), instrument and analyze performance metrics in the page payloads and individual controls&rsquo; payloads. Smart caching and on-demand loading of XAP will be implemented, and developer will work towards optimizing the PLT1 (Page Load Time &ndash; first) and PLTx (subsequent page load times) for this internet facing web application. Some of the other feature set of the web application include optimizing memory utilization on the client (browser &ndash; silverlight runtime) and the server (where WCF runs).<br /><br />The required skills for this opening are: proficiency in OOP and C#, LINQ, ASP.NET (MVC, Controls, life cycle, integration, performance and payload optimizations), DHTML, XML/XSL, JavaScript (Object Oriented), XAML/Silverlight, AJAX (custom and jQuery implementations).<br /><br />Knowledge of KAF Automation and Expression Blend is desired. A BA/BS degree in Computer Science, Electronics or Mathematics, 8+ years or an MS in similar fields with 7+ years of professional experience is required. If you're interested and you fit the criteria, please contact Sumit (samar at microsoft)</p>]]></content:encoded>
    </item>
    <item>
      <title>KM - Knowledge Management</title>
      <link>https://docs.microsoft.com/archive/blogs/samar/km-knowledge-management</link>
      <pubDate>Thu, 12 Mar 2009 22:59:00 GMT</pubDate>
      <dc:creator><![CDATA[Volcanic]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samar/2009/03/12/km-knowledge-management/</guid>
      <description><![CDATA[This is the page for Knowledge Management topics]]></description>
      <content:encoded><![CDATA[This is the page for Knowledge Management topics]]></content:encoded>
    </item>
    <item>
      <title>HCI - Human Computer Interaction</title>
      <link>https://docs.microsoft.com/archive/blogs/samar/hci-human-computer-interaction</link>
      <pubDate>Wed, 11 Mar 2009 13:19:00 GMT</pubDate>
      <dc:creator><![CDATA[Volcanic]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samar/2009/03/11/hci-human-computer-interaction/</guid>
      <description><![CDATA[March 30, 2009 - 5:25p PSTDocumented Observation #1 - Lenovo Laptop Middle Mouse Button
First I...]]></description>
      <content:encoded><![CDATA[<P><STRONG>March 30, 2009 - 5:25p PST<BR></STRONG>Documented Observation #1 - Lenovo Laptop Middle Mouse Button</P>
<P>First I must start by saying that IBM/Lenovo laptops are very stable, durable and high performance machines. Few months ago, I got an X61 Thinkpad. I was readily impressed by its sleel looks and compact size (I'm big fan of lightweight and small machines). Small didn't mean less power. It has 4GB RAM and&nbsp;dual core 64bit processor. I would like to share some of my expriences with it. <IMG style="WIDTH: 200px; HEIGHT: 187px" title="Lenovo Thinkpad X61" border=0 alt="Lenovo Thinkpad X61" align=left src="https://ws.cc.sunysb.edu/it/framework/images/hardware/lenovo_X61.jpg" width=200 height=187 mce_src="https://ws.cc.sunysb.edu/it/framework/images/hardware/lenovo_X61.jpg"></P>
<P>OK now the good part of this post. There's no touch pad on it :) and what you have is a small red mouse button in the middle of the keyboard. My initial thoughts about it were sarcastic. And while using it for first few days, I kept rubbing my thumb on the area below mouse-left and mouse-right buttons. But hey, there's nothing there to scroll or move mouse. Now I had to use my index finger to caress the red mouse button and click the mouseleft button for left clicks with my thumb. I came from using Sony VAIO where I would simply "tap" my finger to do a click. However, the good thing is that mouse-left button (or mouse-right) for that purpose doesn't really make much noise (unlike my Sony VAIO SZ series). My first experiences with this obscure mouse button were not too good. </P>
<P>Now the second problem with this middle-mouse. In "normal" laptops I could scroll page(s) by sliding my finger in the right or bottom corners of the touch pad for vertical and horizontal scrolling respectively. But since there's no touch pad on it, there is a button in the middle of mouse-left and mouse-right buttons, which can be pressed (kept down) and red middle-mouse button moved to scroll in either direction. It works very similer to pressing scroll wheel of a traditional mouse and then moving the mouse. But not impressive because if I don't have a proper driver for it, it would move (scroll) the page in mutliple directions. So there exists a driver that lets me scroll in either horizontal or vertical directions instead of having a free hand movement. </P>
<P>OK now let's talk about the cognitive learning part in using such devices. Sometimes this learning could actually be better for ergonomics of the human computer interaction. After couple of months of playing with the middle-mouse button, I realized that I'm having to move my hand much less, and my fingers (for the purpose of mouse movements) don't have to move much. Which made me realize that my hands aren't getting as tired as they were with a touch-pad based laptop. Not to mention, there was some extra time involved in placing my fingers&nbsp;(thumb and index) to the right place before I could go start moving my mouse and clicking etc. It's a bit different than just moving index finger on any part of the touch-pad. It's worthwhile to notice that IBM/Lenovo probably didn't put a touchpad in this computer due to its size (12 inch screen) but the bigger Lenovo models contain both a touchpad and the middle-mouse.</P>
<P><IMG style="WIDTH: 181px; HEIGHT: 161px" title="Sony UX" border=0 hspace=5 alt="Sony UX" align=left src="https://gesterling.files.wordpress.com/2006/11/sony-ux.jpg" width=181 height=161 mce_src="https://gesterling.files.wordpress.com/2006/11/sony-ux.jpg">Actually because I did talk about Sony, I should also mention about an ultra mobile PC I used couple of years ago (I'll write in detail about it, later). The similarity between the Lenovo X61 and Sony UX Series is that UX also had a similar mouse button in the top right corner of the base of the device. BTW it's a touch screen tiny computer with only 4.5 inch screen and it runs Vista.</P>
<P><U>Conclusion:</U> I think middlemouse button is bit odd to start with but it certainly provides better ergonomics when used for a longer bit of time.</P>]]></content:encoded>
    </item>
    <item>
      <title>[Closed] Job Posting: Software Development Engineer</title>
      <link>https://docs.microsoft.com/archive/blogs/samar/closed-job-posting-software-development-engineer</link>
      <pubDate>Wed, 23 Jan 2008 22:24:00 GMT</pubDate>
      <dc:creator><![CDATA[Volcanic]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samar/2008/01/23/closed-job-posting-software-development-engineer/</guid>
      <description><![CDATA[I have few job openings in my team for Silverlight, AJAX, WCF, WPF and SQL Server...]]></description>
      <content:encoded><![CDATA[<P>I have few job openings in my team for Silverlight, AJAX, WCF, WPF and SQL Server developers.&nbsp;Here's the job description.</P>
<P>&nbsp;“Do you like dynamic challenges in web application development? A large scale internet applications on the world’s top commercial web site sounds interesting to you? Do you want to work on cutting edge web application using state of the art Web 2.0 technologies? If you answer yes to any of the above questions, here is the opportunity for you.<BR><BR>Marketing Center Of Excellence (Global Marketing Platform) division’s World Wide Events &amp; Profile Center team is looking for a self motivated and seasoned senior web UI developer. This is an application that allows partners to create live, in-person and live meeting events via the partners’ extranet application, and these events are exposed on external internet facing site https://msevents.microsoft.com to the users who might be interested in registering and attending the events. Team is working on renovating the Web UI and Middle Tier. In addition to the current features, next generation system includes streaming videos and rich UX via Silverlight, integration with adCenter, contextual display of events on third party sites, communities integration, pluggable controls for other Microsoft.com properties etc. This is a great opportunity to impact the external customers with first hand code. Some of the highlights of the project includes Web UI instrumentation for analyzing user’s cognitive behavior and collecting usage, performance and error data directly from the client side XMLHTTP calls, Web UI and Middle Tier based on modern design patterns, WCF (Indigo) and Web Services based contracts between Middle Tier and the adopters, individually testable and scalable layered architecture. <BR><BR>The required skills for this opening are: proficiency in OOP and C# (2.0), ASP.NET (Controls, Life cycle, Integration, Performance and Payload optimizations), DHTML, XML/XSL, JavaScript (Object Oriented), Web Services, WSE, AJAX (strong custom and Atlas/’ASP.NET AJAX’ implementations). <BR><BR>Knowledge of KAF/ECHO Automation, XAML/Silverlight, SQL Server 2005 (TSQL, Profiler) is desirable. A BA/BS degree in Computer Science, Electronics or Mathematics, 8+ years or an MS in similar fields with 7+ years of professional experience is required.</P>
<P>&nbsp;If it interests you and you have desired qualification, please contact me.</P>]]></content:encoded>
    </item>
    <item>
      <title>Basic C# coding guidelines</title>
      <link>https://docs.microsoft.com/archive/blogs/samar/basic-c-coding-guidelines</link>
      <pubDate>Thu, 15 Mar 2007 23:35:00 GMT</pubDate>
      <dc:creator><![CDATA[Volcanic]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samar/2007/03/15/basic-c-coding-guidelines/</guid>
      <description><![CDATA[C# 2.0
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Use generic collections instead of Hashtables and ArrayList...]]></description>
      <content:encoded><![CDATA[<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face=Calibri><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">C# 2.0</SPAN><SPAN style="FONT-SIZE: 12pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"><FONT size=3><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri">-</SPAN><SPAN style="mso-fareast-font-family: Calibri"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial">Use generic collections instead of Hashtables and ArrayList types</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"><FONT size=3><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri">-</SPAN><SPAN style="mso-fareast-font-family: Calibri"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial">If using Generic types, then refrain from using foreach loop on the collection. Rather use ForEach method to loop through via an anonymous method predicate (much faster because doesn’t create the Iterator). For non generic types try to use for loop instead of foreach if the data being traversed is huge</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">List&lt;string&gt; list = new List&lt;string&gt;();</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">list.Add("aa"); </SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">list.Add("bb");</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">//option 1:</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">foreach(string str in list)</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>Console.WriteLine(str);</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">//option 2: RECOMMENDED</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">list.ForEach(delegate(string str) {</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>Console.WriteLine(str);</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"><FONT size=3>});<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"><FONT size=3><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri">-</SPAN><SPAN style="mso-fareast-font-family: Calibri"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial">Nullify unused objects (doesn’t collect, but marks for collection and ceases from getting promoted into next generation)</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"><FONT size=3><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri">-</SPAN><SPAN style="mso-fareast-font-family: Calibri"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial">IF conditions having just one item in if and else, should be used as ternary operator (? Sign)</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">e.g. instead of the code:</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">int i;</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">if(someConditionTrue)</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>i = 3;</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">else</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>i = 4;</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">It is better to write the above 5 lines into just one:</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">int i = someConditionTrue ? 3 : 4;</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"><FONT size=3><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri">-</SPAN><SPAN style="mso-fareast-font-family: Calibri"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial">Use ‘as’ operator instead of direct typecast using parenthesis with the exception of overloaded explicit cast operator, it saves from NullReferenceException and InvalidCastException</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"><FONT size=3><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri">-</SPAN><SPAN style="mso-fareast-font-family: Calibri"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial">Refrain from XmlDocument usage for navigational purpose, please either use XmlTextReader for sequential access or XPathDocument for XPath based data retrieval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"><FONT size=3><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri">-</SPAN><SPAN style="mso-fareast-font-family: Calibri"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial">For server side XSL transformation, Use XslCompiledTransform instead of XslTransform (Please check </SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><A href="https://blogs.msdn.com/antosha/archive/2006/07/24/677560.aspx" mce_href="https://blogs.msdn.com/antosha/archive/2006/07/24/677560.aspx"><SPAN style="COLOR: purple; FONT-FAMILY: 'Calibri','sans-serif'">https://blogs.msdn.com/antosha/archive/2006/07/24/677560.aspx</SPAN></A></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"> ). For client side transformation, try to load Xsl file asynchronously whenever possible via XMLDOM or XsltProcessor (Geckos)</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"><FONT size=3><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri">-</SPAN><SPAN style="mso-fareast-font-family: Calibri"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial">Always join your threads in a web page, if used (otherwise the page will be rendered and workers will continue operating at the server cost, and ofcourse the results will be unpredictable)</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">Let's say you opened two threads in a web page using the following:</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">Thread AThread<SPAN style="mso-tab-count: 1">&nbsp; </SPAN>= new Thread(new ThreadStart(CallProcOne));</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">AThread.Start();</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><FONT size=3><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">Thread CThread<SPAN style="mso-tab-count: 1">&nbsp; </SPAN>= new Thread(new ThreadStart(CallProcTwo));</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">CThread.Start();</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">//Now it is recommended to do this:</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><FONT size=3><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial">AThread.Join();</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"><FONT size=3>CThread.Join();<o:p></o:p></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p><FONT size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"><FONT size=3><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri">-</SPAN><SPAN style="mso-fareast-font-family: Calibri"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial">Always do NULL checking before operating on an object, NullReferenceException is widely occurring exception in most applications and only a preventive programming can help us get the real error</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"><FONT size=3><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri">-</SPAN><SPAN style="mso-fareast-font-family: Calibri"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial">Handle most specific (expected) exceptions in the catch blocks before deciding towards general Exception, and please don’t use catch without an exception object if you’re not really writing P/Invoke in C#<o:p></o:p></SPAN></FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>Creating custom wrapper for all JavaScript functions</title>
      <link>https://docs.microsoft.com/archive/blogs/samar/creating-custom-wrapper-for-all-javascript-functions</link>
      <pubDate>Fri, 06 Oct 2006 00:03:00 GMT</pubDate>
      <dc:creator><![CDATA[Volcanic]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samar/2006/10/06/creating-custom-wrapper-for-all-javascript-functions/</guid>
      <description><![CDATA[There might be scenarios when all JavaScript side initiated function calls need to be intercepted...]]></description>
      <content:encoded><![CDATA[There might be scenarios when all JavaScript side initiated function calls need to be intercepted for logging and error reporting purposes on the client. Two approaches exist, one, calling an intermediary function and then initiating call to real function, but that could be harder to manage. Since JavaScript allows real flexibility in extending its base objects (such as String, Array, Function etc), it is quite manageable to create a custom wrapper in the base Function object and all functions will go through this route. You might decide to use this feature on as-needed basis.<br><br>In the example below, a custom wrapper known by its name is created under Function by extending the prototype property. Normal JavaScript functions (such as func and printObjects in following example) don't need to change their implementation. Only at the time of calling the real function, just replace the real function name with function name + .wrapper and pass arguments as you would normally do, starting with the "this" which is required for remembering who is the original caller of this function. e.g. a sample call could be <br><br>onclick="myFunction.wrapper(this,'x','arg2',{2,2});"<br><br>&lt;!-- #### Code below --&gt;<br>&lt;script&gt;<br>Function.prototype.wrapper = function(sender)<br>{<br>&nbsp;alert("In Wrapper function first; Logging starts here");<br>&nbsp;alert(arguments.length &gt; 1 ? "First argument of real function is " + arguments[1] : "no additional args")<br>&nbsp;try {<br>&nbsp; this.apply(sender,arguments); //real function call<br>&nbsp;}catch(exception)<br>&nbsp;{<br>&nbsp; //log exception on server side using XMLHTTP and/or display a generic message to user<br>&nbsp;}<br>&nbsp;alert("In Wrapper function; Logging ends here");<br>}<br><br>function func(sender)<br>{<br>&nbsp;alert("Real function called");<br>}<br><br>function printObjects(sender)<br>{<br>&nbsp;document.write("&lt;pre&gt;");<br>&nbsp;for(var i in document)<br>&nbsp; document.writeln(i + " &lt;&lt; " + typeof(i));<br>}<br>&lt;/script&gt;<br><br>&lt;input onclick='func.wrapper(this,"hello",new Object());' type=button id=b value=Press NAME="b"/&gt;<br>&lt;input onclick=printObjects.wrapper(this); value=PrintObjects type=button ID="Button1" NAME="Button1"/&gt;&nbsp;&nbsp; <br>]]></content:encoded>
    </item>
    <item>
      <title>Auxiliary Saver Technique in Web Forms</title>
      <link>https://docs.microsoft.com/archive/blogs/samar/auxiliary-saver-technique-in-web-forms</link>
      <pubDate>Fri, 17 Feb 2006 21:20:00 GMT</pubDate>
      <dc:creator><![CDATA[Volcanic]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samar/2006/02/17/auxiliary-saver-technique-in-web-forms/</guid>
      <description><![CDATA[As we all know state management is a big deal in web applications. We might have web forms that send...]]></description>
      <content:encoded><![CDATA[<P>As we all know state management is a big deal in web applications. We might have web forms that send important data to the server where might lie some validations in addition to the client side JavaScript validations. General challenge is&nbsp;to restore all the client controls to their previous selections. ViewState use can help, however there are two issues in controling state</P>
<P>1. If you're conservative to keep your page size to low, you may not use ViewState.<BR>2. The controls were built using client side script and/or their data was populated dynamically (such as AJAX or XML DSO etc), these bindings will need to happen once again when page is rendered back after the error or the status check</P>
<P>Is it really needed to Postback when saving data using webforms? Answer is No. Because we can utilize an auxilliary "form saver" page/handler that will be posted data from the client using XMLHTTP asynchronously, and whenever it finishes processing, it can return back the&nbsp;XML&nbsp;as a response metadata. This XML response will tell whether the operation to save form data succeeded or not. Also we can customize it to return some&nbsp;status codes (may be used to redirect after saving data etc)&nbsp;and meta language to perform post-save processing on the client side using JavaScript.</P>]]></content:encoded>
    </item>
    <item>
      <title>True Asynchronous Payload</title>
      <link>https://docs.microsoft.com/archive/blogs/samar/true-asynchronous-payload</link>
      <pubDate>Sat, 24 Sep 2005 03:53:00 GMT</pubDate>
      <dc:creator><![CDATA[Volcanic]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samar/2005/09/24/true-asynchronous-payload/</guid>
      <description><![CDATA[For rendering content and feature rich web pages, here are the questions that we have in front of...]]></description>
      <content:encoded><![CDATA[<P>For rendering content and feature rich web pages, here are the questions that we have in front of us:</P>
<P>1. How to speed up the process of data fetch/load at the server to rendering it to the web client.<BR>2. Reduce the markup</P>
<P>I discussed point 2 in my previous post (another way to reduce markup is to not "Generate" X/HTML on the server, do it using XSLT on client). Anyhow 2. is also indirectly correlated to 1. </P>
<P>As a proposed solution, what we need here is the <EM>true asynchronous loading </EM>of the web page that is feature/content rich. So how do we achieve that!? Ironically the answer lies in both the developer's mind (what data to async) and the methodology I'm about to discuss. Here is my thought process for manually dividing the payload distribution</P>
<P>1. Logically separate the different data units of the web page (viz. in a news site, breaking news, stock ticker and weather information can be considered isolated if they all come from different data sources or in other words they have be explicitly loaded by using a DB call)<BR>2. Render the page from server with placeholder markup for these logical data units (i.e. no data, no DB calls have been made so far) and a small JavaScript block containing boolean variables values set to true for which [data units] content needs to be loaded later.<BR>3. After the server request has returned lightweight payload (missing data) and quicker response (server didn't have to do much processing cause most importantly DB calls were skipped), go through the JavaScript boolean variables set by the server, each of them signifies a data units. which ever is set to true, make AJAX call to grab data from the server and populate in the respective&nbsp;placeholders of data units.<BR>4. Next is upto the developer to either render X/HTML out of the data retrieved using plain JavaScript or XSLT. Tip: If using XSL, remember they can also be loaded asynchronously! So higher performance can be achieved if the XSL is large and heavy markup is rendered out of it.<BR>5. In the end, page will appear as being loaded asynchronously and much faster than it would have using a single server send. It's like using multiple small funnels instead of a big one, that is sequential.</P>]]></content:encoded>
    </item>
    <item>
      <title>Determine the Payload division</title>
      <link>https://docs.microsoft.com/archive/blogs/samar/determine-the-payload-division</link>
      <pubDate>Thu, 22 Sep 2005 08:21:00 GMT</pubDate>
      <dc:creator><![CDATA[Volcanic]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samar/2005/09/22/determine-the-payload-division/</guid>
      <description><![CDATA[Lately I've been thinking about devising a mechanism to determine the division of the Payload...]]></description>
      <content:encoded><![CDATA[<P>Lately I've been thinking about devising a mechanism to determine the division of the Payload between the content that is rendered to client web browser (including markup) and the one that client browser can load, hold and process in its memory. The logic behind this idea is to reduce the network traffic on the wire in PLT-1. And then grab the rest of the [required] data using hidden XMLHTTP calls and keep in browser's memory variables. Certain ActiveX (such as XMLHTTP, XMLDOM) can process the data received through AJAX (XMLHTTP/WinHTTP) call and render to the screen. It saves us two things</P>
<P>1. Processing these records on the web server (saving CPU)<BR>2. Rendering markup from server on the HTTP wire (which can be processed and rendered by a cheaper mechanism on the client browser such as XSLT/JS)</P>
<P>And costs us this</P>
<P>1. More server requests (lightweight though)</P>
<P>However to partially get around the cost mentioned above, we need to keep once loaded data into browser memory variables and not make the request if same thing is being requested again.</P>
<P>Coming back to the main issue, to determine how much data should be rendered by the server, and how much responsibility can be&nbsp;given&nbsp;to the client to load (XML) and process without causing IE memory leaks/overruns. Next is to devise an algorithm to determine this division factor on the basis of size of total renderable data.</P>
<P>let d=data; t=time</P>
<P>d(c) + d(s) = d(tl)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;... (1)</P>
<P>t(c) + t(s) = t(tl)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;... (2)<BR></P>
<P>However, in (2) t(s) is a variable and t(c) is constant [assuming all clients have as usual near about high amount of memory and CPU available]. In order to find the value of d, use of induction could be handy, if performance can be optimized or at least standardized as acceptable. I'll post what I find out of this experiment.</P>]]></content:encoded>
    </item>
  </channel>
</rss>