November 2006 - Posts

It's probably about time I started talking about AJAX (previously Atlas), so here we go.  You have probably ran into a time where you need to let a user type free form into a textbox, but you still want to make sure the input is valid.  Of course you can use a validator, but with the FilteredTextBoxExtender you can prevent them from even typing in bad characters.  Extenders make it easy to add new functionality to existing controls such as textboxes, panels, labels, etc. 

The FilteredTextBoxExtender is part of the Ajax Control Toolkit which you can get at ajax.asp.net.  The easiest way to get started with it is (after you have installed ASP.NET AJAX) is to download the toolkit, open the solution, and compile it.  Then include that binary in your web project.

To use the extender start by adding a textbox to the page. The extender has built in functionality to allow only numbers, lower case characters, upper case characters, and custom characters. You can use any combination of the previous. If you use custom, use the ValidChars property to specify the allowed characters. For example, if you wanted to allow floating point numbers, you would set the FilterType to numbers, custom and the ValidChars to . (period). Take a look at the sample below.

<asp:textbox id="MyTextBox" 
runat="server">
<ajaxtoolkit:FilteredTextBoxExtender"
id="MyTextBoxFilter" runat="server"
TargetControlId="MyTextBox"
FilterType="Custom, Numbers"

This like other extenders is quite easy to use and adds useful functionality to many of your existing controls.

If you have gotten around to installing Windows Vista, at some point you might have noticed that the Documents and Settings folder isn't there any more. The documents and settings folder has been replaced by the <i>Users</i> folder.  It has the same basic directory structure but is a little bit cleaner.  For backwards compatibility, a junction is present on the Documnets and Settings folder that links to the Users folder

Users Folder Junction

Windows Vista is out now on MSDN, so go and download it. If you have an x64 processor (either AMD or Intel), I personally recommend the x64 version of Vista. I found that it has pretty good driver support and everything sees to run fine (including the important things like WoW). The only thing I know not to work is connecting a BlackBerry since RIM sucks and does not have a 64 bit driver. As a reminder, for the most part Windows XP 64 bit drivers work fine in Vista when necessary. So don't be scared off by the 64 bit. I've been runnning it in beta for a few months now and am very pleased with it.

Special thanks to Kyle (the new master of AJAX) for pointing this one out to me. After upgrading from Atlas CTP to ASP.NET AJAX, I found that my AutoCompleteExtenders were not working. This is due to the fact that a new attribute is required on the class definition for your web service. Be sure and add the following to anything you are calling through AJAX whether it is an extender or custom script code.

[ScriptMethod]

The attribute is part of the Microsoft.Web.Script.Services namespace.

If you ever have to do anything with a code signing key, it typically comes as a SPC file (public key I think) and PVK file (private key). These of course are useless to .NET. Luckily, there is a utility called pvkimprt. I have no idea where I found it (search Google). This utility makes it easy to create a PFX which you can use in your .NET applications. Simply use the syntax below.

pvkimprt -PFX mycert.spc mykey.pvk

That is all there is to it. You will need to know the password to your private key.

As you may have heard SQL Server 2005 supports automatic cache invalidation with output caching and datasource controls by using notifications. It seems simple enough to set up, but there are a number of things that you can put in a query that will keep the query from caching. Here is a brief list and a link to the complete list.

  • Queries with * in them
  • Queries with aggregates such as SUM, AVG, or user defined.
  • Queries with unnamed columns
  • Queries with computed columns
  • Queries that reference tables on other servers.
  • Queries with outer joins or subqueries

The list goes on and on.  Be sure and read it before you try to use a SqlCacheDependency.  Cache depencies are really cool, but you have to know works and what doesn't or it will most certainly lead to frustration.

Creating a Query for Notification

One of the cool new things in Windows Vista is the Resource Monitor. This handy new tool gives you a lot more information about what a process is doing including open connections it has to files and network addresses.

The processes page is a little different in that it gives a description for the process that is running.

Windows Vista Task Manager Processes

Here you can now also see what services are currently running on the system and what their state is.

Windows Vista Task Manager Services

The performance tab has been changed quite a bit. It makes it easy to tell how much phyiscal memory you have now (note everything isn't in KB any more). The biggest difference however is the button for the Resoruce Monitor. Clicking this launches a new application which tells you very detailed information about the processes that are running.

On the CPU panel, you can see the PID, description, and threads, etc for a process. Of course you could have seen all of this with Task Manager before, but the more interesting panels are Disk and Network.

Windows Vista Resource Manager CPU

On the Disk panel, you can see what files a particular process has open as well as read and write speeds.

Windows Vista Resource Manager Disk

On the Network panel, you can see connections indivudal processes have made, how much data is transferred, and where the connection is going.

Windows Vista Resource Manager Network

Lastly the memory panel shows you memory type things.

Windows Vista Resource Manager Memory

The Resource Manager is a really neat tool and I think will be very useful in finding out what exactly is going on with your system at a given time.

I am a little late on this new, but the .NET Framework 3.0 has now been released. This is very cool because that means you can start building Windows Presentation Foundation application and people will actually be able to use them. On top of that you can start using Windows Communication Foundation (Indigo) to build a service oriented application. Oh yeah, if you are into Worfklow, there is that too. There are no changes to Windows Forms or ASP.NET applications in this version of the framework. It effectively sits on top of .NET Framework 2.0.

This also means that Windows Vista has gone to RTM. Expect to see it on MSDN within the next 7 days.

Microsoft .NET Framework 3.0

There is also some e-learning stuff out there if you are interested.

.NET Framework 3.0 eLearning"

When you have a package that executes another package with the execute package task, you have to specfiy a connection string to the SQL Server. Often times you just use the same connection that you are already using for your data. If you are storing your packages in MSDB, if you don't have permissions set up correctly, you might get a Cannot execute stored procedure. Permission Denied. error. This is easy enough to resolve, you just need to grant execute access to your account in the MSDB database for the associated DTS stored procedures. Instead of granint them manually, you can simply add the use to the dts_operator role and you will have all of the correct permissions.

If you have ever backed up a database and restored it to a new server, you may have encountered issues with the logins associated with the database. The issue is that all the logins are mapped to security contexts on the other server. It may not be apparent at first on how to fix this (nothing in the GUI that I have found), but there is a stored procedure you can run that makes it easy.

sp_change_users_login 'Update_One', 
'DatabaseUsername', 'SqlUsername'

This will map the username in the database named DatabaseUsername to the SQL Server login SqlUsername. Update_One is a parameter that tells it what type of update to do. You can also pass 'Auto_Fix' here and supply an additional password parameter to have it create the account for you.