Tuesday, December 31, 2013
Firebug Net panel - HTTP Traffic Monitoring
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
IIS 7.5 Advanced Logging
It helped to monitor the sequence of requests and status of service responses during a load test.
IIS 7.5 Advanced Logging
Trace listener and logging trace in a file
Trace listener and logging trace in a file
Friday, December 20, 2013
{System.Data.EntityException: The underlying provider failed on Open.
{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.
{System.Data.EntityException: The underlying provider failed on Open.
Friday, December 6, 2013
jQuery - replace html element by .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.
<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>
jQuery - replace html element by .remove()
jQuery - difference between closest() and parents()
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:
<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>
jQuery - difference between closest() and parents()
Friday, November 29, 2013
Automating package restore in Visual Studio, don’t keep NuGet Packages in source control
The best way is to enable package restore during build, the feature added since NuGet 2.0 and improved as of NuGet 2.7.
By automating package restore in Visual Studio the build events can handle installing the missing packages which eliminate the necessity of keeping them in repository.
There are two levels which should be set, simply go for ToolsOptions and then try to choose Package Manager 1. Visual Studio is configured to 'Allow NuGet to download missing packages' 2. Visual Studio is configured to 'Automatically check for missing packages during build in Visual Studio'
It’s done, but there is other options too like [MSBuild-Integrated Package Restore] which I’ll point to that in next blog entry.
Automating package restore in Visual Studio, don’t keep NuGet Packages in source control
Friday, November 22, 2013
Adding external assemblies to load with Visual Studio at startup
Looked into VS configuration file:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe.config
Found the probing tag points to PublicAssemblies & PrivateAssemblies:
The above paths allows to have access to assemblies other than GAC, in this case, I needed to drop the custom coded assembly in a path which is known for VS.
Also assemblies deployed in PublicAssemblies path appear in the Add Reference dialog box, if you don't like to make them available in the Add Reference list but be known for VS, it should be deployed in PrivateAssemblies path.
Simply found the paths as following:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies
in this special case, I added the following parts in devenv.exe.config
and then added the following part in devenv.exe.config to introduce the external methods functionality to Telerik.Reporting designer.
Now VS loads the assembly and it gets available for Telerik.Reporting as extended methods inside designer.
Adding external assemblies to load with Visual Studio at startup
Friday, October 4, 2013
Disable strong name validation in registry or skipping registered assemblies for verification
Then I tried to verify the assembly and it shows the assembly is delay-signed which figured out the reason of previous error:
sn -v assemblyName.exe
To drop the assembly from verification I could run the following command: sn -Vr *,c3692091f38d16a2
Alternative solution is to disable strong name validation by changing registry by adding a new key as "*,*" under the following one:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification
Caution: (Check here) "Use this option only during development. Adding an assembly to the skip verification list creates a security vulnerability. A malicious assembly could use the fully specified assembly name (assembly name, version, culture, and public key token) of the assembly added to the skip verification list to fake its identity. This would allow the malicious assembly to also skip verification."
Disable strong name validation in registry or skipping registered assemblies for verification
Monday, September 30, 2013
How to find the login security type for MS SQL Server
xp_loginconfig (Transact-SQL)
How to find the login security type for MS SQL Server
WCF Load Balancing – basicHttpBinding
Another approach to apply necessary changes through the code discussed before in “WCF service under Network Load Balancing (NLB)” blog entry.
WCF Load Balancing – basicHttpBinding
Tuesday, September 24, 2013
Add SSRS (SQL Reporting Services) to an existing SQL Server Clustered Instance
To avoid above mentioned error it's possible to run setup as following:
Add SSRS (SQL Reporting Services) to an existing SQL Server Clustered Instance
SSRS (Reporting Services), Scale Out, Clusters, or NLB, ...
SSRS (Reporting Services), Scale Out, Clusters, or NLB, ...
Monday, September 23, 2013
How to find out installed features on SQL server instance
Start menu --> All Programs --> Microsoft SQL Server --> Configuration Tools --> SQL Server Installation Center --> Click the "Tools" --> "Installed SQL Server features discovery report"
The command line version would be like the folowing:
setup.exe /ACTION=RUNDISCOVERY /Q
The setup.exe is located somewhere like (for MS SQL Server 2012):
C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\SQLServer2012
The report will be located in log folder under "Setup Bootstrap" in a unique subfolder which will be named as YYYYMMDD_HHmmSS, but the location can be vary depend on installation location:
C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\YYYYMMDD_HHmmSS
How to find out installed features on SQL server instance
Thursday, September 19, 2013
SSRS Line Spacing
Vote up for the following item in Microsoft Connect:
https://connect.microsoft.com/SQLServer/feedback/details/557661/line
SSRS Line Spacing
Friday, September 13, 2013
JavaScript - Calling function "statements" before definition
// logs "Uncaught TypeError: ..." console.log(iFunc(1, 2, 3)); var iFunc = function (x, y, z) { return x*y + arguments[0]*arguments[1]*arguments[2] };
// logs "Uncaught TypeError: Property 'bFunc' of object [object Object] is not a function" console.log(bFunc(1, 2, 3)) var bFunc = function (x, y, z) { return x*y + arguments[0]*arguments[1]*arguments[2] }; </script></body></html>
JavaScript - Calling function "statements" before definition
Thursday, September 12, 2013
Non-primitive [false] Boolean object is actually [true]
If a value is false, undefined, null, NaN, 0, -0, or an empty string(""), it is false! but any other value in JavaScript will be converted to true if used in a Boolean context.
Non-primitive [false] Boolean object is actually [true]
Wednesday, September 11, 2013
JavaScript - references to object properties
As all those prototype properties are objects, the final step would be Object.prototype because there is no other constructor prototype property upper than Object level to be examined.
Anyway if finally JavaScript can't find the property it would have produced an error stating that the property was undefined.
console.log(myArray.hasOwnProperty('toLocaleString')); console.log('toLocaleString' in myArray); console.log(myArray.toLocaleString());
</script> </body> </html>
JavaScript - references to object properties
Javascript console.log for web browsers
To open the console window the following keywords work depend on the web browser:
console window
<b>Internet Explorer<\b> F12 to open the developer tools, then
Ctrl+3 to open the console window
<b>Chrome<\b> Ctrl+Shift+J
<b>Firefox<\b> Ctrl+Shift+K
<b>Safari<\b> Ctrl+Alt+I
Javascript console.log for web browsers
Tuesday, September 10, 2013
Enable/Disable - SSRS Export Types
C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\rsreportserver.config
Inside the <Render> tag elements, the Extension names have Visible attribute which changing them to true will make the Extension visible in the Export list.
Example:
Enable/Disable - SSRS Export Types
Thursday, September 5, 2013
TSQL - Count number of lines in string
TSQL - Count number of lines in string
Thursday, August 29, 2013
SQL Server Data Tools - Update to open Database Project
My search ended up with updating SQL Server Data Tools for Visual Studio 2012 which I used this MSDN link to load and set it up, the problem solved.
SQL Server Data Tools - Update to open Database Project
Clustered SQL server - Get the current node name of running instance
Alternatively, you may run Server manager (right click on "Computer" in start menu and choose "Manage"), then
Features -> Failover Cluster Manager -> [The cluster name] -> Services and applications -> SQL server
It shows details and the "Current Owner" shows the node which SQL server is running on that node.
Clustered SQL server - Get the current node name of running instance
Wednesday, August 28, 2013
Query all SSRS Reports, shared and embeded Datasources, and locations
By customizing the folllowing script easily more information can be queried.
Query all SSRS Reports, shared and embeded Datasources, and locations
Friday, August 23, 2013
Microsoft iSCSI Software Target 3.3 (MS Windows Server 2008 R2)
By clicking on “iSCSI Software Target” it downloads a .msi and install it. After running, right click on device and choose “Create Virtual Disk”.
Choose a file name for the Virtual disk which has .vhd extension and click on Next.
Set the Virtual disk size and click on Next.
Possible to write a description too (optional) and click on Next.
Now bypass adding iSCSI targets by clicking on Next as targets are not defined yet and after that click on Finish.
The Virtual disk is ready:
Right click, on “iSCSI Target” and then “Create iSCSI Target”
Then choose a name:
Better to address the target by IP, then click on Advanced, choose “Add”, and now choose “IP Address” and enter the IP and click to finish this part
Now the target is available:
Then assign the Target to Device by right clicking on the Virtual Disk and choose “Assign/Remove Target”
Click on Add in Target Access tab:
Choose the Target and click on Ok and close the window. It’s done now you can use it in the Target side.
Connect to remote system, choose “Administrative Tools” and choose “iSCSI Initiator” Enter IP address of target In Target text box and click on Quick Connect
Quick connect window discovers target, now click on Done.
Now choose “Volumes and Devices” tab
The device adds in Volume list:
Click on OK and close the window
now right click on the disk and click on Online then right click again and choose “Initialize Disk”, right after right click on new disk and choose “New Simple Volume” to set a letter and format the volume which make it available immediately.
Microsoft iSCSI Software Target 3.3 (MS Windows Server 2008 R2)
Wednesday, August 14, 2013
ASP.NET MVC and SQL Server Reporting Services
".ASPX web form page who contains ReportViewer control"
"The action in the controller"
ASP.NET MVC and SQL Server Reporting Services
Tuesday, August 13, 2013
SSRS Report - Showing Header objects only on First Page
The expression property will be accessible with below steps:
right-click on the header object (Image, text box) -> choose properties -> visibility -> select "Show or hide based on expression" -> insert expression above
SSRS Report - Showing Header objects only on First Page
Adding a Page Break after a Sub-report (SSRS report)
One way which was fit for my case comes simply as following:
- Added a rectangle onto my report and position it just below the sub-report.
- Resized the rectangle to only one pixel tall.
- In properties windows of the Rectangle object, set the PageBreak->BreakLocation property to Start.
Adding a Page Break after a Sub-report (SSRS report)
Tuesday, August 6, 2013
WCF service under Network Load Balancing (NLB)
In message Http header of BasicHttpBinding the Keep-Alive value is true by default which helps to keep persistent connections into services to reuse by sending messages to the same server that improves performance of services. The side effect is the cause of associating clients to specific server which reduces the effectiveness of load balancing. Setting KeepAliveEnabled value to false within a CustomBinding allows NLB functions correctly without sticky session and server affinity.
WCF service under Network Load Balancing (NLB)
Thursday, August 1, 2013
.NET Framework Version (including 4.0+)
The following code is executable directly in LinqPad too, you can get the perfect LinqPad tool (free) by (Joseph Albahari) here.
.NET Framework Version (including 4.0+)
Monday, July 29, 2013
DbEntityValidationException - Entity framework validation error handling
DbEntityValidationException - Entity framework validation error handling
Friday, July 26, 2013
Unable to update the EntitySet 'EntityName' because it has a DefiningQuery and no element exists in the element to support the current operation.
In my case the problem was incorrect Entity Key setting on my entity in EF Model plus forgetting to set primary key in DB table. After setting primary key for the table which entity pointing too, I needed to update the model and open the EF model and manualy set Entity Key for primary key related member in the entity and clearing Entity Key setting for unnecessary entity members. Then rebuild, it worked. The reason was EF created a compound key made of all non nullable entity members which I had to reset them all.
It was my case but there are other possibilities for this error which already discussed if you search on Internet (Google or bing it)Unable to update the EntitySet 'EntityName' because it has a DefiningQuery and no
Wednesday, July 17, 2013
SQL - Record count for all tables in a DB
SQL - Record count for all tables in a DB
Tuesday, July 16, 2013
How to add a digital ID to adobe reader (.pfx exported certificate file)
How to add a digital ID to adobe reader (.pfx exported certificate file)
Sunday, April 14, 2013
Microsoft Security Essentials - a must have security pieces to protect your system
Saved me from Sirefef.gen!C which is a computer virus that intercepts secure web connections and can steal passwords and other sensitive data. Chrome recognises this virus, but it affects all software on the computer. Other browsers and software may continue to work but they are also affected and rendered insecure.
Microsoft Security Essentials can reportedly remove this virus. When the virus is removed, the warnings in Chrome will stop.
Microsoft Security Essentials - a must have security pieces to protect your system