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
$(function () { | |
$('span.field-validation-valid, span.field-validation-error').each(function () { | |
$(this).addClass('help-block col-xs-12 col-sm-reset inline'); | |
}); | |
$('.validation-summary-errors').each(function () { | |
$(this).addClass('alert'); | |
$(this).addClass('alert-error'); | |
$(this).addClass('alert-block'); |
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
var dataArguments = ['args1','arg2','arg3','arg4']; | |
var bucket =[]; | |
$.when.apply($,$.map(dataArguments, function(arg){ | |
//here you setup and return an ajax request | |
//for example | |
var ajaxData = {term:arg, somethingelse:0}; | |
return $.ajax({ |
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
public class LogAttribute : ActionFilterAttribute { | |
private IDictionary<string, object> parameters; | |
private string description; | |
public LogAttribute(string description) { | |
this.description = description; | |
} | |
public override void OnActionExecuting(ActionExecutingContext filterContext) { | |
parameters = filterContext.ActionParameters; |
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
system = ActorSystem.Create("myAkkaSystem"); | |
var coordinator = system.ActorOf<WorkCoordinatorActor>("workcoordinator"); | |
bus = RabbitHutch.CreateBus("host=localhost"); | |
bus.Subscribe<CdrRecieved>("<mysubId>", message => { | |
var result = coordinator.Ask<WorkCompleted>(new StartWorkFor() {Details = message}).Result; | |
//do something with it | |
}); |
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
coordinatorActor.Ask<string>(new JuleeDoTheThing()); | |
//meanwhile in the coordinatorActor.. | |
//.. | |
Receive<JuleeDoTheThing>(message => { | |
_askParent = Context.Sender; | |
childActor.Tell(new DoSomething()); |
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
using System; | |
using Akka.Actor; | |
namespace AkkaAsyncAwait | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var system = ActorSystem.Create("MySystem"); |
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
//this is with the easynetq librabry but could just as easily be anything else. | |
rabbitBus.Subscribe<MyMessageType>(subscriptionId, message => { | |
Log.Debug("message from rabbitmq received"); | |
//this works! because of how Ask works (it creates a fake actor that is passed as sender behind the scenes) | |
var result = workers.Ask<WorkCompleted>(new StartWorkFor() {Details = message}).Result; | |
}); | |
//however this... |
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
class Program | |
{ | |
static void Main(string[] args) { | |
var system = ActorSystem.Create("failboat"); | |
var actor = system.ActorOf(Props.Create(() => new ParentActor())); | |
actor.Tell(5); //this will fail | |
actor.Tell("This message will work"); |
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
public class WerkbonAggregate { | |
private WerkbonModel _state; | |
private List<object> _uncommittedEvents = new List<object>(); | |
public WerkbonAggregate(WerkbonModel state) { | |
_state = state; | |
} | |
public void StartWerkzaamHeden(DateTime gestartOp){ |
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
//Usefull for consumer/producer processing where you keep track of how many work you have served up in the producer | |
//and call Wait with that amount | |
//then consumer will call Hit to signal some work has been completed. | |
//producer will block on Wait until consumer has catched up | |
public class Throttler { | |
private AutoResetEvent resetEvent = new AutoResetEvent(false); | |
private int counter; | |
private int throttleAmount; |
OlderNewer