Convert your nUnit scripts to VSTS Test format/scripts

Convert your nUnit scripts to VSTS Test format/scripts.

http://www.gotdotnet.com/workspaces/workspace.aspx?id=91936c5e-461f-4027


AJAX = Atlas

For those of you that have been following AJAX, it looks like Scott Guthrie is working on a new project called Atlas that will make it easier to develop AJAX applications.  There are looking to have a preview release available for PDC.

http://weblogs.asp.net/scottgu/archive/2005/06/28/416185.aspx


TechEd Grok Talks

The TechEd Grok Talks are finally posted

http://www.groktalk.net .

Cool Visual Studio Add-In for C# called Resharper

Over the last year or so I had been looking at some of the code refactoring utilities on the market but I had not found one that I was happy with until now.  Earlier this week I saw someone uses a Visual Studio 2003 Add-In called Resharper (http://www.jetbrains.com/resharper/) and it looked pretty cool so I decided to try it out. 

ReSharper brings intelligent C# code editing, highlighting and refactoring features to Visual Studio.

Here are a few of examples that I have used so far in the 2 days that I have had it installed.

  • Auto generate properties based on the private member variables. It allows you to pick and choose which member variables to make read, write, or read/write properties and which access modifier to use.
  • When inheriting from a base class, you can quick generate all of the methods that you need to override.
  • Rename a method/variable/class and have it rename every reference to it in a project.
  • Quickly find all places where a method is used.  The results window allow you to click on each result and be taken right to that line of code.  Much nicer than the default VS find options.

So far this has been the most useful add-in that I have used for Visual Studio and one that I can easily see myself not being able to live without. 

I just touched on a small portion of what this add-in can do.  The complete feature list is at http://www.jetbrains.com/resharper/features/


Free Visual Studio 2005 Learning Courses

Microsoft has made available four free E-learning courses for Visual Studio.NET 2005. They are free for download for around 90 days. The courses are :

  • Clinic 2551: Introduction to Visual Studio Team System
  • Course 2924: Building Data Components in Microsoft® Visual Studio® 2005
  • Course 2925: Building Managed Code for SQL Server 2005 and Creating SOA Apps with Visual Studio 2005
  • Course 2928: Implementing Data Access and Security in an ASP.NET 2.0 Web Application

Get them at https://www.microsoftelearning.com/visualstudio2005/


Free SQL Server 2005 Learning Courses

Free SQL Server 2005 Learning Courses

Microsoft has made available seven free E-learning courses for SQL Server 2005. They are free for download for around 90 days. The courses are :

  • Course 2936: Installing and Securing Microsoft® SQL Server™ 2005
  • Course 2937: Administering and Monitoring Microsoft® SQL Server™ 2005
  • Course 2938: Data Availability Features in Microsoft® SQL Server™ 2005
  • Course 2939: Programming Microsoft® SQL Server™ 2005
  • Course 2940: Building Services and Notifications Using Microsoft® SQL Server™ 2005
  • Course 2941: Creating the Data Access Tier Using Microsoft® SQL Server™ 2005
  • Course 2944: Updating Your Reporting Skills to Microsoft® SQL Server™ 2005 Reporting Services

Get them at https://www.microsoftelearning.com/sqlserver2005/


Codesmith

So I started playing with codesmith this week to generate my crud procedures and my data access layer.  It was pretty easy to find some existing templates in the codesmith support forums to use as a starting point that used the Microsoft Data Access Building Block for the DAL and one that did my crud statements for me.  With the new editor that is in the pro edition of Codesmith it was really easy to modify the templates to meet my needs.  It only took me and a co-worker about half a day to get them working like we needed them.  We are happy enough with the initial results that we are looking into purchasing a license for it. 

Are other folks at Intel are using Codesmith?  If so, what kind of code are you generating and what templates are you using.


Pivot ADO.NET Results in the UI

I ran across a cool function to do pivot tables in .NET in the presentation layer at http://weblogs.sqlteam.com/jeffs/archive/2005/05/15/5175.aspx . 

Excerpt from the article

Sample Code:

private void Sample()

        {
            // call this from a form ....

            SqlConnection conn;

            SqlCommand com;

 

            DataGrid dg = new DataGrid();

            dg.Parent = this;

            dg.Dock = DockStyle.Fill;

 

            String SQL =

                "select o.customerID, c.CompanyName, p.productName, sum(od.quantity) as Qty " +

                " from orders o " +

                " inner join [order details] od on o.orderID = od.orderID " +

                " inner join Products p on od.ProductID = p.ProductID " +

                " inner join Customers c  on o.CustomerID = c.CustomerID " +

                " group by o.customerID, c.CompanyName, p.ProductName " +

                " order by o.customerID";

 

            conn = new SqlConnection( "Server=(local);Database=Northwind;uid=xx;pwd=xx");

            conn.Open();

            com = new SqlCommand(SQL, conn);

            try

            {

                dg.DataSource = Pivot(com.ExecuteReader(),"CustomerID","ProductName","Qty");

            }

            catch (SqlException ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

 

// Does all of the work

public static DataTable Pivot(IDataReader dataValues, string keyColumn, string pivotNameColumn, string pivotValueColumn)

        {

            DataTable tmp = new DataTable();

            DataRow r;

            string LastKey = "//dummy//";

            int i, pValIndex, pNameIndex;

            string s;

            bool FirstRow = true;

 

            // Add non-pivot columns to the data table:

 

            pValIndex = dataValues.GetOrdinal(pivotValueColumn);

            pNameIndex = dataValues.GetOrdinal(pivotNameColumn);

 

            for (i=0; i <= dataValues.FieldCount -1; i++)

                if (i != pValIndex &&  i != pNameIndex )

                    tmp.Columns.Add(dataValues.GetName(i),dataValues.GetFieldType(i));

          

            r = tmp.NewRow();

 

            // now, fill up the table with the data:

            while (dataValues.Read())

            {

                // see if we need to start a new row

                if (dataValues[keyColumn].ToString() != LastKey)

                {

                    // if this isn't the very first row, we need to add the last one to the table

                    if (!FirstRow)

                        tmp.Rows.Add(r);

                    r = tmp.NewRow();

                    FirstRow = false;

                    // Add all non-pivot column values to the new row:

                    for (i=0; i<= dataValues.FieldCount-3;i++) 

                        r[i] = dataValues[tmp.Columns[i].ColumnName];

                    LastKey = dataValues[keyColumn].ToString();

                }

                // assign the pivot values to the proper column; add new columns if needed:

                s = dataValues[pNameIndex].ToString();

                if (!tmp.Columns.Contains(s))

                    tmp.Columns.Add(s, dataValues.GetFieldType(pValIndex));

                r[s] = dataValues[pValIndex];

            }

 

            // add that final row to the datatable:

            tmp.Rows.Add(r);


            // Close the DataReader

            dataValues.Close();                  

            // and that's it!

            return tmp;

        }

 

The arguments for the Pivot() function are as follows:

public static DataTable Pivot (IDataReader dataValues, string keyColumn, string pivotNameColumn, string pivotValueColumn)

  • dataValues -- this is any open DataReader object, ready to be transformed and pivoted into a DataTable.  As mentioned, it should be fully grouped, aggregated, sorted and ready to go. 
  • keyColumn -- This is the column in the DataReader which serves to identify each row.  In the previous example, this would be CustomerID.  Your DataReader's recordset should be grouped and sorted by this column as well.
  • pivotNameColumn -- This is the column in the DataReader that contains the values you'd like to transform from rows into columns.   In the example, this would be ProductName.
  • pivotValueColumn -- This is the column that in the DataReader that contains the values to pivot into the appropriate columns.  For our example, it would be Qty, which has been defined in the SELECT statement as SUM(Qty).

And, that's it.  You just call the Pivot() function on any object that implements IDataReader, specify the pivot information, and a DataTable is returned that you can use however you like. 

?>