# Friday, February 29, 2008

Yesterday we discussed the changes to XQuery by allowing LET statements. Today the last XML enhancement is an "enhancement" to XML DML.

XML Data Manipulation Language (DML) is specific to MS SQL Server 2005 and 2008. It is a very useful feature that allows you to insert nodes to an existing XML instance, delete an element, or replace the value of (sort of an edit.) It works like this:

First let's create a table with an XML data type and insert a piece of XML into it:

Create table XMLTest1
    (
    Speaker_ID int primary key,
    SpeakerXML xml not null
    )

GO

Insert into XMLTest1
Values
(
    1,
    '
    <classes>
        <class name="Writing Secure Code for ASP .NET " />
        <class name="Using XQuery in SQL Server 2008" />
        <class name="SQL Server and Oracle Working Together" />
    </classes>
    '
    )

Now to insert an element into this table it is pretty easy, just use the XML modify method of the XML data type. Since our XML instance is in a SQL Server table we have to use the standard SQL UPDATE and SET syntax with a WHERE clause to get to the piece of XML in our table we are concerned with. You can see how easy it is to add an element to the table here:

Update XMLTest1
Set SpeakerXML.modify(
'insert
<class name="Using Linq to SQL" />
into /classes[1]'
)
Where Speaker_ID=1

If we select * from XMLTest1 WHERE Speaker_ID=1 the XML column looks like this now:

<classes>
  <class name="Writing Secure Code for ASP .NET " />
  <class name="Using XQuery in SQL Server 2008" />
  <class name="SQL Server and Oracle Working Together" />
  <class name="Using Linq to SQL" />
</classes>

SQL Server 2008 has an enhancement to this. You can substitute the XML element with a variable. For example let's create a variable here:

DECLARE @newElement xml
Set @newElement='<class name="ASP.NET Scalability"/>'

Now let's do the same insert as before, however, we will use the @newElement variable. This will enable you to select XML from other areas and stick it into a variable and then insert it into another XML instance. Here is the final piece:

Update XMLTest1
Set SpeakerXML.modify(
'insert
sql:variable("@newElement") 
into /classes[1]'
)
Where Speaker_ID=1

If we select * from XMLTest1 WHERE Speaker_ID=1 the XML column looks like this now:

<classes>
  <class name="Writing Secure Code for ASP .NET " />
  <class name="Using XQuery in SQL Server 2008" />
  <class name="SQL Server and Oracle Working Together" />
  <class name="Using Linq to SQL" />
  <class name="ASP.NET Scalability" />
</classes>

Not the greatest of new features, but a handy dandy feature to say the least.

posted on Friday, February 29, 2008 12:00:54 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1] Trackback
# Thursday, February 28, 2008

Continuing our discussion of XML in SQL Server 2008, SQL Server 2005 alowed us to use XQuery to query XML data in an XML data type.  You can use the FLWOR statements of for, where, order by, and retun, but not LET. SQL Server 2008 now has support for LET, which is used to assign values to variables in an XQuery expression. For example we are going to take the XML below and count the number of sessions per speaker using the count XQuery expression and assign it to a variable via LET.

declare @xml xml
set @xml=
'
<Speakers>
    <Speaker name="Stephen Forte">
        <classes>
            <class name="Writing Secure Code for ASP .NET "/>
            <class name="Using XQuery in SQL Server 2008"/>
            <class name="SQL Server and Oracle Working Together"/>
        </classes>
    </Speaker>
    <Speaker name="Richard Campbell">
        <classes>
            <class name="SQL Server Profiler"/>
            <class name="Advanced SQL Querying Techniques"/>
            <class name="SQL Server and Oracle Working Together"/>
            <class name="From 1 Server to 2"/>
        </classes>
    </Speaker>
</Speakers>
'
SELECT @xml.query(
'<Speakers>
{
for $Speaker in /Speakers/Speaker
let $count :=count($Speaker/classes/class)
order by $count descending
return
<Speaker>
{$Speaker/@name}
{$Speaker/count}
<SessionCount>{$count}</SessionCount>
</Speaker>
}
</Speakers>')

The result is shown here, notice that Richard sorts on top since we used the descending order to our order by and ordered by the expression we created via the LET statement. This is very helpful if you are manipulating simple XML and need to do a mini-transform via XQuery. I used to use the RETURN statement all the time to make slight manipulations to my XML, so I was waiting for LET. While this is the only addition to XQuery, it is a much needed and welcome one.

<Speakers>
  <Speaker name="Richard Campbell">
    <SessionCount>4</SessionCount>
  </Speaker>
  <Speaker name="Stephen Forte">
    <SessionCount>3</SessionCount>
  </Speaker>
</Speakers>

posted on Thursday, February 28, 2008 12:00:35 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1] Trackback
# Wednesday, February 27, 2008

Continuing our discussion from yesterday on SQL Server 2008 XML Enhancements, let's take a look at the XSD enhancement of Union and List types. In SQL Server 2005 you could define a simple type of xsd:list with an enumeration to require items in a list for any element that inherits that type. For example our XSD below will allow FedEx, DHL, and UPS for a shipping.

create XML SCHEMA COLLECTION dbo.order_xsd
AS
'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:simpleType name="orderAmt" >
     <xsd:restriction base="xsd:int" >
       <xsd:maxInclusive value="5000" />
       <xsd:minExclusive value="1" />
     </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="shiptypeList">
    <xsd:list>
        <xsd:simpleType>
          <xsd:restriction base="xsd:string">
            <xsd:enumeration value="FexEx"/>
            <xsd:enumeration value="DHL"/>
            <xsd:enumeration value="UPS"/>
          </xsd:restriction>
        </xsd:simpleType>
    </xsd:list>
    </xsd:simpleType>
   <xsd:element name="Order">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="CustomerName" type="xsd:string" />
        <xsd:element name="OrderDate" type="xsd:dateTime"/>
        <xsd:element name="OrderAmt" type="orderAmt"/>
        <xsd:element name="ShipType" type="shiptypeList"/>   
      </xsd:sequence>
    </xsd:complexType>
   </xsd:element> 
</xsd:schema>'
GO

DECLARE @xml XML(dbo.order_xsd)
SET @xml =
'<Order>  
    <CustomerName>Bill Gates</CustomerName>
    <OrderDate>2008-10-10T14:22:27.25-05:00</OrderDate>
    <OrderAmt>100</OrderAmt>
    <ShipType>DHL</ShipType>
</Order>'
GO

So this is cool, gives you some database lookup functionality, kind of third normal form Clemens Vasters style. With the new support for union of lists in SQL Server 2008 with xsd:union, you can combine multiple lists to one simple type. For example in our XSD below we allow the same strings as FedEx, etc, but also numerical values.

My example below is pretty basic, but this is useful if you have more than one way to describe something and need two lists to do so. One thing that comes to mind is units of measurement, metric and English measurements, so shoe sizes, US and Italian, etc.  This is very useful when you need to restrict items and are writing them from a database, etc.

Take a look at the demo for SQL 2008 below, notice that I changed the data to 1 from FedEx:

create XML SCHEMA COLLECTION dbo.order_xsd
AS
'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:simpleType name="orderAmt" >
     <xsd:restriction base="xsd:int" >
       <xsd:maxInclusive value="5000" />
       <xsd:minExclusive value="1" />
     </xsd:restriction>
   </xsd:simpleType>
    <xsd:simpleType name="shiptypeList">
        <xsd:union>
            <xsd:simpleType>
              <xsd:list>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:integer">
                    <xsd:enumeration value="1"/>
                    <xsd:enumeration value="2"/>
                    <xsd:enumeration value="3"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:list>
            </xsd:simpleType>
            <xsd:simpleType>
              <xsd:list>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="FedEx"/>
                    <xsd:enumeration value="DHL"/>
                    <xsd:enumeration value="UPS"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:list>
            </xsd:simpleType>
        </xsd:union>
    </xsd:simpleType>

   <xsd:element name="Order">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="CustomerName" type="xsd:string" />
        <xsd:element name="OrderDate" type="xsd:dateTime"/>
        <xsd:element name="OrderAmt" type="orderAmt"/>   
        <xsd:element name="ShipType" type="shiptypeList"/>
        <xsd:any namespace="##other" processContents="lax"/>   
      </xsd:sequence>
    </xsd:complexType>
   </xsd:element> 
</xsd:schema>'
GO

DECLARE @xml XML(dbo.order_xsd)
SET @xml =
'<Order>  
    <CustomerName>Bill Gates</CustomerName>
    <OrderDate>2008-10-10T14:22:27.25-05:00</OrderDate>
    <OrderAmt>100</OrderAmt>
    <ShipType>1</ShipType>
    <Notes xmlns="sf">Steve Test 1</Notes>
</Order>'
GO

posted on Wednesday, February 27, 2008 12:00:16 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] Trackback
# Tuesday, February 26, 2008

The SQL Server 2008 February CTP is now installed. I did it on my daily machine to force me to use it in a more realistic environment. It installed a-ok with my default SQL 2005 instance. As you can see below you can use the SQL 2008 IDE to manage and work with both SQL Server instances on your computer at the same time.

image

I am playing with the new XML features of SQL Server. For those of you that know my old company, Corzen, used the XML data type to do some really cool stuff. I'm now investigating the XML features for the update to the Programming SQL Server 2008 book from MS Press.

I guess that XLINQ is pretty cool and well accepted Microsoft did not change all that much in the XML world in SQL Server 2008. The new XML features of SQL Server 2008 are:

  • Lax validation support in XSD-giving you some more flexibility with your required areas of the XSD
  • Full support of the XSD: xs:dateTime, basically the preservation of time zones
  • Union and List types in XSDs (I have not played with this yet so can't speak to how useful it will be yet, give me a day)
  • Support of the LET FLOWR expression in XQuery (yay!)
  • XML DML "enhancements." I put that in quotes for two reasons, there is only one true enhancement, allowing you to insert data from a SQL column or a SQL variable as part of your insert. This is a very minor enhancement, I was hoping for a new syntax for specifying position, etc. Also XML DML is SQL Server specific, so it is hard to get very excited about this feature.

Now let's take a look at some of the XSD enhancements. SQL Server 2005 added the ability put XML data into an intrinsic XML data type. This was a vast improvement over SQL Server 2000 where we had to put data in text fields. In addition, SQL Server 2005 allowed us to restrict this column with an XSD. Consider this XSD:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:simpleType name="orderAmt" >
     <xsd:restriction base="xsd:int" >
       <xsd:maxInclusive value="5000" />
       <xsd:minExclusive value="1" />
     </xsd:restriction>
   </xsd:simpleType>
   <xsd:element name="Order">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="CustomerName" type="xsd:string" />
        <xsd:element name="OrderDate" type="xsd:dateTime"/>
        <xsd:element name="OrderAmt" type="orderAmt"/>
      </xsd:sequence>
    </xsd:complexType>
   </xsd:element> 
</xsd:schema>

We have defined a few elements, given them a sequence and data types. We also say that you can only have an order amount between 1 and 5000 (work with me, I like simple demos) since the OrderAmt element inherits the simple type orderAmt. This works well, for example if we create an XSD and a table with an XML column bound to that XSD in SQL 2005:

--Valid SQL Server 2005 Schema
CREATE XML SCHEMA COLLECTION dbo.order_xsd
AS
'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:simpleType name="orderAmt" >
     <xsd:restriction base="xsd:int" >
       <xsd:maxInclusive value="5000" />
       <xsd:minExclusive value="1" />
     </xsd:restriction>
   </xsd:simpleType>
   <xsd:element name="Order">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="CustomerName" type="xsd:string" />
        <xsd:element name="OrderDate" type="xsd:dateTime"/>
        <xsd:element name="OrderAmt" type="orderAmt"/>
      </xsd:sequence>
    </xsd:complexType>
   </xsd:element> 
</xsd:schema>'
GO

CREATE TABLE xml_schematest (
   Order_ID int primary key,
   Order_XML XML(order_xsd) --XML Schema Name
)

Now let's insert some XML in there, the XML will be like this:

Insert into xml_schematest
VALUES
(1,
'<Order>  
    <CustomerName>Bill Gates</CustomerName>
    <OrderDate>2008-10-10T14:22:27.25-05:00</OrderDate>
    <OrderAmt>100</OrderAmt>
</Order>
')

Here is the result, notice the Z for UTC as well as the new time (more on that below):

<Order>
  <CustomerName>Bill Gates</CustomerName>
  <OrderDate>2008-10-10T19:22:27.250Z</OrderDate>
  <OrderAmt>100</OrderAmt>
</Order>

This XML will fail since it has an order over 5000.

Insert into xml_schematest
VALUES
(2,
'<Order>  
    <CustomerName>Bill Gates</CustomerName>
    <OrderDate>2008-10-10T14:22:27.25-05:00</OrderDate>
    <OrderAmt>10000</OrderAmt>
</Order>
')

So life is good. We have a nice XSD and it restricts our content. SQL Server 2008 has added two new features of an XSD that we will look at today. The first is something called Lax validation. Let's say that you wanted to add an additional element after <OrderAmt> that is not part of the same schema. In SQL Server 2005, schemas can use processContents values of skip and strict for any and anyAttribute declarations as a wildcard. If it was set to skip, SQL will skip completely the validation of the additional element, if it is set to strict, SQL will require that it has an element or namespace defined in the current schema. SQL Server 2008 adds support for an additional validation option: lax. By setting the processContents attribute for this wildcard section to lax, you can enforce validation for any elements that have a schema associated with them, but ignore any elements that are not defined in the schema. Pretty cool, no?

Also the xsd:dateTime XML data type is now timezone aware. SQL Server 2005 you had to provide a time zone for dateTime, time and date data (did you really ever do that? If you needed the flexibility, trust me, this was a pain). What was not cool was that SQL Server 2005 did not preserve the time zone information for your data for dateTime or time,  it normalizes it to UTC (so for example 2008-10-10T08:00:00:000-5:00 is normalized to 2008-10-10T13:00:00:000Z. Notice the Z for UTC. Quite annoying.) In SQL Server 2008, this has been removed! Take a look at this code:

CREATE XML SCHEMA COLLECTION dbo.order_xsd
AS
'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:simpleType name="orderAmt" >
     <xsd:restriction base="xsd:int" >
       <xsd:maxInclusive value="5000" />
       <xsd:minExclusive value="1" />
     </xsd:restriction>
   </xsd:simpleType>
   <xsd:element name="Order">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="CustomerName" type="xsd:string" />
        <xsd:element name="OrderDate" type="xsd:dateTime"/>
        <xsd:element name="OrderAmt" type="orderAmt"/>   
        <xsd:any namespace="##other" processContents="lax"/>   
      </xsd:sequence>
    </xsd:complexType>
   </xsd:element> 
</xsd:schema>'
GO
CREATE TABLE xml_schematest (
   Order_ID int primary key,
   Order_XML XML(order_xsd) --XML Schema Name
)
GO

Now this will work and even preserve the time zone of -5 (New York) and notice the random <Notes> element due to lax validation. Here is how to insert the XML:

Insert into xml_schematest
VALUES
(1,
'<Order>  
    <CustomerName>Bill Gates</CustomerName>
    <OrderDate>2008-10-10T14:22:27.25-05:00</OrderDate>
    <OrderAmt>100</OrderAmt>
    <Notes xmlns="sf">Steve Test 1</Notes>
</Order>
')

Here are the results in the database with the original time zone:

<Order>
  <CustomerName>Bill Gates</CustomerName>
  <OrderDate>2008-10-10T14:22:27.25-05:00</OrderDate>
  <OrderAmt>100</OrderAmt>
  <Notes xmlns="sf">Steve Test 1</Notes>
</Order>

Tomorrow I will look at Union and List types.

posted on Tuesday, February 26, 2008 12:00:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] Trackback
# Monday, February 25, 2008

Google's co-founder Sergey Brin said on Sunday that Microsoft's proposed takeover of Yahoo! is an "unnerving" maneuver that threatens innovation on the Internet. Brin stated:

"The Internet has evolved from open standards, having a diversity of companies... And when you start to have companies that control the operating system, control the browsers, they really tie up the top Web sites, and can be used to manipulate stuff in various ways. I think that's unnerving."

Get a grip Sergey. This sort of scare tactic could have worked 10 years ago before Web 2.0 and before there was a serious threat to Microsoft on the Internet called Google. Google is a huge company that has an over 70% market share. Microsoft has a tiny market share, even with the combined Yahoo, Microsoft-Yahoo will still be very far behind Google.

Microsoft's hold on the desktop and browser for the last 10 years has not made it any more powerful in the 2008 Web 2.0 world. They are distant third place in search and losing ground. They are no longer the evil empire.

Google is the new evil empire. They are big, they control a ton of eyeballs and many people in the valley are now saying that Google is very difficult to deal with. Microsoft is just another player in the Internet space, Google is bringing up old battle cry's from yesteryear. Sergey better watch out, the Department of Justice may just come after him in a few years. Don't think so? Bill Gates never thought so.

posted on Monday, February 25, 2008 10:32:11 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] Trackback
# Friday, February 22, 2008

It was my birthday on Wednesday and we decided to go to the Pyramids with all of the investors of DashSoft as well as the entire team of local Egyptians. There is nothing like going to the Pyramids with locals. But the adventure started before we even got there.

Riding a taxi in Cairo is always an adventure. The adventure starts before you get into the taxi, when you have to negotiate the fair. Vassil was the butt of our jokes since he paid LE 90 (about $17) to get from the hotel to the office on Monday when we paid about LE 15 ($2.75). Vassil is not the best negotiator but desperately wanted to make amends. We got the inside scoop from the locals that it should cost no more than LE 35 from our hotel to the Pyramids. I warned Vassil that the taxi driver may start at LE 200 and he will have to knock him down. Vassil asked the first taxi for a price and the taxi started at LE 50 and Vassil immediately said 40, not something like 5! Oh well....

As we rode through Cairo, we were due to meet Remon at the Pyramids. He was traveling with the whole team of developers and testers from the office. All of the developers have been to the Pyramids just once in their lives and it was on a school trip. Remon rented a bus, a bus we were not on.

Back in the taxis, Vassil was filming me practicing my Arabic with the drivers of other cars since we were stuck in traffic. After we got to the highway we lost the third taxi in our caravan, holding Richard Campbell and his wife and friend Mike. Our taxi driver phones Richard's taxi and we pull over to the slow lane  of the highway and stop and wait for them. I decide to get out and have some fun. I tell my taxi drivers I want to buy my taxi. They start to compete saying who's taxi is better. The fun got even better when a random third taxi appeared and thought we were broken down (I was taking photos of the taxis) and when I explained to him that I was attempting to buy a taxi, he offered his. I had him down to about $700.  My driver then shooed him away. Finally Richard's taxi drove by and the look on their faces was priceless, I was walking around on the highway taking photos and they did not expect to see me. Oddly enough, Remon's van passed us by and Reem noticed me on the side of the road taking photos and joking with the taxi drivers. So they pulled over and picked us up. We paid our taxi drivers and took their photos and left for the Pyramids.

IMG_0809a

Entering the Pyramids you learn that it costs LE 100 ($20) for a foreigner to enter the Pyramids and LE 4 (< $1) for an Egyptian! I pose for a photo with my Egyptian wife Lamees and try to pass myself off as an Egyptian to no avail. I did show my student photo from my MBA program and pay the LE 50 student rate.

IMG_0817a

We enter the grounds and go inside the Great Pyramid. Unfortunately no cameras are allowed inside and we climb up to the room where the king's body and gold was stored. After climbing up for 15 minutes in the heat and no oxygen, we finally get there. It is an empty room. But a 4,000 year old empty room. Very cool.

We get down and then start having more fun. We take tons of silly photos. The Egyptians were just as excited as us foreigners.

IMG_0834a

Next we move on to the camels. Yes camels. What kind of trip to the Pyramids would be complete without camels?!?! I have been to the Pyramids about 7 or 8 times so I do not ride a camel but take tons of photos.

IMG_0854a

We then move to the Sun-Boat museum where the Pharaoh's boat is stored.  The admission fee is LE 40 and I once again try to pass myself off as Egyptian. The best I can do is say I am the professor of all of the locals with me, Lamees gives the man her Student ID card and we buy 10 local student passes (LE 20) and one foreigner student pass (LE 20) and go inside. One foreigner costs the same as 10 locals! We meet up with Richard who I instruct to call me Professor.

IMG_0892a

Next we drive in the bus to the paranoiac view point of all three main Giza Pyramids. We take a team photo.

IMG_0896a

The locals want to ride horses down to the Sphinx. Most of us get on a horse but some are afraid or want to ride a camel. Some are just plain old boring and take the bus down. (Richard and his crew.) The camel/horse guy double crosses Michael (the local who negotiated the deal) and we are taken down to the Sphinx and then back to where we started. So we take the bus down to the Sphinx to meet Richard and crew.

IMG_0932a

By now we have been at the Pyramids for about 5 hours and are hungry for lunch. There is a Pizza Hut right across from the Sphinx. I say "let go in there!" and our only dissenter is Remi who says "I can get Pizza Hut in the Netherlands but not Falafel." The locals really want American fast food, who can blame them! I tell Remi that I can get falafel in New York, but not Pizza Hut. (True) So we split up and get some Pizza Hut. The view of the Sphinx inside of Pizza Hut is awe inspiring and my photos are better then outside due to the height of the second floor.

IMG_0943a

After hanging out and shooting the breeze we take the bus back to the hotel, which contains the largest shopping mall in the Middle East and shop. I decide to hang out in Starbucks and wait for the girls.

We then depart for the Nile where Remon has arranged a boat ride, dinner, and birthday cake as well as Arabic music and dancing. It is a full moon and we cruse along the Nile for a few hours, eating, dancing and having a blast. Several happy birthday chants were sung in both English and Arabic. 

We head back to the hotel, have a drink and pass out. It sure has been an interesting 36 years so far.

PS: flickr photos are here.

posted on Friday, February 22, 2008 10:21:09 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2] Trackback
# Tuesday, February 19, 2008

Today Toshiba announced the death of HD DVD saying that it will no longer produce HD DVD players. While a standards war between Toshiba's HD DVD and SONY's Blu-Ray was in full swing, Blu-Ray emerged today as the winner. The death of HD DVD was very quick, here is how it happened:

  • Popularity of SONY Playstation 3 at Christmas
  • Warner Brothers pulling out of the format leading to limited Selection of HD DVDs titles
  • Netflix going Blu-Ray exclusive

I think the tipping point was Netflix going exclusive. With Warner Brothers out and Paramount rumored, the writing was on the wall. It took 8 days from the Netflix announcement to the actual tossing in of the towel by Toshiba. Score one for the power of the people. Once Netflix spoke on behalf of its members, HD DVD died.

Blu-ray will have to compete hard against high-def Internet downloads. With a lot of the public not willing to pay over $30 for a new Blu-ray disk movie (compared to a $10 DVD) and new players being expensive;  hard drive space being super cheap and broadband also ubiquitous and cheap, Blu-ray will have a major fight on its hands. Expect a repeat of the MP3 Napster debate from 10 years ago.

Business models will have to change. Will the movie/DVD industry learn anything from the music/CD industry? I doubt it.

posted on Tuesday, February 19, 2008 5:12:05 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] Trackback
# Wednesday, February 13, 2008

According to the Alley Insider, Yahoo's second largest shareholder, investor firm Legg Mason, has met with Steve Ballmer and supports a bump in the price and thinks that Yahoo should take it. Legg Mason outlined in a letter to shareholders that Microsoft will offer better value than Yahoo can deliver on its own. If you remember Microsoft offered $36 last summer. Expect them to go at least this high, if not higher. (They most likely were prepared to pay this high already.) The Google-Yahoo deal has went cold according to the Wall Street Journal, so Yahoo has very little in the way of options.

Brilliant strategy by Microsoft. Come in at a low point when Yahoo is laying off 1,000 workers with a low bid. Get the shareholders excited, have the board reject the offer and then up the bid. Not the board of directors is stuck between a rock and a hard place. Or between a Google and a Microsoft.

When it looks like this deal will go through, I will post why I am such a strong supported of it and counter all the anti-deal.

posted on Wednesday, February 13, 2008 8:03:41 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] Trackback
# Tuesday, February 12, 2008

Over the weekend Yahoo! board members leaked to the Wall Street Journal that they felt that the Microsoft bid of $31 a share is "massively undervalued." Yahoo then officially rejected Microsoft's bid on Monday. What happened is that Yahoo's management convinced the board of directors not to sell at $31. But Yahoo shareholders want to earn that $31 or more. So Yahoo said the offer was "massively undervalued" and that $40 is what they want. Microsoft responded by saying that $31 is a full and fair deal and that Yahoo's counter offer of $40 is "Absurdly High." This is the classic negotiation tactic know as anchoring.

Microsoft is not backing down. Steve Ballmer said he is willing to go higher. Negotiation statistics say that in cases like this firms usually "split the difference" and would settle for around $35 a share. But Microsoft is also pulling no stops, they are hiring a proxy firm to start a hostile takeover. This is knows as Microsoft's BATNA or "best alternative to a negotiated agreement." It is the stick to the upping the price carrot.

Microsoft is offering Yahoo a solid premium over its true valuation. Since there are no other bidders and Yahoo's financial position is weak at the moment, Yahoo has very little leverage. Yahoo's only other option (BATNA) is to have massive layoffs (some scenarios put it at 33% of the company) and potentially outsource search and advertising to Google. (We all saw how that worked for AOL, moving from 20% to 5%.) Actually according to the Alley Insider, Microsoft's premium is rather large: RBC's Jordan Rohan has said: Yahoo is valued at about $24. That would put Microsoft's bid at an approximately 30% premium. Shareholders like 30% premiums. They also don't like when board of directors let pride get in the way of a fail deal to earn 30% on their money (epically with the Dow down 14% this year.) They tend to have shareholder revolts when board of directors do that. Microsoft is already talking to large investors to get them on their side. According to the Alley Insider:

  • Mutual fund giant T. Rowe Price, which owns 18 million shares of Yahoo! said yesterday that it would be "very vocal" if Microsoft raises its offer and Yahoo! rejects it again.
  • Capital Research and Management, Yahoo!'s largest investor with a recently raised stake of 11.6 percent, is said to favor a deal as well.

Once again, my prediction is that the deal will go through. Yahoo has nowhere to turn. Its large shareholders are going to be angry if the board rejects another offer. Microsoft has to fight the new evil empire Google and will up the ante. This is going to be fun to watch.

posted on Tuesday, February 12, 2008 11:13:31 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] Trackback
# Friday, February 08, 2008

Yahoo!'s board of directors is to meet today to decide the fate of the company. There is a lack of an alternative suitor since the only viable one, Softbank, bailed out today. Microsoft CEO Steve Ballmer said in Business Week that the Yahoo! brand will "live on" which means the death of MSN and possible the Live! brand as well.

Yahoo!'s only other option is a deal with Google and try to stay independent. They would have outsource the search and ad functionality to Google and shut down that operation, laying off thousands (some estimates are 33% or more of the company) and focusing on the portal/content side of the business.

AOL did that. It did not work out well for them, they lost drastic market share and have never recovered. If Yahoo! did the same and lost market share, then they would be ceding eyeballs to Google.

My gut tells me that Yahoo! is not going to make the same mistake twice. It is Yahoo! that put Google on the map. Yahoo! outsourced their search to Google in the early days of Google and Google eventually took all the market share away. Why would all those smart people make the same mistake twice? My gut tells me that Ballmer has assured them of independence and they will swallow their pride and take the deal.

As a Microsoft watcher, I am excited about the deal. Here is my message to Microsoft: Don't mess this up! The whole world is watching. Microsoft is the "evil empire" in Silicon Valley. Everyone hates Microsoft there. If Microsoft handles Yahoo! right it is a historic opportunity for Microsoft to win the hearts and minds of the Valley. If they mess up the brand (think of this: Microsoft Yahoo! MSN Live! Messenger for Workgroups Professional Edition 2008 Service Pack 2a) and come in all arrogant and have tremendous layoffs, then why bother? If Microsoft handles this in a great way and wins over the hearts and minds of Yahoo! employees (who all hate Microsoft) then it is the first step in repositioning itself in the Valley. The new new evil empire in the Valley will be Google.

posted on Friday, February 08, 2008 10:46:07 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] Trackback
# Thursday, February 07, 2008

Let’s say that you are an American software company and are doing some custom consulting work for a company in the UK. They agree to pay you £ 1,000,000 in six months when you deliver the source code. (Great work if you can get it!)

Today the £ is trading at: $1.9438/£, this means that each £1 will get you US $1.94. This puts the value of your contract at $1,943,800. So we have seen the US dollar fall over the last few years and you want to protect yourself against fluctuations. If the dollar gains 10% for example in six months, you will get less dollars in six months when the UK company pays you. You want to lock into today's exchange rate.

There are many ways to do it, but here is a cool one. According to today’s WSJ, the UK prime rate is 5.5%. In the US, E*Trade’s 6 month CD rate is 3.38%.

So what do you do? Borrow £ and invest them in $. Here is what you do in specifics:

You know you are going to have a payment of £ 1,000,000 in six months. So take out a 6 month loan in the UK which you will pay back with your £ 1,000,000 payment.

How much of a loan? Not £ 1,000,000. But £ 1,000,000 minus the interest you will pay. You find that like this:

The UK prime rate is 5.5% per year. You will borrow for 6 months. So 5.5/2= 2.75%. (You divide by 2 since you are doing it for 6 months of ½ a year. If it was for 3 months you would divide by 4.)

Now get the 2.75% to a multiplier, so 1 + (2.75/100)= 1.0275

So £ 1,000,000 / 1.0275 = £ 973,236

So you will borrow £ 973,236. In six months you will owe £ 1,000,000.

Now take that £ 973,236 and convert it to US dollars.

£ 973,236 x $1.9438/£= $1,891,776.16

Now invest that in your E*Trade 6 month CD at 3.38% (We don’t have to divide by 2 since this is the published rate for 6 months, E*Trade did the math for us.)

Now get the 3.38% multiplier, so 1 + (3.38/100)=1.0338

In 6 months you will receive: $1,891,776.16 x 1.0338=$1,955,718.19

When you have to pay off your loan in six months in the UK, it is £ 1,000,000, just hand over your £ 1,000,000 check your customer gives you. Who cares what the £ is trading at-up or down. You also made about $12,000 over your estimate of $1,943,800 by investing the money at a higher annual rate (closer to 6% than your borrowed at 5.5%). Of course you will have to pay taxes on this amount but then again you can deduct the interest on your taxes of the UK loan!

Now, let's return in 6 months and see if the £ went up or down against the $!

posted on Thursday, February 07, 2008 10:26:28 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2] Trackback
# Wednesday, February 06, 2008

Google is afraid of the potential of a Microsoft acquisition of Yahoo. On Sunday, Google posted a reaction on the takeover deal. Google's reply is well, amusing.

They cry wolf.They say that the deal is uncompetitive. I find that hard to accept when Microsoft+ Yahoo= a tiny fraction of Google's market share in ad and search traffic. They are also crying foul saying that Microsoft is the big evil machine. This is an easy thing to do in the valley. Everyone hates Microsoft in the valley. Flickr even has a protest group. The valley is home to the anti-Microsoft camp: Oracle, Sun, Apple, and Google. Lots of people in Silicon Valley will automatically say "Microsoft is Evil!" when prompted just as people will automatically say "Down with Bush!" when promoted at a Clinton rally. Why do they hate Microsoft? They are the "evil empire" of course. Microsoft is big, owns too much market share, and is arrogant according to the valley faithful.

But Google has to look in the mirror. They are the big 800 lb gorilla everyone is afraid of! Not Yahoo, not Microsoft!

Google is the reason that Yahoo has failed as a company and is a takeover target. Yahoo use to be the sizzle of the Internet, now Google destroyed them. Google is the reason why the most profitable company of all time, Microsoft, is scared and doing such  a bold move. Yahoo may be Microsoft’s last hope to be a meaningful player on in a Web.20 world. Who's to blame? Google. Google is the big bad machine nowadays.

Back to the deal, Yahoo has three choices.

First they can ride out the offer and try to stay independent. That is unlikely since the company is in such deep trouble. They may also face shareholder lawsuits if they reject Microsoft's offer. Maybe they can take hedge fund money or be acquired by an European telecom or take money from a sovereign wealth fund.

Second they can outsource their search and ads to Google and focus on being a portal. They may raise their revenue by 25% in doing so according to the Wall Street Journal. This would be a total surrender. (Remember it was Yahoo that put Google on the map!) The DOJ may get involved in this case since Google would own search except for smaller players like MSN and Ask.

Third option is to take the Microsoft offer. This is the most likely outcome.

There is likely to be some DOJ action on this case, however, a Yahoo-Microsoft deal would make an actual attractive competitor to Google. Absent of the deal, Yahoo has to do something, most likely outsource the search and ads to Google. Google could be a very dangerous company without any real competition (Microsoft's AdCenter is a poor competitor) in the search advertising space. They would be more evil then Microsoft on the desktop.

Google knows this. This is why their CEO phoned Yahoo and said that they will give Yahoo any "help" they need to fight off the takeover. The status quo suits Google well. That is why they are arguing for it.

But there is no more status quo. If the DOJ blocks the deal and Yahoo remains independent, Yahoo will not remain independent for much longer. Someone else will acquire them, Yahoo is in too much trouble.

Google is afraid. They should be. Their world is about to change drastically. Their share price dropped almost 10% since this deal was announced. If the deal goes through, Microsoft will eventually lose the evil empire title and Google will be crowned the new king of evil. Funny since their motto is "do no evil."

posted on Wednesday, February 06, 2008 4:41:31 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1] Trackback
# Friday, February 01, 2008

At TechEd Developers in Barcelona, Spain last November, I did an interactive session on ASP.NET Scaling tips. It was such a hit they had to move it to a large room-very difficult to make an interactive session. I took tons of questions and just had a conversation with the audience-and even had some rebel rousers in the back who I had to mock publicly. It was a great session (at least I think so).

Turns out that they filmed it behind my back. That is cool since now it will be published on MSDN Spotlight. You can see it here.

posted on Friday, February 01, 2008 7:29:12 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] Trackback