Sunday, January 13, 2008

Let's face it, a multiple monitor setup is the only way to go for a software developer, or any other computer professional these days. If you are still using only a single monitor, you are not working at your full potential. Here is a quote taken from lifehacker.com.

Survey after survey shows that whether you measure your productivity in facts researched, alien spaceships vaporized, or articles written, adding an extra monitor will give your output a considerable boost -- 20 percent to 30 percent, according to a survey by Jon Peddie Research.

Personally, I feel my productivity increases even more than that, and at minimal my development experience increases ten fold. I do not enjoy switching from layer upon layer of windows searching for the data I need in the proceeding window. Even Microsoft Research states this on their web sites:

You arrive at your office in the morning, sit down, look at your to do list and wonder how you're going to get it all done. If only you had a tool, a genie in a bottle, anything that would help you get more done in less time. And caffeine is out; you gave that up last week.

Microsoft researchers haven't perfected the genie, but they've found a tool that can increase your productivity by 9 to 50 percent and make your work day easier. And you can begin using it right away.

The researchers conducted user studies that proved the effectiveness of adding a second or even third monitor to your workstation, creating a wide-screen effect.

My setup at home consists of two Acer AL2216Wbd 22" Widescreen LCD monitors powered by a single Dualhead GeForce 8600GTS video card. I purchased the three of these for less than 6 hundred dollars from newegg. The cables that came with the two monitors were not long enough reach my computer, so I ordered a couple DVI cables from monoprice.com for less than $15.00 a piece. Previous, I had a much more expense 20.1" gateway monitor, but it recently bit the bucket so it was replaced with my current setup cheaper and I am loving it.  Here is a screen shot of my home workstation as it sits today. Notice that the background stretches across both monitors.

DSC01873

Windows does not do this by default, and you will need a third party program to get this effect. I use a free program called DisplayFusion from Binary Fortress Software.  It will let you adjust the images in case your two monitors run at different resolutions. This is handy if you use an LCD as a second monitor for you laptop.

sshot-1

If you need some good backgrounds, gamewallpapers is a good place to start. They have a wide assortment of some very cool backgrounds for your desktop. Another site with some nice backgrounds is dual-display and a third can be found here.

World of Warcraft

wallpaper_world_of_warcraft_05_preview

Half Life 2

wallpaper_half-life_2_01_preview

 

kick it on DotNetKicks.com
posted on Sunday, January 13, 2008 10:36:54 AM (Eastern Standard Time, UTC-05:00)  #    Comments [5]


DSC01866Last week I got my HP Media Smart Home Server EX470 setup for my home network. I must say, I really love this box. It is quite and takes very little power to operate and extends my ability to get at the data I want, when I want. Scott Hanselman mentioned on his blog that he measured the power consumption to cost around $3.00 per month @ $0.0079 per kWh. That is much cheaper than say, my Xbox 360 or home computers.

Home Server uses Windows Server 2003 SP2 as it's underlying operating system, but has many features especially designed for the home user.

These include:

  • Automatically backup of any PC on the network
  • Remote access to your files and applications including remote desktop
  • Stream your photos, music and videos to any PC or Xbox 360 on your network
  • Built in iTunes server to stream music to family members' PC
  • Duplication of designated folders across multiple hard drives
  • Centralize all shared files for your home network

There are currently two models made by HP, the EX470 and the EX475. Both comes with a standard 512mb of memory, but with a little computer know how and some help from Home Server Hacks, you can easily upgrade either machines to 2gb of RAM. The EX470 comes with a single 500gb hard drive in one of it's four drives bays, while the EX475 has two drives to bring it's standard configuration to a full 1 terabyte. All other specs between the two machines are identical. 

With the exception of setting up my the source control software Subversion on it, I am pretty much running the server as stock at the moment until I get a chance to more fully explore it's capacities. I will post more once I have delved deeper. 

kick it on DotNetKicks.com
posted on Sunday, January 13, 2008 5:30:48 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]


 Tuesday, January 01, 2008

Rusty - Copy

John Russell Plant

My name is John, but most of my friends refer to me as Rusty. I'm a software developer, living in Clearwater, FL since January of 2005 and currently work for a web based benefit provider company called Motivano located in Tampa, FL. There I develop code in C#, VB.NET, ASP.NET and T-SQL. I've been writing code professionally for over twenty years using a variety of different languages and in varying Industries. I have been a part of the online community since the days of FidoNet running The 19th Hole BBS.  

My Interest include coding, motorcycles, sailing and gaming on Xbox Live.  Well, that is enough about me, get back to the blog.

posted on Tuesday, January 01, 2008 6:33:03 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]


 Monday, December 10, 2007

aa718325_vs08_isHere 

It has been a while since I have posted, and I am sure everyone knows by now.  Visual Studio 2008 was released to manufacturing ( RTM ) and can be downloaded by MSDN subscribers. Product demos and trail editions can also be downloaded.

posted on Monday, December 10, 2007 4:24:20 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]


 Friday, September 28, 2007

 

posted on Friday, September 28, 2007 9:52:01 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2]


 Monday, September 10, 2007

Return of the Stored Procedure

We have seen a couple examples of how to use LINQ to SQL in the previous posts  LINQ to SQL Part 1, LINQ to SQL Part 2, and how easy it is to use. The next question now becomes, What if your company strictly uses stored procedures for all of its data accessing?  Companies today can have stored procedures number from the hundreds to the thousands. With LINQ to SQL, you can still call your stored procedures and even mix and match the type styles.

First off, if you are using SQLMETAL, you will have to add an extra parameter to your DataContext build. Here is the needed extra parameter hi-lighted in red. This will again build the needed class to enable you to access the database.

SQLMETAL /SERVER:ORCASBETA2_VSTS\SQLEXPRESS /DATABASE:NORTHWIND /CODE:NWIND.CS /SPROCS

Once we have the class built and added to our project, we can get down to work. Here is a some sample code using the Northwind database.

   1: static void TestWithAdo()
   2:        {
   3:            SqlConnection conn = new SqlConnection(Properties.Settings.Default.NorthwindConnectString);
   4:  
   5:            SqlCommand spCommand = new SqlCommand("SalesByCategory", conn);
   6:            spCommand.CommandType = CommandType.StoredProcedure;
   7:            spCommand.Parameters.Add("@CategoryName", "Seafood");
   8:            spCommand.Parameters.Add("@OrdYear", "2007");
   9:  
  10:            conn.Open();
  11:  
  12:            SqlDataReader reader = spCommand.ExecuteReader();
  13:            while (reader.Read())
  14:            {
  15:                Console.WriteLine("{0,-20}\t{1,10:c}",
  16:                            reader["ProductName"].ToString().PadRight(20, ' ').Substring(0, 20),
  17:                            reader["TotalPurchase"]);
  18:            };
  19:  
  20:            reader.Close();
  21:            conn.Close();
  22:        }

First, let's look at the standard ADO.NET way of accessing a stored procedure in .NET.  We create a SqlConnection object, followed by a SqlCommand Object. We than have to add parameters and open the connection. Finally, we need to create an SqlDataReader object before we can retrieve the first row of data from the database. Quite a few steps for each a every stored procedure we wish to call. 

Now lets take a look at LINQ to SQL 

   1: static void TestWithLinq()
   2:         {
   3:             Northwind db = new Northwind(Properties.Settings.Default.NorthwindConnectString);
   4:  
   5:             var SalesReport = db.SalesByCategory("Seafood", "2007");
   6:  
   7:             foreach (var SalesItem in SalesReport)
   8:             {
   9:                 Console.WriteLine("{0,-20}\t{1,10:c}",
  10:                         SalesItem.ProductName.PadRight(20, ' ').Substring(0, 20),
  11:                         SalesItem.TotalPurchase);
  12:             }
  13:         }

With LINQ we can really reduce most of the needed ADO.NET code down to just a line or two.  Once the Northwind object has been instantiated, we can simply call the stored procedure like any other method in the class as observed in the above code.  I don't know any programmer that uses SQL day in and out that won't be foaming at the mouth for this.

kick it on DotNetKicks.com
posted on Monday, September 10, 2007 3:48:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1]


 Thursday, August 30, 2007
In LINQ to SQL Part 1 I used a very simple query, almost too simple.  This time I want to take it a step up and add a few joins into the mix, and show how to handle them. Below is a standard TSQL query that will to pull the employee name and his/her territory and region from the Northwind database.  We start all selecting the four columns we want pulled and join several tables together.  Finally, we order the results by lastname and then by firstname. Nothing odd or strange here in TSQL.
 
   1: select e.lastname, e.firstname, t.territoryDescription,r.regiondescription
   2: from employees e
   3: join employeeterritories et on e.employeeid = et.employeeid 
   4: join territories t on t.territoryid = et.territoryid
   5: join region r on r.regionid = t.regionid
   6: order by lastname,firstname
 
In LINQ we once again write our code in somewhat of a reverse order. We start with the from statement and than do our joins statements , followed by the orderby and then select the four columns we want pulled into our resultset. This resultset will be a enumerable anonymous type that can be used with databinding or use with a simple foreach statement.
 
   1: var EmployeeList = from employees in nw.Employees
   2:                    join employeeTerritories in nw.EmployeeTerritories 
   3:                      on employees.EmployeeID equals employeeTerritories.EmployeeID
   4:                    join territories in nw.Territories 
   5:                      on employeeTerritories.TerritoryID equals territories.TerritoryID                               
   6:                    join region in nw.Region 
   7:                      on territories.RegionID equals region.RegionID  
   8:                    orderby employees.LastName,employees.FirstName 
   9:                    select new
  10:                    {
  11:                        employees.LastName,
  12:                        employees.FirstName,
  13:                        territories.TerritoryDescription,
  14:                        region.RegionDescription 
  15:                    };

The following code shows not only the query above, but how simple it is to loop through your resultset and display the information. Remember, when writing your code, you will get the full use of intellisense to help you.

   1: using System;
   2: using System.Collections.Generic;
   3: using System.Linq;
   4: using System.Text;
   5:  
   6: namespace ConsoleTest001
   7: {
   8:  
   9:     class Program
  10:     {
  11:         static void Main(string[] args)
  12:         {
  13:             Northwind nw = new Northwind(Properties.Settings.Default.NorthwindConnectString);
  14:  
  15:             var EmployeeList = from employees in nw.Employees
  16:                                join employeeTerritories in nw.EmployeeTerritories 
  17:                                  on employees.EmployeeID equals employeeTerritories.EmployeeID
  18:                                join territories in nw.Territories 
  19:                                  on employeeTerritories.TerritoryID equals territories.TerritoryID                               
  20:                                join region in nw.Region 
  21:                                  on territories.RegionID equals region.RegionID  
  22:                                orderby employees.LastName,employees.FirstName 
  23:                                select new
  24:                                {
  25:                                    employees.LastName,
  26:                                    employees.FirstName,
  27:                                    territories.TerritoryDescription,
  28:                                    region.RegionDescription 
  29:                                };
  30:                           
  31:             foreach(var e in EmployeeList)
  32:             {
  33:                 Console.WriteLine("{0,-10} {1,-10}\t{2}\t{3,20}", 
  34:                                     e.LastName, 
  35:                                     e.FirstName,
  36:                                     e.TerritoryDescription.PadRight(20,' ').Substring(0,20),
  37:                                     e.RegionDescription);
  38:             }
  39:  
  40:             Console.ReadLine();
  41:  
  42:         }
  43:     }
  44: }

Here is the result of of the LINQ to SQL query written out to the console.

sshot-2

 

kick it on DotNetKicks.com
posted on Thursday, August 30, 2007 2:37:15 PM (Eastern Standard Time, UTC-05:00)  #    Comments [2]


 Wednesday, August 22, 2007
An upcoming new feature of C# 3.0 and part of Visual Studio 2008 ( Orcas ) will be Automatic Properties. This feature is meant to help reduce the number of lines of code a developer has to make and improve the developer experience. Currently, when a developer creates a new class, he has to create a getter and setter for each field. This seems rather redundant when you have no initial setup logic to add, but there are very good reasons such as data binding and future assembly compatibility.  I'm sure most developers have written code similar to the following before:
 
   1: class Customer
   2: {
   3:     private string _FirstName;
   4:     private string _LastName;
   5:  
   6:     public string FirstName
   7:     {
   8:         get
   9:         {
  10:             return _FirstName;
  11:         }
  12:         set
  13:         {
  14:             _FirstName = value;
  15:         }
  16:     }
  17:     public string LastName
  18:     {
  19:         get
  20:         {
  21:             return _LastName;
  22:         }
  23:         set
  24:         {
  25:             _LastName = value;
  26:         }
  27:     }
  28: }

A pretty straight forward customer class with two properties ( FirstName, LastName ).  Now with automatic properties, the same code can be compressed down to fewer lines. When the compiler encounters code like the following, it will automate the generation of the private fields along with get and set method.  This lets the developer write fewer lines of code up front and follow good class design. Later on, if needed, the developer can put custom getter/setter code without having to recompile the consuming assembly.

   1: class Customer
   2: {
   3:     public string FirstName { get; set; }
   4:     public string LastName { get; set; }
   5: }

The last information I've heard is that this as a C# only feature. I haven't heard of anything similar for VB.NET at this time. 

posted on Wednesday, August 22, 2007 1:11:03 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]