This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var fsw = new FileSystemWatcher(@"c:\"){ | |
IncludeSubdirectories = true | |
}; | |
fsw.EnableRaisingEvents = true; | |
var created = Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(h=>fsw.Created+=h,h=>fsw.Created-=h); | |
var changed = Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(h=>fsw.Changed+=h,h=>fsw.Changed-=h); | |
var deleted = Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(h=>fsw.Deleted+=h,h=>fsw.Deleted-=h); | |
var renamed = Observable.FromEventPattern<RenamedEventHandler, FileSystemEventArgs>(h=>fsw.Renamed+=h,h=>fsw.Renamed-=h); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
All need the Microsoft.Diagnostics.Tracing.TraceEvent nuget package | |
Shows how you can both produce some simple ETW events (these are not written to the eventlog) | |
A couple of ways to consume said events. | |
1. using standard tooling like perfview, xperf, etc. | |
2. create your own EventListener class as demonstrated by ProducerAndSimpleListener, which allows you to do pretty much anything | |
3. listen in realtime as done in RealTimeListener | |
4. Others do similar things I believe like tx.windows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace EventStoreDTCFirstTry | |
{ | |
public class EventStoreDistributedTransaction | |
{ | |
private static readonly Guid ResourceManagerId = new Guid("F6049197-5B56-4C90-ACA9-39A2516C547A"); | |
private readonly EventStoreConnection _connection; | |
private readonly EventStoreTransaction _esTransaction; | |
public EventStoreDistributedTransaction(EventStoreConnection connection, string stream, int expectedVersion) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// stripped out some comments | |
foreach (var ag in _unitOfWork.GetChanges()){ | |
AggregateMetaData ag1 = ag; | |
var events = ag.Root.GetChanges().Select((o, i) => _serializer.Serialize(o, origEventId, srvcName, ag1.Identifier, i,metaData)).ToList(); | |
// taken out code that checks to make sure the events we write are not too big for GES | |
var t = _connection.AppendToStreamAsync(ag1.Identifier, ExpectedVersion.Any , events); | |
try | |
{ | |
t.Wait(); | |
if (t.IsFaulted) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# found the rss feed for the resolution i liked | |
$r=Invoke-WebRequest http://channel9.msdn.com/Shows/Windows-Azure-Friday/feed/wmvhigh | |
$nodes = [xml]$r.Content | % {$_.selectNodes("rss/channel/item/enclosure")} | |
$nodes.url | % { $dest=split-Path -leaf $_ ; Start-BitsTransfer -Source $_ -Destination $dest -Asynchronous} | |
Get-BitsTransfer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#$esCred = get-credential -UserName admin | |
<# Set automatic credentials - obviously just using the defaults#> | |
$username= "admin" | |
$password = "changeit" | |
$secstr = New-Object -TypeName System.Security.SecureString | |
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)} | |
$escred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr | |
<# | |
Need to Reset the checkpoint for the RequestedAddition -> ContractAccepted service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[parameter(Mandatory=$true,ValueFromPipeline=$true)] | |
[System.IO.FileInfo] $inputFile, | |
[Parameter(Mandatory=$true)] | |
[String] $searchPattern, | |
[Parameter(Mandatory=$true)] | |
[String] $replaceText | |
) | |
Begin{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module VisualStudioProjectModifiers | |
$projs = dir -Recurse -filter *.csproj | |
# lookup of AssemblyName to projectFile | |
$lookup = @{} | |
$projs | % { | |
select-string '<AssemblyName>(.*)</AssemblyName>' $_.FullName } | %{ | |
$lookup[$_.Matches.Groups[1].value] = $_.Path | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var l = new FileModel[] { new FileModel() { Filename = "pizza is great" }, | |
new FileModel {Filename = "MarkyMark"}, | |
new FileModel {Filename = "JeffyJeff"} | |
}.AsQueryable(); | |
var subStrings = new string[] {"is", "pizza","pizza","pizza","Mark"}; | |
l.MultiValueContainsAny(subStrings, t=>t.Filename).Dump("Filters to"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Query Kind="Program"> | |
<Connection> | |
<ID>e8afa357-aae4-40ae-a4ad-e4783f38f696</ID> | |
<Server>rdbtest2012</Server> | |
<Database>PackageMonitorReadModel_SGSpike-Main</Database> | |
<ShowServer>true</ShowServer> | |
</Connection> | |
<NuGetReference>EventStore.Client</NuGetReference> | |
<NuGetReference>Newtonsoft.Json</NuGetReference> | |
<NuGetReference>Rx-Linq</NuGetReference> |
OlderNewer