- Uri format
- Single node
tcp://user:password@myserver:11234
- DNS
discover://user:password@myserver:1234
- Simplest possible
eventstoreConnection.Create(Uri uri)
- Single node
- ConnectionSettings vs Connection Strings
- Settings = fluent API (show example)
- Connection string = Newer, familiar format, can store in config, probably better?
"ConnectTo=tcp://admin:changeit@localhost:1113; HeartBeatTimeout=500"
This file contains hidden or 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
using System.Text; | |
using EventStore.Client; | |
var settings = EventStoreClientSettings.Create("esdb+discover://localhost:2113?tls=false"); | |
var esClient = new EventStoreClient(settings); | |
// Give us something to catch up | |
await WriteEvents(1000); | |
ulong lastEventPosition = 0; | |
await CreateSubscription(); |
This file contains hidden or 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
// Welcome! require() some modules from npm (like you were using browserify) | |
// and then hit Run Code to run your code on the right side. | |
// Modules get downloaded from browserify-cdn and bundled in your browser. | |
var gs1js = require("gs1js") | |
var code = '0105000471007015' // 01 GTIN | |
+ '2110001136169476' + String.fromCharCode(29) // 21 Serial | |
//Variable length fields (like this serial number) |
This file contains hidden or 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
rich@Richs-MacBook-Pro [01:59:50] [~/fs-test] | |
-> % oi --logging init | |
9,9 - Assigned logger | |
49,39 - Parsing profiles | |
49,0 - Initializing application | |
61,12 - Initializing interpreters | |
65,3 - Adding interpreter: mono for .exe | |
65,0 - Getting definition builder | |
66,1 - Building definitions | |
92,27 - Adding item init |
This file contains hidden or 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
using (var context = new PrincipalContext(ContextType.Domain, "PHARMAXO.local", "OU=Corsham,dc=pharmaxo,dc=local")) | |
{ | |
var qbeUser = new UserPrincipal(context) { Enabled = true }; | |
using (var searcher = new PrincipalSearcher(qbeUser)) | |
{ | |
var results = searcher.FindAll().Select(r => r.GetUnderlyingObject() as DirectoryEntry); | |
var names = results.Where(r => r.Properties["title"].Value != null && ((string)r.Properties["title"].Value) != "") | |
.Select(r => String.Format("{0} {1}", r.Properties["givenName"].Value, r.Properties["sn"].Value)) | |
.OrderBy(r => r); | |
foreach(var name in names) |
This file contains hidden or 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
"http://batchesv3-test/deviations" | |
{ | |
"Description": "A woftam occurred!", | |
"DeviationType": "Batch", | |
"DeviationReference": "14D0005", | |
"UserName": "Richard Knight" | |
} |
This file contains hidden or 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
public class EventDispatcher | |
{ | |
private EventHandlerRegistry _registry; | |
public EventDispatcher(EventHandlerRegistry reg) | |
{ | |
_registry = reg; | |
} | |
public void Dispatch(object e) |
This file contains hidden or 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
//install nginx | |
sudo apt-get update | |
sudo apt-get install nginx | |
--------- | |
//make a folder for our cache to live in | |
sudo mkdir /var/www |
This file contains hidden or 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
using System; | |
using System.Net; | |
using System.Text; | |
using System.Threading.Tasks; | |
using EventStore.ClientAPI; | |
using Microsoft.AspNet.SignalR; | |
using Microsoft.Owin.Hosting; | |
using Owin; | |
namespace EventStoreSignalR |
This file contains hidden or 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
using System; | |
using System.Net; | |
using System.Text; | |
using EventStore.ClientAPI; | |
using Newtonsoft.Json; | |
using SimpleJson; | |
using SuperSocket.ClientEngine; | |
using WebSocket4Net; | |
namespace websockets_test |