Can you ever have enough screen realestate?

Tuesday, September 26, 2006 4:01:16 AM (GMT Daylight Time, UTC+01:00)

I don't think so. Count them... yes 5 monitors.

Building Live Writer Plug-Ins

Tuesday, September 19, 2006 5:05:06 AM (GMT Daylight Time, UTC+01:00)

This look like a pretty good summary on how to build a plug-in for Live Writer.  Posting this one so I don't forget.

http://nayyeri.net/archive/2006/08/15/Write-a-Windows-Live-Writer-plugin-using-C_2300_.aspx

Stop Watch Wrapper

Tuesday, September 19, 2006 4:45:06 AM (GMT Daylight Time, UTC+01:00)

With .NET 2.0 they introduced the StopWatch class which can be used to time the execution of your code to a very high resolution.  Here is a wrapper to help package it up.

public class PerformanceTimer : IDisposable

    {

        Stopwatch _stopwatch = new Stopwatch();

        private static string _elapstedTime;

        public PerformanceTimer()

        {

            PerformanceTimer._elapstedTime = string.Empty;

            _stopwatch.Start();

        }

        public static string ElapstedTime

        {

            get { return _elapstedTime; }

            set { _elapstedTime = value; }

        }

        public void Dispose()

        {

            _stopwatch.Stop();

            TimeSpan ts = _stopwatch.Elapsed;

 

            _elapstedTime =

                    String.Format("{0:00}:{1:00}:{2:00}.{3:00}",

                    ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);

        } 

    }

The class is used in the following manner:

using(new PerformanceTimer())

{

    //Execute code you are timing here.

 

}

 

string result = PerformanceTimer.ElapstedTime;

Creating Seed Data - Updated

Tuesday, September 19, 2006 4:31:38 AM (GMT Daylight Time, UTC+01:00)

I did another update to my SeedData class, it now supports the creation of:

  • Job Titles
  • Addresses
  • States
  • Zip Codes
  • County

The city, states and zip codes all match appropriately, in other words if you request a random zip for example, it will return the zip with the related City, State and county.  The data is older (from the 1990 census) but it works great for generating real looking dummy data. 

The following code shows how to use the class

//Load external Seed Data files that aren't automatically loaded (check src to see which are)

SeedData.LoadSeedData("Titles", string.Format(@"{0}\SeedData_JobTitles.txt", Application.StartupPath), 0);

SeedData.LoadSeedData("Address", string.Format(@"{0}\SeedData_Addresses.txt", Application.StartupPath), 0);

 

PersonTableGateway gw = new PersonTableGateway();

 

using(new PerformanceTimer())

{

 

    for (int i = 0; i < 500; i++)

    {

        //create a record using the SeedData class

        Person p = new Person();

        p.FirstName = SeedData.GetFirstName().Trim();

        p.LastName = SeedData.GetLastName().Trim();

        p.NetworkUserID = p.FirstName.Substring(0, 1) + p.LastName;

        p.EMail = p.NetworkUserID.Trim() + "@sysknowlogy.com";

        p.Phone = SeedData.CreatePhone("612");

        p.Title = SeedData.GetRandomSeed("Titles");

        p.TitleDescription = "Description of the title goes here.";

 

        //create a street address

        p.Address1 = SeedData.Number(1000,9999) + " " + SeedData.GetRandomSeed("Address");

 

        ZipCode zip = SeedData.GetZip();

        p.Zip = zip.Zip;

        p.City = zip.City;

        p.State = zip.State;

        p.Branch = zip.City;

 

        gw.CreatePerson(p);

 

    }

}

 

 

 

SeedData1.zip (564.84 KB)

GotCodeSnippets.NET: THE online source for Visual Studio code snippets

Wednesday, September 06, 2006 5:37:04 PM (GMT Daylight Time, UTC+01:00)

Stumbled across this... GotCodeSnippets.NET