Archive

Archive for December, 2004

DSL designer example

December 23, 2004 Leave a comment

A nice article from Chris.

Categories: Whidbey

DSL Tools Preview available

December 23, 2004 Leave a comment

DSL tools December CTP is available on MSDN downloads. Quite an interesting topic.

From Jochen Seemann‘s blog

Categories: Whidbey

A Neat little SQL Server Enterprise Manager Tip

December 20, 2004 Leave a comment

From Scott Mitchell’s blog:

"hit Ctrl+C on a table name and then go to a text editor and hit Ctrl+V and get the appropriate CREATE TABLE SQL syntax for the “copied” table (which includes constraints)"

Really Really Cool.

Categories: SQL Server

ASP.NET: Scrollable datagrid with a fixed header

December 17, 2004 Leave a comment

A colleague of mine had a requirement for a scrollable datagrid with a fixed header. Well, this may not be the best way to design UIs for the web. But in some cases the clients are demanding features as if it were a desktop application. Coming back to the problem, Google pointed to quite a few solutions. I was impressed by Dino Esposito’s solution on http://www.codearchitects.com

http://www.codearchitects.com/casubscription/Default.aspx (you need to sign up to download).

Other related links:

http://datawebcontrols.com/faqs/CustomizingAppearance/ScrollableDataGridWithFixedHeader.shtml

http://slingfive.com/pages/code/scrollTable/

Categories: ASP .NET

Modelling trees for RDBMS

December 16, 2004 Leave a comment

An interesting problem on how to model tree structures with RDBMS came up this week. Google again came to the rescue. There are two approaches to model hierarchies in a RDBMS. The commonly used one is the adjacency list model

emp       boss      salary
===========================
‘Albert’  ‘NULL’    1000.00
‘Bert’    ‘Albert’   900.00
‘Chuck’   ‘Albert’   900.00
‘Donna’   ‘Chuck’    800.00
‘Eddie’   ‘Chuck’    700.00
‘Fred’    ‘Chuck’    600.00

Problem with the adjacency list model is that the boss and employee columns are the same kind ( names of personnel) and therefore should be shown in only one column in a normalized table.

A more efficient way would be the nested sets model

emp         lft  rgt
======================
‘Albert’      1    12
‘Bert’         2    3
‘Chuck’      4    11
‘Donna’      5    6
‘Eddie’       7    8
‘Fred’        9    10

            Albert (1,12)
            /       
          /           
    Bert (2,3)    Chuck (4,11)
                   /         |         
                 /           |            
               /             |             
             /               |               
        Donna (5,6)  Eddie (7,8)  Fred (9,10)

Imagine a little worm crawling anti-clockwise along the tree.  Every time he gets to the left or right side of a node, he numbers it.  The worm stops when he gets all the way around the tree and back to the top.

Here are two common queries which can be used to build others:

1. An employee and all their Supervisors, no matter how deep the tree.

SELECT P2.*
   FROM Personnel AS P1, Personnel AS P2
  WHERE P1.lft BETWEEN P2.lft AND P2.rgt
    AND P1.emp = :myemployee;

2. The employee and all subordinates. There is a nice symmetry here.

SELECT P2.*
   FROM Personnel AS P1, Personnel AS P2
  WHERE P1.lft BETWEEN P2.lft AND P2.rgt
    AND P2.emp = :myemployee;

This approach will be two to three orders of magnitude faster than the adjacency list model for subtree and aggregate operations.

From a post by Joe Celko on the microsoft.public.sqlserver.programming newsgroup:

http://groups.google.co.in/groups?hl=en&lr=&selm=93kor0%24bls%241%40nnrp1.deja.com&rnum=3

Another good article can be found @ http://www.yafla.com/papers/sqlhierarchies/sqlhierarchies.htm

Also looks like SQL for Smarties will be a good book to read.

Categories: SQL Server

Chameleon Clock – A neat little program

December 14, 2004 Leave a comment

Check this one – A cool replacement for the system tray clock.

Categories: Software Picks

Web Services and Binary payload

December 14, 2004 Leave a comment

Just ran into a request from one of colleagues on how to handle file attachments in Web Services.

Google pointed me this article on MSDN.

http://msdn.microsoft.com/webservices/building/wse/default.aspx?pull=/library/en-us/dnwse/html/wsedime.asp

This uses DIME. DIME is now giving way to SOAP MTOM. http://www.w3.org/TR/2004/WD-soap12-mtom-20040608/

But as of now I believe the option is to go with DIME as WSE still doesn’t support MTOM.

Read this if need further background.

http://www.winfx247.com/247reference/msgs/0/1206.aspx

Another approach is outlined @

http://www.codeproject.com/cs/webservices/DIMEBridge.asp?print=true

Categories: Web Services

TreeView Internet Explorer Web Control – TreeNodeSrc File locking issue

December 14, 2004 Leave a comment

One of my friends ran into an issue with the TreeView Internet Explorer Web Control. It looked like ASP.NET worker process was maintaining a lock on the xml file.

Did a google search and ran into this post on ASP.NET forums. The last but one post was the solution.

http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=331111

Categories: ASP .NET

Express Manager – Can’t wait

December 13, 2004 Leave a comment

Can’t wait to get my hands on SQL Server 2005 Express Manager December CTP.

Categories: SQL Server

SQL Server – Case When statements

December 13, 2004 Leave a comment

Well, saw some strange behaviour with case when statements.

In each of the when statements, I select a different column.

Looks like even if one of the columns is an int and others varchar, SQL Server tries to convert the varchar columns to int.

If i put an explicit convert on the int column to varchar there is no such attempt to convert.

Hmm… Pretty strange for me though. Thanks to my friend Venky, for helping me in finding this one.

Categories: SQL Server