Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Feb 1, 2016

Configure ASP.NET SignalR in a web farm


I had a problem after I put into production a Visual Studio project with SignalR library.

In localhost every call seemed to be right but after the publishing step, some random request returned me an http error. After some google search I found that the problem was that the site is published in a web farm with 7 differents servers. In this case could happen that the first call is send from one server and managed from another server in the farm.

Every server has its encryption and decryption own code and if you want SignalR calls return a valid http status you should share these keys from the servers in the farm. So for each server in the farm open IIS and go to Sites and single click in the site where SignalR is used. In the central panel now go to Machine Key and double click.

Uncheck “Automatically generate at runtime” and “Generate a unique key for each application” and put a valid unique validation Key and a valid unique decryption key in the text boxes.

Look at the picture below, you should have something similar to this.

[Excerpted from: http://nextstepblog.altervista.org/configure-asp-net-signalr-in-web-farm/?doing_wp_cron=1454300698.7938909530639648437500]



Other Important Links:

http://www.asp.net/signalr/overview/performance/scaleout-with-sql-server

http://www.tugberkugurlu.com/archive/scaling-out-signalr-with-a-redis-backplane-and-testing-it-with-iis-express

http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx

Jul 2, 2013

Popular Javascript Frameworks


Knockout.js

Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model. Any time you have sections of UI that update dynamically (e.g., changing depending on the user’s actions or when an external data source changes), KO can help you implement it more simply and maintain-ably.

http://knockoutjs.com/

Knockout.js


Angular.js

AngularJS is an open-source JavaScript framework, maintained by Google, that assists with running what are known as single-page applications. Its goal is to augment browser-based applications with model–view–controller (MVC) capability, in an effort to make both development and testing easier. The library reads in HTML that contains additional custom tag attributes; it then obeys the directives in those custom attributes, and binds input or output parts of the page to a model represented by standard JavaScript variables. The values of those JavaScript variables can be manually set, or retrieved from static or dynamic JSON resources.
http://angularjs.org/
Angular.js


Backbone.js

Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
http://backbonejs.org
Backbone.js


Node.js

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
http://nodejs.org/
Node.js


Modernizr

Modernizr is a small JavaScript library that detects the availability of native implementations for next-generation web technologies, i.e. features that stem from the HTML5 and CSS3 specifications. Many of these features are already implemented in at least one major browser (most of them in two or more), and what Modernizr does is, very simply, tell you whether the current browser has this feature natively implemented or not.
http://modernizr.com
Modernizr


Require.js

RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino and Node. Using a modular script loader like RequireJS will improve the speed and quality of your code.
http://requirejs.org
Require.js


Less

LESS extends CSS with dynamic behaviour such as variables, mixins, operations and functions.LESS runs on both the server-side (with Node.js and Rhino) or client-side (modern browsers only).
http://lesscss.org/
Less


Sass

Sass is an extension of CSS3, adding nested rules, variables, mixins, selector inheritance, and more. It’s translated to well-formatted, standard CSS using the command line tool or a web-framework plugin.
http://sass-lang.com
Saas

 

Source: http://www.codeproject.com/Articles/596800/JavaScript-Frameworks-and-Resources

Dec 28, 2012

Knockout : a Javascript library

I was searching the youtube for some video on Asp.net MVC 4 when I stumbled upon one which had ASP.Net MVC 3 + Knockout….

The name naturally evoked curiosity and slowly I was going through sites to learn more about the library. The more I read the more I got fascinated by it..

The features that it offered were so much desirable by us web developers and yet it was all so simple..

Despite the act that it also means that we would again have to get used to another set of syntax (am still not completely recuperated from the wave of learnings for the jquery libs yet !!! )

I can definitely see a big push towards it in the near future…

 

Definition of the Knockout.js Library as available in the official website (Knockoutjs.com)

Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model.

Any time you have sections of UI that update dynamically (e.g., changing depending on the user’s actions or when an external data source changes), KO can help you implement it more simply and maintainably.

 

--------------------------------------------------------------------------------------------------------

Headline features:

  • Elegant dependency tracking - automatically updates the right parts of your UI whenever your data model changes.
  • Declarative bindings - a simple and obvious way to connect parts of your UI to your data model. You can construct a complex dynamic UIs easily using arbitrarily nested binding contexts.
  • Trivially extensible - implement custom behaviours as new declarative bindings for easy reuse in just a few lines of code.

---------------------------------------------------------------------------------------------------------

Other things that I noticed…

  • Tight integration with Asp.net MVC –
    • In a controller action use the JSON ActionResult as a return type
    • In a simple html page call the controller action through a jquery Ajax call
    • On the success of the previous call fill the knockout variable
    • bind the ui controls with the ko variable.
  • MVVM pattern based bidirectional binding.
    • Bind the ui controls to the ko variable
    • create functions to add remove to the ko variables
    • all the dependent controls will automatically reflect the changes
  • Very small footprint.
    • Easy for mobile browsers too
    • Since it is backward compatible till IE6, can be used without the fear of unsupported browser.
  • Main components:
    • KO observablevariables and observableVariableArrays (for binding list type controls)
    • The code to fill these variables
    • // This is a simple *viewmodel* - JavaScript that defines the data and behavior of your UI
      function AppViewModel() {
      this.firstName = "Bert";
      this.lastName = "Bertington";
      }

    • The activation code
    • // Activates knockout.js
      ko.applyBindings(new AppViewModel());

    • Binding the observable variables to the ui controls

                           <pre>
                             &lt;p&gt;First name: &lt;input data-bind=&quot;value: firstName&quot; /&gt;&lt;/p&gt;
                            &lt;p&gt;Last name: &lt;input data-bind=&quot;value: lastName&quot; /&gt;&lt;/p&gt;

                          </pre>

Some important links:

Tutorials: http://learn.knockoutjs.com/#/?tutorial=intro

Video tutorials:

By the creator:  http://www.youtube.com/watch?v=DnhGqcKEPiM

Very simple but important tutorial: http://www.youtube.com/watch?v=ZAZrUUv2Xuk