My use case is I’ve got a session survey column on the Silicon Valley Code Camp session evaluation page. The results of a question like “How is this course overall” can be 0,1,2,3,4,5 where 0 means the person did not answer the question and 5 means the person chose not applicable. I want to throw away both of these answers in my average using the SqlServer AVG function (knowing AVG does not include nulls). With some help from StackOverflow and some creative nesting, I came up with the following Sql. It feels ugly and not scalable, but it does work. I’m open to other suggestions but thought I’d post it anyhow as a first pass just to see what others think. I’m including the full query so it’s clear what I’m going … Continue Reading

I recently added a cool new feature to our Silicon Valley Code Camp web site that lets attendees authenticate their accounts with the meetup OAuth api and then we track the meetups that add us (SVCC) as a sponsor. We then do a nice aggregation on the bottom of all our web pages, and one dedicated meetup page (http://www.siliconvalley-codecamp.com/meetup) of all those sponsors. After adding this new feature (and sending out 10,000 emails announcing it), our web site started running out of memory. Ouch! With 5 minutes of installation and setup, I skipped reading the tutorials, just said launch the site with my IIS Express. I pointed ANT at the base of my web site, told ANT I was using IIS Express and then simply said … Continue Reading

This is not a big deal, but I have recently bumped into several people that did not know about it so I thought I’d do a blog post just to show what it is and how is just trivial to use for useful stuff. The issue I’m showing is how to see the Sql generated from Entity Framework. My old habit use to be to stop the debugger and hover over the query variable in the code, grab it as a debug variable, then cut and paste to SqlServer enterprise. Now, I just go to the DEBUG menu in VS, Windows / Intellitrace and I get a nice listing on the right side of all my ADO.NET calls. The last one is the one I just did. My code below is pretty self explanatory. You can see I’ve just issued a db.SaveChanges(). You can also … Continue Reading

Some Background and Getting Started Last weekend, a relatively new customer of mine moved their production hosting from a private dedicated server running ASP.NET to ORCSWeb cloud hosting. They were running SqlServer 2000 and Windows Server 2003. We moved them to Microsoft Windows 2008 and Sqlserver 2008. These kind of moves of productions servers always make me very nervous. It seems like even though we make list after list, check the lists twice, test moving the SqlServer databases, etc., something always seems to go wrong. In this case, their SqlServer database is 50Gig so that adds a little interest also. The moved started at 8PM eastern time. Everything seemed to be going smoothly until I actually tried … Continue Reading