Archive for the ‘programming’ category

SQL Server 2008 SP1 Final Released?

April 1st, 2009

We’ve had an open support ticket with Microsoft due to some bugs we’re seeing with SQL Server Reporting Services 2008.  After Microsoft saying that the Update Pack 4 for SQL Server 2008 (released back in mid-March) would fix our problems, they sent us an email this week letting us know that the final version of Service Pack 1 for SQL Server 2008 would be released yesterday, March 31, 2009.

Unfortunately so far the links they’ve provided don’t go anywhere.  I’ll be checking these links through the day and the rest of the week and will post any further updates if I actually do find the “real” links.

According to our internal document, below is the information about SP1:

Microsoft SQL Server 2008 Service Pack 1

Release date: March 31, 2009

How to obtain

To obtain SQL Server 2008 SP1, visit the following Microsoft Web site:

http://www.microsoft.com/downloads/details.aspx?FamilyID=66ab3dbb-bf3e-4f46-9559-ccc6a4f9dc19

To obtain Microsoft SQL Server 2008 Feature Pack, April 2009, visit the following Microsoft Web site:

http://www.microsoft.com/downloads/details.aspx?FamilyID=b33d2c78-1059-4ce2-b80d-2343c099bcb4

To obtain Microsoft SQL Server 2008 Express Edition SP1, visit the following Microsoft Web site:

http://www.microsoft.com/downloads/details.aspx?FamilyID=01af61e6-2f63-4291-bcad-fd500f6027ff

It should be released on March 31, 2009.

Ways to optimize your ASP.NET applications

February 2nd, 2009

I’ve spent quite a bit of time recently optimizing our ASP.NET application to help improve performance.  After spending time analyzing the code and the database for inefficiencies, it was clear that something needed to be done to minimize the data (reduce the request size) that was being delivered to each user for each page request.

After lots of reading and testing, I ended up reducing the size of most of our page requests by as much as 95% in some instances. In the next few posts I will go over, in detail, how you can use the following steps to optimize your ASP.NET (and non-ASP.NET) web applications with only a little bit of work:

  • Enabling and configuring HTTP compression in IIS6
  • Enabling content expiration for static content (graphics, css files, JavaScript files, etc) in IIS6
  • Changing your application to store ViewState in the session rather than in each page
  • Configuring Telerik’s Radcontrols to work as efficiently as possible

Cumulative update package 3 for SQL Server 2008

January 30th, 2009

Since we have been developing with SQL Server 2008 here at work on my latest project I have been keeping an eye on its available updates and fixes (at least until they come out with Service Pack 1). Cumulative Update Package 3 has been made available now.

Per Microsoft:

A supported cumulative update package is now available from Microsoft. However, it is intended to correct only the problems that are described in this article. Apply it only to systems that are experiencing these specific problems. This cumulative update package may receive additional testing. Therefore, if you are not severely affected by any of these problems, we recommend that you wait for the next SQL Server 2008 service pack that contains the hotfixes in this cumulative update package.

After scanning down the list it seems that we could benefit from at least two or three fixes listed:

  • FIX: You may encounter a deadlock scenario when you use table variables in SQL Server 2005 or in SQL Server 2008
  • FIX: When you use a ReportViewer control to view a SQL Server 2008 Reporting Services report that contains two pages, the formatting for the second page is lost
  • FIX: When you print a report by using the SQL Server 2008 Reporting Services Client-Side Printing functionality, the spacing is too small or too large

I would probably take Microsoft’s advice and hold off installing this update if you’re not specifically seeing any of the issues mentioned in the fix list.

You can download Cumulative update package 3 for SQL Server 2008 here.

SQL Server (2008) Performance Tuning Resources

December 23rd, 2008

Here is a (running) list of some SQL Server Performance Tuning resources that I’ve compiled over the past week or so.  These have been helpful in educating me on the black art of database performance tuning.  I realize the title states SQL Server 2008, but really most of these probably apply for SQL Server 2005 and 2008.  I, particularly am working with 2008, which is why I’ve put them into that category.

General

Missing Indexes

Duplicate Indexes

Unused Indexes/Index Usage

Re-indexing

Inefficient Queries

Performance Counters

Performance Data Collector

Database Engine Tuning Advisor

Updating Statistics

Deadlocks

JavaScript Reporting Services ReportViewer control error fix

December 8th, 2008

I have been going back and forth banging my head against a wall trying to fix a JavaScript error that was happening on my Reporting Services ReportViewer control when the View Report button is clicked.  The error was a JavaScript error and seemed to be related to using something AJAX related on the same page as the ReportViewer control, but it took me a while to figure out what it was and fix it.  All of the problems I saw on the web related to using either an AJAX update panel or one of the extenders in the AJAX Control Toolkit.  Unfortunately for me I wasn’t using either one of them so trying to figure this one out was tricky.

The specific JavaScript error was:

Microsoft JScript runtime error: ‘this._postBackSettings.async’ is null or not an object

My page was setup where I had a master page with an AJAX menu on it (Radmenu to be specific).  In order to use the Radmenu you need a ScriptManager object.  Other than the menu, I didn’t have any AJAX related controls on either the master page or the content page.

What I eventually figured out was that my report pages (which use a base class) needed to disable partial rendering.  To do this, you must do it in your page’s init event.  If you do it after the init you’ll get an invalid operation exception.  Here’s the code in the base class (you can put this in your code behind if you’re not using a base class):

    Private Sub Page_Init1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
 
        ' Make sure this page has a master page
        If Not IsNothing(Me.Master) Then
 
            Dim masterScriptManager As ScriptManager
            masterScriptManager = CType(Master.FindControl("MasterScriptManager"), ScriptManager)
 
            ' Make sure our master page has the script manager we're looking for
            If Not IsNothing(masterScriptManager) Then
 
                ' Turn off partial page postbacks for this page
                masterScriptManager.EnablePartialRendering = False
            End If
 
        End If
 
    End Sub

Just in case others stumble across this and are trying to solve their problem, here are some of the links I landed on when trying to solve the problem:

SQL Server 2008 RTM released!

August 8th, 2008

Not that I think I’m breaking any news here, but SQL Server 2008 has been officially RTM (released to manufacturing).  So far I’ve been very pleased working with SQL Server 2008 and am excited to get my RC0 version updated to an official release.

One thing I stumbled across was a warning users to wait for Visual Studio.NET 2008 SP1 to be released BEFORE upgrading to the RTM version of SQL Server 2008.  This blog post cites compatibility problems if you don’t have SP1 installed before working with the RTM version of SQL. What I’m not sure about is if this applies to people using beta versions of SQL Server 2008 (RC0), Visual Studio 2008 SP1 and .NET Framework v3.5 SP1 like I am.  This uncertainty made me think that it may be best to wait for the final release of SP1 for VS.NET and the 3.5 Framework.

I then came across a nugget here that said:

well….there’s a…ahem…NDA about this topic…but SQL Server 2008 RTM ships with a RTM version of the .NET Framework 3.5 SP1 bits…i’ll let you connect the dots.

I guess it’s time to dig around in the RTM version of SQL 2008 to see if it’s there.  I also wonder if it’s safe to install over top of my RC0 version of if I should remove RC0 before installing the RTM version.  I guess I’ll have to Google more to see what’s required.  I’ll provide updates as I find answers and get upgraded.

**** Update:

According to the release notes the beta SP1 isn’t an acceptable solution.  And since they’re saying SP1 will be officially released next week anyways, it makes sense just to wait for that I think.

What’s wrong with my Linqdatasource? – Method not found!

August 8th, 2008

I’ve been having a very weird problem in Visual Studio 2008 when trying to use the automatic operations for the Linqdatasource (insert, update or delete).  It seems that no matter what I try I get this weird “Method not found” problem.  Unfortunately there doesn’t seem to be a lot of help out on the web about why this may be happening.  I’m starting to think that there may be something goofed up with my 3.5 Framework or Visual Studio 2008.

Here’s the error and a link to the problem I posted out on the ASP.NET forums.  If anybody has come across this weird problem let me know. Unfortunately the 1 person that has replied on the discussion forums hasn’t been much help and offers up only basic suggestions as to why it may not be working, all of which were things that I had already known or tried right off the bat.

System.MissingMethodException: Method not found: ‘System.Object System.Web.UI.WebControls.Parameter.GetValue(System.Object, Boolean)’.

Generated: Mon, 04 Aug 2008 12:40:10 GMT
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.MissingMethodException: Method not found: 'System.Object System.Web.UI.WebControls.Parameter.GetValue(System.Object, Boolean)'.
at System.Web.UI.WebControls.LinqDataSourceView.MergeDictionaries(Object dataObjectType, ParameterCollection reference, IDictionary source, IDictionary destination, IDictionary destinationCopy)
at System.Web.UI.WebControls.LinqDataSourceView.BuildInsertDataObject(Object table, IDictionary values)
at System.Web.UI.WebControls.LinqDataSourceView.ExecuteInsert(IDictionary values)
at System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback)
at System.Web.UI.WebControls.FormView.HandleInsert(String commandArg, Boolean causesValidation)
at System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
at System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
--- End of inner exception stack trace ---
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.sellyourhome_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Comments (from previous blog):

Have you installed the beta for Visual Studio 2008 / .NET Framework 3.5

SP 1?? I had the exact same issue on my development box until I

uninstalled the beta and installed the official release at http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&;displaylang=en . Make sure you first run the beta removal tool: http://www.microsoft.com/downloads/details.aspx?FamilyId=A494B0E0-EB07-4FF1-A21C-A4663E456D9D&;displaylang=en


2008!!

July 16th, 2008

Wow, it’s been quite a while since I’ve posted.  It was just into 2008 back in January.  Wow how time flies!

Well, 2008 has brought many new versions of the tools that I use on a daily basis for my job.  Visual Studio has a 2008 version out.  Microsoft SQL Server has their 2008 version out (well, RTM will be next month so they say).  Also the .NET Framework is cranking along with the 3.5 framework which they are almost out with a final release of SP1.

I am excited that my job and the project I’m currently working on has given me the ability to upgrade to the latest versions of these tools.  So far I’ve been the most excited with SQL Server 2008 and all of the new features it has to offer.  Intellisense for T-SQL, now that’s nice!

I’m also anxiously awaiting Apple’s rumored update of their MacBook Pro laptop line.  Once they come out I’m going to get one and beef it up for my .NET Development.  I know many .NET developers out there would never think of owning a Mac, but man… once you go Mac you never go back!  My desktop at work is a HP workstation with Windows XP and I can’t even tell you how many times I need to reboot to keep things running smoothly.  It’s sad that as a Windows user I just am in the habbit now of rebooting when I leave for the day or when I go out to lunch.  With the Mac, I’m like “gee, I haven’t rebooted in a few weeks, I should probably just do it for the hell of it.”

Family life has been keeping me busy too.  We welcomed our 3rd child this past March and have been knee deep in kids!  Our twins turned 2 in June and they’re getting smarter and smarter with each day that passes.  It scares me that they’ll no doubt have me/us tied up in a closet at some point as they take over the house.

I am going to make an effort to post more moving forward.  God knows I come across enough technical things that would probably be helpful to others.  I’m learning to work with LINQ (also, here, scroll down to LINQ section) and can’t wait to get more into that.  Also, SubSonic, a great tool, is out with a new version.  I’ll be playing with that too when building an application I’m working on for my side-business.

Stay tuned!

Testing email when working with no SMTP server

January 9th, 2008

Happy New Year!

While this tip isn’t my own, it still seems as though it will be very helpful.  I know that I do a lot of development locally where I don’t have an SMTP server setup.  This tip, courtsey of .NET Tip of the Day, really will eliminate that problem and allow you to work with email without the headaches.

Testing code that sends email has always been a pain. You had to set up a SMTP service just to test that your .NET application sends the e-mail correctly.

However, there is a way to send e-mails with no SMTP server set up. Just configure your .NET application to drop e-mails into a specified folder instead of sending them via SMTP server:

<system.net>

<mailSettings>

<smtp deliveryMethod=”SpecifiedPickupDirectory”>

<specifiedPickupDirectory pickupDirectoryLocation=”c:\Test\” />

</smtp>

</mailSettings>

</system.net>

This will instruct SmtpClient class to generate mail message, save it as .eml file and drop it into c:\Test\ folder.

VB.NET RC4 Encryption for database storage

November 28th, 2007

I recently had to upgrade some Classic ASP code to .NET for some data encryption.  The routines use RC4 encryption and make the result database friendly.  The following class can easily be dropped into your project for use with little effort.  The sample code shows the encryption and decryption methods.  You just provide the message and the key for either instance.  From there you can drop it in your database or do whatever you want!

Sample Usage:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim plainText As String = “I’m exposed!”
Dim passkey As String = “keep me safe”

Dim safeText As String
safeText = Common.Encryption.Encrypt(plainText, passkey)

Response.Write(safeText)

Dim decrypted As String
decrypted = Common.Encryption.Decrypt(safeText, passkey)

Response.Write(decrypted)

End Sub

You can view the entire class here.  If you’re looking for some quick and easy encryption this will do the trick.