September 2007 Entries
To force a named pipes connection to your database, prepend the name in your connection string with "np:".
E.g.
<add key="my_conn_string" value="Data Source=np:(local)\SQL1; ....
To “enable” Intellisense for MSBuild projects ending with the extension “msbuild”:
1) 1) Add this registry key (no line break in the key):
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Editors\
{412B8852-4F21-413B-9B47-0C9751D3EBFB}\Extensions]"msbuild"=dword:00000029
2) Create a file called “test.msbuild” and then try to open it. Choose “Select program from list” and browse to VS2005 devenv.exe and check “Always use the selected”. Click ok. Once Visual Studio opens, you should have it! (Since the XSD for MSBuild is already “known” by Visual studio. Fyi – the file is located here:
\windows\Microsoft.NET\framework\v2.0.50727\Microsoft.Build.xsd
and
\Program Files\Microsoft Visual Studio 8\xml\Schemas\1033
there.
If you don't like using the .msbuild extension, you can change it. Just modify the registry key, changing "msbuild"...
You may run into an issue trying to close a created window in FireFox, this javascript usually does the trick on your close link:
window.open(’java script:window.close();’,'_self’,'’);
The call to FindAll:
myDerivedClass.FindAll(MyBaseClass.AnyWordInNameStartsWith<MyDerivedClass>(partialName));
Within MyBaseClass.cs:
public static Predicate<T> AnyWordInNameStartsWith<T>(string partialName) where T:MyBaseClass, new()
{
return delegate(T myClass)
{
partialName = partialName.ToLowerInvariant();
if (myClass.Name.ToLowerInvariant().StartsWith(partialName))
{
return true;
}
List<string> words = new List<string>();
string[] splWords = myClass.Name.ToLowerInvariant().Split(' ');
for (int i = 0; i < splWords.Length; i++)
{
words.Add(splWords[i]);
if (i > 0)
{
StringBuilder restOfName = new StringBuilder();
for (int j = i; j < splWords.Length; j++)
{
restOfName.Append(splWords[j]);
if (j < splWords.Length - 1)
{
restOfName.Append(" ");
}
...
In your java script::
var postBackElem;
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageLoadedHandler);
function BeginRequestHandler(sender, args)
{
postBackElem = args.get_postBackElement();
}
function PageLoadedHandler(sender, args)
{
var c = 'panels created: ';
var u = 'panels updated: ';
for(var i=0;i<args.get_panelsCreated().length;i++) {
c += args.get_panelsCreated()[i].id + ', ';
}
for(var i=0;i<args.get_panelsUpdated().length;i++) {
u += args.get_panelsUpdated()[i].id + ', ';
}
alert(c);
alert(u);
}
The September 2007 issue of TechNet Magazine is out on the website. Check out my IT Toolbox column here:
http://technet.microsoft.com/magazine/91c79f72-f88d-43d6-abb6-0e3cbc39b1e5
In this issue I covered:
xSQL Bundle Professional Edition Move SQL Server Databases
WinSSHD Enable More Secure Communication
USB Monitor Professional Monitor USB Activity
Virtual CloneDrive Manage Virtual Media
SharePoint Products and Technologies Administrator's Pocket Consultant (Book Review)