»

[27 Feb 2009 | 5 Comments]

There are a few ways of deploying a .NET 2.0 ASP.NET application using Web Site Deployment Project using VS.NET Publish Command using VS.NET Build Command 1.) Using VS.NET Build ASP.NET not Visual Studio performs the build.  ASP.NET builds everything, including .cs and .vb code files and places all resulting assemblies in folder structure under Temporary ASP.NET files directory.  As ASP.NET does all of the compilation, the debug setting in the compilation section of the web.config controls debug or release mode.  Compile with debug=true and you'll find the .pdb debugging symbol files alongside each assembly.  In this scenario the Configuration Manager is obsolete (not used) and as such the only option is 'Debug'.   2.) Using VS.NET Publish This option is available when you are ready to publish to production.  The Publish command will precompile a web application and place the results into a director of your choosing (IIS/FTP/Directory).  Options are available on the Publish dialog box that map to aspnet_compiler switches.  The aspnet_compiler tool has option to create pdb files however this is not available on the dialog box (within vs.net).  Publish always builds in release mode without pdb files.  The Publish command does not change the debug setting in the web.config SO if you precompile and updateable (option 'allow this precompiled site to be updateable') web site and then update the web site in place (which will result in a dynamic compilation) those dynamic compilations will produce debug code and pdb files. 3.) Using Web Site Deployment Project (WSD) This project allows VS.NET to use MSBUILD files provided by WSD to ask for debug and release builds.  This tool uses the aspnet_compiler similar to above with the Publish option however the WSD option will change the debug setting in the web.config to false for release builds (different than the Publish option)  By default the built files will be in respective debug or release directories.   Conclusion VS.NET Build - builds web site to Temporary ASP.NET files directory with options specified in web.config VS.NET Publish - builds to release mode (always) however does not change the compilation mode in web.config file (which can lead to less than optimum performance if site is dynamically recompiled) Web Deployment Project - Builds based on Configuration Manager mode (debug/release) AND updates the web.config with additional options for creating debug symbols and swapping out web.config sections based on release mode     see related post http://blog.davidyardy.com/archive/2008/07/05/asp.net-2.0-compilation-models-again.aspx

Asp.Net, Javascript, Visual Studio »

[3 Feb 2009 | 1 Comments]

Visual Studio 2008 SP1 has the following patch to allow IntelliSense with jQuery [More]

SQL Server »

[2 Feb 2009 | 6 Comments]

I had a need to compare two SQL Server table for differences between them.  I started using .NET dataset features (merge, acceptchanges, getchanges) as follows:         Dim data1 DataSet = GetData1()          Dim data2 DataSet = GetData2()            Dim ds As New DataSet         ds.Merge(data1)         ds.AcceptChanges()         ds.Merge(data2)         ds.GetChanges(DataRowState.Modified) There are a few gotcha's with the above code.  The primary problem was that both tables must have primary keys defined.  I figured ok, I could create primary keys through code for the related DataTables however I soon realized that there were duplicate rows within the tables. SQL Server 2005 has Except and Intersect functions (http://msdn.microsoft.com/en-us/library/ms188055(SQL.90).aspx) that return distinct values by comparing the results of two queries.  The entire row is compared against another row from another table.Except returns any distinct values from the left query that are not found on the right query.Intersect returns any distinct values that are returned by both the query on the left and right sides. In order to use the number and order of the columns must be the same in the queries and also the data types must be comparable.  To return all rows in table1 that do not match exactly the rows in table2, you can use Except ...select * from table1 except select * from table2(likewise to find the opposite just reverse the table names above)To return all rows in table1 that match exactly what is in table2, using Intersect...select * from table1 intersect select * from table2Combining the above two... (the following will return the differences)select 'table1' as tblName, *  from  (select * from Table1 except select * from Table2) xunion allselect 'table2' as tblName, *  from  (select * from Table2 except select *  from Table1 ) x If you are fortunate to have primary keys you can of course still use IN/NOT IN type queries however it seems that performance is much improved with the Except/Intersect approach.

Javascript »

[1 Feb 2009 | 3 Comments]

Recently, Microsoft released their ASP.NET AJAX Framework which allows developers to build AJAX applications more easily.  ASP.NET AJAX consists of two pieces.  1.) Microsoft AJAX Library - contains a set of script files that provide common functions and an OO programming framework 2.) ASP.NET 2.0 AJAX Extensions - includes a set of server controls that allows developers to add AJAX functionality by dragging and dropping controls onto a page The following are brief descriptions of the javascript extensions made available by the AJAX Client Library by Namespace. Global Namespace - contains members and types that extend base JavaScript objects. Array Extensions (add, addRange, clear, clone, contains, dequeue, enqueue, forEach, indexOf, insert, pars, remove, removeAt) Boolean Extension (parse - converts a string into a Boolean) Date Extension (format, localeFormat, parseInvariant, parseLocale)         var today = new Date();         alert (today.format('D'));         d - Short date pattern (05/10/07)         D - Long date pattern (Thursday, 10 May 2007)         t - Short time pattern (18:05)         T - Long time pattern (18:05:12)         F- Full date pattern (Thursday, 10 May 2007 18:05:12)         M - Month and date pattern (May 10)         s - Sortable date and time pattern (2007-05-10T18:05:12)         Y - Year and month pattern (2007 May) Error Extensions (argument, argumentNull, argumentOutOfRange, argumentType, argumentUndefined, create, invalidOperation, notImplemented, parameterCount, popStackFrame) Number Extension (format, localeFormat, parseInvariant, parseLocale)         p - number is converted to a string that represents a percent         d - converted to a string of decimal digits         c - converted to a string that represents a currency         n - converted to a string of the form "-d,ddd,dd"         var num = Number.parseInvariant("130.33");         alert (num.localeFormat("c")); // $130.33 Object Extensions (getType, getTypeName)         getType - returns the type of specified object         getTypeName - returns the type name of an object String Extension (endsWith, format, localeFormat, startsWith, trim, trimEnd, trimStart) Sys Namespace          Sys - root namespace containing some base classes such as Sys.CultureInfo                   Application - objects/methods that expose client events and manage client components                   ApplicationLoadEventArgs - container object for arguments of the Application Load event                   CancelEventArgs - base class for events that can be canceled                   Component - base class for all asp.net ajax objects including Control class and Behavior class                   CultureInfo - object that can be used to provide locale specific functionality                   Debug code - debugging and tracing functionality                   EventArgs - used for storing event arguments                   EventHandlerList - collection of client events for a component containing event names and handlers                    PropertyChangedEventArgs - contains event arguments associated with changed properties                   StringBuilder - facilitates more efficient string concatenation          Sys.Net - provides networking and communication support          Sys.UI - contains set of classes for UI support          Sys.Services - support for asp.net application services such as login/authentication          Sys.Serialization - provides support for data serialization/Json          Sys.WebForms - contains classes for async page loading Shortcut Description $addHandler Shortcut to Sys.UI.DomEvent.addHandler method $addHandlers Shortcut to Sys.UI.DomEvent.addHandlers method $clearHandlers Shortcut to Sys.UI.DomEvent.clearHandlers method $create Shortcut to Sys.Component.create method $find Shortcut to Sys.Application.findComponent method $get Shortcut to Sys.UI.DomElement.getElementId method $removeHandler Shortcut to System.UI.DomEvent.removeHandler method