Using the new MemoryFailPoint

This is an interesting concept.  It doesn’t help much for TFS since most of the time we don’t have any idea how much data is coming back from SQL until it’s too late, but I could see it being useful in lots of other scenarios 🙂 

You allocate a MemoryFailPoint for X megabytes of memory, where X is an upper bound on the expected additional working set for processing one request. You then process the request, then call Dispose on the MemoryFailPoint. If not enough memory was available, the constructor will throw an InsufficientMemoryException, which is a different exception type we created to express the concept of a “soft OOM”.

Source: BCLTeam’s WebLog : CLR Behavior on OutOfMemoryExceptions [Brian Grunkemeyer]

bulk editing with GridView

One of the things I’m likely to do in my toy ASP.NET sites is implement bulk editing of rows – it’s just too silly to force the user to put individual rows into edit mode. 

Matt does a great job showing how to make a GridView subclass that makes this easy to do, and simple to keep extending as needed.

Matt’s .NET Tips & Tricks : Real World GridView: Bulk Editing

I wrote this to give you a basic understanding of how to create a bulk edit GridView. Of course there are many enhancements you could add to this. Perhaps you only want some of the rows to be editable, not all of them. Or, you want the grid to not be editable until the user clicks an “edit everything” button. Maybe you would like all of the changes to complete in a transaction. And probably you want this to do something I haven’t even thought of (I would like to know if you come up with something though).

Technorati Tags:

Simonyi V2: hungry notation

I ate a slice of 6-day-old cold pizza for lunch today.

Now Google’s cooking

With its dedication to providing free and largely healthful, organic and artisan-produced meals three times a day to its employees, Google may well be leading the way in corporate food-service programs in the same way it has set the bar for search engines.

500 error from localhost on fresh IIS install under XP

I’ve been using the development server in VS for my toy ASP.NET sites so far, but decided to play with IIS yesterday.  I popped up in the XP Pro CD (RTM bits, not slipstreamed with SP2) and installed IIS only to hit this problem today when I tried to browse to localhost.

Now that it’s up and going, and since I installed IIS *after* the .NET framework, I’m going to go run aspnet_regiis and get back to actual asp.net work. 

Why even bother with ASP support since I’m not going to use it?  Valid question, but the answer is just that I wanted to get it fixed because it didn’t feel right to me 🙂

The famous ‘Class not registered’

Description:
The server failed to load application ‘/LM/W3SVC/1/ROOT. The error was ‘Class not registered’.
  1. comand line “msdtc -resetlog”
  2. rundll32 wamreg.dll, CreateIISPackage
  3. regsvr32 asptxn.dll
  4. IISRESET

Technorati Tags: ,

want to help make excel 12 faster for *your* data?

Ok, now admittedly it’s tempting to use some of the O12 features and whip up something silly like a Mandelbrot generator, but still – I’m sure someone out there has a spreadsheet they’re hoping could get quicker in Excel 2007! 🙂

https://i2.wp.com/www.math.binghamton.edu/gifs/mandel.gif

Help us make Excel 2007 faster …

Given the near-infinite variety of things we see people build in Excel, we are always looking for good examples of workbooks that are calculation-intensive to help us compare Excel 2007’s calculation performance with previous versions’ performance on real-world files that matter to customers. At some point last week it dawned on me that some of the Excel 12 blog readers might be in a position to help (given the number of comments and emails I have had from folks interested in or concerned about calculation and function speed). So I’d like to appeal to folks to send in calculation-intensive workbooks they would like us to use as part of our performance tuning exercise.

Technorati Tags: ,

SQL Server's row versioning – half of a conversation

The below are the parts of my response in an email thread that involved me – I haven’t heard back from the other party, so I’m not posting his parts of the thread since I don’t have his permission (yet).  Now, admittedly, this means that without sufficient context, some of this will be confusing, but hopefully you’ll get some value out of it.

[His part deleted]

Agreed – IMHO, the SQL Server team should be shouting about this from the rooftops – the reason they may not be doing so is because the response from the Oracle camp would (correctly) be: “Hey, we’ve had that for well over a decade – congrats on finally catching up with that feature!  Tell us when you can do a real grid!”

I did do a post about the feature.  I’m not sure if it properly covers it with the below issues, but give it a read and let me know 🙂

Also, I’ll try to answer things in this email as well – feel free to post it or tell me to if you think there’s enough additional value to have it posted.

https://blog.sublogic.com/2006/02/oracles-multiversioning-now-available-in-sql-server/

Also, there’s a *great* (IMHO) TechNote about it.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/sql2k5snapshotisol.asp

[His part deleted]

You don’t need A_S_I turned on to get this – once RCS is on, writes to the database go to 2 places – the actual table and a copy to tempdb with the versioning info (see technote for a good description of the linked list that’s created).

The versioning information isn’t actually kept around for the statement/transaction that performs it – it’s kept for the other statements/transactions that are going on in the system.  After all, whoever wrote the data wants to see the post-write data.  It’s everyone else in the system that doesn’t want to see it, they want to see the pre-write state instead.

When 1) read committed statements start (with RCS on) OR 2) snapshot isolation transactions (with ASI also ON and snapshot requested), they take note of the current “transaction sequence number” (just a global increment of committed transactions).  During the statement/transaction, the TSN is kept along with the query.

As queries during the statement/transaction happen, they evaluate based on that point-in-time of the database (TSN is a point in time, much like changeset in a version control system).  If the query runs and it needs a particular row that’s been modified/deleted/whatever, it can’t get it from the current contents of the table, but that’s not a problem – it goes over to the tempdb and finds the right version of the row there (following the linked list from the technote).

[His part deleted]

Couple issues here.

How long versions are kept
First, as described above, the writers cause the versioning information to be stored, but it’s all the other things going on in the system that determine how long it’s kept around.  For instance, if I kept a snapshot isolation transaction running for 10 minutes, that’s how long all the other writes would have to be kept around in tempdb.  This is because at any point in time during my snapshot-isolation transaction, I may query any table I want, and I have to see the table in whatever state it was 10 minutes ago when I started by transaction.

This is why snapshot isolation gets its own A_S_I setting and explicitly has to be requested – it doesn’t change the number of writes to tempdb (those are fixed once row versioning starts getting used), but it does have a significant effect on how long the versioning information is required.  When just RCS is on (and no snapshot isolation is in effect), you don’t typically have to keep around the row versions nearly as long since they’re only needed to evaluate currently running statements.

Once snapshot isolation is in effect, the row versions have to be kept around (potentially) much longer (based on how long the transactions run, of course).  For instance, if all your transactions were a single statement, they would have equivalent load on the tempdb, but that’s rarely the case, of course 🙂

Implicit transactions
Each statement commits as its own transaction by default, but it’s a bad idea (IMHO) to call this implicit transactions. (I’ve seen it called “autocommit mode” a bit.  Admittedly, this is more trivia than anything else, but you can turn on implicit_transactions for a connection and when one of the “state of the data matters to me” commands executes, an implicit transaction starts (and does *not* commit as soon as the statement is done).  These implicit transactions span multiple statements, and you need to commit/rollback them like any other transaction – it just saved you from doing BEGIN TRAN.

[His part deleted]

I’m not sure I’m parsing the above sentence correctly, so I’ll just re-state the above – once the snapshot isolation transaction starts, all writes done by *other* transactions have to be kept around in tempdb until the transaction ends.  This is necessary since the snapshot transaction has to see the entire database at the point in time when it start, with only the changes applied that it made.

Row Versioning goodness

SQL Server 2005 provides non-locking, non-blocking read consistency to your users via snapshot isolation. Find out when to use it to improve performance and reduce latency in your applications.

Technorati Tags: ,

software as a service – the coming wave

While the debate continues on what percentage of the overall market SaaS will be, it’s clearly something to keep an eye on 🙂

SaaS is a journey, walk with us

For now, I want to highlight what Microsoft is bringing to the table in terms of SaaS architecture guidance.

If I can try to summarize the key areas where architects should spend their time, it would be the following:

  • Scale the application
  • Enable multi-tenant data
  • Facilitate customization

ASP.NET parameters – User.Identity.Name?

I’m not sure what the actual answer is (yet), but I wonder whether I can bind User.Identity.Name as a parameter like I can profile/session/form/etc. parameters in ASP.NET 2.0.

Currently I just read it into a session var called UserName and bind that.  Simple enough, just makes me wonder 🙂

Technorati Tags: ,

ClickOnce and permission elevation

I’ve been coding up some simple apps that I’m likely to share as ClickOnce apps, and I was very glad to hear that the RTM bits don’t require Authenticode!

ClickOnce and permission elevation prompting in the internet zone

The Decision – 
With the .Net Framework V2.0 release of ClickOnce,
any ClickOnce App deployed from the internet zone can prompt the user
for permission elevation.
[…]
Let’s consider the scenario below …
Jen is a .Net entusiast and a golf fanatic. She writes a .Net Golf Handicap calculator that unfortuantely needs Intranet (Not Internet) zone permissions to run. Jen wants to share this App on her homepage with her golfing friends and would also like them to get updates as she adds new functionality to her program; ClickOnce is the ideal choice of deployment technology for her.