CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of Diagnostic
XML
<system.diagnostics>
      <sources>
        <source name="TraceSourceApp"
          switchName="sourceSwitch"
          switchType="System.Diagnostics.SourceSwitch">
          <listeners>
            <add name="console"
              type="System.Diagnostics.ConsoleTraceListener">
              <filter type="System.Diagnostics.EventTypeFilter"
                initializeData="Warning"/>
by bnaya   November 03, 2011 @ 12:25am
57 Views
no comments
 
C#
private static TraceSource mySource =
            new TraceSource("TraceSourceApp");
static void Main(string[] args)
{
    mySource.TraceEvent(TraceEventType.Error, 1, "Error message.");
 
    // Change the event type for which tracing occurs.
    // The console trace listener must be specified 
    // in the configuration file. First, save the original
    // settings from the configuration file.
by bnaya   November 03, 2011 @ 12:24am
75 Views
no comments
 
#requires get-interface from http://www.nivot.org/2009/03/26/PowerShell20CTP3ModulesInPracticeNETInterfaces.aspx
# this needs to be program files x86 if in 64 bit context
$runtimeDir="$($env:ProgramFiles)\Inishtech SLP Code Protector"
add-type -path "$runtimeDir\Microsoft.Licensing.Runtime2.0.DLL"
#NB if you leave this empty, you'll only see the memory store
$shortCode = "abc12"
$r = new-object Microsoft.Licensing.SLMRuntime $shortCode
$ls = get-interface $r.LicenseStores ([Microsoft.Licensing.ISLMLicenseStores])
$localStores=$ls.MachineStore
$localStores | %{get-interface $_ ([Microsoft.Licensing.ILicenseStore])}
149 Views
no comments
 
C#
const string PC_CATEGORY = "_Tmp";
const string PC_NAME = "_Tmp";
 
if (!PerformanceCounterCategory.Exists(PC_CATEGORY))
{
    CounterCreationDataCollection data = new CounterCreationDataCollection();
    CounterCreationData counter = new CounterCreationData(PC_NAME, "", PerformanceCounterType.NumberOfItems32);
    var pcCategory = PerformanceCounterCategory.Create(PC_CATEGORY, "", PerformanceCounterCategoryType.MultiInstance, data);
 
    data.Add(counter);
by bnaya   February 09, 2011 @ 12:45am
177 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate