http://support.microsoft.com/kb/981741
Sunday, January 9, 2011
Visual Studio 2010 runs faster when the Windows Automation API 3.0 is installed
Applications that use Windows Automation APIs can significantly decrease Microsoft Visual Studio IntelliSense performance if Windows Automation API 3.0 is not installed. For example, the Windows pen and touch services can significantly decrease Visual Studio IntelliSense performance if Windows Automation API 3.0 is not installed.
http://support.microsoft.com/kb/981741
http://support.microsoft.com/kb/981741
Sunday, January 2, 2011
T-SQL Copy database diagrams to another database
Unlike stored procedure, functions, tables, views, ... MS Sql server doesn't have an easy way to script or create database diagrams. It keeps all the diagrams in [sysdiagrams] system table.
SELECT *
FROM sysdiagrams
USE newDb
GO
INSERT INTO sysdiagrams
([name], pricipal_id, version, definition)
SELECT [name], pricipal_id, version, definition
FROM #tempDiagrams

SELECT *
FROM sysdiagrams
USE newDb
GO
INSERT INTO sysdiagrams
([name], pricipal_id, version, definition)
SELECT [name], pricipal_id, version, definition
FROM #tempDiagrams
T-SQL Copy database diagrams to another database
Saturday, December 25, 2010
Greenshot - a free screenshot tool

Greenshot is a light-weight screenshot software tool for Windows.
Greenshot was published under GPL, i.e. this software can be downloaded and used free of charge, even in a commercial environment.
Greenshot - a free screenshot tool
Sunday, December 19, 2010
Smallest Dot Net
Get smallest .Net framework possible!
An interesting one page web site can help you to find out which version of .NET has been installed in your system. It also provide details and estimate about the size of download which makes your system up to date with latest .NET version.

An interesting one page web site can help you to find out which version of .NET has been installed in your system. It also provide details and estimate about the size of download which makes your system up to date with latest .NET version.
Smallest Dot Net
Sunday, November 14, 2010
Free ebook: Programming Windows Phone 7

Charles Petzold wrote the book in 24 chapters, you can download the e-book version and enjoy learning how to program for Windows Phone 7 from here.
Free ebook: Programming Windows Phone 7
Sunday, September 19, 2010
Core JavaScript files in the Microsoft AJAX Library
The JavaScript files provide client side functionality for your web pages. Three JavaScript files are stored as resources in the System.Web.Extensions assembly.
At runtime, the HTTP handler ScriptResourceHandler loads the files, caches them for future use, compresses them, and sends them to the web browser when they’re requested:
* MicrosoftAjax.js, contains most of the Microsoft AJAX Library’s functionality, the browser compatibility layer, the core JavaScript classes, and the Base Class Library.
* MicrosoftAjaxTimer.js, contains classes to support the Timer server control. This control enables you to update either part of or an entire web page at regular intervals,
* MicrosoftAjaxWebForms.js, contains classes to support partial page rendering, this functionality allows portions of a page to be updated asynchronously.

At runtime, the HTTP handler ScriptResourceHandler loads the files, caches them for future use, compresses them, and sends them to the web browser when they’re requested:
* MicrosoftAjax.js, contains most of the Microsoft AJAX Library’s functionality, the browser compatibility layer, the core JavaScript classes, and the Base Class Library.
* MicrosoftAjaxTimer.js, contains classes to support the Timer server control. This control enables you to update either part of or an entire web page at regular intervals,
* MicrosoftAjaxWebForms.js, contains classes to support partial page rendering, this functionality allows portions of a page to be updated asynchronously.
Core JavaScript files in the Microsoft AJAX Library
Sunday, June 13, 2010
Visual Source Safe - Recursive get items
The following codes work around Visual Source Safe (VSS), it's to get latest items from a project path in VSS.
using System;
using System.IO;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Configuration;
using Microsoft.VisualStudio.SourceSafe.Interop;
namespace VssDiff
{
public class VssItem
{
#region Fields
private string cnStr;
private string dtaTblName;
#endregion
#region Properties
public string CnStr { get { return cnStr; } set { cnStr = value; } }
public string DtaTblName {
get { return dtaTblName; }
set { dtaTblName = value; }
}
#endregion
public DataSet VssDataSet;
public VssItem()
{
VssDataSet = new DataSet();
CnStr =
ConfigurationManager.ConnectionStrings["cnStr"].ConnectionString;
DtaTblName = "VSS";
}
public bool VssDataTableAdd()
{
bool retVal = false;
string errMsg = string.Empty;
if ( VssDataSet == null )
{
errMsg = "Data Set is Null, add new data table failed.";
MessageBox.Show( errMsg, "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error );
return retVal;
}
DataTable vssDtaTbl = new DataTable(DtaTblName);
vssDtaTbl.Columns.Add("vssItemEnv",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemName",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemType",
System.Type.GetType("System.Int32"));
vssDtaTbl.Columns.Add("vssItemVer",
System.Type.GetType("System.Int32"));
vssDtaTbl.Columns.Add("vssItemSpec",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemLabel",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemComment",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemDate",
System.Type.GetType("System.DateTime"));
VssDataSet.Tables.Add(vssDtaTbl);
retVal = true;
return retVal;
}
public void VssGetLatest(string vssPrjPath)
{
VSSItem mainVssItem;
string userId = Environment.UserName;
Microsoft.VisualStudio.SourceSafe.Interop.VSSDatabaseClass
vssDb = new VSSDatabaseClass();
vssDb.Open(@"\\MyServer\VSS\srcsafe.ini", userId, "");
vssDb.CurrentProject = vssPrjPath; // "$/MyApp/SOURCE";
mainVssItem = vssDb.get_VSSItem(vssDb.CurrentProject, false);
foreach (VSSItem vssSubItem in mainVssItem.get_Items(false))
{
VssItemSave(vssDb, vssSubItem);
if (vssSubItem.Type == (int)VSSItemType.VSSITEM_PROJECT)
if (vssSubItem.Spec.Contains("MyApp"))
VssChildGetLatest(vssDb, vssSubItem);
Application.DoEvents();
}
vssDb.Close();
}
private void VssChildGetLatest(
VSSDatabaseClass vssDb,
VSSItem vssItm)
{
try
{
VSSItem vssChildItem = vssDb.get_VSSItem(vssItm.Spec, false);
foreach (VSSItem vssSubItem in vssChildItem.get_Items(false))
{
VssItemSave(vssDb, vssSubItem);
if (vssSubItem.Type == (int)VSSItemType.VSSITEM_PROJECT)
if (vssSubItem.Spec.Contains("MyApp"))
VssChildGetLatest(vssDb, vssSubItem);
Application.DoEvents();
}
}
catch { }
}
public bool VssItemSave(VSSDatabaseClass vssDb, VSSItem vssItm)
{
bool retVal = true;
try
{
DataRow vssItmDtaRow = VssDataSet.Tables[DtaTblName].NewRow();
vssItmDtaRow["vssItemEnv"] = DtaTblName;
vssItmDtaRow["vssItemName"] = vssItm.Name;
vssItmDtaRow["vssItemType"] = vssItm.Type;
vssItmDtaRow["vssItemVer"] = vssItm.VersionNumber;
vssItmDtaRow["vssItemSpec"] = vssItm.Spec;
foreach (VSSVersion vssVersion in vssItm.get_Versions(0))
{
if (vssVersion.VersionNumber == vssItm.VersionNumber)
{
vssItmDtaRow["vssItemLabel"] = vssVersion.Label;
vssItmDtaRow["vssItemComment"] = vssVersion.Comment;
vssItmDtaRow["vssItemDate"] = vssVersion.Date;
break;
}
}
VssDataSet.Tables[dtaTblName].Rows.Add(vssItmDtaRow);
}
catch (Exception ex)
{
retVal = false;
MessageBox.Show(ex.Message);
}
return retVal;
}
}
}

using System;
using System.IO;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Configuration;
using Microsoft.VisualStudio.SourceSafe.Interop;
namespace VssDiff
{
public class VssItem
{
#region Fields
private string cnStr;
private string dtaTblName;
#endregion
#region Properties
public string CnStr { get { return cnStr; } set { cnStr = value; } }
public string DtaTblName {
get { return dtaTblName; }
set { dtaTblName = value; }
}
#endregion
public DataSet VssDataSet;
public VssItem()
{
VssDataSet = new DataSet();
CnStr =
ConfigurationManager.ConnectionStrings["cnStr"].ConnectionString;
DtaTblName = "VSS";
}
public bool VssDataTableAdd()
{
bool retVal = false;
string errMsg = string.Empty;
if ( VssDataSet == null )
{
errMsg = "Data Set is Null, add new data table failed.";
MessageBox.Show( errMsg, "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error );
return retVal;
}
DataTable vssDtaTbl = new DataTable(DtaTblName);
vssDtaTbl.Columns.Add("vssItemEnv",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemName",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemType",
System.Type.GetType("System.Int32"));
vssDtaTbl.Columns.Add("vssItemVer",
System.Type.GetType("System.Int32"));
vssDtaTbl.Columns.Add("vssItemSpec",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemLabel",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemComment",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemDate",
System.Type.GetType("System.DateTime"));
VssDataSet.Tables.Add(vssDtaTbl);
retVal = true;
return retVal;
}
public void VssGetLatest(string vssPrjPath)
{
VSSItem mainVssItem;
string userId = Environment.UserName;
Microsoft.VisualStudio.SourceSafe.Interop.VSSDatabaseClass
vssDb = new VSSDatabaseClass();
vssDb.Open(@"\\MyServer\VSS\srcsafe.ini", userId, "");
vssDb.CurrentProject = vssPrjPath; // "$/MyApp/SOURCE";
mainVssItem = vssDb.get_VSSItem(vssDb.CurrentProject, false);
foreach (VSSItem vssSubItem in mainVssItem.get_Items(false))
{
VssItemSave(vssDb, vssSubItem);
if (vssSubItem.Type == (int)VSSItemType.VSSITEM_PROJECT)
if (vssSubItem.Spec.Contains("MyApp"))
VssChildGetLatest(vssDb, vssSubItem);
Application.DoEvents();
}
vssDb.Close();
}
private void VssChildGetLatest(
VSSDatabaseClass vssDb,
VSSItem vssItm)
{
try
{
VSSItem vssChildItem = vssDb.get_VSSItem(vssItm.Spec, false);
foreach (VSSItem vssSubItem in vssChildItem.get_Items(false))
{
VssItemSave(vssDb, vssSubItem);
if (vssSubItem.Type == (int)VSSItemType.VSSITEM_PROJECT)
if (vssSubItem.Spec.Contains("MyApp"))
VssChildGetLatest(vssDb, vssSubItem);
Application.DoEvents();
}
}
catch { }
}
public bool VssItemSave(VSSDatabaseClass vssDb, VSSItem vssItm)
{
bool retVal = true;
try
{
DataRow vssItmDtaRow = VssDataSet.Tables[DtaTblName].NewRow();
vssItmDtaRow["vssItemEnv"] = DtaTblName;
vssItmDtaRow["vssItemName"] = vssItm.Name;
vssItmDtaRow["vssItemType"] = vssItm.Type;
vssItmDtaRow["vssItemVer"] = vssItm.VersionNumber;
vssItmDtaRow["vssItemSpec"] = vssItm.Spec;
foreach (VSSVersion vssVersion in vssItm.get_Versions(0))
{
if (vssVersion.VersionNumber == vssItm.VersionNumber)
{
vssItmDtaRow["vssItemLabel"] = vssVersion.Label;
vssItmDtaRow["vssItemComment"] = vssVersion.Comment;
vssItmDtaRow["vssItemDate"] = vssVersion.Date;
break;
}
}
VssDataSet.Tables[dtaTblName].Rows.Add(vssItmDtaRow);
}
catch (Exception ex)
{
retVal = false;
MessageBox.Show(ex.Message);
}
return retVal;
}
}
}
Visual Source Safe - Recursive get items
Sunday, May 23, 2010
Visual Studio - Search order for assemblies
Search order for assemblies when building a project of a solution in Visual Studio:
* Files from the current project indicated by {CandidateAssemblyFiles}.
* $(ReferencePath) property that comes from .user/targets file.
* $(HintPath) indicated by reference item.
* Target framework directory.
* Directories found in registry that uses AssemblyFoldersEx Registration.
* Registered assembly folders, indicated by {AssemblyFolders}.
* $(OutputPath) or $(OutDir)
* GAC
If the desired assembly is found by HintPath, but an alternate assembly can be found using ReferencePath, it will prefer the ReferencePath to the HintPath one.

* Files from the current project indicated by {CandidateAssemblyFiles}.
* $(ReferencePath) property that comes from .user/targets file.
* $(HintPath) indicated by reference item.
* Target framework directory.
* Directories found in registry that uses AssemblyFoldersEx Registration.
* Registered assembly folders, indicated by {AssemblyFolders}.
* $(OutputPath) or $(OutDir)
* GAC
If the desired assembly is found by HintPath, but an alternate assembly can be found using ReferencePath, it will prefer the ReferencePath to the HintPath one.
Visual Studio - Search order for assemblies
Visual Studio - Specify assemblies location by registry key
- Open registry by Regedit
- Search for following key (Depend on VS version use the correct number to point to this key in registry):
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\AssemblyFolders]
- Set the value of the key [AssemblyFolders] of type REG_SZ to the path of your assemblies.

- Search for following key (Depend on VS version use the correct number to point to this key in registry):
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\AssemblyFolders]
- Set the value of the key [AssemblyFolders] of type REG_SZ to the path of your assemblies.
Visual Studio - Specify assemblies location by registry key
Subscribe to:
Posts (Atom)

