# Monday, April 20, 2009

I enjoy attending technical conferences and I try to make it to as many as I can.  I like talking to and learning from bright people in the developer community and picking up the latest technologies.  Developer conferences are a great way to get this information and there is no shortage of such conferences.

The Kalamazoo X conference is different.  Although the target audience is software developers, the content will focus on soft skills.  Topics such as Leadership and Social Network dominate the agenda.  The conference features four tracks: Soft Skills; Architecture, Design and Process; User Experience; and Career Development.  However each session will be short enough that an attendee will be able to see 100% of the content.

I'll be there to share ideas on effective communication with your customer or manager, a topic I've given a lot of thought to in recent years.

The conference is scheduled this Saturday April 25 at the Kalamazoo Valley Community College Center for New Media in downtown Kalamazoo, MI.  You can register and get more information at http://kalamazoox.org/

I hope to see you there.

Monday, April 20, 2009 9:56:13 PM (GMT Daylight Time, UTC+01:00)
# Friday, April 17, 2009

Tomorrow (Saturday April 18), I will be speaking at the Central Ohio Day of .Net in Wilmington, OH.

My topic is Using Microsoft Distributed Cache to speed your application.  This is similar to a talk I gave last summer at three user groups in Ohio and Michigan.  However, the topic is more relevant now as the release of Microsoft Velocity nears.  I have updated and expanded my presentation and written all new demos for this talk. 

A consistent caching strategy becomes critical as enterprise applications grow in size.  With Velocity, Microsoft finally has a product in the enterprise caching space.

You can get more information and register by clicking the badge below.  I hope to see you there. 

Friday, April 17, 2009 12:41:03 PM (GMT Daylight Time, UTC+01:00)
# Monday, April 6, 2009

WM .Net University April 4, 2009 - I'll be there!

The dust has settled and the first West Michigan .Net University is now history.  You can view photos of it here.

I was fortunate that my talk (Intro to SQL Server Data Models and T-SQL) was in the morning because I had tickets to the Final Four in the evening on the other side of the state.

Shane and I put together a talk aimed at people with very little database experience.  We agreed that I would cover the basic introductory material first; then he would explain some more intermediate topics.  I rehearsed a story about the history of databases that included people keeping records on stone tablets and storing these tablets in a file cabinet; I wrote a lot of sample queries demonstrating the syntax of a T-SQL statements; and I wrote a series of articles on T-SQL

I turned out that I didn't use any of this material.

We had a small group in our session so we let them set the agenda.   Everyone already had at least a year of database experience so I scrapped the introductory stuff.  I spent far more time than I expected showing off the features of the SQL Management Studio.  We answered questions about the strategies for normalization, backing up data, and primary keys.

In fact, I showed almost none of the slides we prepared.

The good news is that the audience seemed happy with the session.  The got their questions answered without wasting time on things they already knew.  In the end, I think they were glad we were so flexible and so was I.

The feedback I heard on the other sessions was also positive.  Congratulations to Chris Woodruff for organizing a successful event.

Overall it was a very good day.  Oh... and the Final Four?  Well, my Spartans won of course.  It was a great day!

Monday, April 6, 2009 11:34:52 AM (GMT Daylight Time, UTC+01:00)
# Tuesday, March 31, 2009

My talk this morning at ArcReady is Windows Live Services and on Live Mesh.

Click the icons below to download the slides and demos.

Here is a preview of the slides:
Tuesday, March 31, 2009 2:45:24 PM (GMT Daylight Time, UTC+01:00)
# Monday, March 30, 2009

I have secheduled a lot of public speaking for the next 30 days.  The sessions are listed below.  All these events are either free or charge a nominal fee.  Most will even provide some food. I believe that none of them are sold out yet, so I provided a link to each so you can register.

Architecting for the cloud: Mesh and Live Services

March 31
Microsoft ArcReady
Southfield, MI

Live Mesh is a data synchronization client that has a rich API to build applications on. Live services are a collection of APIs that can be used to create rich applications for your customers. Live Services are based on Internet standard protocols and data formats.


An Introduction to SQL Server

(with Shane Jordan)
April 4
West Michigan .Net University
Grand Rapids, MI

Want to learn about the SQL Server 2008? Want to build normalized data models and learn Transact SQL? Join us in this Introduction to SQL Server session to get a good introduction to building your own data models and queries.


Using Microsoft Distributed Cache to speed your application

April 18
Central Ohio Day of .Net
Wilmington, OH

Retrieving data from a disc or a database can be a time-consuming operation.  Data that is accessed frequently can be stored in an in-memory cache, which can speed up its retrieval considerably.  Microsoft Distributed Cache (aka “Velocity”) provides a framework for storing and managing cached data. 

In this session, we will discuss how to use this framework in your application and demonstrate some code that implements this framework.


Proactive communication with your manager or customer

April 25
Kalamazoo X Conference
Kalamazoo, MI

After 15 years in the IT industry, I've discovered that the single biggest contributor to success is effective communication. In this situation, I'll describe lessons I've learned about how to improve communication with a customer or manager and how to use effective communication to increase the probability of high customer satisfaction.


This is the most ambitious month of speaking I've ever scheduled.  Microsoft Distributed Cache is the only topic above on which I have previously presented and this presentation will be longer and feature a newer API than the one I gave at three user groups last September.

If you attend any of these events, please feel free to find me and say 'Hello'.

Monday, March 30, 2009 6:00:40 PM (GMT Daylight Time, UTC+01:00)
# Saturday, March 28, 2009

Last year, I noticed there were more local community-driven events than I had time to attend.  I love seeing that kind of enthusiasm for technology among the community. 

These events are great for me because - although I've been in software development for many years - I love to learn and frequently jump at the chance to learn from and share ideas with other experienced developers and architects.

I have noticed that most of these events targeted experienced developers.  Topics tended to be moderate to advanced and speakers assumed a certain level of expertise from their audience in order to grasp their talk. 

This can be frustrating for less-experienced developers.  It's difficult to understand the details of NHibernate when you are still trying to figure out how to write simple queries against SQL Server.

Chris Woodruff first described to me the idea of a .Net University - a community event targeted at those new to .Net programming.  All the content would be introductory, allowing people to learn fundamentals.

I liked the idea immediately.  When I was a trainer, I always spent time on the first day reviewing the basic prerequisites of the class material.  I knew that no one would understand anything about web development if they didn't know how to construct an HTML document. 

So Chris is now organizing the West Michigan .Net University that will be held April 4 in Grand Rapids. 

The morning sessions will all be introductory and the afternoon will feature more intermediate topics.  Each session will be about 3 hours - longer than at a typical code camp.

I'll be there delivering a morning session titled SQL 101, in which I'll explain the basics of working with a relational database - SQL Server in particular.  I"ll describe how to work with data and how to use code and tools to interact with SQL Server.  I've been preparing for this talk by writing a 'Back To Basics' series on this blog.

Other sessions include .Net Bootcamp; Intro To ASP.Net and AJAX; and Real World Architecture.  You can view the complete session list at http://dodn.org/WestMichiganDotNetU/Sessions.aspx

A lot of great speakers have signed up for this event so I'm counting on some great sessions. 

WM .Net University April 4, 2009 - I'll be there!

Saturday, March 28, 2009 10:35:47 PM (GMT Standard Time, UTC+00:00)
# Friday, March 27, 2009
Back To Basics

NOTE:

For demos in this article, we will use a table named Customer that contains the following columns:

Name Data Type
FirstName nvarchar(50)
LastName nvarchar(50)
StreetAddress nvarchar(255)
City nvarchar(255)
State char(2)
ZipCode nvarchar(10)
TotalSales decimal(18,2)

In addition, I created a primary key on the CustID column and set it to autoincrement by setting the following properties:

Is Identity Yes
Identity Seed 1
Identity Seed 1

Afer adding a couple rows to the table, the data looks like this.

CustID FirstName LastName StreetAddress City State ZipCode TotalSales
1 Steve Smith 900 Belle St Detroit MI 48888 5000.00
2 Ryan Miller 1 Shutout Ct Buffalo NY 32323 250.00

We can use the INSERT command to add a new row to this table. The syntax of the INSERT command is

INSERT INTO [TableName]
    (
    [Column List]
    )
VALUES
    (
    [Values List]
    )

We can insert a row for a new Customer - Brad Van Pelt - with the following code.

INSERT INTO Customer
    (
    FirstName, 
    LastName, 
    StreetAddress, 
    City, 
    State, 
    ZipCode, 
    TotalSales
    )
VALUES
    (
    'Brad',
    'Van Pelt', 
    '99 Linebaker Ln', 
    'Owosso', 
    'MI', 
    '47777', 
    4000
    )

Notice that each column name in the first set of parentheses matches a value in the second set of parentheses: 'Brad' with FirstName, 'Van Pelt' with LastName and so on. Notice also that we did not provide a value for the CustID column. This is because CustID is an identity column and, therefore, gets populated with an incremented number when a new row is added.

After executing the above INSERT statement, our data should look like this:

CustID FirstName LastName StreetAddress City State ZipCode TotalSales
1 Steve Smith 900 Belle St Detroit MI 48888 5000.00
2 Ryan Miller 1 Shutout Ct Buffalo NY 32323 250.00
3 Brad Van Pelt 99 Linebaker Ln Owosso MI 47777 4000.00

In this article, we showed how to use T-SQL's INSERT, UPDATE, and DELETE commands to modify the data in a table.

The new customer was automatically assigned a CustID value of 3. Because this value uniquely identifies the newly-added row, we can use it to find and update that row. The syntax to update a row in SQL Server is

UPDATE [Table]
    SET [Column1] = [New Value 1],
        [Column2] = [New Value 2],
        [Column3] = [New Value 3],
        etc...
    WHERE [Filter Condition]

Only rows that match the filter condition will be updated and only those columns specified in the SET clause will be updated.  We will use the following command to update the StreetAddress, City, State and ZipCdoe columns of Customer 3:

UPDATE Customer
    SET StreetAddress = '100 Safety St',
        City='New York',
        State='NY'
        ZipCode='01111'
    WHERE CustID = 3

After executing the above UPDATE command, our data should like this:

CustID FirstName LastName StreetAddress City State ZipCode TotalSales
1 Steve Smith 900 Belle St Detroit MI 48888 5000.00
2 Ryan Miller 1 Shutout Ct Buffalo NY 32323 250.00
3 Brad Van Pelt 100 Safety St New York NY 01111 4000.00

We use the DELETE command to delete rows in a SQL Server table. The DELETE syntax is

DELETE Customer
    WHERE CustID = 3

The following code will delete Customer 3

DELETE Customer
    WHERE CustID = 3

After executing the above DELETE command, our data will look like this:

CustID FirstName LastName StreetAddress City State ZipCode TotalSales
1 Steve Smith 900 Belle St Detroit MI 48888 5000.00
2 Ryan Miller 1 Shutout Ct Buffalo NY 32323 250.00

In this article, we showed how to use the INSERT, UPDATE and DELETE commands to modify data in a SQL Server table.

Friday, March 27, 2009 4:18:46 AM (GMT Standard Time, UTC+00:00)
# Thursday, March 26, 2009

Episode 16

Microsoft Technology Specialist Randy Pagels describes the benefits of Microsoft Visual Studio Team System.  You can learn more about VSTS from Randy at http://www.teamsystemcafe.net/

4 mins, 18 secs

Thursday, March 26, 2009 10:32:10 AM (GMT Standard Time, UTC+00:00)
# Monday, March 23, 2009

This screencast describes the basic concepts of caching and the upcoming Microsoft Distributed Cache, which is code named "Velocity"

Monday, March 23, 2009 11:13:55 AM (GMT Standard Time, UTC+00:00)
# Saturday, March 21, 2009
Back To Basics

NOTE:

For demos in this article, we will use three tables: Customer, SalesOrder and OrderLine. 

The structure of the Customer table is:

Name Data Type
CustID int
FirstName nvarchar(50)
LastName nvarchar(50)
StreetAddress nvarchar(255)
City nvarchar(255)
State char(2)
ZipCode nvarchar(10)

The Customer table contains the following data.

CustID FirstName LastName StreetAddress City State ZipCode
1 David Giard 123 Oxford Ct Erlanger KY 40111
2 Magic Johnson 456 Hollywood Blvd Lansing MI 45222
3 Bubba Smith 789 Killbubbakill St Baltimore MD 10111

The structure of the SalesOrder table is
Name Data Type
OrderID int
CustID int
OrderDate datetime

The SalesOrder table contains the following data.

OrderID CustID OrderDate
1 1 2009-03-01
2 1 2009-03-02
3 2 2009-03-07
4 2 2009-03-14
5 3 2009-03-21

The structure of the OrderLine table is
Name Data Type
OrderID int
LineNumber int
ProductName nvarchar(255)
Quantity int

The OrderLine table contains the following data  
OrderID LineNumber ProductName Quantity
1 1 Widget 7
1 2 Super Widget 4
2 1 Widget 5
2 2 Super Widget 3
3 1 Widget 2
4 1 Super Widget 3
5 1 Widget 6
5 2 Super Widget 1

In a previous article, I explained how we can (and often should) split a table into multiple tables in order to eliminate data redundancy - a process known as "normalization".

In this article, I'll explain how to retrieve related data from multiple tables and return them in a single result set.

Recall from the Normalization article that - in order to relate to tables - we add a key to each table.  The Primary key in the parent table is a column that is unique for each row and, therefore, servers to uniquely identify a row.  The child table contains a foreign key which is the same value as a Primary key in the parent table, so it points to a given row in the parent.

To retrieve data from multiple tables into a single result set, we do something called a "JOIN".  In SQL, there are two ways to JOIN tables:

  • Using the JOIN keyword
  • Adding the join condition on a WHERE clause

JOIN keyword

The syntax for joining tables with the JOIN keyword is

The syntax for joining tables with the JOIN keyword is

SELECT [List of Columns]
    FROM [Table 1]
    JOIN [Table 2]
        ON [Join Condition]

 For example, to retrieve the Name, SalesOrder Date and SalesOrder Amount of each customer in our sample tables, use the following query:

SELECT 
        FirstName, 
        LastName, 
        OrderDate 
    FROM Customer 
    JOIN SalesOrder 
        ON Customer.CustID = SalesOrder.CustID

Notice that we need to prefix the CustID column name with the table name in our filter condition.  This is because the CustID column name is not unique.  We need to tell SQL to which column we are referring.

The results of this query are

FirstName LastName OrderDate
David Giard 2009-03-01
David Giard 2009-03-02
David Giard 2009-03-07
Magic Johnson 2009-03-14
Bubba Smith 2009-03-21

WHERE clause

The syntax for joining two tables with the WHERE clause is

SELECT [List of Columns]
    FROM [Table 1], [Table 2]
    WHERE [Join Condition]

The syntax to return the same result set as above is

SELECT
        FirstName,
        LastName,
        OrderDate
    FROM Customer, SalesOrder
    WHERE Customer.CustID = SalesOrder.CustID

Recall that the WHERE clause is also used to filter your result set.  In fact, you can use it for both filtering and joining.  The following two queries yield the same results (showing only those records that match customer 1.

SELECT
        FirstName,
        LastName,
        OrderDate
    FROM Customer
    JOIN SalesOrder
        ON Customer.CustID = SalesOrder.CustID
    WHERE Customer.CustID = 1

SELECT
        FirstName,
        LastName,
        OrderDate
    FROM Customer, SalesOrder
    WHERE Customer.CustID = SalesOrder.CustID
        AND Customer.CustID = 1

Here is the result set for either of the above two queries:

FirstName LastName OrderDate
David Giard 2009-03-01
David Giard 2009-03-02
David Giard 2009-03-07

You can use these same techniques to join more than two tables. Here is the syntax to add the OrderLine table to our queries

SELECT
        SalesOrder.OrderID,
        FirstName,
        LastName,
        OrderDate,
        ProductName,
        Quantity
    FROM Customer
    JOIN SalesOrder
        ON Customer.CustID = SalesOrder.CustID
    JOIN OrderLine
        ON SalesOrder.OrderID = OrderLine.OrderID

SELECT
        SalesOrder.OrderID,
        FirstName,
        LastName,
        OrderDate,
        ProductName,
        Quantity
    FROM Customer, SalesOrder, OrderLine
    WHERE Customer.CustID = SalesOrder.CustID
        AND SalesOrder.OrderID = OrderLine.OrderID

Here is the result set of either of these 3-table queries

OrderID FirstName LastName OrderDate ProductName Quantity
1 David Giard 2009-03-01 Widget 7
1 David Giard 2009-03-01 Super Widget 4
2 David Giard 2009-03-02 Widget 5
2 David Giard 2009-03-02 Super Widget 3
3 David Giard 2009-03-07 Widget 2
4 Magic Johnson 2009-03-14 Super Widget 3
5 Bubba Smith 2009-03-21 Widget 6
5 Bubba Smith 2009-03-21 Super Widget 1

I prefer to use the JOIN keyword syntax when joining tables together because it is more clear what part of the query is a filter and what part of a query is a join. 

In this article, we showed the ways to use SQL Server to join multiple tables into a single result set.

Saturday, March 21, 2009 10:31:36 PM (GMT Standard Time, UTC+00:00)