mbm - 7/19/2008 7:21:00 PM
To return the latest record (one record only) from data base table where one of the fields is in Date/Time format:

SELECT TOP 1 * FROM table_name ORDER BY date_time_column_name DESC


Notes:

* for ORACLE instead of TOP 1,  ROWNUM shall be used

* the query may return NULL value - suitable exception handling must be provided

Programming in C# using data binding and data view

DataView dv = new DataView(DataSet_name.table_name);

string sort = "Date_column_name DESC";

dv.Sort = sort;

DateTime rdt;

if (dv.Count > 0) rdt = Convert.ToDateTime(dv[0]["Date_column_name"]);

Do not forget to fill the corresponding table adapters before creating data view.

TableAdapter.Fill(DataSet_name.table_name);

and only then

 

DataView dv = new DataView(DataSet_name.table_name);


mbm - 2/11/2008 5:19:00 PM
C# code:

using System.DirectoryServices.AccountManagement;

string userName = SystemInformation.UserName;

string UDN = SystemInformation.UserDomainName;

string domainUser = UDN + "\\" + userName;

PrincipalContext pc = new PrincipalContext(ContextType.Domain);

UserPrincipal user = UserPrincipal.FindByIdentity(pc, IdentityType.SamAccountName, domainUser);

GroupPrincipal group = GroupPrincipal.FindByIdentity(pc, "Domain_Group_Name");

bool is_member = user.IsMemberOf(group);

mbm - 2/16/2008 6:11:00 PM
Detailed instructions by Paul Keister in his excellent article

Adaptive Connection Strings for Windows Forms Applications

in brief

the connection string property is set read only in the Settings.Designer.cs class:

public string MyAppConnectionString {
get {
return ((string)(this["MyAppConnectionString"]));
}
}

However, all application settings are accessible in read/write mode by using the indexer directly.  The following code demonstrates how to modify the connection string using this approach:

//change the application connection string
Properties.Settings.Default["MyAppConnectionString"] = strCnString;

//debug:verify that this really did work
Console.WriteLine(Properties.Settings.Default.MyAppConnectionString);

mbm - 5/10/2008 6:14:00 PM
General Exclusions for All Windows Platforms
  • Pagefile.sys
  • *.pst
  • %systemroot%\System32\Spool (replace %systemroot% with actual directory)
  • %systemroot%\SoftwareDistribution\Datastore (replace %systemroot% with actual directory)
  • %allusersprofile%\NTUser.pol
  • %systemroot%\system32\GroupPolicy\registry.pol

Microsoft Active Directory Domain Controller

  • : \ WINNT \ SYSVOL
  • : \ WINNT \ NTDS
  • : \ WINNT \ ntfrs
  • : \ WINNT \ system32 \ dhcp
  • : \ WINNT \ system32 \ dns

Microsoft IIS Server

  • Web Server log files should be excluded from scanning. By default, IIS logs are saved in
  • : \ WINNT \ system32 \ LogFiles
  • : \ WINNT \ system32 \ IIS Temporary Compressed Files

Microsoft SQL Server

Because scanning may hinder performance, large databases should not be scanned. Since Microsoft SQL Server databases are dynamic, exclude the directory and backup folders from the scan list. If it is necessary to scan database files, a scheduled task can be created to scan them during off-peak hours.

  • SQL Server data files. These files usually have one of the following file name extensions: .mdf, .ldf, .ndf (: \ Program Files \ Microsoft SQL Server \ MSSQL \ Data)
  • SQL Server backup files. These files frequently have one of the following file name extensions:  .bak, .trn
  • Full-Text catalog files
  • The directory that holds Analysis Services data
  • The directory that holds Analysis Services temporary files that are used during Analysis Services processing
  • Analysis Services backup files
  • The directory that holds Analysis Services log files
  • Q:\ (if using SQL Clustering)

Cluster Servers

  • Q:\ (Quorum drive)
  • C:\Windows\Cluster

Microsoft Sharepoint Portal Server

  • : \ Program Files \ SharePoint Portal Server
  • : \ Program Files \ Common Files \ Microsoft Shared \ Web Storage System
  • : \ Windows \ Temp \ Frontpagetempdir
  • M:\

Microsoft Systems Management Server (SMS)

  • SMS \ Inboxes \ SMS_Executive Thread Name
  • SMS_CCM \ ServiceData
  • Microsoft Operations Manager Server (MOM)
  • : \ Documents and Settings \ All Users \ Application Data \ Microsoft \ Microsoft
  • Operations Manager
  • : \ Program Files \ Microsoft Operations Manager 2005

Microsoft Internet Security and Acceleration Server (ISA)

  • : \ Program Files \ Microsoft ISA Server \ ISALogs
  • : \ Program Files \ Microsoft SQL Server \ MSSQL$MSFW \ Data

Microsoft Windows System Update Server (WSUS)

  • \ WSUS
  • \ WsusDatabase

 Hyper-V host server

  • Default virtual machine configuration directory (C:\ProgramData\Microsoft\Windows\Hyper-V)
  • Custom virtual machine configuration directories
  • Default virtual hard disk drive directory (C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks)
  • Custom virtual hard disk drive directories
  • Snapshot directories
  • Vmms.exe (Note: May need to be configured as process exclusions within the antivirus software)
  • Vmwp.exe (Note: May need to be configured as process exclusions within the antivirus software)

Additionally, when use Live Migration together with Cluster Shared Volumes on Windows Server 2008 R2, exclude the CSV path "C:\Clusterstorage" and all its subdirectories.


mbm - 5/10/2008 6:34:00 PM
Article on Microsoft Tech Net with the latest information for the supported number of virtual processors and integration services when running different guest operating systems (virtual machines) on Windows Server 2008 R2 Hyper-v

http://technet.microsoft.com/en-us/library/cc794868(WS.10).aspx

Quick data

Windows Server 2008 (all versions, including R2 and SP1) - 1,2,3 or 4 Virtual processors (vCPU)

Windows Server 2003 (all versions, inluding R2) - 1 or 2 virtual processors

Windows 2000 Server with Service Pack 4 - only one (1) virtual processor

Windows 7 all versions including SP1 - 1,2,3 or 4 virtual processors

Windows Vista - 1 or 2 vCPUs

Windows XP SP3 - 1 or 2 vCPUs

Windows XP SP2 - 1 vCPU only, Windows XP x64 Edition with SP2  - 1 or 2 virtual processors

mbm - 4/17/2008 6:12:00 PM
To enable or to disable hyper-threading on virtualization hosts?

There are many articles, documents and discussions in Internet and there is no definitive answer about the hyper-threading usage in virtualized environment.

About Hyper-Threading

A processor architecture feature that allows a single processor to execute multiple independent threads simultaneously. Hyper-threading was added to Intel's Xeon and Pentium® 4 processors. Intel uses the term “package” to refer to the entire chip, and “logical processor” to refer to each hardware thread. Also called symmetric multithreading (SMT).

To me the following HP document gives most complete description and recomendations to help taking the best decision for each particular case.

Best Practices When Deploying Microsoft Windows Server 2008 R2 or Microsoft Windows Server 2008 SP2 on HP ProLiant DL980 G7 Servers

Hyper-threading settings recommended for optimal performance:

Enabled – for systems running Windows Server 2008 R2 or Windows Server 2008 R2 SP1, if the application supports more than 64 processors, and if the application benefits from the additional logical processors

Disabled – for systems running Windows 2008 SP2, or Windows Server 2008 R2 Hyper-V, when there are more than 64 logical processors

Performance testing may indicate a zero performance gain when enabling hyper-threading, and in some cases, even degraded performance. HP always recommends that you test your workloads with hyper-threading both ON and OFF. Whether or not the workload or custom application supports more than 64 processors, it is always good practice to test and benchmark these configurations.

From the same document

Hyper-threading refers to Intel’s proprietary technology for increasing parallel computational power (processor multi-tasking) by allowing the OS to see and address each physical processor core as if it were 2 virtual processors. It also enables the OS and applications to share work between those 2 virtual processors whenever possible, thereby making use of resources that would otherwise sit idle.

Performance Best Practices for VMware vSphere™ 5.0 sugests

Make sure hyper-threading is enabled in the BIOS for processors that support it.

Hyper-Threading

  • Hyper-threading technology (sometimes also called simultaneous multithreading, or SMT) allows a single physical processor core to behave like two logical processors, essentially allowing two independent threads to run simultaneously. Unlike having twice as many processor cores—that can roughly double performance—hyper-threading can provide anywhere from a slight to a significant increase in system performance by keeping the processor pipeline busier.

If the hardware and BIOS support hyper-threading, ESXi automatically makes use of it. For the best performance we recommend that you enable hyper-threading ...

  • When ESXi is running on a system with hyper-threading enabled, it assigns adjacent CPU numbers to logical processors on the same core. Thus CPUs 0 and 1 are on the first core, CPUs 2 and 3 are on the second core, and so on.

ESXi systems manage processor time intelligently to guarantee that load is spread smoothly across all physical cores in the system. If there is no work for a logical processor it is put into a halted state that frees its execution resources and allows the virtual machine running on the other logical processor on the same core to use the full execution resources of the core.

Be careful when using CPU affinity on systems with hyper-threading. Because the two logical processors share most of the processor resources, pinning vCPUs, whether from different virtual machines or from a single SMP virtual machine, to both logical processors on one core (CPUs 0 and 1, for example) could cause poor performance.

  • ESXi provides configuration parameters for controlling the scheduling of virtual machines on hyper-threaded systems (Edit virtual machine settings > Resources tab > Advanced CPU). When choosing hyper-threaded core sharing choices, the Any option (which is the default) is almost always preferred over None.

The None option indicates that when a vCPU from this virtual machine is assigned to a logical processor, no other vCPU, whether from the same virtual machine or from a different virtual machine, should be assigned to the other logical processor that resides on the same core. That is, each vCPU from this virtual machine should always get a whole core to itself and the other logical CPU on that core should be placed in the halted state. This option is like disabling hyper-threading for that one virtual machine.

For nearly all workloads, custom hyper-threading settings are not necessary...

And finally if not decided yet, note the followin from RemoteFX installation guide on HP servers

IMPORTANT

RemoteFX features require both Hyper-V and Hyper-threading enabled at the BIOS.