# Monday, August 31, 2009

Back To Basics

This series of articles provides an introduction to relational databases in general and Microsoft SQL Server in particular.

Part 1: What is a Database?

Part 2: Relationships

Part 3: Selecting data from a table

Part 4: Aggregating data

Part 5: Joins

Part 6: Inserts, Updates and Deletes

Monday, August 31, 2009 1:04:07 PM (GMT Daylight Time, UTC+01:00)

Episode 46

In this interview, Craig Berntson describes continuous integration and how he uses it to increase productivity on his projects.

16 mins, 10 secs

Monday, August 31, 2009 12:45:00 PM (GMT Daylight Time, UTC+01:00)

Live Mesh offers a folder synchronization feature that allows you to designate a folder on your computer and replicate all changes to files in that folder to a matching folder on one or more other computers. These other computers could be
computers that you own (so that you can synchronize documents or project files between a home and a work PC);
your friend's computer (allowing multiple users to update the same documents and keep make sure everyone has the latest changes);
or a virtual computer in the cloud (so that your documents are backed up and accessible anywhere you have an Internet connection).

Here's how it works. To get started, go to http://mesh.com and sign in with your Windows Live ID. (If you don't yet have a Live ID, you can get one at https://signup.live.com). Read the license agreement and click "I Agree" to proceed.

The first page displayed is the Mesh Devices page which shows all the devices on which you wish to manage through Live Mesh. The Devices page allows you to add computers and other devices to your Mesh so that you can view and manage them.
You will see an icon representing each computer currently included in your mesh.  One of these icons is the "Live Desktop". This is a virtual device that exists "in the cloud", meaning it is available from anywhere as long as you have Internet access. If the bottom arrow is not pointing to the Live Desktop, click the Live Desktop icon once to rotate it to the bottom. Then click Connect to view this device. You will see a screen that looks similar to the desktop of a computer running Windows XP, Vista or 7. 

Live Mesh

Although this Live Desktop computer has no start menu, it does have by default a couple empty folders - "Home Documents" and "Work Documents". These folders exist to hold documents that you can synchronize from your own physical computer.

Live Desktop

To be able to synchronize documents on your physical computer, you must add your computer to your mesh.

To do so, you must be sitting at your computer. From the Devices page, click the "Add Device" icon. The icon will rotate to the bottom. From the dropdown at the bottom of the screen, select whether your computer is running a 32-bit or 64-bit version of Windows. Even though Windows 7 is not listed in this dropdown, I am running it on 64-bit Windows 7 and it seems to work fine. Click "Install" to begin installing the Mesh tools to your local computer and to add your computer to the mesh.

You will be prompted to give your computer a descriptive name and it will appear hereafter on the Devices page with that name. Step through the Installation wizard to install the Mesh client software on your computer.

Once the Mesh tools are installed on your computer, you can begin synchronizing folders.

You should see two shortcuts on your desktop for "Home Documents" and "Work Documents". Click these shortcuts to create these folders and have them synchronize to the folders of the same name on the Live Desktop. Any files that you drag into either of these folders will be automatically synchronized the folder of the same name on your Live Desktop. Any subsequent updates to files in those folders will show up in the file on your live desktop.

But you are not limited to only synchronizing these two folders. You can synchronize any folder on your computer.

To synchronize a folder, you need to add it to your mesh. Right-click the folder in Windows Explorer and select "Add folder to Live Mesh...".

Add Folder right-click menu

The "Add Folder" dialog displays.

Add Folder dialog

Here you can give the folder a more descriptive name if you like. Click "Show Synchronization Options" in the dialog. The dialog will expand to list every device in your mesh.

Add Folder Synchronization options

You can specify the devices that should synchronize with this folder and how synchronization occurs. By default, the folder is synchronized between your local computer and the Live Desktop and that synchronization occurs whenever a file is added, deleted or modified on either device. You can click the arrow next to a device to change the options. For example, you may wish to skip large files because those take a long time to synchronize and may use up your disk space quota.

It may also be useful to synchronize a folder with another physical computer. To do so, you must first add that other computer to you Mesh account (see above); then it will appear in the Synchronization Options dialog and you can specify exactly how you want to share the selected folder with the selected device.

When you are finished, the folder will turn blue to indicate it is synchronized using Live Mesh.

Live Mesh is a simple way to backup files, make data accessible from multiple locations, and collaborate with other users.

Monday, August 31, 2009 2:44:24 AM (GMT Daylight Time, UTC+01:00)
# Saturday, August 29, 2009

In Preview 6 of Microsoft's Managed Extensibility Framework (MEF), the framework changed the rules on matching multiple exports to a single import.

In previous versions of MEF, the attribute syntax was identical whether we were matching a single item or multiple items to an Import. Both scenarios used the [Import] attribute to tell MEF to find exports with a matching contract.

For example, if your application is using MEF to match a string variable, based on a string contract, you would use code similar to the following

string SomeString { get; set; }

This works if MEF finds exactly one matching export string, as in the following code.

string ThatExportedMefString
        return "This string was provided by an MEF contract.  It is from  an external assembly.";

If there is a chance MEF might find multiple Exports that satisfy the above contract, you would need (in previous versions) to modify the imported type, so that it implements IEnumerable, as in the following example

IEnumerable<string> SomeStringList { get; set; }

Beginning with MEF Preview 6, the rule for the attribute becomes more strict. If you are matching a number of items into an IEnumerable set of items on your import, you must replace the Import attribute with the ImportMany attribute. In the above example, the Import declaration becomes

IEnumerable<string> SomeStringList { get; set; }

The main advantage of this change is that ImportMany will not blow up if MEF finds no matching export for the contract. Import throws an exception if it cannot find a matching export.

Of course, your code will need to handle cases in which there are 0 matches, 1 match, or many matches when MEF seeks exports to match this contract. In the above example, that code might look like

foreach (string s in SomeStringList)

In my opinion, when you are writing an Import and you don't have control over the Export (for example, if you are allowing third-party vendors to supply the matching Exports), you should always use the ImportMany attribute. The only time you should use the Import attribute is if you are only looking for contract matches in assemblies that you have written and you can guarantee that there will always be exactly one match.

Saturday, August 29, 2009 8:41:51 PM (GMT Daylight Time, UTC+01:00)
# Friday, August 28, 2009

Episode 45

In this interview, Jessica Moss describes SQL Server Integration Services (SSIS): What it is; how it works; and how to get started learning and using it.

7 mins, 48 secs

Friday, August 28, 2009 9:12:57 AM (GMT Daylight Time, UTC+01:00)
# Wednesday, August 26, 2009

Episode 44

Chris Smith is a software design engineer on the Microsoft Visual F# team. In this interview, Chris describes the uses of F# and how it differs from object-oriented languages, such as C# and Visual Basic.

21 mins, 51 secs

Wednesday, August 26, 2009 4:54:12 AM (GMT Daylight Time, UTC+01:00)
# Monday, August 24, 2009

Episode 43

Kathleen Dollard is the only person I've met who is building a production application using Managed Extensibility Framework (MEF). In this interview, she describes how to use MEF and shares her vision of how it will affect the way we architect applications in the future.

17 mins, 37 secs

Monday, August 24, 2009 4:24:28 AM (GMT Daylight Time, UTC+01:00)
# Sunday, August 23, 2009

Those who attended DevLink last week should enjoy these photos I took. Even if you didn't attend, you may like to see shots of what you missed or people you know.  You can view over 200 photos here.

If you have a very short attention span or if you enjoy the heart-pounding music of Link Wray, the slideshow below is for you.  Turn up your speakers and move your furniture out onto the front lawn before clicking 'Play'.

2 mins, 28 secs

Sunday, August 23, 2009 11:26:29 PM (GMT Daylight Time, UTC+01:00)
# Saturday, August 22, 2009

I started using DasBlog for this blog almost two years ago.

For the past couple months, I've been struggling trying to add a permanent page to my web site. By permanent, I mean a page that is always relevant and is always available at the top of the site; as opposed to a blog post, which is dated and moves down as new blog posts are added.

My biggest problem is that I wanted the new page to have the same theme as all existing pages. It seemed simple enough but DasBlog did not provide an obvious way to do this.

Recently I discovered an old post by Omar Shahine at http://www.shahine.com/omar/FormatPageMacroInDasBlog.aspx

He described in detail exactly what I wanted to do.

Essentially, I create a file named xxx.format.html and add any static HTML I want on my new page. To apply the theme, I need to use FormatPage.aspx, which ships with DasBlog. FormatPage.aspx accepts a parameter path, which points to an HTML document and displays that document with the current theme applied.

After uploading my HTML page, I can apply a theme by linking to FormatPage.aspx?path=DaveSchedule.format.html.

Now I have a link in a tab at the top of every page pointing to my past and upcoming speaking schedule and that page has the same theme as the rest of the site.

Saturday, August 22, 2009 4:43:00 PM (GMT Daylight Time, UTC+01:00)
# Friday, August 21, 2009

Episode 42

The 2009 Lansing Day of .Net was held August 1 at the Jack Breslin Student Events Center in East Lansing, MI. This was the first event that Dennis Burton organized and he discussed it with us here.

8 mins, 28 secs

Friday, August 21, 2009 5:16:31 AM (GMT Daylight Time, UTC+01:00)