# Sunday, October 9, 2005

I know that all my firends in Pakistan read my blog, and let me say my heart goes out to you. You and your country really touched me on my most recent visit.

While most of my firends are safe in Karachi, I had to search for Saqib Ilyas in Lahore, much closer to the epicenter. Thankfully he is ok.

My buddy Fahad Majeed reports about the earthquake here.

You can donate here.

posted on Sunday, October 9, 2005 10:38:32 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback
# Saturday, October 8, 2005

SQL Server 2005 allows you to store XML in a native data type. That is cool, however, having XML in the database is almost useless unless you can query the elements and attributes of the XML data natively. XQuery becomes very useful when you can use it to search based on the values of a particular element or attribute. The xml.exist() function accepts an XQuery as input and returns 0, 1, or NULL, depending on the result of the query; 0 is returned if no elements match, 1 is returned if there is a match, and NULL is returned if there is no data to query on. For example we will verify if a node exists in this particular XML string of classes.

DECLARE @XML xml

Set @XML='

<classes>

   <class name="SQL Server Index"/>

   <class name="SQL Precon"/>

</classes>

'

Select @XML.exist('/classes')

 

The code above returns a 1 since the “classes” element exists in the XML variable. If you change the XQuery expression to search for an XML node that does not exist like,  Select @XML.exist('/dogs), then it will return 0.

You can see this in action as part of a CHECK CONSTRAINT. SQL Server will not allow you to use an xml.exist as part of a CHECK CONSTRAINT. So you have to first create a user defined function (UDF) to perform the action. This UDF accepts an XML field and retunes the value of an xml.exist() method looking for an instance of < Orders'>:

USE AdventureWorks

GO

CREATE FUNCTION dbo.DoesOrderXMLDataExist        

(@XML XML)                    

RETURNS bit                       

AS

BEGIN                              

RETURN @XML.exist('/Orders')   

END;

GO

 

            To use this UDF as a CHECK CONSTRAINT, just create a table and pass the column you want to apply the constraint to the UDF you just created.

--create the table using the function

CREATE TABLE OrdersXMLCheck

   (OrderDocID INT PRIMARY KEY,

   xOrders XML NOT NULL Default '<Orders/>'

 CONSTRAINT xml_orderconstraint

  CHECK(dbo.DoesOrderXMLDataExist(xOrders)=1))

 
Its that simple, now you have a rule enforced on that column making sure that an <Order> element is added to this table.
posted on Saturday, October 8, 2005 3:56:06 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [2] Trackback
# Wednesday, September 28, 2005
That was my time for a mile in the race this weekend down 5th Avenue. In some respects a mile that fast was harder than the marathon. Headed out to Redmond, Washington to visit the boys at Microsoft at the MVP Summit. Should have some good stories to tell in the old blog while I am out there.
posted on Wednesday, September 28, 2005 4:30:10 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Tuesday, September 20, 2005

This Sunday I am going to see the Dalai Lama speak at Rutgers University. The topic is “Peace, War, and Reconciliation.” I am curious to see how he approaches the topic of China and Tibet.

 

Not being a fan of Richard Gere I do find the Chinese occupation of Tibet wrong. I can say this having visited the region several times and spending a lot of time there making friends with the locals in Tibet, Bhutan and Nepal. I hope the Dali Lama speaks to this.

posted on Tuesday, September 20, 2005 8:23:07 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Monday, September 19, 2005

Three and a half years ago I scaled my first peak in the Catskills and was hooked to get into the exclusive Catskill 3500 club. The 3500 club is someone who has climbed all 35 peaks of 3500 feet elevation in the Catskills, including 4 of them twice in the winter. You may say, that is easy, but considering that 18 or so of them are trail less and the Catskills can have a foot of snow as early as October 1 and as late as May 1.

 

Well I did it! It did take me long enough since I got diverted by the mountains in Bhutan, Machu Picchu, Everest, Denali, Mt. Rainer (twice), Kilimanjaro and a marathon in some strange land of Antarctica.

 

So in all of those crazy treks, Nepal is my favorite country (people, scenery, Buddhist culture), Rainer is my favorite, and Kilimanjaro is the one most likely to do more than once.

 

In the Catskills, I would do almost any of the mountains over again (and will do a bunch this winter) and most likely will start climbing some peaks in the White Mountain Range in NH.

 

So here are the peaks:

 

2002:

Slide (2/9)

Balsam (2/24)

Hunter (6/2)

Southwest Hunter (6/2)

Black Dome (9/8)

Thomas Cole (9/8)

Blackhead (9/8)

Whindham High Peak (9/28)

Graham (9/29)

Balsam Lake (9/29)

Panther (11/10)

Panther (12/29)

 

2003:

Blackhead (1/12)

Big Indian (3/13)

Eagle (3/13)

Westkill (3/23)

Table (4/19)

Peekamoose (4/19)

Indian Head (10/4)

Twin (10/4)

Sugarloaf (10/4)

Pleatu (10/4)

Katterskill High Peak (10/25)

Bearpen (10/26)

Vly (10/26)

Slide (11/16)

Wittenberg (11/16)

Cornell (11/16)

North Dome (12/28)

Sherill (12/28)

 

2004:

Balasm (1/4)

Lone (9/22)

Rocky (9/22)

Doubletop (9/25)

Fir (11/27)

 

2005:

Balsam Cap (5/15/05)

Friday (5/15/05)

Rusk (7/16/05)

Halcott (09/17/05)

 

posted on Monday, September 19, 2005 3:05:31 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback
# Wednesday, September 7, 2005

Back from China and ready to start the fall marathon season in New York along with the usual list of conferences, MVP Summits and the like.

 

A very quick synopsis on China, well it was pretty cool. Got to experience communism first hand (and made me not take for granted the freedoms I have as an American) and see some amazing historical, religious and cultural areas. I met so many everyday Chinese people, very excited to practice their English talking with me for hours and exchanging views and ideas.

 

While I went to several places in China (Beijing, Datong, Dunhuang, Xi’am, Shanghai, Hong Kong and Macau), I have to say two places really stuck out for me.

 

 

First is the Great Wall. It lives up to its reputation. It is steep, vast and goes on and on and on. I kept climbing on up, seeing in the distance a watchtower and figured to myself “well this watchtower should be the last one, I can then view over the other side of the mountain.” Then when I got there, there were just more and more and more. A truly amazing experience.

 

Second is the Yungang Caves, just outside of Datong in the Shanxi Province. These caves were carved out of a mountain by Buddhists 1500 years ago (yes 1500) and are a very special place-it was a bit of a pilgrimage for me. Started in 450 AD, Yungang is a relic of the Northern Wei Dynasty (386-534). It is a combination of Chinese and  Indian Gandhara Buddhist art. Chinese are not like the Buddhists in other parts of SouthEast Asia that are Theravada, the Chinese are Mahayana.

 

Anyway, I saw a ton of other great stuff, but don’t want to bore you all with the details. Time to get back to the Model View Controller Design pattern…..

posted on Wednesday, September 7, 2005 9:01:09 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [2] Trackback
# Wednesday, August 24, 2005

Today we woke up and visited Mao’s Tomb. A brutal reminder that while economically free China is still a one party state without any elected government.

 

Climber the Great Wall, visited the Forbidden City and Summer Palace (which rocks), of course a visit to a Buddhist Lama temple rounded out some time in Beijing.

 

Now I am in Datong, where no English is spoken at all. Visiting some old Buddhist Caves and Monasteries tomorrow before off to Xiam to see the warriors.

(This does not suck)

posted on Wednesday, August 24, 2005 9:52:46 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [2] Trackback
# Tuesday, August 9, 2005

SQL Server 2005 Notification Services is what you would traditionally call “middle ware” or part of an application server. SQL Server is traditionally a “back end” or an infrastructure component to your architecture. SSNS is middleware provided by Microsoft as part of the SQL Server 2005 package. Microsoft has not traditionally provided a lot of middleware, but ever since the success of “Viper” or Microsoft Transaction Server (MTS), Microsoft has been providing more and more reliable and scalable middleware. Since SSNS is middleware and not part of the core database engine, SSNS is a separate setup option that is turned off by default when you initially set up your SQL Server 2005 server. You will need to select SSNS to install it at initial setup. 

If you choose to install SQL Server 2005 Notification Services, all of its components and support files install in a separate subdirectory (typically the \Notification Services subdirectory of your default SQL Server installation.). If you are like me and need to know what everything is, you can see by inspecting the subdirectory that SSNS is made up of a few components, the important ones are explained here:

microsoft.sqlserver.notificationservices.dll-this is the actual guts of Notification Services. A managed .NET assembly that contains the core code for SSNS and the built-in providers you use to retrieve data and create notifications and subscriptions.

NSService.exe-the executable shell of microsoft.sqlserver.notificationservices.dll used for running as a Windows Service. Each instance of NSService.exe runs as a Windows Service and can be managed by SQL Management Studio. Instances of NSService.exe are independent of SQL Server 2005 instances.

Providers-is the extensible framework that SSNS is built around: event providers, formatters and delivery protocol providers.

Nscontrol.exe-this is a utility program that is used when you compile your application and generates the SQL Server Database and objects that the Windows Service application uses to retrieve data and create notifications.

XML Schemas-When you generate a SSNS application, you use configuration files that are XML based. The schemas provided as part of the framework validate those documents.

Sample applications-more than most other tools, the community has used the sample applications to fully show the power of Notification Services. We will explore them as well.

This is good stuff. More later..

posted on Tuesday, August 9, 2005 4:03:48 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback