return new EmptyResult() VS return NULL

in ASP.NET MVC when my action will not return anything I use return new EmptyResult() or return null is there any difference? Answer You can return null. MVC will detect that and return an EmptyResult. MSDN: EmptyResult represents a result that doesn’t do anything, like a controller action returning null Source code of MVC. public … Read more

SignalR + posting a message to a Hub via an action method

I am using the hub- feature of SignalR (https://github.com/SignalR/SignalR) to publish messages to all subscribed clients: public class NewsFeedHub : Hub public void Send(string channel, string content) { Clients[channel].addMessage(content); } This works fine when calling “Send” via Javascript, but I would also like the web application to publish messages (from within an ASP.NET MVC action … Read more

Ansible – Print message – debug: msg=”line1 \n {{ var2 }} \n line3 with var3 = {{ var3 }}”

In Ansible (1.9.4) or 2.0.0 I ran the following action: – debug: msg=”line1 \n {{ var2 }} \n line3 with var3 = {{ var3 }}” $ cat roles/setup_jenkins_slave/tasks/main.yml – debug: msg=”Installing swarm slave = {{ slave_name }} at {{ slaves_dir }}/{{ slave_name }}” tags: – koba – debug: msg=”1 == Slave properties = fsroot[ {{ … Read more

Creating delegates manually vs using Action/Func delegates

Today I was thinking about declaring this: private delegate double ChangeListAction(string param1, int number); but why not use this: private Func<string, int, double> ChangeListAction; or if ChangeListAction would have no return value I could use: private Action<string,int> ChangeListAction; so where is the advantage in declaring a delegate with the delegate keyword? Is it because of … Read more

Modelling a permissions system

How would you model a system that handles permissions for carrying out certain actions inside an application? Answer Security models are a large (and open) field of research. There’s a huge array of models available to choose from, ranging from the simple: Lampson’s Access control matrix lists every domain object and every principal in the … Read more