Archive for March, 2010

Data-tier Applications

Thursday, March 25th, 2010

SQL Server 2008 R2 provides an easy way to author, deploy, and manage data-tier objects as a single entity through data-tier applications. A data-tier application (DAC) is an entity that contains all of the database and instance objects used by an application.

You can create DACs using two methods. First, you can use the Extract Data-tier Application wizard to extract database and instance objects from a database in SQL Server Management Studio (SSMS). This wizard will take you through a couple simple steps and create the DAC for you.

After you have extracted the DAC, you can author it in Visual Studio 2010 or you can deploy it to an instance of SQL Server using the Deploy Data-tier Application wizard. The Deploy Data-tier Application wizard will guide you through several steps to deploy the DAC to the instance you select.

You can create a DAC in Visual Studio 2010 or author a DAC you extracted by starting a Data-Tier Application project. After a DAC has been imported, you can add several elements to the DAC project: DAC properties, definitions of all the database objects used by the application, definitions of the instance-level objects, a server selection policy that defines the pre-requisite conditions an instance of the Database Engine should have to host the DAC, and files and scripts that can be embedded in the DAC.

There are two ways to view DACs: through Object Explorer and through Utility Explorer. Object Explorer will let you see a list of DACs on the instance. Utility Explorer will give you a more detailed view of the DAC, and allows you to view utilization information just like managed instances.

Share

SQL Server Utility: Managing Multiple SQL Server Instances

Thursday, March 25th, 2010

Have you ever wanted to be able to see a centralized view of Microsoft SQL Server instances and database applications? SQL Server 2008 R2 introduces a new way to view information about your SQL Server instances.  At a glance, you can see a snapshot of your instances including utilization information using the SQL Server Utility. This information is available in a new view called the Utility Explorer that you access through SQL Server Management Studio.

When you open the Utility Explorer, you are presented with the screen shown below. In this screen, you are given the steps you need to do in order to use SQL Server Utility. Each of these topics links to steps to complete the activity.

In order to use SQL Server Utility, you must create a Utility Control Point. The other steps are optional. A Utility Control Point, or UCP, is configured on a SQL Server instance. After configuring a UCP, you can enroll other SQL Server instances on the same UCP. The Utility Explorer displays information about each instance such as CPU utilization, file space utilization and volume space utilization. The display will look similar to the image below. The columns displayed are configurable by right-clicking the title bar and selecting the information you wish to view.

Notice the red arrow under volume space. This is indicating the instance is overutilized. If the instance were underutilized, there would be a green down arrow. The green checkmarks indicate the instance is well utilized. You can configure the values that will alert you when the instance is overutilized or underutilized. This allows you to customize these values best for your organization.

In addition to view information about SQL Server instances, you can view information about data-tier applications. My next post will discuss data-tier applications.

Share

Using Windows PowerShell as an IT Pro – Part 13

Monday, March 22nd, 2010

In my last post I looked at some basic variable types. Now I will examine arrays.
An array is a data structure for storing a collection of data elements of the same type. Basically this means that you can have a single variable that stores multiple values.
Assign multiple values to a variable to create and initialize an array. The values stored in the array are delimited with a comma and separated from the variable name by the assignment operator (=).
For example, to create an array named $a that contains the seven numeric (int) values of 22, 5, 10, 8, 12, 9, and 80, type:
$a = 20,4,11,3,1,9,60

When no data type is specified, Windows PowerShell creates each array as an object array (type: object[]). You can create a strongly typed array, that is, an array that can contain only values of a particular type, the same way you create a strongly typed variable. You specify a type, such as string[], long[], or int32[]. Precede the variable name with an array type enclosed in brackets to cast an array.
[int32[]]$ia = 1500,2230,3350,4000

Simply type the array name to display all the elements in the array. For example:
$ia

You can refer to the elements in an array by using an index, beginning at position 0. Enclose the index number in brackets. For example, to display the third element in the $a array, type:
$ia[2]

You can create arrays that are cast to any supported type in the Microsoft .NET Framework. For example, the objects that Get-Process retrieves to represent processes are of the System.Diagnostics.Process type. Enter the following command to create a strongly typed array of process objects.
[Diagnostics.Process[]]$gp = Get-Process

Then, display the contents of $gp to see a list of running processes.
$gp

In my next post we will review operators and expressions.

Share

Sounding Off Part One

Sunday, March 21st, 2010

A big part of what we do at Aeshen is creating instructional and informational content. We painstakingly work to create PowerPoint presentations, demonstration scripts for instructors, and supporting documentation. After creating these materials, we are often called upon to create a complete set of video and audio recordings based on the new content.

Creating the video recordings is a simple task. Very few things in the surrounding environment force me to re-record video footage of the demonstrations or PowerPoint presentations.

Audio is a completely different story. The human brain is very sophisticated. Not only can it perform calculations and orchestrate the overall functioning of your body, it works as an extremely fine tuned filter for extraneous stimuli. I did not realize this until I began recording audio tracks for the content that I developed.

It quickly became evident that a silent office or home space is not quiet at all. The extra sounds were simply filtered out and ignored by my brain. When I played back some of my first recordings, they were filled with sounds of breathing, air moving through the ventilation system, vehicles passing by, airplanes overhead, birds, dogs, and even far off construction noises.

I started out by hanging carpet and other materials around me to absorb the sounds. When that did not work, I moved from location to location hoping to find a quieter spot to record in. What I really found out is that each location in the building presented a different collection of background noises to filter out.

The other frustration was the variety of reverberation experienced in each location. One location was a simple room that offered little reverberation, but was subject to a great deal of background noise. Another room had a vaulted ceiling set at odd angles. Definitely not the right place to record quality audio.

After trying every room I could, I finally resigned myself to finding an alternative place to record. Unfortunately, recording studios charge from $65 to well over $100 per hour of use. That put them out when I realized that I would need many hours to record the audio.

Some heavy research helped me to decide that the best thing to do was to create my own studio. I am now sitting in a six by eight foot sound isolating room writing this blog. Building the studio was definitely not without its challenges. However, the tighter control I now have over the environment is enabling me to record much higher quality audio than I had before.

In the second installment of this blog, I will discuss the building of the studio along with some of the challenges I faced.

Share

Better error messages (Part 2)

Friday, March 19th, 2010

…Continued from part 1

In part 1, I scolded you for showing error messages to users.  I suppose I should ‘fess up though and just admit that I’ve shown my share of error messages over the years!  The more I consider the problem though, the more I think that error messages are a bit of a lazy way out. 

In this part, let’s get to a more practical level and talk about when it might seem important to show messages.  Hopefully we can find ways to avoid most of them.  There may well be other classes of messages that seem to require message boxes, but I’ll start with these. 

Reasons to show a dialog:

  1. Fatal error such as an unhandled exception
  2. Environment problem like file missing, bad permissions, hardware disconnected
  3. Transient outage (network, file server, database)
  4. The user must take action (user mistake, conflict with existing record)
  5. Warning/info message like update available

Fatal errors

On the surface this might seem like a no-brainer.  If you catch an unhandled exception in your Application object, then there just isn’t much that you can do about it.  Clearly, the ideal would be to avoid it, but it’s too late.  On the other hand, this is very valuable information.  This is definitely when you want your users to let you know so you can prevent it from happening again.  Remember though, that your user clicked OK, the dialog disappeared, and then the whole app went away.  Totally unexpected!

If the user can restart the app and keep going, then you probably won’t ever hear about it.  Sometime, over lunch, you might hear people make a mention of “that one” problem that happens a few times each week.  Don’t bother getting annoyed that no one reported it.  Code defensively!

If you can send that exception, the current record, any temp files, or anything else that would be useful, then you’ll be in much better shape.  Write the data to a tracker database, open a help desk ticket, whatever you need to do.  Rather than trying to reproduce an error that might happen once in a thousand times, this give you hard data from the time that it did happen.

Environment problems

These can be tricky.  If a file is missing or has the wrong permissions then something important just isn’t going to happen.  If hardware is disconnected, then your bar code scanner will be useless.  The good thing about most of these errors is that you can check for the condition before anything goes wrong.

If hardware is missing, display a message (I never said dialogs are completely forbidden!).  The trick is to do the work on the user’s behalf as much as possible.  The user will need to reconnect the device, but your code can check periodically and “unlock” the application when it appears.  After all, if it’s required, then clicking OK doesn’t serve any purpose unless the device is back anyway.

You can check for files to exist or even read-write permissions before writing.  Instead of a generic unhandled exception since “that file won’t ever be set to read-only” just expect it.  Log and send the error, then let the user know that the application isn’t useable without help desk intervention.  The worst thing is for the user to get through four screens of data entry just to lose everything due to an “impossible error.”  Make it work every time for your users.  You’ll have a better reputation and better information about what needs attention.

Outage

Databases stop responding.  Network links go down.  File servers get rebooted during production hours.  There isn’t much that you can do about them, but you pretty much know that the issue won’t last forever.  Let the user know that there is an outage, and make it clear that retrying is happening automatically.  Users hate “please retry.”  They already attempted it and it failed.  They are starting out annoyed and this won’t help.

Required action

Clearly there are situations where you can’t do anything for the user.  Is a required field missing?  Did another user update the same record and cause a conflict?  I hate to admit it, but here’s a situation that can’t be avoided.  At the same time though, you can do a better job with it.  Is a field blank or formatted wrong?  Jump to the field and flash a bright red outline around it.  Did the update cause a conflict?  Create a region above or below your contents that only appears with critical information.  Just like a web application will often have an error message area, there’s no reason why a desktop application can’t do the same thing.  A dialog gets dismissed and forgotten.  Show the message until the update is successful so the user can actually benefit from the information.

Warning/Info messages

Now these are definitely the bane of any user.  A message that says “record saved” is just a stupid impediment to the work flow.  Flash an indicator somewhere, show a non-modal notification (balloon dialog), or use a status bar in the application.  Just don’t interrupt for something that has no business interrupting.  The user only cares when something goes wrong – otherwise stay out of the way!

Continued in part 3…

Share

Using Windows PowerShell as an IT Pro – Part 12

Friday, March 19th, 2010

In my last post I began looking at variables. Now I will go over types and how they function.
Windows PowerShell supports a number of different types such as strings, integers, arrays, etc. You can explicitly specify a type or allow Windows PowerShell to do it dynamically, which is sometimes referred to as automatic type conversion. Type conversions are used when an object of one type is assigned a value that requires another type (such as adding a string to a number). This conversion happens automatically as long as the type was not specified manually, and it is not destructive to the original object.
For example we can assign a new value to the $Loc variable which currently has the System.Management.Automation.PathInfo type, and then use the GetType method to show its new type.
$Loc = "Test"
$Loc.GetType().FullName

Then, assign it a numeric value and check the type again.
$Loc = 3
$Loc.GetType().FullName

$Loc was made an Int32 because the value wasn’t enclosed in quotes and because the value was composed solely of digits. Had it been in quotes, it would have been interpreted as a System.String.
In both cases, Windows PowerShell determined the data type that was the most appropriate for the value of the variable. This should work for most variables but there may be situations where you want the variable type to remain as it is. Suppose you are reading values out of a file and you always want the values to be treated as strings. Some of the values, however, might contain only digits, raising the possibility that Windows PowerShell would treat them as Int32 or another numeric type, which may create problems for your script. If Windows PowerShell does not recognize the value as a string, then all the methods of the System.String class are not available (and your script might rely on one of these unavailable methods).
Manually assigning a type is simple and is done when you create it. Assigning a string to a variable essentially forces the variable to be of the System.String class. Assigning a number to a variable, on the other hand, usually results in the variable becoming an Integer (or, more specifically, an Int32, which can store a specific range of values). For example, we can create a new variable and define it as a string.
[String]$var = 5
$Var.GetType().FullName

Normally, $Var would have been an Int32, but because we defined it as a String, it makes the numeric value we assigned to it a string.
Forcibly declaring variables does have repercussions, though they are not necessarily bad. In the next example, a new variable is created, defined as an integer, and assigned a numeric value. Then, it is assigned a string value.
[Int]$Num = 4
$Num = "test"

As shown above, when we tried to assign a string value to it, an error message was displayed. Because $Num was defined as a Int32, Windows PowerShell expected to convert the string “test” into an integer value. It was unable to do this, nor was it able to change the type of $Num to String.
In my next post we continue to look at types.

Share

Using Windows PowerShell as an IT Pro – Part 11

Tuesday, March 16th, 2010

In my last post I reviewed the Out-Gridview cmdlet. Now I will look at variables.
Windows PowerShell lets you create variables – essentially named objects – to preserve output for later use. The Windows PowerShell variables are actually mapped to underlying classes in the Microsoft® .NET Framework. In the Framework, variables are objects, meaning they can store data and also manipulate it in many ways.
Variables are always specified with the initial character $ and can include a mix of letters, numbers, symbols, or even spaces. However, if spaces are used, the variable needs to be enclosed in braces, such as: ${My Variable} = “Hello”). Variables are created by typing a valid variable name or assigning a value to it. A variable name should help you remember what it contains, using a simple, straight-forward name.
$Loc = Get-Location

Output is not displayed when this command is entered, because the output is sent to $Loc. In Windows PowerShell, displayed output is a side effect of the fact that data which is not otherwise directed always gets sent to the screen. Typing $Loc shows its value, which in this case is the current location.
$Loc

Get-Member is used to display information about the contents of variables. Get-Member enumerates the properties and methods of that object type. Piping $Loc to Get-Member shows that it is a PathInfo object, just like the output from Get-Location.
$Loc | Get-Member

There is also a default variable that can be used for certain situations. The $_ acts a placeholder for the current object. This can be used to access the properties or methods of the current object in a command. For example we can use $_ to help filter the output of the Get-Service cmdlet, displaying only services that have a status of Running.
Get-Service | where {$_.status -eq "Running"}

In my next post we continue to look at variables and types.

Share

Better error messages (Part 3)

Friday, March 12th, 2010

…continued from Part 2

So by now your applications are awesome!  You are winning industry awards, your users want you, and developers want to be you.  Things couldn’t be better!  Well, baby steps are good anyway…

There are two main lessons to take away from this rant article:

Lesson 1: Don’t leave it to the user

If the help desk needs information then applications need to take care of that automatically.  Just like Windows Error Reporting, applications need to submit crash data automatically if it matters.  The user is using software for one reason: to get work done.  Anything that gets in the way of that is a failure.  If you need to break flow for a dialog it had better be a critical error.  If it’s recoverable, then it’s not the user’s business.  Deal with it and leave the user alone!

Lesson 2: Recover automatically

If you have an I/O error, try again.  Delay if you need to so you don’t overload systems, but don’t make the user think about it.  If your application needs to crash, send a crash dump and then trigger a restart.  Windows has a great feature called Application Recovery and Restart where you have a chance to clean up from before the crash and recover pretty quickly.  It takes a little plumbing work but it’s worth it.

Lesson 3: Present information that’s actually useful

Don’t interrupt the user.  If you think you need to, think it through again.  If you still need to, make it painless as possible.  Don’t make the user remember things – just give them something relevant to complete their task.

 

Now that you know what not to do, here are few thoughts on better error handling.  It may or may not work in your application, but hopefully it will inspire more painless errors:

Solution 1: Dashboard

I’m guessing someone is already doing this, but nothing that I use.  Most applications, certainly LOB systems, have certain dependencies: network, file server, LOB system, database.  Create a bar across on one your application’s borders to indicate the state of these dependencies.  A green means good, red means bad.  A flash means a change to error.  When the LOB system goes red, that implies that something in the background detected a problem.  Hopefully it hasn’t even affected the user yet.  If they care, they can click the indicator to see details (tooltip or maybe even modal since the user initiated it).  With such a feature they will have warm fuzzies when things are green, and know who to blame when they see red (see what I did there?).

Solution 2: Interrupt Sparingly

Show modal “working” dialogs only if the user absolutely cannot work while something is resolved.  Indicate that the app is retrying.  If the user can work in part of the system but not another, then disable links to that part of the system until it’s resolved, and retry in the background to know when it’s resolved.  Take it out of the user’s hands.

Solution 3: Queued updates

Try to avoid real-time system updates whenever possible.  Queue up all updates.  In normal circumstances they will be immediately processed, but when problems arise they will seamlessly be managed.  Write queued data to disk to resume after problems.  Consider if updates should “expire” if in queue too long.  Discreetly display the number of pending updates to user.  This won’t work everywhere, but is ideal in a data-entry system.  This also has the side benefit of cleanly breaking blocking operations from the user interface.

Solution 4: Fatal errors

Certainly you will need to interrupt the user sometimes.  If you are expecting a license file and it isn’t there, or a critical DLL is missing all of a sudden, then there’s nothing that you can do about it.  You’ll need to stop the user.  This is the one situation that the user must be given a message.  The key is to make it short and to the point.  As little boilerplate as possible.  “The application is not configured properly.  A message has been sent to the help desk.  The application will now exit.”

 

There is no magic bullet, but you can make things better.  You can reduce messages – instead of hourly or daily occurrences, maybe they become weekly.  When errors do occur, they will hopefully stand out more.  Maybe then, users will notice messages.  Of course, if you do good enough jobs, you’ll already be fixing the issue by the time they report it!

Share

Exchange Server 2010: Personal Archives

Saturday, March 6th, 2010

Exchange Server 2010 has several features to help manage the storage and retention of e-mail messages. One of the cool new features is called the Personal Archive, replacing the need for individual users to manage Microsoft Outlook PST files on their local computers. In essence, the Personal Archive feature provides users with a separate archive mailbox stored on the Exchange server and i accessible using Outlook 2010 and OWA.

The Personal Archive mailbox is created on a per user basis and can be enabled for both new mailboxes and for existing mailboxes. For new mailboxes, you will create the user’s mailbox using the New Mailbox wizard. When you get to the Archive Settings page, select Create an archive mailbox for this account. To enable the archive mailbox for an existing mailbox, find the mailbox in the Exchange Management Console (Recipient Configuration | Mailbox), and then click Enable Archive in the Actions pane. Mailbox items will then be moved automatically from the primary user mailbox to the archive based on the retention policy settings.

When you install Exchange Server 2010, it automatically creates a default archive policy and three personal archive policies available to the users. The default policy directs any messages that are more than two years old to be automatically moved to the archive mailbox. After the Exchange Mailbox Assistants run on the user mailbox and processes all messages against this default archive policy, the user can then select one of the other three policies for individual folders in their mailbox structure. These three personal policies allow messages to be archived after 1 year, after 5 years, or marks the folder as to never be archived.

The Personal Archive mailbox is stored in the same database as the user’s primary mailbox and will follow the primary mailbox if it is moved from one database to another.

Share

It’s Part of SQL Server 2008 R2?

Friday, March 5th, 2010

SQL Server 2008 R2 includes some impressive new features and functions. But, when you run setup they are nowhere to be found. Included in the list are the new StreamInsight, PowerPivot (sort of), and Master Data Services. Where are these features and why are they not included in the setup wizard?

Except for PowerPivot for SharePoint, the features are in their own distribution folders on the setup DVD. StreamInsight is in the StreamInsight folder and Master Data Services is in the MasterDataServices folder. PowerPivot for SharePoint is actually included in the setup wizard, but you need to know where to look. More on that later.

To answer the question as to why StreamInsight and Master Data Services are not part of the setup we need to look at the big picture as Microsoft defines it. Microsoft has decided to migrate all data management and analysis applications under a single umbrella and that umbrella is their flagship database, SQL Server 2008 R2. This is much like what they are doing with SharePoint by including PerformancePoint as a feature beginning with SharePoint 2010.

The thinking is that creating a comprehensive data management suite is simpler if the components are marketed as a single platform. Not only does this make sense logistically, it makes sense financially. Instead of socking companies with more fees as they continue to build their data management infrastructure, Microsoft has rolled many of their previous offerings into the SQL Server 2008 R2 platform. Companies now benefit financially by no longer being required to fork out thousands of dollars for each of the features that they want to implement. Rather than forking out thousands of dollars for each application, they can purchase the appropriate edition of SQL Server and find everything they need.

I mention this because StreamInsight, in particular, is not a SQL Server based product. StreamInsight sits outside of the SQL Server resource pool and performs Complex Event Processing on incoming data streams. Designed to handled massive volumes of data in memory, StreamInsight enables a company to create processes that scan the incoming data streams and discard or redirect the data based criteria written in a .NET compliant language and using LINQ.

StreamInsight can use SQL Server based data tables to hold static data used for comparison purposes. It can also pass selected data through and ouput adapter to SQL Server for storage. Because StreamInsight runs against memory based data, it can process the queries without the I/O overhead required by a traditional database server.

Master Data Services is another application included with SQL Server 2008 R2. Master Data Services does store data in SQL Server. However, the processing it does is not a pure database or data warehouse function. Master Data Services (MDS) enables and organization to gather multiple copies of significant master data together, merge and standardize the data, and then send it back out the original applications. Those applications then contain a consistent and accurate representation of the common data. A previous blog contains a more detailed discussion of what constitutes master data so I will not go into that here.

Finally, we have the new PowerPivot for SharePoint. PowerPivot for SharePoint is a new addition to SQL Server Analysis Services in SQL Server 2008 R2. Microsoft created the SharePoint add-in to enable users to create, share, and manipulate PowerPivot workbooks in concert with PowerPivot for Excel 2010. The only way to install PowerPivot for SharePoint is to perform a SQL Server Analysis Services installation with SharePoint integration. After selecting SharePoint integration, the wizard walks through the essential configuration tasks for PowerPivot. A standard Analysis Services installation does not include PowerPivot. For a more in depth discussion of PowerPivot for SharePoint and PowerPivot for Excel please see my previous blogs.

By combining all of these features into SQL Server 2008 R2, Microsoft is proving even more that they are committed to improving the way businesses handle data without requiring excessive investments. I am sure that there is even more to come and that the next release of SQL Server will continue this trend of managing data where ever it is so that companies can continue to gain ground in managing and analyzing business critical data.

Share