<?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:blogger='http://schemas.google.com/blogger/2008' 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-18719227</id><updated>2024-10-09T09:43:21.119+05:30</updated><category term="sql"/><category term="android"/><category term="asp.net"/><category term="MVC"/><category term="eclipse"/><category term="performance"/><category term="Knockout"/><category term="MVC3"/><category term="Sql Audit"/><category term="counters"/><category term="security"/><category term="CDC"/><category term="ddms"/><category term="excption"/><category term="facebook sso"/><category term="hints"/><category term="information_schema"/><category term="locks"/><category term="perfmon"/><category term=".metadata"/><category term=".net"/><category term="64 Bit"/><category term="ACT"/><category term="ASP.NET 2.0"/><category term="Application Test"/><category term="Barcode"/><category term="CAT.NET"/><category term="CKEditor"/><category term="Change data capture"/><category term="Claims"/><category term="Collection"/><category term="DBA"/><category term="DDL changes"/><category term="Deep validation"/><category term="Entity Framework Code First"/><category term="Enum"/><category term="Extension Methods"/><category term="Federated Authentication"/><category term="GC"/><category term="Google USB driver"/><category term="Grid"/><category term="HTML ID"/><category term="JSON"/><category term="JSON Date"/><category term="JSON Decimal Mapping"/><category term="Knockout Validation"/><category term="List"/><category term="MVC Decimal Mapping"/><category term="MilliSeconds"/><category term="Parallel"/><category term="Patterns"/><category term="ProcDump"/><category term="SAML"/><category term="Sharepoint"/><category term="SiteMinder"/><category term="Source Control"/><category term="Space"/><category term="Stress Test"/><category term="TFS"/><category term="TFS Plugin"/><category term="TOP clause"/><category term="TPL"/><category term="WebGrid"/><category term="WinDbg"/><category term="android mobile"/><category term="android mobile testing"/><category term="android sdk manager"/><category term="android testing"/><category term="apk"/><category term="blocks"/><category term="browser"/><category term="captcha"/><category term="checkdb"/><category term="cloud"/><category term="code analysis"/><category term="commit"/><category term="compress"/><category term="connection reset"/><category term="datediff"/><category term="dbcc"/><category term="deadlocks"/><category term="denali"/><category term="detect"/><category term="error"/><category term="excel"/><category term="expire headers"/><category term="export"/><category term="font list"/><category term="force stop"/><category term="gridview"/><category term="hashkey"/><category term="hashkey generation"/><category term="headers"/><category term="ignore files"/><category term="iis 6.0"/><category term="install"/><category term="java build path"/><category term="keystore"/><category term="logcat"/><category term="login issue"/><category term="minified"/><category term="mobile"/><category term="nolock"/><category term="openssl"/><category term="packages"/><category term="page methods"/><category term="progress update"/><category term="project error"/><category term="rdbms"/><category term="resize"/><category term="reverse"/><category term="schema"/><category term="sdl"/><category term="service accounts"/><category term="simulating call"/><category term="simulator"/><category term="sql cluster"/><category term="sql injection"/><category term="sql server 2011"/><category term="sql server 2012"/><category term="sql sharp"/><category term="sql#"/><category term="squishit"/><category term="sso"/><category term="string reverse"/><category term="timeout"/><category term="tips"/><category term="tricks"/><category term="udf"/><category term="validation"/><category term="wcf service"/><category term="windows forms"/><category term="xlsx"/><category term="xss"/><category term="yslow"/><title type='text'>Learning Curve</title><subtitle type='html'>Blog to help every programmer to learn good stuff about programming and keep them updated with the latest trend that is happening in the IT industry</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>135</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-18719227.post-6546874634108926203</id><published>2013-09-15T17:21:00.000+05:30</published><updated>2013-09-15T17:22:19.845+05:30</updated><title type='text'>Using WCAT Scenario Creator</title><content type='html'>&lt;div class=WordSection1&gt;&lt;p style=&#39;margin:0cm;margin-bottom:.0001pt;line-height:17.55pt;vertical-align:baseline&#39;&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;Stress and Load testing on Windows used to be done using a utility called WCAT - Web Capacity Analysis Tool. This tool is powerful and it requires more manual scripting to get the performance results.&amp;nbsp; The current version of WCAT is 6.3 and can be downloaded from the following location: &lt;a href=&quot;http://www.iis.net/downloads/default.aspx?tabid=34&quot;&gt;&lt;span style=&#39;color:#2E8BCC;border:none windowtext 1.0pt;padding:0cm;text-decoration:none&#39;&gt;http://www.iis.net/downloads/default.aspx?tabid=34&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;margin:0cm;margin-bottom:.0001pt;line-height:17.55pt;vertical-align:baseline&#39;&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2 style=&#39;margin:0cm;margin-bottom:.0001pt;line-height:23.1pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;text-transform:lowercase;word-spacing:0px&#39;&gt;&lt;span style=&#39;font-size:15.5pt;font-family:&quot;Segoe UI Semibold&quot;,&quot;sans-serif&quot;;font-variant:small-caps;color:#253340;font-weight:normal&#39;&gt;setup and test&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l0 level1 lfo1;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;1.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;Download the file&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l0 level1 lfo1;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;2.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;Run the installation package&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l0 level1 lfo1;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;3.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;Read the introduction to WCAT included in the installation&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:15.0pt;margin-left:0cm;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;c:\program files\wcat\doc\wcat.doc&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l1 level1 lfo2;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;1.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;Once you have reviewed the basics you will need to install it on your client machines. (client are machines that will actually issue the commands to the server simulating your web clients).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:37.5pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l1 level2 lfo2;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;1.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;open a command prompt (as administrator if on vista)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:37.5pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l1 level2 lfo2;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;2.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;cd c:\program files\wcat\&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:37.5pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l1 level2 lfo2;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;3.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;cscript //H:Cscript&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:37.5pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l1 level2 lfo2;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;4.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;wcat.wsf -terminate -update -clients localhost&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:37.5pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l1 level2 lfo2;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;5.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;machine will reboot&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l1 level1 lfo2;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;2.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;To run the software you will first need to edit the client (scenario.ubr) and settings.ubr files to match the requests you wish to test. A simple HTTP get request for the scenario should suffice&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l1 level1 lfo2;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;3.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;Save these two files to your WCAT directory&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l1 level1 lfo2;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;4.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;Run your test with the following commands:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;line-height:14.25pt;vertical-align:middle&#39;&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;wcat.wsf -clients yourclientmachineip -run -t scenario.ubr -f settings.ubr -s yourserverip&amp;nbsp; -p yourserverport&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l1 level1 lfo2;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;5.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;To view the results open log.xml&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;margin:0cm;margin-bottom:.0001pt;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;strong&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340;border:none windowtext 1.0pt;padding:0cm&#39;&gt;scenario.ubr &lt;/span&gt;&lt;/strong&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:15.0pt;margin-left:0cm;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;scenario&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; name&amp;nbsp;&amp;nbsp;&amp;nbsp; = &amp;quot;HTTP Request Test&amp;quot;;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; warmup&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 5; //seconds&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; duration&amp;nbsp;&amp;nbsp;&amp;nbsp; = 10; //seconds&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cooldown&amp;nbsp;&amp;nbsp;&amp;nbsp; = 5; //seconds&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; default&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // send keep-alive header&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setheader&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name&amp;nbsp;&amp;nbsp;&amp;nbsp; = &amp;quot;Connection&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value&amp;nbsp;&amp;nbsp; = &amp;quot;keep-alive&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set the host header&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setheader&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name&amp;nbsp;&amp;nbsp;&amp;nbsp; = &amp;quot;Host&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value&amp;nbsp;&amp;nbsp; = server();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // HTTP1.1 request&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = HTTP11;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // keep the connection alive after the request&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; close&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = ka;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; transaction&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id = &amp;quot;simple scenario&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weight = 1;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = &amp;quot;/&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; secure &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;= true;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; statuscode&amp;nbsp; = 200;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; close&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = reset;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;margin:0cm;margin-bottom:.0001pt;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;strong&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340;border:none windowtext 1.0pt;padding:0cm&#39;&gt;settings.ubr&lt;/span&gt;&lt;/strong&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:15.0pt;margin-left:0cm;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;settings&lt;br&gt;{&amp;nbsp; &amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; server&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = &amp;quot;yourserveripaddresshere&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; clients&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; virtualclients = 5;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; counters&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interval = 10;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;Processor(_Total)\\% Processor Time&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;Processor(_Total)\\% Privileged Time&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;Processor(_Total)\\% User Time&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;Processor(_Total)\\Interrupts/sec&amp;quot;;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;Memory\\Available KBytes&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;Process(w3wp)\\Working Set&amp;quot;;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;System\\Context Switches/sec&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;System\\System Calls/sec&amp;quot;;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;Web Service(_Total)\\Bytes Received/sec&amp;quot; ;&lt;span class=apple-converted-space&gt;&amp;nbsp;&lt;/span&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;Web Service(_Total)\\Bytes Sent/sec&amp;quot; ;&lt;span class=apple-converted-space&gt;&amp;nbsp;&lt;/span&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;Web Service(_Total)\\Connection Attempts/sec&amp;quot; ;&lt;span class=apple-converted-space&gt;&amp;nbsp;&lt;/span&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = &amp;quot;Web Service(_Total)\\Get Requests/sec&amp;quot; ;&lt;span class=apple-converted-space&gt;&amp;nbsp;&lt;/span&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; registry&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = &amp;quot;System\\CurrentControlSet\\Control\\FileSystem&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = &amp;quot;NtfsDisableLastAccessUpdate&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type = REG_DWORD;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; registry&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = &amp;quot;System\\CurrentControlSet\\Services\\Tcpip\\Parameters&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = &amp;quot;SynAttackProtect&amp;quot;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type = REG_DWORD;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2 style=&#39;margin:0cm;margin-bottom:.0001pt;line-height:23.1pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;text-transform:lowercase;word-spacing:0px&#39;&gt;&lt;a name=&quot;StressandLoadTestingforWebApplications(W&quot;&gt;&lt;/a&gt;&lt;span style=&#39;font-size:15.5pt;font-family:&quot;Segoe UI Semibold&quot;,&quot;sans-serif&quot;;font-variant:small-caps;color:#253340;font-weight:normal&#39;&gt;more complicated scenarios and tests&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p style=&#39;mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:15.0pt;margin-left:0cm;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;Since building more complex scripts can be a pain and time consuming, it is&amp;nbsp;recommended to download the following two pieces of software that will help automate the building of the scenario scripts.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;margin:0cm;margin-bottom:.0001pt;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;strong&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340;border:none windowtext 1.0pt;padding:0cm&#39;&gt;Downloads:&lt;/span&gt;&lt;/strong&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;br&gt;1. Fiddler 2.0&lt;br&gt;&lt;a href=&quot;http://www.fiddler2.com/Fiddler2/version.asp&quot;&gt;&lt;span style=&#39;color:#2E8BCC;border:none windowtext 1.0pt;padding:0cm;text-decoration:none&#39;&gt;http://www.fiddler2.com/Fiddler2/version.asp&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;margin:0cm;margin-bottom:.0001pt;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;2. WCAT Scenario Creator&lt;br&gt;&lt;a href=&quot;http://fiddler2wcat.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=35356&quot;&gt;&lt;span style=&#39;color:#2E8BCC;border:none windowtext 1.0pt;padding:0cm;text-decoration:none&#39;&gt;http://fiddler2wcat.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=35356&lt;/span&gt;&lt;/a&gt;&lt;br&gt;You will need to download WCATScenarioGenerator.dll&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;margin:0cm;margin-bottom:.0001pt;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;strong&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340;border:none windowtext 1.0pt;padding:0cm&#39;&gt;Installation:&lt;/span&gt;&lt;/strong&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;br&gt;1. Install Fiddler2&lt;br&gt;2. Save WCATScenarioGenerator.dll to the Fiddler2 scripts folder&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;margin:0cm;margin-bottom:.0001pt;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;strong&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340;border:none windowtext 1.0pt;padding:0cm&#39;&gt;Use:&lt;/span&gt;&lt;/strong&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l2 level1 lfo3;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;1.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;Open fiddler and click the launch IE button from within Fiddler2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l2 level1 lfo3;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;2.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;It will start recording a list of sessions along the left side&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l2 level1 lfo3;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;3.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;After you&#39;ve got a sequence on the left you want to save to a scenario for WCAT do the following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l2 level1 lfo3;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;4.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;In fiddler 2 in the bottom left you should see a black rectangle.&amp;nbsp; This is where you can type commands for the WCAT extension&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:37.5pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l2 level2 lfo3;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;1.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;Type wcat reset then carriage return&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:37.5pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l2 level2 lfo3;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;2.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;type wcat addtrans then carriage return&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:37.5pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l2 level2 lfo3;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;3.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;type wcat save&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l2 level1 lfo3;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;5.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;you will now have a file called fiddler.wcat in your fiddler2 install folder&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l2 level1 lfo3;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;6.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;open fiddler.wcat and save it to your c:\program files\wcat\ as newscenarioname.ubr&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;mso-margin-top-alt:3.6pt;margin-right:0cm;margin-bottom:3.6pt;margin-left:18.75pt;text-indent:-18.0pt;line-height:14.25pt;mso-list:l2 level1 lfo3;vertical-align:middle&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;7.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;run wcat and execute your new scenario file&lt;br&gt;wcat.wsf -clients yourclientmachineip -run -t newscenarioname.ubr -f settings.ubr -s yourserverip&amp;nbsp; -p yourserverport&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:15.0pt;margin-left:0cm;line-height:17.55pt;vertical-align:baseline;outline: 0px;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;background-position:initial initial;background-repeat:initial initial;word-spacing:0px&#39;&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#253340&#39;&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/6546874634108926203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/6546874634108926203'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2013/09/using-wcat-scenario-creator.html' title='Using WCAT Scenario Creator'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-8324858095803917391</id><published>2012-11-20T19:24:00.001+05:30</published><updated>2012-11-20T19:24:53.014+05:30</updated><title type='text'>ASP.NET ~ SQL Cache Notification issue</title><content type='html'>&lt;div class=WordSection1&gt;&lt;p class=MsoNormal&gt;After enabling the database and table in sql server to support sql caching, I noticed that the cache is not still reflected with the updates. I verified to make sure if the database and tables are enabled and found that those are enabled. I opened the AspNet_SqlCacheTablesForChangeNotification table in sql server and noticed my table listed. The web.config file was also updated properly but still the cache was not getting invalidated. This was driving me crazy as why is the notification not working.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;I enabled the database to support sql caching as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727&amp;gt;aspnet_regsql -S &amp;lt;&amp;lt;server&amp;gt;&amp;gt; -E -d &amp;lt;&amp;lt;myDB&amp;gt;&amp;gt; &amp;#8211;ed&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;I enabled the table to support sql caching as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727&amp;gt;aspnet_regsql -S &amp;lt;&amp;lt;server&amp;gt;&amp;gt; -E -t &amp;lt;&amp;lt;myTable&amp;gt;&amp;gt; -d &amp;lt;&amp;lt;myDB&amp;gt;&amp;gt; &amp;#8211;et&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;I have also set the web.config to support sql caching as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;caching&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sqlCacheDependency enabled=&amp;quot;true&amp;quot; pollTime=&amp;quot;2000&amp;quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;databases&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name=&amp;quot;&amp;lt;&amp;lt;myDB&amp;gt;&amp;gt;&amp;quot; connectionStringName=&amp;quot;myDBConnString&amp;quot; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/databases&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/sqlCacheDependency&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/caching&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;After a while I checked the AspNet_SqlCacheTablesForChangeNotification table again just to make sure if everything is alright and that the table name is listed properly. I noticed that the case of the table name was different in AspNet_SqlCacheTablesForChangeNotification table. I was not sure but I just wanted to change case exactly as how it is displayed in the list of tables and give a try. I changed the table name manually in AspNet_SqlCacheTablesForChangeNotification table and then I tried again and it worked.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;Whew&amp;#8230;.That was a great relief. &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;Hope this helps someone facing similar problem&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8324858095803917391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8324858095803917391'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/11/aspnet-sql-cache-notification-issue.html' title='ASP.NET ~ SQL Cache Notification issue'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-2312737390435513277</id><published>2012-10-27T16:35:00.001+05:30</published><updated>2012-10-27T16:37:33.149+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="JSON Decimal Mapping"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC Decimal Mapping"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC3"/><title type='text'>ASP.NET MVC ~ JSON decimal binding problem</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
With ASP.NET MVC, we will face problem when mapping JSON decimal values in an AJAX call to the model. For example consider the following class and the action method:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;kwd1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;kwd1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;typ1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;MyClass&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; {&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;pln1&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;kwd1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;kwd1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;decimal&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; decValue1 &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; get&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; set&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;pln1&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;kwd1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;kwd1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; intValue1 &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; get&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; set&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;pln1&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;kwd1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;kwd1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;decimal&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; decValue2 &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; get&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; set&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;kwd1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;typ1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;ActionResult&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;typ1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;MyMethod&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;typ1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;MyClass&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; mc&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;pln1&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;kwd1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;typ1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;View&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;();&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
and assume the following jquery ajax call:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;$&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;ajax&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;({&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;pln1&quot;&gt;&amp;nbsp;&amp;nbsp; type&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;str1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;&quot;POST&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;pln1&quot;&gt;&amp;nbsp;&amp;nbsp; url&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;str1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;&quot;/Default/MyMethod&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;pln1&quot;&gt;&amp;nbsp;&amp;nbsp; contentType&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;str1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;&#39;application/json&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;pln1&quot;&gt;&amp;nbsp;&amp;nbsp; data&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;JSON&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;stringify&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;({&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;decValue1&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;lit1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;21&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;lit1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;00&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;intValue1&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;lit1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;3,&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;decValue2&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;:6.36})&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 9.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
On executing the above code, we will notice that the value for decValue1 will not be binded properly and that it will hold a value of 0. The reason is that the method JSON.stringify converts the value as follows before actually posting:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;str1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;decValue1&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;str1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;lit1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;21&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;str1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;intValue1&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;str1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;lit1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;3,&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;str1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;decValue2&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;str1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun1&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.0pt;&quot;&gt;:6.36}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The default model binding behaviour believes the value of decValue1 to be of type integer (21) and therefore ignores to map this value to the destination type which is decimal. In order to overcome this problem, we will have to create our custom decimal binder and then register that in the application start event. The following is the code provided by &lt;a href=&quot;http://haacked.com/articles/AboutHaacked.aspx&quot;&gt;Phil Haack&lt;/a&gt; to manage the custom binding of decimal types:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 4.55pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;using&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 4.55pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;using&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; System.Globalization;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 4.55pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;using&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; System.Web.Mvc;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 4.55pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 4.55pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;public&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;class&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; DecimalModelBinder : IModelBinder &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 4.55pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 4.55pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;public&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;object&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 4.55pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ValueProviderResult valueResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModelState modelState = &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;new&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; ModelState { Value = valueResult };&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;object&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; actualValue = &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;null&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;try&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; actualValue = Convert.ToDecimal(valueResult.AttemptedValue, CultureInfo.CurrentCulture);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;catch&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; (FormatException e) &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; modelState.Errors.Add(e);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bindingContext.ModelState.Add(bindingContext.ModelName, modelState);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 36.0pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; mso-fareast-language: EN-IN;&quot;&gt;return&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt; actualValue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 4.55pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-left: 4.55pt;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: black; mso-fareast-language: EN-IN;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
and then we should register this custom decimal binder class in the application start event in the Global.asax.cs file as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;protected&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt; &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;void&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt; Application_Start() &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AreaRegistration.RegisterAllAreas();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;ModelBinders.Binders.Add(&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;typeof&lt;/span&gt;&lt;/b&gt;&lt;strong&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;(&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;decimal&lt;/span&gt;&lt;/b&gt;&lt;strong&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;), &lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: blue; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;strong&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt; DecimalModelBinder());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: green; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;// All that other stuff you usually put in here...&lt;/span&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Now, if we execute the same code, we should see the values mapped properly.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/2312737390435513277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/2312737390435513277?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/2312737390435513277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/2312737390435513277'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/10/aspnet-mvc-json-decimal-binding-problem.html' title='ASP.NET MVC ~ JSON decimal binding problem'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-4309692907994658588</id><published>2012-10-25T15:29:00.001+05:30</published><updated>2012-10-25T16:05:10.668+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Knockout"/><title type='text'>Knockoutjs ~ Int16 data mapping fails from JSON to .NET</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We design class comprising of different data types based on our requirement. Assume there is a requirement to store the age of a person. In this case, we can specify any numerical datatype for Age like byte, short or int. In most cases we end up choosing int (Int32) datatype. But sometimes developer opts for either byte datatype or short (Int16) datatype. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Let’s assume that we have the following Person class with Age datatype as short (Int16).&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Person&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Int32&lt;/span&gt; Id { &lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; Name { &lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Int16&lt;/span&gt; Age { &lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The corresponding class definition on the cshtml view (javascript side) will be defined as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; Person (person) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; self = &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.Id=ko.observable(person.Id);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.Name=ko.observable(person.Name);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.Age=ko.observable(person.Age);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The following would normally be our method to send the information back to the server:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.save = &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (person) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$.ajax({&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type: &lt;span style=&quot;color: maroon;&quot;&gt;&quot;POST&quot;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url: &lt;span style=&quot;color: maroon;&quot;&gt;&quot;Save&quot;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data: ko.toJSON(self),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataType: &lt;span style=&quot;color: maroon;&quot;&gt;&#39;json&#39;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contentType: &lt;span style=&quot;color: maroon;&quot;&gt;&#39;application/json;charset=UTF-8&#39;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; success: &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (result) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;success&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; error: &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (xhr, ajaxOptions, thrownError) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;save error status: &quot;&lt;/span&gt; + xhr.status);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;save error thrown: &quot;&lt;/span&gt; + thrownError);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
And the following would be our ASP.NET code to capture the information:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style=&quot;color: #2b91af;&quot;&gt;HttpPost&lt;/span&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;JsonResult&lt;/span&gt; Save(&lt;span style=&quot;color: #2b91af;&quot;&gt;Person&lt;/span&gt; person)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (person == &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;) &lt;span style=&quot;color: blue;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;ArgumentNullException&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;person&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; personBusiness = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;PersonBusiness&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; result = person.Id == 0 ? personBusiness.Insert(person) : personBusiness.Update(person);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; Json(result);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In the above case we would expect that the person object would have the information mapped properly provided by the user but unfortunately Age will hold value of 0 no matter what value is supplied by the user. It seems like the mapping of short datatype is not properly implemented. This becomes evident when we change the datatype of Age from Int16 to Int32. Now on the save action we can see that the Age attribute will has the value as set by the user.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Hope this solves someone facing such issue.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/4309692907994658588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/4309692907994658588?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/4309692907994658588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/4309692907994658588'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/10/knockoutjs-int16-data-mapping-fails.html' title='Knockoutjs ~ Int16 data mapping fails from JSON to .NET'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-7860719644717569330</id><published>2012-10-18T20:00:00.001+05:30</published><updated>2012-10-18T20:02:23.498+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Deep validation"/><category scheme="http://www.blogger.com/atom/ns#" term="Knockout"/><category scheme="http://www.blogger.com/atom/ns#" term="Knockout Validation"/><title type='text'>&quot;Dynamic&quot; deep validation with KnockoutJS model</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In this article, &lt;a href=&quot;http://hemant-vikram.blogspot.in/2012/09/knockout-model-and-validating-inner.html&quot;&gt;Knockout Model and Validating &quot;inner&quot; Models&lt;/a&gt;, we have seen how deep validation is done. Here is a snippet of that validation:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.save = &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; () {&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 36pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; (self.errors().length != 0) { &lt;/span&gt;&lt;span style=&quot;color: darkgreen; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;//verifying the errors attribute using the count of errors&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.errors.showAllMessages(); &lt;/span&gt;&lt;span style=&quot;color: darkgreen; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;//displaying the corresponding error messages&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 36pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color: darkgreen; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;//returning the control providing user a chance to correct the issues&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In the above method, we are simply invoking the showAllMessages method from the errors member. This will work for on occasion but sometimes this will fail and the validation error messages will not be displayed. In this situation, there is a workaround using which we can achieve this validation functionality working. The workaround is to add errors member to javascript class and then invoike the showAllMessage method for each of the instance of the class as shown below:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; Contact(id, phoneType, phone) {&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; self = &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.ClientId = ko.observable(id);&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.PhoneType = ko.observable(phoneType).extend({ required: &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; });&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.Phone = ko.observable(phone).extend({ required: &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span class=&quot;js-localvariable&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-property&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;errors &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-operator&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;= &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-variable&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;ko&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-property&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;validation&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-property&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;group&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-localvariable&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: darkgreen; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; //adding the errors object for javascript class making each instance to hold the error individually&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;};&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; ClientModel (id, firstName, lastName, email, contacts) {&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; self = &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.Id = ko.observable(id);&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.FirstName = ko.observable(firstName).extend({ required: &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;, maxLength: 50 });&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.LastName = ko.observable(lastName).extend({ required: &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;, maxLength: 50 });&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.Email = ko.observable(email).extend({ maxLength: 50, email: &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; });&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.Contacts = ko.observableArray(ko.utils.arrayMap(contacts, &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; (aContact) {&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; return&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; aContact; })); &lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Next we will update the save method as follows to perform the validation:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;self.save = &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; () {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; errorCount = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span class=&quot;js-variable&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;ko&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-property&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;utils&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-property&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;arrayForEach&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-localvariable&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;Contacts&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;(), &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-keyword&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-variabledef&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;contact&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;){&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-localvariable&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt; text-indent: 36pt;&quot;&gt;
&lt;span class=&quot;js-localvariable&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;contact&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-property&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;errors&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-property&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;showAllMessages&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;js-punctuation&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt; text-indent: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;errorCount = errorCount + 1;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;js-punctuation&quot;&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 36pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt; (errorCount != 0) { &lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt; text-indent: 36pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: darkgreen; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;//save code block&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-IN;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Hope this helps.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/7860719644717569330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/7860719644717569330?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/7860719644717569330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/7860719644717569330'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/10/dynamic-deep-validation-with-knockoutjs.html' title='&quot;Dynamic&quot; deep validation with KnockoutJS model'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-3012622523008850706</id><published>2012-09-12T20:01:00.001+05:30</published><updated>2012-09-12T20:05:43.481+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON Date"/><category scheme="http://www.blogger.com/atom/ns#" term="MilliSeconds"/><title type='text'>Dealing with JSON format date</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
When working with web application and dealing with JSON formatted data, we may come across date types that are represented as &lt;b&gt;&lt;span style=&quot;color: #1f497d;&quot;&gt;/Date(1347490800000)/&lt;/span&gt;&lt;/b&gt;. The value between the parenthesis i.e. &lt;b&gt;&lt;span style=&quot;color: #1f497d;&quot;&gt;1347490800000 &lt;/span&gt;&lt;/b&gt;indicates the number of milliseconds elapsed since 1&lt;sup&gt;st&lt;/sup&gt; Jan 1970. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In order to show the date in human understandable format, we will have to construct the date object using these millisecond values. In JavaScript, this can be done as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; myJSONDate = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;/Date(1347490800000)/&quot;;&lt;/span&gt;&lt;span style=&quot;color: darkgreen;&quot;&gt; //For demonstration purpose but in realtime we will get from Ajax call returning data in JSON format&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; value = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Date(parseInt(myJSONDate.replace(/\/Date\((.*?)\)\//gi, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;$1&quot;&lt;/span&gt;)));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In the above method, we have used native JavaScript’s regular expression technique to get hold of the millisecond value stripping the /, Date and parenthesis characters. In JavaScript, the new date object by default starts from 1&lt;sup&gt;st&lt;/sup&gt; Jan 1970.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Similarly, we will can construct the DateTime object in .NET from JSON date as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; jsonDate = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;/Date(1347490800000)/&quot;&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;jsonDate = System.Text.RegularExpressions.&lt;span style=&quot;color: #2b91af;&quot;&gt;Regex&lt;/span&gt;.Replace(jsonDate, &lt;span style=&quot;color: #a31515;&quot;&gt;@&quot;/Date\((.*?)\)\/&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;$1&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; date = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;DateTime&lt;/span&gt;(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds(&lt;span style=&quot;color: blue;&quot;&gt;long&lt;/span&gt;.Parse(jsonDate));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Hope this helps…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/3012622523008850706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/3012622523008850706?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/3012622523008850706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/3012622523008850706'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/09/dealing-with-json-format-date.html' title='Dealing with JSON format date'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-7731610146194655914</id><published>2012-09-05T18:40:00.001+05:30</published><updated>2012-09-05T18:44:26.365+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Knockout"/><category scheme="http://www.blogger.com/atom/ns#" term="validation"/><title type='text'>Knockout Model and Validating &quot;inner&quot; Models</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
More and more technologies, projects and products are basing their foundation on MVC and MVVM principles. The reason is that it makes the project or product to be maintained easily without much headache. The latest trend in client based web development is also shifting towards MVVM model and the tool that is getting most widely used is the &lt;a href=&quot;http://knockoutjs.com/&quot;&gt;Knockout javascript library&lt;/a&gt;. It’s a great tool that eases binding making even the complex javascript tasks to be designed pretty easily like for example dynamically rendering design for multiple contacts and collecting details, etc..,&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Basic Knockout Model Validation&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Validating a basic knockout model is a straight forward task. We just have to use the extend method on the observable attributes and set the necessary parameters. Consider the following model:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; ClientModel (id, firstName, lastName, email) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; self = &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.Id = ko.observable(id);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.FirstName = ko.observable(firstName).extend({ required: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;, maxLength: 50 });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.LastName = ko.observable(lastName).extend({ required: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;, maxLength: 50 });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.Email = ko.observable(email).extend({ maxLength: 50, email: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.save = &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; () {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (self.errors().length != 0) { &lt;span style=&quot;color: darkgreen;&quot;&gt;//verifying the errors attribute using the count of errors&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.errors.showAllMessages(); &lt;span style=&quot;color: darkgreen;&quot;&gt;//displaying the corresponding error messages&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;; &lt;span style=&quot;color: darkgreen;&quot;&gt;//returning the control providing user a chance to correct the issues&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.ajax({&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type: &lt;span style=&quot;color: maroon;&quot;&gt;&quot;POST&quot;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url: &lt;span style=&quot;color: maroon;&quot;&gt;&quot;Save&quot;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data: ko.toJSON(self),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contentType: &lt;span style=&quot;color: maroon;&quot;&gt;&#39;application/json&#39;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; success: &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (mydata) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;Success&quot;)&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;error: &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (xhr, ajaxOptions, thrownError) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;save method error status: &quot;&lt;/span&gt; + xhr.status);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;save method error thrown: &quot;&lt;/span&gt; + thrownError);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;$(document).ready(&lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; () {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; clientModel = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; ClientModel(1, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;Hello&quot;, &quot;World&quot;, &quot;hell0@world.com&quot;&lt;/span&gt;);&lt;span style=&quot;color: maroon;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;clientModel.errors = ko.validation.group(clientModel);&lt;span style=&quot;color: darkgreen;&quot;&gt; //setting up the errors attribute to the model to capture the validation error message&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;ko.applyBindings(clientModel);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The above is a basic model with validations added for the attributes using the extend method (More validation can be found &lt;a href=&quot;https://github.com/ericmbarnard/Knockout-Validation/wiki/Native-Rules&quot;&gt;here&lt;/a&gt;). The validation error messages are shown when the save method of the model is executed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Deep Knockout Model Validation&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Often we face situation where we will have a requirement for a complex model than the basic one. &lt;b&gt;For example&lt;/b&gt;: our client may request us to design a solution to allow multiple contact numbers for a customer to be collected. In this case, the underlying model is changed as follows. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; Contact(id, phoneType, phone) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; self = &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.ClientId = ko.observable(id);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.PhoneType = ko.observable(phoneType).extend({ required: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.Phone = ko.observable(phone).extend({ required: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; ClientModel (id, firstName, lastName, email, contacts) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; self = &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.Id = ko.observable(id);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.FirstName = ko.observable(firstName).extend({ required: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;, maxLength: 50 });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.LastName = ko.observable(lastName).extend({ required: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;, maxLength: 50 });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.Email = ko.observable(email).extend({ maxLength: 50, email: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;self.Contacts = ko.observableArray(ko.utils.arrayMap(contacts, &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (aContact) {&lt;span style=&quot;color: blue;&quot;&gt; return&lt;/span&gt; aContact; }));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.save = &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; () {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (self.errors().length != 0) { &lt;span style=&quot;color: darkgreen;&quot;&gt;//verifying the errors attribute using the count of errors&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.errors.showAllMessages(); &lt;span style=&quot;color: darkgreen;&quot;&gt;//displaying the corresponding error messages&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;; &lt;span style=&quot;color: darkgreen;&quot;&gt;//returning the control providing user a chance to correct the issues&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.ajax({&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type: &lt;span style=&quot;color: maroon;&quot;&gt;&quot;POST&quot;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url: &lt;span style=&quot;color: maroon;&quot;&gt;&quot;Save&quot;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data: ko.toJSON(self),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contentType: &lt;span style=&quot;color: maroon;&quot;&gt;&#39;application/json&#39;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; success: &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (mydata) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;Success&quot;)&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;error: &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (xhr, ajaxOptions, thrownError) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;save method error status: &quot;&lt;/span&gt; + xhr.status);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;save method error thrown: &quot;&lt;/span&gt; + thrownError);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;$(document).ready(&lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; () {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; contacts = {&lt;span style=&quot;color: blue;&quot;&gt; new&lt;/span&gt; Contact(1, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;Home&quot;, &quot;1234567890&quot;&lt;/span&gt;), &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Contact(1, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;Work&quot;, &quot;9876543210&quot;&lt;/span&gt;) };&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; clientModel = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; ClientModel(1, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;Hello&quot;, &quot;World&quot;, &quot;hell0@world.com&quot;, &lt;/span&gt;contacts);&lt;span style=&quot;color: maroon;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;clientModel.errors = ko.validation.group(clientModel);&lt;span style=&quot;color: darkgreen;&quot;&gt; //setting up the errors attribute to the model to capture the validation error message&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;ko.applyBindings(clientModel);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The above is a also a model with validations added for the attributes using the extend method. The validation error messages excepts the contacts will be displayed when the save method of the model is executed. The reason is that we have not made the validation “deep” so the inner validations are not executed. In order to achieve this, we will have to include the following Knockout initialization block:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;ko.validation.init({grouping: { deep: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; }, messagesOnModified: &lt;span style=&quot;color: blue;&quot;&gt;false &lt;/span&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Adding the above line of code should make the inner validations work in most cases. But if it still doesn’t work, then we will have to add the errors attribute to the Contact model just like we have added for the ClientModel. The below listing shows the updated Contact model with errors attribute added:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; Contact(id, phoneType, phone) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; self = &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.ClientId = ko.observable(id);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.PhoneType = ko.observable(phoneType).extend({ required: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.Phone = ko.observable(phone).extend({ required: &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; self.errors = ko.validation.group(self);&lt;span style=&quot;color: darkgreen;&quot;&gt; //setting up the errors attribute to the Contact model to capture the validation error message&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Having added the errors attribute to the Contact model, we also need to update the save method of the ClientModel to verify the errors collection attribute and return if in case there are errors. The updated save method is listed below:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;self.save = &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; () {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var &lt;/span&gt;errorExists = &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; (self.Contacts().errors().length != 0) { &lt;span style=&quot;color: darkgreen;&quot;&gt;//verifying the errors attribute from the Contact model&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.Contacts().errors.showAllMessages(); &lt;span style=&quot;color: darkgreen;&quot;&gt;//displaying the corresponding error messages&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; errorExists = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;; &lt;span style=&quot;color: darkgreen;&quot;&gt;//set error flag to stop further processing&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; (self.errors().length != 0) { &lt;span style=&quot;color: darkgreen;&quot;&gt;//verifying the errors attribute using the count of errors&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.errors.showAllMessages(); &lt;span style=&quot;color: darkgreen;&quot;&gt;//displaying the corresponding error messages&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; errorExists = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;; &lt;span style=&quot;color: darkgreen;&quot;&gt;//set error flag to stop further processing&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; (errorExists) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;; &lt;span style=&quot;color: darkgreen;&quot;&gt;//returning the control providing user a chance to correct the issues&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.ajax({&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type: &lt;span style=&quot;color: maroon;&quot;&gt;&quot;POST&quot;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url: &lt;span style=&quot;color: maroon;&quot;&gt;&quot;Save&quot;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data: ko.toJSON(self),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contentType: &lt;span style=&quot;color: maroon;&quot;&gt;&#39;application/json&#39;&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; success: &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (mydata) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;Success&quot;)&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;error: &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (xhr, ajaxOptions, thrownError) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;save method error status: &quot;&lt;/span&gt; + xhr.status);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  alert(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;save method error thrown: &quot;&lt;/span&gt; + thrownError);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
From the above updated save method, all the errors corresponding to the main model (ClientModel) and the child model (Contact) will be displayed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Hope this helps!!!&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/7731610146194655914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/7731610146194655914?isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/7731610146194655914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/7731610146194655914'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/09/knockout-model-and-validating-inner.html' title='Knockout Model and Validating &quot;inner&quot; Models'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-4214315986691692412</id><published>2012-07-21T16:26:00.001+05:30</published><updated>2012-07-21T16:26:29.410+05:30</updated><title type='text'>MVC ~ Transferring data from one page to another</title><content type='html'>&lt;div class=WordSection1&gt;&lt;p class=MsoNormal&gt;Lot of times we would need to pass data from one page to another. The data could be a simple data or it can also be a complex data. In case of simple data, we can transfer using query string parameter and this does the job but when the size of the data is really big or if it is a complex type, then we need a different mechanism.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;With MVC, we get the dictionary object to store the values at one end and retrieve it at the other end. These values are actually stored in session and lasts until the session terminates. Here is how we can make use of it:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;text-autospace:none&#39;&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas;color:gray&#39;&gt;//&lt;/span&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas;color:green&#39;&gt;store the data to temp data dictionary. Data can be of any type&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;text-autospace:none&#39;&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas&#39;&gt;TempData[&lt;span style=&#39;color:#2B91AF&#39;&gt;&amp;#8220;myUniqueKey&amp;#8221;&lt;/span&gt;] = &lt;span style=&#39;color:blue&#39;&gt;value&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;text-autospace:none&#39;&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas&#39;&gt;&amp;#8230;&amp;#8230;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;text-autospace:none&#39;&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas&#39;&gt;&amp;#8230;&amp;#8230;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;text-autospace:none&#39;&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas;color:gray&#39;&gt;//&lt;/span&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas;color:green&#39;&gt;retrieve the data from temp data dictionary.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;text-autospace:none&#39;&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas;color:blue&#39;&gt;if&lt;/span&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas&#39;&gt; (TempData.ContainsKey(&lt;span style=&#39;color:#2B91AF&#39;&gt;&amp;#8220;myUniqueKey&amp;#8221;&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;text-indent:36.0pt;text-autospace:none&#39;&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas&#39;&gt;myComplexData = TempData[&lt;span style=&#39;color:#2B91AF&#39;&gt;&amp;#8220;myUniqueKey&amp;#8221;&lt;/span&gt;] as &lt;span style=&#39;color:#2B91AF&#39;&gt;MyComplexData&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;text-autospace:none&#39;&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas&#39;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;span style=&#39;font-size:9.5pt;font-family:Consolas&#39;&gt;Happy Programming!!!&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/4214315986691692412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/4214315986691692412'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/07/mvc-transferring-data-from-one-page-to.html' title='MVC ~ Transferring data from one page to another'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-1437472917778407461</id><published>2012-07-15T14:52:00.001+05:30</published><updated>2012-07-15T15:05:40.353+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="timeout"/><title type='text'>Resolving HTTP Connection Timeout with Android applications</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Response time of any application greatly matters especially those dealing with network operations. Sometimes the response from the server is reasonable but at times servers get busy and takes much time in responding. In such situation, we generally set timeout (in the range of 20-30 seconds) for method execution and handle the operation accordingly. This range of timeout is fair for web application but coming to mobile devices the response time has to be much quicker in the range of 3-5 seconds.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We define the connection timeout as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
HttpParams params = httpclient.getParams(); &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
HttpConnectionParams.setConnectionTimeout(params, 3000); &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Here in the above snippet the connection timeout is set to 3000 milliseconds or 3 seconds. But executing the operation, we will notice that the execution does not return after 3 seconds though set rather it waits for a long time. In order to resolve this issue, along with setting the connection timeout, we also need to set the socket timeout as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
HttpParams params = httpclient.getParams(); &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
HttpConnectionParams.setConnectionTimeout(params, 3000); &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
HttpConnectionParams.setSoTimeout(params, 3000);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Now executing the operation, we will notice that the execution of code block returns in 3 seconds.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Hope this solves your problem…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Happy programming !!!&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/1437472917778407461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/1437472917778407461?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/1437472917778407461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/1437472917778407461'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/07/resolving-http-connection-timeout-with.html' title='Resolving HTTP Connection Timeout with Android applications'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-4157615582692494996</id><published>2012-07-12T17:12:00.001+05:30</published><updated>2012-07-12T17:26:11.950+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="java build path"/><title type='text'>Eclipse build error: The project was not built since its build path is incomplete. Cannot find the class file for xxxxx. Fix the build path then try building this project</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We are creating a project in Eclipse studio, building the project and it executes. Everything goes fine and smooth. Next time we open the Eclipse studio and see red cross mark error beside our imports on basic java class references. To be more specific, we get the following issue:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;i&gt;The project was not built since its build path is incomplete. Cannot find the class file for xxxxx. Fix the build path then try building this project&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Here xxxxx can be any of the java class file. We wonder why we get this and that it didn’t happen when we worked on the project just before Lunch!!! Annoying huh.. Ok so what is the problem and how to get rid of this ASAP? Well…the problem is with the reference of java library in our project. Sometimes Eclipse loses the reference path and require us to help it out. And how do we do that…here are the steps:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Right click on the project from the Project Explorer and select “Properties”. Alternatively we can also select “Properties” from the Project menu.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;From the Properties dialog, select “Java Build Path” from the left side view.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
3.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Clicking the “Libraries” tab we can see the libraries referenced in the project and will also see that something is wrong with JRE library referenced in the project as shown below:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;span style=&quot;color: #1f497d;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDoTz-hDDeP9OPc-65r9Y9HGG3DmJmF1aLhXffKdwmo0j1UD7FIJO6gZ52wAE842XeQKE5n5Oxz0sKmi7RcaucGvTs24_DNvSq0uYDP4miSmKtNdE2leYBpLPnXaQxxGSQ-64S/s1600/image001-739624.jpg&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5764247006932827074&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDoTz-hDDeP9OPc-65r9Y9HGG3DmJmF1aLhXffKdwmo0j1UD7FIJO6gZ52wAE842XeQKE5n5Oxz0sKmi7RcaucGvTs24_DNvSq0uYDP4miSmKtNdE2leYBpLPnXaQxxGSQ-64S/s320/image001-739624.jpg&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;color: #1f497d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
4.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Next we select th&lt;span style=&quot;color: #1f497d;&quot;&gt;is&lt;/span&gt; library and remove it. Then we click the “Add Library…” button on the right and then select the “JRE System Library” and then click the “Next” button as shown below:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;span style=&quot;color: #1f497d;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdHo71B7vvxfJusHf_DP7qLjd668oRwIP-m83tdlhtZ0N741aVeDSruVacDFXsxGhLEFuubOpll-ifHsljPfXd5r7rykNwJyg6nujVq0rhy51hojNYAIlLDgaa62lN6ntZuEmO/s1600/image002-741261.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5764247008911021330&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdHo71B7vvxfJusHf_DP7qLjd668oRwIP-m83tdlhtZ0N741aVeDSruVacDFXsxGhLEFuubOpll-ifHsljPfXd5r7rykNwJyg6nujVq0rhy51hojNYAIlLDgaa62lN6ntZuEmO/s320/image002-741261.png&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;color: #1f497d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
5.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;By default, we will see that “Workspace default JRE” is selected as shown below. We can leave this as is and then click the “Finish” button&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;span style=&quot;color: #1f497d;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKMLi1WH1GOrJ1fnuvRlL3p8PiaGmvhhkYnWAkJ7R5sxSikOlr5TPkQSu2F9Dj7S2U3tXrF-NvOvoZhMSNoc5hm5dbxDdWHpaHrVZy5DPAkQvIiHSSW4RqqZA46qRPF5KdigPE/s1600/image003-742874.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5764247014776794626&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKMLi1WH1GOrJ1fnuvRlL3p8PiaGmvhhkYnWAkJ7R5sxSikOlr5TPkQSu2F9Dj7S2U3tXrF-NvOvoZhMSNoc5hm5dbxDdWHpaHrVZy5DPAkQvIiHSSW4RqqZA46qRPF5KdigPE/s320/image003-742874.png&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;color: #1f497d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
Now that we have the JRE library referenced to the project, we should see the error go away. But sometimes not. In this case, we do the regular clean-up of the project as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
1.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Project Menu -&amp;gt; Clean&lt;br /&gt;&lt;br /&gt;2.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Right click on the project from “Project Explorer” and “Refresh”&lt;br /&gt;&lt;br /&gt;3.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Right click on the project from “Project Explorer” and under &quot;Android Tools&quot; click “Fix Project Properties”&lt;br /&gt;&lt;br /&gt;4.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; May be even restart Eclipse if the above 3 steps doesn’t work and then repeat the 3 steps after restarting&lt;/div&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;br /&gt;
Finally we see the error go away. Whew….&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
Hope this helps reduce your headache and…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
Happy Programming!!!&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/4157615582692494996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/4157615582692494996?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/4157615582692494996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/4157615582692494996'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/07/eclipse-build-error-project-was-not_12.html' title='Eclipse build error: The project was not built since its build path is incomplete. Cannot find the class file for xxxxx. Fix the build path then try building this project'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDoTz-hDDeP9OPc-65r9Y9HGG3DmJmF1aLhXffKdwmo0j1UD7FIJO6gZ52wAE842XeQKE5n5Oxz0sKmi7RcaucGvTs24_DNvSq0uYDP4miSmKtNdE2leYBpLPnXaQxxGSQ-64S/s72-c/image001-739624.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-4005838883879976242</id><published>2012-07-10T19:54:00.001+05:30</published><updated>2012-07-10T19:56:56.364+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CKEditor"/><title type='text'>Resolving ~ uncaught exception: [CKEDITOR.editor] The instance &quot;myCKEditor&quot; already exists.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Having added the CKEditor successfully to our web application, we see that it loads fine but during post-back we get a javascript error message as&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;uncaught exception: [CKEDITOR.editor] The instance &quot;myCKEditor&quot; already exists.&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The error states about the existence of the CKEditor in the browser. So, we have to get rid of the ones that already exists using the following method:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;language&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;javascript&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text/javascript&quot;&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (CKEDITOR.instances[&lt;span style=&quot;color: maroon;&quot;&gt;&#39;myCKEditor&#39;&lt;/span&gt;]) { &lt;span style=&quot;color: blue;&quot;&gt;delete&lt;/span&gt; CKEDITOR.instances[&lt;span style=&quot;color: maroon;&quot;&gt;&#39;myCKEditor&#39;&lt;/span&gt;] };&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (CKEDITOR.instances[&lt;span style=&quot;color: maroon;&quot;&gt;&#39;myCKEditor&#39;&lt;/span&gt;]) { CKEDITOR.instances[&lt;span style=&quot;color: maroon;&quot;&gt;&#39;myCKEditor&#39;&lt;/span&gt;].destroy(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The above code will remove the existence of the ‘myCKEditor’ editor from the browser memory and recreates it thereby resolving the issue.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Happy Programming!!!&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/4005838883879976242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/4005838883879976242?isPopup=true' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/4005838883879976242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/4005838883879976242'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/07/resolving-uncaught-exception.html' title='Resolving ~ uncaught exception: [CKEDITOR.editor] The instance &quot;myCKEditor&quot; already exists.'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-8966552049110465643</id><published>2012-07-08T17:16:00.001+05:30</published><updated>2012-07-08T17:32:04.350+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="compress"/><category scheme="http://www.blogger.com/atom/ns#" term="minified"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC3"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><category scheme="http://www.blogger.com/atom/ns#" term="squishit"/><title type='text'>Delivering Compressed and Combined files for MVC 3 applications</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
It is very difficult to stay in the race without delivering application that performs “The Best” in the web world. To help us be in the race, we have lot of resources available in the internet to search for and plug in to our web application to gain optimal performance. One such tool is Squish It.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
SquishIt is a framework for ASP.NET web application that compresses and combines javascript and css files. There are lot more options available with the SquishIt framework, but let’s walk-through the quick process of setting up the framework for ASP.NET MVC 3 application to compress and combine the css and javascript files.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Ok here we go…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Download the latest framework from the GitHub from the following location: &lt;a href=&quot;https://github.com/jetheredge/SquishIt/downloads&quot;&gt;https://github.com/jetheredge/SquishIt/downloads&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Extract the zip file and reference the SquishIt.Framework.dll and SquishIt.Mvc.dll in your MVC application. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;b&gt;Note:&lt;/b&gt; If the dlls are not available in the bin folder of the extracted zip file, then you will have to open the solution in VS and built it (in release mode) and then reference the dlls in your MVC application.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
3.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Next open the page (cshtml) where you have references to javascript and css files&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
4.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Add the following library references at the top of the cshtml page:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;background: none repeat scroll 0% 0% yellow; font-family: Consolas; font-size: 9.5pt;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; SquishIt.Framework&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;background: none repeat scroll 0% 0% yellow; font-family: Consolas; font-size: 9.5pt;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; SquishIt.Mvc&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo1; text-autospace: none; text-indent: -18.0pt;&quot;&gt;
5.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Next we have to transform the code that references the css files from:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;&lt;/span&gt;&lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Url.Content(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Content/Site.css&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;)&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;stylesheet&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text/css&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;link&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;&lt;/span&gt;&lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Url.Content(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Content/ jquery.alerts.css&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;)&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;stylesheet&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text/css&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;link&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;&lt;/span&gt;&lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Url.Content(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Content/bootstrap.css&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;)&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;stylesheet&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text/css&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;background: none repeat scroll 0% 0% yellow; font-family: Consolas; font-size: 9.5pt;&quot;&gt;@(&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: 9.5pt;&quot;&gt;Bundle&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;.Css()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Add(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Content/Site.css&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Add(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Content/jquery.alerts.css&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Add(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Content/bootstrap.css&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .ForceRelease()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .MvcRender(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Content/Site_#.css&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo1; text-autospace: none; text-indent: -18.0pt;&quot;&gt;
6.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;And then we transform the code that references the javascript files from:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;&lt;/span&gt;&lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Url.Content(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Scripts/jquery.validate.min.js&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;)&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text/javascript&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;&lt;/span&gt;&lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Url.Content(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Scripts/jquery-ui-1.8.11.min.js&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;)&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text/javascript&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;&lt;/span&gt;&lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Url.Content(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Scripts/MicrosoftAjax.js&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;)&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text/javascript&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot;&gt;@(&lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Bundle&lt;/span&gt;.JavaScript()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Add(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Scripts/jquery.validate.min.js&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Add(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Scripts/jquery-ui-1.8.11.min.js&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Add(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/Scripts/MicrosoftAjax.js&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .ForceRelease()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .MvcRender(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/scripts/combined_#.js&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;background: none repeat scroll 0% 0% yellow; font-family: Consolas; font-size: 9.5pt;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
And that’s it! Go ahead and run your application. Open the Firefox YSlow plugin and verify the number of requests for the css and javascript files. It should be two. Also, you would find that the size of the output file is a reduced one.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
Happy programming!!!&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/8966552049110465643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/8966552049110465643?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8966552049110465643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8966552049110465643'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/07/delivering-compressed-and-combined.html' title='Delivering Compressed and Combined files for MVC 3 applications'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-1675383120810557543</id><published>2012-07-02T09:12:00.001+05:30</published><updated>2012-07-02T11:08:58.634+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML ID"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC3"/><title type='text'>MVC 3 Get the Html ID of a control for jQuery calls</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
jQuery makes the life of web developer simpler by addressing most of the browser compatibility issues. Every developer wants to make use of jQuery library to leave (most of) the browser related compatibilities to be taken care of by jQuery and concentrates on the actual requirements instead of worrying about other factors.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Integration of jQuery in any web project is as easier as it can be. The only important thing is to carefully pass the correct or appropriate id to jQuery calls. It is easier to view the generated source and hard code the corresponding ID to the jQuery calls. Ofcourse this would work and good for short term projects however for long term projects hard coding is not the best idea and nor is it recommended. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
With traditional ASP.NET application, we use the following method to get hold of the Html ID that will&amp;nbsp; be generated for a control:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
var id = $(“#&amp;lt;%=aspNetDotnetControl.ClientID %”&amp;gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This technique doesn’t work with ASP.NET MVC architecture. The following is one of the easiest way to do this in MVC 3:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Define the extension method for the HtmlHelper class to return the fully qualified name for the given html (partial) field&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Define another extension method that just takes the fully qualified name and return the ID of the HTML element&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.Diagnostics.CodeAnalysis.&lt;span style=&quot;color: #2b91af;&quot;&gt;SuppressMessage&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Microsoft.Design&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;CA1011:ConsiderPassingBaseTypesAsParameters&quot;&lt;/span&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.CodeAnalysis.&lt;span style=&quot;color: #2b91af;&quot;&gt;SuppressMessage&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Microsoft.Design&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;CA1006:DoNotNestGenericTypesInMemberSignatures&quot;&lt;/span&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; NameFor&amp;lt;TModel, TProperty&amp;gt;(&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;HtmlHelper&lt;/span&gt;&amp;lt;TModel&amp;gt; htmlHelper, &lt;span style=&quot;color: #2b91af;&quot;&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Func&lt;/span&gt;&amp;lt;TModel, TProperty&amp;gt;&amp;gt; expression)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; htmlHelper != &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt; ? htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(&lt;span style=&quot;color: #2b91af;&quot;&gt;ExpressionHelper&lt;/span&gt;.GetExpressionText(expression)) : &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;.Empty;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.Diagnostics.CodeAnalysis.&lt;span style=&quot;color: #2b91af;&quot;&gt;SuppressMessage&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Microsoft.Design&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;CA1011:ConsiderPassingBaseTypesAsParameters&quot;&lt;/span&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;System.Diagnostics.CodeAnalysis.&lt;span style=&quot;color: #2b91af;&quot;&gt;SuppressMessage&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Microsoft.Design&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;CA1006:DoNotNestGenericTypesInMemberSignatures&quot;&lt;/span&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; IdFor&amp;lt;TModel, TProperty&amp;gt;(&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;HtmlHelper&lt;/span&gt;&amp;lt;TModel&amp;gt; htmlHelper, &lt;span style=&quot;color: #2b91af;&quot;&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Func&lt;/span&gt;&amp;lt;TModel, TProperty&amp;gt;&amp;gt; expression)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;HtmlHelper&lt;/span&gt;.GenerateIdFromName(NameFor(htmlHelper, expression));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; After defining the above two extension methods, we are now ready to make use of it in our cshtml files as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;$(&lt;span style=&quot;color: maroon;&quot;&gt;&#39;#&lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot;&gt;@&lt;/span&gt;&lt;/span&gt;Html.IdFor(m =&amp;gt; m.Service.Name)&lt;span style=&quot;color: maroon;&quot;&gt;&#39;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; And that’s it. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/1675383120810557543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/1675383120810557543?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/1675383120810557543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/1675383120810557543'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/07/mvc-3-get-html-id-of-control-for-jquery.html' title='MVC 3 Get the Html ID of a control for jQuery calls'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-6094032111510519808</id><published>2012-06-23T11:53:00.001+05:30</published><updated>2012-06-23T11:54:38.753+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="android sdk manager"/><category scheme="http://www.blogger.com/atom/ns#" term="connection reset"/><category scheme="http://www.blogger.com/atom/ns#" term="packages"/><title type='text'>Issue installing Packages from Android SDK Manager</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
I was interested in testing my android application using different packages and tools that is available from the Android SDK Manager. I clicked the SDK Manager and I was presented with the tools/packages already installed in my system as well as those that are not installed into my system.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
I selected the packages, accepted the licensing of the package and clicked the “Install (x) Packages…” button. The download started but after few seconds I noticed that the download and installation of the selected package was not successful and I got the “Connection reset” message in the log window. I wasn’t sure what could be the issue but I was able browse the internet.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
After having googled about this issue, my colleague recommended to try the installation on another machine. I tried in one my colleague’s machine and saw that the download of the package and the installation succeeded. Next what I did is copied all these packages from the my colleagues system under the folder: &lt;b&gt;&amp;lt;android-sdk-directory&amp;gt;/add-ons&lt;/b&gt; and copied to my system’s &lt;b&gt;&amp;lt;android-sdk-directory&amp;gt;/add-ons &lt;/b&gt;directory. Then I restarted my Eclipse studio and opened the SDK Manager. I noticed all these packages marked as installed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMdDe4YQO40NktJx8ha6mge3ynBPdeAO9RHdj3F32Otv5sloowu9x-6bG_q_Cywls3cQSHloRtCqmSdU8_HWPCHCoP7TyDOuPP23JhHammnDewH7QgjH6Fmre_JLtHVc2WnHyx/s1600/image001-720303.jpg&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5757114270347339138&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMdDe4YQO40NktJx8ha6mge3ynBPdeAO9RHdj3F32Otv5sloowu9x-6bG_q_Cywls3cQSHloRtCqmSdU8_HWPCHCoP7TyDOuPP23JhHammnDewH7QgjH6Fmre_JLtHVc2WnHyx/s320/image001-720303.jpg&quot; /&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Hope this helps someone solve this type of issue…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/6094032111510519808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/6094032111510519808?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/6094032111510519808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/6094032111510519808'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/06/issue-installing-packages-from-android.html' title='Issue installing Packages from Android SDK Manager'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMdDe4YQO40NktJx8ha6mge3ynBPdeAO9RHdj3F32Otv5sloowu9x-6bG_q_Cywls3cQSHloRtCqmSdU8_HWPCHCoP7TyDOuPP23JhHammnDewH7QgjH6Fmre_JLtHVc2WnHyx/s72-c/image001-720303.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-6935016418370622409</id><published>2012-06-21T19:47:00.000+05:30</published><updated>2012-06-21T19:49:26.575+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Source Control"/><category scheme="http://www.blogger.com/atom/ns#" term="TFS Plugin"/><title type='text'>Eclipse TFS Plugin Source control issue</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
At times when working with Team explorer, connecting to TFS Server from Eclipse studio can be a painful experience. Assume that you are working in a project and the source code is controlled from TFS server. Every changes are checked id and you are good for the day.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Next day you open the Eclipse studio ready to work on your project and notice that your project is not getting connected to TFS server (though all internet connectivity and your TFS server is up). You notice from the “Team” menu (right click your project to find this menu) that all command of TFS are disabled but “Return online…”. Clicking “Return online…” You will notice a window shows up displaying progress trying to connect to TFS server to associate source control binding to your project but fails in the first attempt but still continues and then displays the projects you have permission on. You select the project from the list of projects displayed and click the Finish button believing your project would now be associated but still no luck. You will find that all commands are still disabled under “Team” menu except “Return online…”. Annoying huh…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In this situation we can notice that if we double click the source control from the Team Explorer window, nothing will show up in the Source Control Explorer window…arrrr&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We can try cleaning the project, restarting the eclipse studio, etc.., but nothing helps and we continue to face this issue and the Team Explorer will continue its struggle trying to connect to the TFS Server. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Ok so what’s the solution then…well...In this situation, instead of spending more time researching on this issue, we can perform the following actions to restore source code binding with TFS:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Delete the project (remove only) from eclipse studio (&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Important Note:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: red;&quot;&gt; Not physical delete of the project from the system&lt;/span&gt;) &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Restart Eclipse studio and connect to TFS server. This time you will notice that it connects successfully without any issues.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
3.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;From the Source Control Explorer, right click on your project and click Import… button.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
4.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Provide appropriate details in the “Import Project from Team Foundation Server” wizard and…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Things are back to normal….&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Hope this help you solve your problem…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/6935016418370622409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/6935016418370622409?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/6935016418370622409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/6935016418370622409'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/06/eclipse-tfs-plugin-source-control-issue.html' title='Eclipse TFS Plugin Source control issue'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-264194217294961287</id><published>2012-06-16T18:04:00.000+05:30</published><updated>2012-06-16T18:07:24.155+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="android mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="android mobile testing"/><category scheme="http://www.blogger.com/atom/ns#" term="Google USB driver"/><title type='text'>Debugging Android Application directly from Android Mobile</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We develop the android application and 75% of the time test using android simulator and witness the application working perfectly all right. We are happy and deploy the application to our android mobile (same target platform) and test verify. 90 to 95% of the time we see the application working alright with the actual device but sometimes we face issues.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
What do we do next…we check back the application in simulator atleast once following the same scenario and see if we are able to replicate the issue. We see that the application works just fine in the same scenario in case of the simulator.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
OK what next…what are our options…Well we have different mechanism to troubleshoot and the popular amongst those are as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Write to the log and then work through the application in the device with the same scenario reproducing the issue and then pull the log from the device and identify and solve the issue.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
Yes but this type of troubleshooting is less preferable if the owner of the mobile is our pocket!!! This type of troubleshooting is more suitable when the user of our application lives in remote location.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;From the eclipse studio start debugging the application directly from the android device.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
This is one of the easiest way to quickly troubleshoot and fix if we are facing the issue only when executing the application in the android mobile.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Ok…but how…well here is how you do this…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;From the Eclipse studio, pull open the “Windows” menu and select “Android SDK Manager” to view the list of target platform, additional libraries and Devices installed and/or available.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;From this list, expand the “Extras” folder and make sure “Google USB Driver” is installed as shown below in the screenshot. If this is not installed, then check mark the “Google USB Driver” and get this installed. &lt;b&gt;Note:&lt;/b&gt; If any updates are available to the packages already installed, then they are selected by default. It is upto us if we want those updates or not.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBN5u7BcVwL_WFsVplQ0rqflJynZgZ7xExMIMFLSCs8OH1l29fjaHR6FYg6nOpDL8ONPSLNyO_09cgjPYmSuJRvrbn81z6J9D5a68ZrMDyVcySCRu5JywQ-qk-ornYpRPKw9AI/s1600/image001-726428.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5754612474479739410&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBN5u7BcVwL_WFsVplQ0rqflJynZgZ7xExMIMFLSCs8OH1l29fjaHR6FYg6nOpDL8ONPSLNyO_09cgjPYmSuJRvrbn81z6J9D5a68ZrMDyVcySCRu5JywQ-qk-ornYpRPKw9AI/s320/image001-726428.png&quot; /&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
3.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;On your phone, click Settings &amp;gt; Applications &amp;gt; Development and make sure USB Debugging is on.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
4.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;After installing the “Google USB Driver”, connect the device to the system using the USB cable. A window opens up and prompt about installing drivers. Wait for it to complete.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
5.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Open the command prompt window and navigate to the “platform-tools” directory under android-sdk directory. In my case it was (D:\Program Files\Android\android-sdk-windows\platform-tools)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
6.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Type “adb devices” in the command prompt and this will list the devices installed. From this list you should see a serial number (some sequence of digits) and this happens to be the serial number of your android mobile. If you see so, then you are set to go.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
7.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Now, instead of following the regular way of executing/running the application, this time it will be different. Right click on your project and from the context menu select Run As &amp;gt; Run Configurations…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
8.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;From the “Run Configurations” window, click the “Target” tab and select the “Manual” option from the “Deployment Target Selection Mode” panel as shown below&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Otvc9Hf_HKztIzlczTByDFgk417ll6Llwj3awrY3-L5EdD4AFQ0BqueomiBlUDByYxq39su2YvvUdAA8rbisJPfBYmj_eMTrmDA6zwz_BVuZJ0oXxLDHpvs1jXhnqRlG_Wlw/s1600/image003-727877.jpg&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5754612477881837234&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Otvc9Hf_HKztIzlczTByDFgk417ll6Llwj3awrY3-L5EdD4AFQ0BqueomiBlUDByYxq39su2YvvUdAA8rbisJPfBYmj_eMTrmDA6zwz_BVuZJ0oXxLDHpvs1jXhnqRlG_Wlw/s320/image003-727877.jpg&quot; /&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
9.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Now click the “Run” button from the “Run Configurations” window and you will be prompted with the “Android Device Chooser” window. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
10.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;From the “Android Device Chooser” window, select “Choose a running Android device” option and then select the serial number (this will match with the serial number that displayed in the command window) and click the “OK” button.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18.0pt;&quot;&gt;
11.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;This time the application (apk file) is loaded directly in the android mobile and you can follow the same mechanism to debug it (Setting breakpoints and so on)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
Hope this helps troubleshooting your issue…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
Happy Androiding…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/264194217294961287/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/264194217294961287?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/264194217294961287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/264194217294961287'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/06/debugging-android-application-directly.html' title='Debugging Android Application directly from Android Mobile'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBN5u7BcVwL_WFsVplQ0rqflJynZgZ7xExMIMFLSCs8OH1l29fjaHR6FYg6nOpDL8ONPSLNyO_09cgjPYmSuJRvrbn81z6J9D5a68ZrMDyVcySCRu5JywQ-qk-ornYpRPKw9AI/s72-c/image001-726428.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-3487781136448307585</id><published>2012-06-09T11:27:00.000+05:30</published><updated>2012-06-09T12:31:17.740+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="android testing"/><category scheme="http://www.blogger.com/atom/ns#" term="simulating call"/><category scheme="http://www.blogger.com/atom/ns#" term="simulator"/><title type='text'>Simulating an Incoming Call in the Android Simulator</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
At times, when developing the application or after developing the application, we are interested to test and break our application with all possible ways we can so that end users don’t end up facing such issues. One such scenario that we possibly miss out while testing our application using simulator is when a call arrives and our application is active.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This scenario is easy to simulate in the android simulator and this is done as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Start the Android Simulator and we can notice the number that is displayed on the title bar (as showing using the arrow mark in the screenshot below). In this case it is 5554.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpcw1hyphenhyphenmsLXcHntt_N_jSSrxSgCQCP-VnRNhk_k10rrlNitoBzdE4NchcPIayTFAbeH_TLhylmGTfE7vdI7OaPTiD15qYlx7SfrAyD4OP279LmnMqpn6ssiPJkKRNHxz7-HuJ6/s1600/image001-724381.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5751912651336313986&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpcw1hyphenhyphenmsLXcHntt_N_jSSrxSgCQCP-VnRNhk_k10rrlNitoBzdE4NchcPIayTFAbeH_TLhylmGTfE7vdI7OaPTiD15qYlx7SfrAyD4OP279LmnMqpn6ssiPJkKRNHxz7-HuJ6/s320/image001-724381.png&quot; /&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Open the command prompt window and type the following command to start the telnet session to localhost with port number as the number identified in the above step i.e., 5554&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;i&gt;telnet localhost 5554&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
3.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;This will open the telnet command session to the simulator. In this session, we can type help command and this will display all possible actions that we can perform on the simulator.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK-Vvt7M22UL5q_7iqJGoDViufVnEgF_AMy8xPRuaqIMBUblpTfafQ3D9sgi4loJPkhpDVX-OM92CW1rUDKOZTlwW_f_0n-lucGh5My2cmgXzBILfl2Ia7Le2hYoDUJCzC4pFr/s1600/image002-725875.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5751912654421494690&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK-Vvt7M22UL5q_7iqJGoDViufVnEgF_AMy8xPRuaqIMBUblpTfafQ3D9sgi4loJPkhpDVX-OM92CW1rUDKOZTlwW_f_0n-lucGh5My2cmgXzBILfl2Ia7Le2hYoDUJCzC4pFr/s320/image002-725875.png&quot; /&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
4.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;From the displayed list of commands, we are interested in performing an incoming call to the simulator. The command is gsm and to know the syntax we type the following command:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;i&gt;help gsm&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
This command will display all sub-commands that can be used as part of gsm operation and they are as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSbARk3QmdcvvCojzacY1-r-tl3cZQxuFgvC8F7l7ocuO3aW8qNZ5sT14l8S-KKOilnX02_OH5nxHpS1RRLzBse9k4LLUDRaVony70RgaXdbX9BqUYukIHtoZjgb0Apmh-bMgd/s1600/image003-726941.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5751912658969508386&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSbARk3QmdcvvCojzacY1-r-tl3cZQxuFgvC8F7l7ocuO3aW8qNZ5sT14l8S-KKOilnX02_OH5nxHpS1RRLzBse9k4LLUDRaVony70RgaXdbX9BqUYukIHtoZjgb0Apmh-bMgd/s320/image003-726941.png&quot; /&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
5.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;From the above list, we are interested in the gsm call sub-command and this can be issued as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;i&gt;gsm call 9999999999&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
here we can use any 10 digit number and not less or more. Issuing this command we can see an inbound call in the simulator as shown below:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36.0pt;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7vvzo0GSB4eaRE9MSsMlyJ-nsgazrRMVOagbMe9LVhHnlaFkTGW9_sRDXwOrU7O0Dql4Gu68Hx8NYuye4CfeZ-c8_HWRhLs2nHk8iF68-8cM0wQCT-5lyWoBiomdouVK6GI93/s1600/image004-727967.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5751912668345507618&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7vvzo0GSB4eaRE9MSsMlyJ-nsgazrRMVOagbMe9LVhHnlaFkTGW9_sRDXwOrU7O0Dql4Gu68Hx8NYuye4CfeZ-c8_HWRhLs2nHk8iF68-8cM0wQCT-5lyWoBiomdouVK6GI93/s320/image004-727967.png&quot; /&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This helps us by providing a new level of testing using the android simulator and not depend on android devices in such scenarios.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Happy Androiding…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/3487781136448307585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/3487781136448307585?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/3487781136448307585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/3487781136448307585'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/06/simulating-incoming-call-in-android.html' title='Simulating an Incoming Call in the Android Simulator'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpcw1hyphenhyphenmsLXcHntt_N_jSSrxSgCQCP-VnRNhk_k10rrlNitoBzdE4NchcPIayTFAbeH_TLhylmGTfE7vdI7OaPTiD15qYlx7SfrAyD4OP279LmnMqpn6ssiPJkKRNHxz7-HuJ6/s72-c/image001-724381.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-8395113208813234504</id><published>2012-06-06T12:52:00.000+05:30</published><updated>2012-06-06T12:52:53.677+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".metadata"/><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="project error"/><title type='text'>Eclipse displaying error icon on Android Project</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
When working with Android Project files, sometimes we work directly from within Eclipse studio and sometimes outside of the studio. Assume that in one our android project, we are in need of one complex functionality to be performed. We Google and get hold of java source that does exactly what we require. So, we go ahead and download the java source file and add it using Eclipse studio to our android project. Having added that we notice a couple of errors in the downloaded java file. Instead of fixing it right away, we decide to fix at a later point of time and close the eclipse editor (assuming a long break time).&lt;br /&gt;
&lt;br /&gt;
Returning back we learn that our R &amp;amp; D team have implemented the complex functionality and now we decide to get rid of the downloaded java file. We move to the src folder location using windows explorer and delete the file. (Note that this file was added using the eclipse studio and on top of that the downloaded file had errors). Now we open the eclipse studio and notice that there are no error icons displayed for any files but the android project.&lt;br /&gt;
&lt;br /&gt;
We try the following ways to get rid of the error but all goes in vain:&lt;br /&gt;
1. Clean the project but still the error remains&lt;br /&gt;
2. Refresh the project but still the error remains&lt;br /&gt;
3. Fix Project Properties from Android Tools but still the error remains&lt;br /&gt;
&lt;br /&gt;
The fix that worked in our case is removing the &lt;b&gt;.metadata&lt;/b&gt; folder from the project root location. This folder seems to hold reference to all the files added using eclipse studio. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/8395113208813234504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/8395113208813234504?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8395113208813234504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8395113208813234504'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/06/eclipse-displaying-error-icon-on.html' title='Eclipse displaying error icon on Android Project'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-3047565574189350316</id><published>2012-06-01T19:43:00.000+05:30</published><updated>2012-06-05T18:27:27.898+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="apk"/><category scheme="http://www.blogger.com/atom/ns#" term="facebook sso"/><category scheme="http://www.blogger.com/atom/ns#" term="keystore"/><category scheme="http://www.blogger.com/atom/ns#" term="login issue"/><category scheme="http://www.blogger.com/atom/ns#" term="sso"/><title type='text'>Android ~ Facebook login issue from Android application</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
When developing android applications that uses Facebook’s LoginButton to authenticate and authroize, there will be no issues running on the emulator. But when the same apk file (android installation file) is installed in an android device and executed it won’t work. The Facebook’s LoginButton, after clicking, progresses a while and returns back to the same screen taking us nowhere.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
There could be several reasons for this behaviour but I have came across a couple of symptoms and was successful in addressing those:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18pt;&quot;&gt;
&lt;span style=&quot;mso-list: Ignore;&quot;&gt;1.&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;You might have not set the hashkey for your application in facebook or you might have messed up/changed your working android debug.keystore file locally in your system.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
If you have not yet set the hashkey for your application, please generate hashkey for your application first, then set the hashkey for the facebook application. Here is the article that explains in a step by step manner to create your hashkey: &lt;a href=&quot;http://hemant-vikram.blogspot.in/2012/05/generating-hashkey-for-android-facebook.html&quot;&gt;http://hemant-vikram.blogspot.in/2012/05/generating-hashkey-for-android-facebook.html&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
At times when working with our android application we may sometimes use other’s debug.keystore file and replace our’s to see if some of our issues go away. Now if we generate the apk file and install in the device to test it out, we will notice this issue. To resolve we will have to re-generate hashkey and set that in the facebook apps.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -18pt;&quot;&gt;
&lt;span style=&quot;mso-list: Ignore;&quot;&gt;2.&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;You might have missed the invocation of super method in the &lt;i&gt;protected void onActivityResult(int requestCode, int resultCode, Intent data) &lt;/i&gt;method block&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
If you have missed, then add the following as the first line in your method block:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;i&gt;super.onActivityResult(requestCode, resultCode, data);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; There is one another problem that I dealt with the signed apk file. I used the following&amp;nbsp;steps to sign the apk file:&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;Right Click on the Project -&amp;gt; Android Tools -&amp;gt; Export Signed Application Package... &lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;I provided the project name and clicked next and selected the keystore location path that has an &lt;span style=&quot;color: red;&quot;&gt;empty space&lt;/span&gt; in it. Having generated the keystore file, signed apk file, generated the hashkey using the keystore file and setting it to facebook app settings page I was seeing that I was not able to get past the login screen. I was seeing a facebook progress dialog and after&amp;nbsp;few seconds it disappears. I was running out of clues as what could be missing. Later along with my colleague, went thru the same process of generating the keystore and all that but this time &lt;span style=&quot;color: #38761d;&quot;&gt;without an empty space&lt;/span&gt; character in the path. We ran the apk file and tried the facebook signon and bingo. It worked!!! &lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Hope this helps you to resolve your problem and importantly save some time…&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Happy Androiding &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/3047565574189350316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/3047565574189350316?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/3047565574189350316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/3047565574189350316'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/06/android-facebook-login-issue-from.html' title='Android ~ Facebook login issue from Android application'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-1368947584197308498</id><published>2012-05-30T21:04:00.000+05:30</published><updated>2012-06-05T18:29:15.601+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="commit"/><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="ignore files"/><category scheme="http://www.blogger.com/atom/ns#" term="TFS"/><title type='text'>Eclipse &amp; TFS ~ Ignoring file from commit</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The TFS plugin for Eclipse doesn’t have a direct way to support ignoring the files from committing directly from IDE just like SVN does. For example, we prefer not to commit the “bin” directory. In order to ignore certain files or directory, we will have to create a file with the name .tpignore and save it in the root directory of the project. For example, to ignore bin directory and all of its files, the content of the .tpignore file should be as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
/bin/&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
/bin/.*&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/1368947584197308498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/1368947584197308498?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/1368947584197308498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/1368947584197308498'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/05/eclipse-tfs-ignoring-file-from-commit.html' title='Eclipse &amp; TFS ~ Ignoring file from commit'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-7888591417984737862</id><published>2012-05-30T11:36:00.000+05:30</published><updated>2012-06-05T18:30:05.585+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="facebook sso"/><category scheme="http://www.blogger.com/atom/ns#" term="hashkey"/><category scheme="http://www.blogger.com/atom/ns#" term="hashkey generation"/><category scheme="http://www.blogger.com/atom/ns#" term="openssl"/><title type='text'>Generating Hashkey for Android Facebook Application Integration</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Step 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Download Openssl from &lt;a href=&quot;http://code.google.com/p/openssl-for-windows/downloads/list&quot;&gt;http://code.google.com/p/openssl-for-windows/downloads/list&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Step 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Extract to a folder (in my case d:\android\openssl)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Step 3&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Copy your debug.keystore file to the Java JDK folder where keytool.exe is present &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In my case debug.keystore was in C:\Users\hemant\.android\debug.keystore&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
And&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
keytool.exe was in D:\Program Files\Java\jre7\bin folder&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Step 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Open the command prompt in the jdk bin folder where keytool.exe is and execute the following command:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;keytool -exportcert -alias androiddebugkey -keystore debug.keystore &amp;gt; d:\android\openssl\bin\debugkey.txt&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Provide password as android when prompted&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Step 5&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Navigate to openssl\bin folder (here we have debugkey.txt) in the command prompt and execute the following commands:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;margin-left: 27pt; mso-list: l0 level1 lfo1; text-indent: -18pt;&quot;&gt;
&lt;span style=&quot;mso-list: Ignore;&quot;&gt;a.&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;openssl sha1 -binary debugkey.txt &amp;gt; debugkey_sha.txt&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;margin-left: 27pt; mso-list: l0 level1 lfo1; text-indent: -18pt;&quot;&gt;
&lt;span style=&quot;mso-list: Ignore;&quot;&gt;b.&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;openssl base64 -in debugkey_sha.txt &amp;gt; debugkey_base64.txt&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
That’s it! We are done. The debugkey_base64.txt contains the hashvalue. We need to copy paste this key to the Basic Settings page of our facebook application as shown below using the green arrow.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;mso-fareast-language: EN-IN;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLJmt5L6NjCmogwH_KhZOVXailhvMPn5xcLSblwCnzhPfxD9Td3iysTzji_efzdzP-BGNlCZHVt277DQGX2tE0TC-3sFOvtaeGQonMxYNZyq-oZ3LgRmQTKsYGH9mqoJPyp5Za/s1600/image001-701001.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5748204276430015522&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLJmt5L6NjCmogwH_KhZOVXailhvMPn5xcLSblwCnzhPfxD9Td3iysTzji_efzdzP-BGNlCZHVt277DQGX2tE0TC-3sFOvtaeGQonMxYNZyq-oZ3LgRmQTKsYGH9mqoJPyp5Za/s320/image001-701001.png&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/7888591417984737862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/7888591417984737862?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/7888591417984737862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/7888591417984737862'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/05/generating-hashkey-for-android-facebook.html' title='Generating Hashkey for Android Facebook Application Integration'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLJmt5L6NjCmogwH_KhZOVXailhvMPn5xcLSblwCnzhPfxD9Td3iysTzji_efzdzP-BGNlCZHVt277DQGX2tE0TC-3sFOvtaeGQonMxYNZyq-oZ3LgRmQTKsYGH9mqoJPyp5Za/s72-c/image001-701001.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-6981415204296209788</id><published>2012-05-25T18:19:00.000+05:30</published><updated>2012-06-09T12:32:31.332+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="ddms"/><category scheme="http://www.blogger.com/atom/ns#" term="force stop"/><title type='text'>Android ~ Manually terminating an application or an activity</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Best Practice recommended for Android development is to leave memory management to Android OS itself. What this means is when user moves out of our activity/application, we need not call the finish method to destroy it and release memory rather leave the application running without “finishing” it. When Android OS runs low in memory, it may decide to terminate the running activities.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Ok having said that and during development, assume we are interested to start the application fresh. In order to achieve this, we have four ways to do it and they are as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
&lt;b&gt;1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;Restart the emulator&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
This will take longer time but you can achieve your expectation&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
&lt;b&gt;2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;Re-run the application&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
This too will take longer time but comparatively less than that of restarting the emulator and you will achieve your expectation&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
&lt;b&gt;3.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;Stop Process from DDMS view&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
This is quickest method and can be done only from the Eclipse studio&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
Eclipse Studio -&amp;gt; DDMS Perspective view -&amp;gt; Devices panel -&amp;gt; select process -&amp;gt; click stop button&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
&lt;b&gt;4.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;Force stop from Settings&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot;&gt;
This is also the quickest and the safest method you can do directly from the Android device.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Android Emulator -&amp;gt; Settings -&amp;gt; Applications -&amp;gt; Manage Applications -&amp;gt; Running Tab -&amp;gt; Select Application -&amp;gt; Force Stop&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/6981415204296209788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/6981415204296209788?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/6981415204296209788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/6981415204296209788'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/05/android-manually-terminating.html' title='Android ~ Manually terminating an application or an activity'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-8901898517226213558</id><published>2012-05-25T17:02:00.000+05:30</published><updated>2012-06-09T12:33:12.646+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="ddms"/><category scheme="http://www.blogger.com/atom/ns#" term="logcat"/><title type='text'>Android LogCat does not show anything !!!</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Sometimes when working with Android applications, we may come across a situation where we will not see anything showing up the log no matter even if we select application specific log or all verbose messages. So what went wrong and how can this be fixed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Here is the easiest way to fix this….&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx357P7Xr6PysjyUxF6Sif2bfglO6JLuPfd88T0Owz-1xH5S0N9dPYhcWAvo6q7V_ZckTh6moDATk2DZz94fobSP1E0MhHV4WTXEH8CiyKjYott7bhDsACZ7I-pBswNAeVa1Sq/s1600/image001-746119.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5746432795118836642&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx357P7Xr6PysjyUxF6Sif2bfglO6JLuPfd88T0Owz-1xH5S0N9dPYhcWAvo6q7V_ZckTh6moDATk2DZz94fobSP1E0MhHV4WTXEH8CiyKjYott7bhDsACZ7I-pBswNAeVa1Sq/s320/image001-746119.png&quot; /&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Open the DDMS perspective view. From the top left panel (Devices panel), select your application and that’s it…You will see the next moment logs get pouring in the logcat window.&lt;span style=&quot;font-size: 8pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hemant-vikram.blogspot.com/feeds/8901898517226213558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18719227/8901898517226213558?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8901898517226213558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8901898517226213558'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/05/android-logcat-does-not-show-anything.html' title='Android LogCat does not show anything !!!'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx357P7Xr6PysjyUxF6Sif2bfglO6JLuPfd88T0Owz-1xH5S0N9dPYhcWAvo6q7V_ZckTh6moDATk2DZz94fobSP1E0MhHV4WTXEH8CiyKjYott7bhDsACZ7I-pBswNAeVa1Sq/s72-c/image001-746119.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-8767504274224866329</id><published>2012-03-29T16:46:00.000+05:30</published><updated>2012-03-29T16:47:47.531+05:30</updated><title type='text'>Deploying WCF Service on IIS 6.0</title><content type='html'>&lt;div class=WordSection1&gt;&lt;p class=MsoNormal&gt;After deploying WCF service to IIS 6.0, we will notice that the page will not load when requesting &lt;a href=&quot;http://mydomain.com/myservice.svc&quot;&gt;http://mydomain.com/myservice.svc&lt;/a&gt; instead we would get 404 page not found exception. If you place a sample HTML file in the same directory and try to visit the page, the page will show up.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;After googling, I learnt that after installing .NET Framework 4.0 Client Profile redistributable in the server, by default the ASP.NET 4.0 ISAPI extension is not enabled. This can be determined using the following command in the command prompt:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;C:\&amp;gt;cscript c:\WINDOWS\system32\iisext.vbs&lt;b&gt; /ListFile&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;Executing the above command will list all the extension files of IIS as&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;span style=&#39;font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-fareast-language:EN-IN&#39;&gt;Status / Extension Path&lt;br&gt;------------------------&lt;br&gt;0 &amp;nbsp;C:\WINDOWS\system32\inetsrv\httpodbc.dll&lt;br&gt;0 &amp;nbsp;C:\WINDOWS\system32\inetsrv\ssinc.dll&lt;br&gt;0 &amp;nbsp;C:\WINDOWS\system32\inetsrv\asp.dll&lt;br&gt;1 &amp;nbsp;C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll&lt;br&gt;1 &amp;nbsp;C:\WINDOWS\system32\MQISE.DLL&lt;br&gt;&lt;b&gt;&lt;span style=&#39;color:red&#39;&gt;0&lt;/span&gt;&lt;/b&gt; &amp;nbsp;C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;From the above listed extension files, you will see that the status is &lt;b&gt;&lt;span style=&#39;color:red&#39;&gt;0&lt;/span&gt;&lt;/b&gt;&lt;span style=&#39;color:red&#39;&gt; &lt;/span&gt;for aspnet_isapi.dll of ASP.NET Framework 4.0. This means it is not enabled and this is preventing ASP.NET 4.0 processing your request. To enable the extension use the following command:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;C:\&amp;gt;cscript c:\WINDOWS\system32\iisext.vbs&lt;b&gt; /EnFile&lt;/b&gt; C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;Once the above command is executed successfully, you should be able to see your WCF service coming up in the browser.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8767504274224866329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8767504274224866329'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/03/deploying-wcf-service-on-iis-60.html' title='Deploying WCF Service on IIS 6.0'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18719227.post-8406823697074390331</id><published>2012-02-27T14:43:00.000+05:30</published><updated>2012-02-27T14:45:09.249+05:30</updated><title type='text'>Sql Server 2008 Express SP1 installation on Windows XP SP 3</title><content type='html'>&lt;div class=WordSection1&gt;&lt;p class=MsoNormal&gt;Hi Guys,&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:36.0pt&#39;&gt;I was working with my team creating setup package using VS 2010 for a desktop application. The requirement is to install Sql Server 2008 Express Edition with SP1 along with other tools. The setup was working fine Windows 7 and Windows XP. But with Windows XP SP 3 64 bit machine, we started facing issues installing Sql Express 2008 SP1. We were getting the following exception log message:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:36.0pt&#39;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:36.0pt&#39;&gt;&lt;i&gt;&lt;span style=&#39;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#333333&#39;&gt;An error occurred attempting to install SQL Server 2008 Express Service Pack 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p style=&#39;mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;margin-bottom:.0001pt;line-height:125%;background:white&#39;&gt;&lt;i&gt;&lt;span style=&#39;font-size:11.0pt;line-height:125%;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#333333;mso-fareast-language:EN-US&#39;&gt;Installing using command &#39;C:\DOCUME~1\TICKSE~1\LOCALS~1\Temp\VSDB.tmp\SqlExpress2008\SQLEXPR32_x86_ENU.EXE&#39; and parameters &#39;/q /hideconsole /action=Install /features=SQL /instancename=SQLEXPRESS /enableranu=1 /sqlsvcaccount=&amp;quot;NT Authority\Network Service&amp;quot; /AddCurrentUserAsSqlAdmin /skiprules=RebootRequiredCheck&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p style=&#39;mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;margin-bottom:.0001pt;line-height:125%;background:white&#39;&gt;&lt;i&gt;&lt;span style=&#39;font-size:11.0pt;line-height:125%;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#333333;mso-fareast-language:EN-US&#39;&gt;Process exited with code -2067922433&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&#39;font-family:&quot;Segoe UI&quot;,&quot;sans-serif&quot;;color:#333333&#39;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:36.0pt&#39;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:36.0pt&#39;&gt;After lot of googling and with help of my team, I got the following link that discusses about addressing permission issue with the registry key &amp;#8220;Microsoft Sql Server&amp;#8221;. We tried the option and bingo!!! It worked. Here are the steps if in case you are stuck with similar issue.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:36.0pt&#39;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:36.0pt;line-height:12.0pt;background:white&#39;&gt;&lt;u&gt;&lt;span lang=EN-US style=&#39;font-size:12.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#333333;border:none windowtext 1.0pt;padding:0cm&#39;&gt;Steps&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:36.0pt;line-height:12.0pt;background:white&#39;&gt;&lt;span lang=EN-US style=&#39;font-size:12.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#333333&#39;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:72.0pt;text-indent:-18.0pt;line-height:12.0pt;mso-list:l1 level1 lfo2;background:white&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;1.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;Located&amp;nbsp;&lt;b&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server&lt;/b&gt;&amp;nbsp;in registry&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:72.0pt;text-indent:-18.0pt;line-height:12.0pt;mso-list:l1 level1 lfo2;background:white&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;2.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;Right click and go to&amp;nbsp;&lt;b&gt;Permission&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:72.0pt;text-indent:-18.0pt;line-height:12.0pt;mso-list:l1 level1 lfo2;background:white&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;3.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;Click on&amp;nbsp;&lt;b&gt;Advance&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:72.0pt;text-indent:-18.0pt;line-height:12.0pt;mso-list:l1 level1 lfo2;background:white&#39;&gt;&lt;![if !supportLists]&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;4.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;Tick on both check box (I. Inherit from parent the permission... II. Replace permission entries on all child objects...), click&amp;nbsp;OK&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=MsoNormal style=&#39;margin-left:72.0pt;text-indent:-18.0pt;line-height:12.0pt;mso-list:l1 level1 lfo2;background:white&#39;&gt;&lt;![if !supportLists]&gt;&lt;span lang=EN-US style=&#39;font-size:10.0pt;font-family:inherit;color:#333333&#39;&gt;&lt;span style=&#39;mso-list:Ignore&#39;&gt;5.&lt;span style=&#39;font:7.0pt &quot;Times New Roman&quot;&#39;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;Click&amp;nbsp;OK&amp;nbsp;again&lt;span lang=EN-US style=&#39;font-size:10.0pt;font-family:inherit;color:#333333&#39;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8406823697074390331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18719227/posts/default/8406823697074390331'/><link rel='alternate' type='text/html' href='http://hemant-vikram.blogspot.com/2012/02/sql-server-2008-express-sp1.html' title='Sql Server 2008 Express SP1 installation on Windows XP SP 3'/><author><name>Hemant</name><uri>http://www.blogger.com/profile/09526519343820410790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>