Archive for July, 2011

http://www.codeproject.com/KB/web-cache/CachingDependencies.aspx

http://www.blaze.io/mobile/http-pipelining-big-in-mobile/

http://www.brianp.net/2011/07/19/will-http-pipelining-help-a-study-based-on-the-httparchive-org-data-set/

Refer following links in your web pages to get latest version of JQuery files from CDN …

http://code.jquery.com/jquery-latest.js
http://code.jquery.com/jquery-latest.min.js

Check your flash player version – link

Posted: July 20, 2011 in Flash
Tags:

http://flashplayerversion.com

http://encosia.com/11-keystrokes-that-made-my-jquery-selector-run-10x-faster/

Do you know how to use Firebug’s console effectively?

Execute jQuery/javascript statement at the console, with your page loaded in the browser, and you will instantly see the array of matching elements that are returned. If that result set isn’t correct, press the up-arrow key to retrieve the last command entered, refine the statement, and test it again

It works in conjunction with Firebug’s debugger. When execution is paused, switching to the console tab allows you to interrogate and manipulate the state of the DOM as it was at the time execution was halted. As you step through JavaScript code in the debugger, the execution context of the console remains in sync with the debugger’s.

I had spent last few days on getting the project build scripts written using MSBuild script (http://msdn.microsoft.com/en-us/library/dd393573.aspx) + MSBuild tasks from MSBuild Community Tasks project (http://msbuildtasks.tigris.org/) on non development environments which does not have Visual Studio 2008, SQL Server 2008 and I faced tough time to make them work. I thought of sharing here my exploration though the attempt is not fully successful in resolving the issues. I have following information to share from the process of resolving the issues …

Source code (web deployment files) resides in VSS and MSBuild Community Tasks provides tasks to do operations on VSS like VssGet, VssCheckout, VssCheckin, VssUndoCheckout, VssLabel, VssAdd, Version .. etc.

Development environments will have all the required software to run the Build Scripts except MSBuild Community Tasks.

QA or any other environments usally will not have development software so we need to install light weight versions of these softwares like .NET Framework, Software SDKs which will give SDK Tools and related dlls.

I tried different options and got into many issues related to 32-bit/64-bit software installations, GAC installated software … etc

  • Don’t use assemblies installed in GAC when you are shipping them as a bundle. Good thing is have those assemblies referred from some folder within the bundle or have build steps to register those assemblies to GAC.
  • Ensure you are using either 32-bit or 64-bit softwares whereever it is required. For example I am using VSS which is 32-bit and I installed .NET Framework 2.0 SDK for 64 bit as my machine is 64-bit and when I run my build script I endeded up getting following error
    • Retrieving the COM class factory for component with CLSID {783CD4E4-9D54-11CF-B8EE-00608CC9A71F} failed due to the following error:  80040154
  • Installing both 32-bit/64-bit MSBuild Extension Pack in the machine at the same time will make build script variables (MSBuildExtensionsPath) by default refer the 64-bit installation path (C:\Program Files\MSBuild) instead of 32-bit (C:\Program Files (x86)\MSBuild). This will create problem in case  if your build script expects them for 32-bit installation path. To avoid this situation you need to set system environment variable explicitly otherwise you will face following issue
    • Error MSB4036: The “VssGet” task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is “public” and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the “C:\Windows\Microsoft.NET\Framework64\v2.0.50727” directory.

Some of the links that I used for my exploration …

I tried installing Visual Studio 2005/2008 SDKs to get various .NET Framework Tools (http://msdn.microsoft.com/en-us/library/d9kh6s92.aspx) mainly related to Build and deployment (Visual Studio command prompt which can recognize MSBuild command which is used part of the build scripts) so that I can use minimal installation on non development environments.

For pushing DB objects between source and destination databases using console exe (C# code, exe intern used in a batch file) and following SQL Server Management Objects are needed.

  • Microsoft.SqlServer.Smo.dll (Database, Server classes)
  • Microsoft.SqlServer.SmoExtended.dll (Transfer class)
  • Microsoft.SqlServer.SqlEnum.dll (CompatibilityLevel Enum)
  • Microsoft.SqlServer.Management.Sdk.Sfc.dll (used by Smo.dll)
  • Microsoft.SqlServer.ConnectionInfo.dll (SqlConnectionInfo, ServerConnection classes)

Management objects will by default come with SQL Server 2008 full installation or using Microsoft SQL Server 2008 Feature Pack. Feature Pack is a collection of stand-alone install packages that provide additional value for SQL Server 2008. Different feature packs can be installed using below link, for Ex: Microsoft SQL Server 2008 Management Objects alone …

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=8824

Some DB objects which are maintained in VSS are taken to the local file system and based on file modified time stamp we had run on target database directly using MSBuild Extension Pack. MSBuild Extension Pack provides a collection of over 400 MSBuild tasks which can operate on …

  • System Items: Active Directory, Certificates, COM+, Console, Date and Time, Drives, Environment Variables, Event Logs, Files and Folders, FTP, GAC, Network, Performance Counters, Registry, Services, Sound
  • Code: Assemblies, AsyncExec, CAB Files, Code Signing, DynamicExecute, File Detokenisation, GUID’s, Mathematics, Strings, Threads, Xml, Zip Files
  • Applications: BizTalk 2006 / 2010, Email, IIS6, IIS7, MSBuild, SourceSafe, SQL Server 2005, SQL Server 2008, StyleCop, Twitter, Team Foundation Server, Visual Basic 6, Windows Virtual PC, WMI

Get MSBuild Extension Pack from http://msbuildextensionpack.codeplex.com/

Btw … MSBuild Extension Pack and MSBuild Community Tasks are two different collections of MSBuild tasks. You can install both of them and choose to use whichever suits your needs.

Latest version of MSBuild Extension Pack 3.5.9.0 and MSBuild Extension Pack 4.0.3.0 supports .NET 3.5 and 4.0. The older version SDC Task Library (http://sdctasks.codeplex.com/) is meant for .NET 2.0 which has around 300 build tasks and there is no active support for this version now.

Below link has interesting article about code coverage testing using Visual Studio 2010.

http://www.buffington.com/Blog/post/2010/04/27/Visual-Studio-2010-Code-Coverage-Testing-in-10-Easy-Steps.aspx

You may not see result if you exactly follow those steps. In Step 4 don’t change selection to Trace and Test Impact. It should have Local selection as Code Coverage settings were asked to do on Local.testsettings file.

You can also use Test menu -> Test View option to run the tests.

If you are writing an API then you will have class library type projects (.dll output). You can quickly create test methods for your API methods by automatically generating the Unit Tests using “Create Unit Tests …” which you can see when you right click on any method. This will ask you to create Test Project and just follow the steps that it asks. Once Test methods are created you can comment out Assert.Inconclusive line in all test methods and provide proper input/expected variable values before running the Tests.

Check your javascript code quality using http://www.jslint.com/

For all installations of SQL Server 2008, the default compatibility level is 100. Databases created in SQL Server 2008 are set to this level unless the model database has a lower compatibility level. When a database is upgraded to SQL Server 2008 from any earlier version of SQL Server, the database retains its existing compatibility level if it is at least 80. Upgrading a database with a compatibility level below 80 sets the database to compatibility level 80. This applies to both system and user databases. Use ALTER DATABASE to change the compatibility level of the database. To view the current compatibility level of a database, query the compatibility_level column in the sys.databases catalog view.

ALTER DATABASE database_name SET COMPATIBILITY_LEVEL = { 80 | 90 | 100 }

  • 80 = SQL Server 2000
  • 90 = SQL Server 2005
  • 100 = SQL Server 2008

or Use sp_dbcmptlevel system proc to check/set different compatiblity levels to a database.

sp_dbcmptlevel ‘<db name>’ – to check the current compatibility
sp_dbcmptlevel ‘<db name>’, 100 – to set the compatibility to SQL Server 2008 

Changing the compatibility level while users are connected to the database can produce incorrect result sets for active queries. So set the database to single-user access mode and change the database compatibility to avoid any unexpected results.

 Read detailed info and importance of database compatibility @ http://msdn.microsoft.com/en-us/library/bb510680.aspx

I got to know this as some of our dynamic transfer build scripts were failed in the stage environment and the environments are having migrated databases from sql server 2005 to sql server 2008. As part of the migration database compatibility has not been changed to sql server 2008 i.e. 100. After setting 100 as compatibility level everything started working as expected.