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
/// <summary> | |
/// These extensions provide resilient options for linking to cut down on boilerplate | |
/// They provide a null link for each real link, meaning that there is a block available which will discard messages | |
/// This behaivour is only really useful with a predicate; otherwise all blocks will be dropped | |
/// A default predicate is supplied (this may be dangerous if the caller does not understand the default behaivour?) | |
/// </summary> | |
public static class ResilientExtensions { | |
public static IEnumerable<IDisposable> ResilientLinkTo<TOutput>(this ISourceBlock<TOutput> source, ITargetBlock<TOutput> target) { | |
var link = source.LinkTo(target, x => x != null); | |
return GenerateNullLink(source, link); |
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
var MyApp = angular.module('MyApp'); | |
MyApp.factory('msgBus', ['$rootScope', function($rootScope) { | |
var msgBus = {}; | |
msgBus.emitMsg = function(msg, data) { | |
data = data || {}; | |
$rootScope.$emit(msg, data); | |
}; | |
msgBus.onMsg = function(msg, func, scope) { | |
var unbind = $rootScope.$on(msg, func); | |
if (scope) { |
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
// Asynchronous Client Socket Example | |
// http://msdn.microsoft.com/en-us/library/bew39x2a.aspx | |
using System; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Threading; | |
using System.Text; | |
// State object for receiving data from remote device. |