Skip to content

Instantly share code, notes, and snippets.

View yallie's full-sized avatar

Alexey Yakovlev yallie

View GitHub Profile
@yallie
yallie / mono-windows-output.txt
Last active August 29, 2015 13:56
LogicalCallContext bug in Mono 3.2.x
Original thread: 1
Current thread: 3
Value is null
Current thread: 5
Value is null
Current thread: 5
Value is null
@yallie
yallie / test.cs
Created March 5, 2015 23:02
TcpEx bug #2414: disposing the host doesn't release the tcp port
// Tcp version works properly
// TcpEx version (commented lines) crashes
using System;
using System.Linq;
using Zyan.Communication;
using Zyan.Communication.Protocols.Tcp;
using Zyan.Communication.Security;
using Zyan.Communication.SessionMgmt;
@yallie
yallie / example.cs
Created May 20, 2015 12:45
Async/await example for Zyan Communication Framework
// Compile this code using: csc example.cs /r:Zyan.Communication.dll
// First run — starts server.
// Second run — starts client.
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zyan.Communication;
using Zyan.Communication.Protocols.Tcp;
@yallie
yallie / Hello.cs
Created November 24, 2012 18:17
Zyan «Hello, World» example
/* Server */
// Create component host named "ZyanDemo" and bind to TCP port 8080
var host = new ZyanComponentHost("ZyanDemo", 8080);
// Register component type and interface
host.RegisterComponent<IHelloWorldService, HelloWordService>();
/* Client */
@yallie
yallie / HelloZyanClient.cs
Last active October 13, 2015 04:38
Zyan «Hello, World» client
// Connect to server
var connection = new ZyanConnection("tcp://localhost:8080/ZyanDemo");
// Create HelloWorldService proxy
var proxy = connection.CreateProxy<IHelloWorldService>();
// Invoke method
proxy.SayHello("HelloWorld");
// Subscribe to a remote event
@yallie
yallie / HelloZyanServer.cs
Last active October 13, 2015 04:38
Zyan «Hello, World» server
// Create component host named "ZyanDemo" and bind to TCP port 8080
var host = new ZyanComponentHost("ZyanDemo", 8080);
// Register component type and interface
host.RegisterComponent<IHelloWorldService, HelloWorldService>();
@yallie
yallie / hashset.cs
Created February 22, 2013 06:35
HashSet<char>.Contains(c) versus string.Contains(c)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
struct Program
{
static void Main()
{
@yallie
yallie / hashset2.cs
Last active December 14, 2015 02:09
HashSet<char> benchmark, version #2
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
struct Program
{
static void Main()
{
@yallie
yallie / hashset3.cs
Created February 22, 2013 09:48
HashSet<char> benchmark, version #3.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
struct Program
{
static void Main()
{
@yallie
yallie / hashset4.cs
Created February 22, 2013 10:13
string vs HashSet<char>, version #4.
using System;
using System.Collections.Generic;
using System.Diagnostics;
struct Program
{
static void Main()
{
const int iterations = 100000;