Friday, April 20, 2007

ORM and when query plans go bad.

I've been listening to quite a few discussions on the debates between the use or ORMs and two topics that never seem to get discussed is:

  1. How can dynamic SQL ORMs deal with the fact that your database server (a.k.a SQL Server) can decide at any point that it is going to use an alternate query plan. A simple index HINT on the join syntax can fix this problem but how is my ORM going to handle this?

  2. How come there is no talk about scaling these ORMs. No, I'm not talking about scaling the database. A layer between the ORM and the database execution.
Point #1 can be explained away in a theoretical world where all the correct load testing scenarios are covered during your quality assurance phase. BUT THAT NEVER HAPPENS.

Point #2 I've also een starting to pay more attention to the Microsoft Entities Framework. .NET Rocks did a show with one of the product managers for ADO.vNext (Dan someone) and he talked about the Entities framework in depth. He talked about how they are getting pressure from the community that they are not supporting all the functionality that the ORMs (such as NHibernate) are providing. His response was that MS has a longer term strategy with the EF to support replication and reporting (essentially a unified model) against the EF. He continued to say we would have to put up with the limited capabilities to reach this higher level.

The interesting part was that he continued on to talk about how he worked on the WinFS team before it was killed. He talked about the reason it was killed was because they were unable to deliver all the functionality on one release and how no one (especially mgmt) could not decide on the base feature set. It was rather ironic that he was mentioning this on the heals of talking about how the EF was a stepping stone.

In my opinion the EF will certainly be a wait and see technology. CSLA .NET is still my choice.

Searching for .NET solutions

Dan Appleman did a talk at VSLive Orlando about "Discoverability". I was not able to attend the session but my co-worker did.

I also heard Dan talk on the internet talk show .Net Rocks regarding the same topic. One interesting link that was served up was a site that uses a google custom search. Dan has set one up for only search the top .NET sites. The site is www.searchdotnet.com and currently searchs about 300 sites. Some of those sites are the MSDN blog sites so the actual depth of the content being searched is much greater than the 300 sites.

So far it has been returning much more relative results than straight google searchs on .NET topics.
I've been looking for a private simple desktop VPN solution for a while and I finally found it.

http://www.hamachi.cc/

Encrypted over HTTP... NICE! No more opening RTP ports in my firewall.

Thursday, April 19, 2007

Javascript prototype function for formatting dates objects.

Some useful javascript for formatting date objects:

String.prototype.zf = function(l) { return '0'.string(l - this.length) + this; }
String.prototype.string = function(l) { var s = '', i = 0; while (i++ < l) { s += this; } return s; }
Number.prototype.zf = function(l) { return this.toString().zf(l); }

Date.prototype.format = function(f)
{
if (!this.valueOf())
return ' ';

var d = this;

return f.replace(/(yyyy|mmmm|mmm|mm|dddd|ddd|dd|hh|nn|ss|a\/p)/gi,
function($1)
{
switch ($1.toLowerCase())
{
case 'yyyy': return d.getFullYear();
case 'mmmm': return gsMonthNames[d.getMonth()];
case 'mmm': return gsMonthNames[d.getMonth()].substr(0, 3);
case 'mm': return (d.getMonth() + 1).zf(2);
case 'dddd': return gsDayNames[d.getDay()];
case 'ddd': return gsDayNames[d.getDay()].substr(0, 3);
case 'dd': return d.getDate().zf(2);
case 'hh': return ((h = d.getHours() % 12) ? h : 12).zf(2);
case 'nn': return d.getMinutes().zf(2);
case 'ss': return d.getSeconds().zf(2);
case 'a/p': return d.getHours() < 12 ? 'a' : 'p';
}
}
);
}