Wednesday, July 04, 2007
#
Discovered this useful script today
Open Visual Studio 2005 command prompt and enter the script below to get all files checked out by all users
tf status /s:teamserver /u:*
To do more check out the
tf status documentation
Sunday, December 18, 2005
#
Check out
this research tool from Microsoft if you use MS Outlook
Pandora is a very cool music discovery service that helps you find the music you'll love.
Thursday, November 17, 2005
#
Wednesday, November 09, 2005
#
Microsoft Content Management Server 2002 Service Pack 2 is now available to download from here.
http://www.microsoft.com/downloads/details.aspx?FamilyID=3de1e8f0-d660-4a2b-8b14-0fce961e56fb&DisplayLang=en
SP2 provides:
Support for ASP.NET 2.0 (.NET Framework 2.0)
Support for Visual Studio 2005
Support for SQL 2005
Support for running on 64-bit machines in 32-bit emulation mode
Tuesday, November 01, 2005
#
Installed VS 2005 last night. It went pretty smooth. If you have something like Microsoft Anti Spyware installed, you might want to turn it off during the install. ie if you are not going to be in front of the computer during the process. It pops up a few times asking you to allow/block certain processes. A single reboot at the end and I was ready to write my first program:
using System;
namespace AnswerToEverything
{
public class Universe<T>
{
public void Show(T t)
{
Console.WriteLine(t);
}
}
class Program
{
static void Main()
{
Universe<string> hello = new Universe<string>();
hello.Show("Hello World");
Universe<int> answer = new Universe<int>();
answer.Show(42);
Console.ReadLine();
}
}
}
I'm currently evaluating different source code editors trying to find the one most suitable for me as a notepad replacement. Some of the features I'm looking for are:
Something that loads as quickly as notepad
Regular Expression Find
Syntax Highlighting
Find in Files/Folders/Subfolders
Explorer Bar
Multi-tab
Compare 2 files
Column Mode Select
Free preferably!!!, but not necessary
Here are a few I've dug out.
Crimson Editor
Textpad
JEdit
Ultraedit
Editpad
PSPad
Notepad2
Notepad++
Any other recommendations? What do people think is the best out there?
Tuesday, October 25, 2005
#
The PDC05 Sessions are online for 6 months
here
Monday, October 17, 2005
#
Another good reason to attend the UK Launch event.
Sunday, October 16, 2005
#

See you there.
Thursday, October 06, 2005
#
The Singleton Pattern ensures a class has only one instance, and provides a global point of access to it. There are many objects we only need one of: thread pools, caches, objects that handle common settings, objects used for logging, objects that act as device drivers etc. In this case we take a class and let it manage a single instance of itself. We then prevent any other class from creating a new instance on its own and we provide a global access point to the instance.
Here is a simple example of the Single Pattern. A class that always provides a single connection to a database.
using System;
using System.Data.SqlClient;
namespace Vivek.Generic
{
public class SingletonConnection
{
#region -- private variables --
private volatile static SingletonConnection uniqueInstance;
private static object syncRoot = new Object();
private static string strConnectionString;
private SqlConnection sqlConnection;
#endregion
#region -- public properties --
public static string ConnectionString
{
get { return strConnectionString; }
set { strConnectionString = value; }
}
public SqlConnection SqlConnection
{
get { return sqlConnection; }
}
#endregion
#region -- private constructor --
private SingletonConnection()
{
sqlConnection = new SqlConnection(strConnectionString);
}
#endregion
#region -- Get Single Instance --
public static SingletonConnection GetInstance()
{
if(uniqueInstance == null)
{
lock (syncRoot)
{
if(uniqueInstance == null)
{
uniqueInstance = new SingletonConnection();
}
}
}
return uniqueInstance;
}
#endregion
}
}
Note:
To deal with multithreading we use the volatile and lock keywords.
The volatile modifier is used for a field that is accessed by multiple threads. Using the volatile modifier ensures that one thread retrieves the most up-to-date value written by another thread.
lock ensures that one thread does not enter a critical section while another thread is in the critical section of code. If another thread attempts to enter a locked code, it will wait (block) until the object is released.
And our class can be used like this...
...
SingletonConnection.ConnectionString = "Data Source=Vivek;Initial Catalog=Northwind;Integrated Security=SSPI;";
SingletonConnection singleConnection = SingletonConnection.GetInstance();
SqlConnection sqlConn = singleConnection.SqlConnection;
...
A useful tip posted by
Steven Swafford Just copy and paste the following into your text editor and save as a .reg file. Double click the file and now you have access to the VS.NET tools from any command window.
Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]"AutoRun"="\"%VS71COMNTOOLS%vsvars32.bat\""
Ildasm.exe can be a useful tool to review your assembly. It is located in the \Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\bin folder. Here are a couple of things you can do with it.
1) Search for hard-coded strings in your code:
Ildasm.exe yourcomponent.dll /text findstr ldstr2) Identify locations that might have boxing
overhead:
Ildasm.exe yourcomponent.dll /text findstr box
Ildasm.exe yourcomponent.dll /text findstr unbox