Tuesday, December 31, 2013

Firebug Net panel - HTTP Traffic Monitoring

Needed to collect info around request URL, request header, response status, and response value of REST service calls, I utilized Net panel of Firebug which provided me a lot of details to verify the service calls processes in the web application.

The goal of using the Net panel was monitoring the HTTP traffic initiated by a web page which simply revealed all the collected and computed information in a graphical and intuitive interface.





introduction of Firebug by Rob Campbell


Share/Bookmark

IIS 7.5 Advanced Logging

To be able to capture all requests URLs and status of them in a real-time manner during a load test I added IIS Advanced Logging and customized it by defining the log, setting, and activating it.

It helped to monitor the sequence of requests and status of service responses during a load test.




Share/Bookmark

Trace listener and logging trace in a file

Possible to create and use a trace listener in code or by using a configuration file, as it’s easier to change configuration file without touching the code I tried to add it for a WebApi REST service by the following code for Telerik reports:

<system.diagnostics> <trace autoflush="false" indentsize="4"> <listeners> <add name="WebApiRESTListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="Services.Reporting.REST.Tracing.log" /> <remove name="Default" /> </listeners> </trace> </system.diagnostics>

Share/Bookmark

Friday, December 20, 2013

{System.Data.EntityException: The underlying provider failed on Open.

Entity Framework 5.0 with DbContext in the code tried to have access data as data Access layer code of a WCF service, the following error happened:

{System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: Connection Timeout Expired. The time out period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=50; handshake=1215; [Login] initialization=0; authentication=14; [Post-Login] complete=13022; ---> System.ComponentModel.Win32Exception: The wait operation timed out

It didn't have Transaction around the code, if I had a TransactionScope around the code then it treat connections as multiple ones using a distributed transaction which force open/close connections with each call. But without the transaction I needed to add opening connection code.

using (MyEntities ctx = new MyEntities()) { #region Added to work when Transaction is not around ctx.Database.Connection.Open(); #endregion courseList = ctx.MyMethod(MyParam).ToList(); }

Share/Bookmark

Friday, December 6, 2013

jQuery - replace html element by .remove()

.remove()
Remove the set of matched elements from the DOM.

You could remove an element from DOM but it doesn't get eliminated from wrapper set and this feature allows you remove an element, operate on that element, and then place that element back into the DOM, all within a single jQuery chain.

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<title></title> </head> <body> <div id="ItemToBeRelaced">remove it!</div>
<script> (function ($) { $('#ItemToBeRelaced') .remove() .html('<a href="http://greyknots.com/">GreyKnots</a>') .appendTo('body'); })(jQuery); </script>
</body> </html>

Share/Bookmark

jQuery - difference between closest() and parents()

closest() stops traversing once it finds a match.
closest() can only return a maximum of one element.
closest() will actually include the currently selected element in its filtering.
parents() gets all parents and then filters on your optional selector.

Try the following example:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<title></title> </head> <body> <!-- Nested Div(s) --> <div id="parent3"> <div id="parent2"> <div id="parent1"> <div id="parent0"> <div id="LastInChain"></div> </div> </div> </div> </div>
<script> (function ($) { alert($('#LastInChain').parents().length); alert($('#LastInChain').parent().attr('id')); alert($('#LastInChain').parents('#parent0').attr('id')); alert($('#LastInChain').parents()[0].id);
alert($('#LastInChain').closest('#parent1').length); alert($('#LastInChain').closest('#parent1').length); alert($('#LastInChain').closest('#parent1').attr('id')); })(jQuery); </script>
</body> </html>

Share/Bookmark