Technical

JavaScript Factory Design Pattern

The Factory design pattern separates object creation from the rest of code. When creation of an object is complex or a subject to a change, a factory acts as a nice mediator. However factory needs a good design as it may lead to class explosions. A simple factory is an object which implements the creation of another object, acting as a shield from the rest of application.

Tags: 

JavaScript Singleton Design Pattern

The Singleton pattern restricts an instantiation of an object to a single instance thus reducing its memory allocation and allowing a "lazy loading" on an as-needed basis. The advantages of that pattern are the reduced memory occupation, single point of access and a postponed initialization which prevents instantiation until it is required. As a disadvantage one may point out that object is hardly ever reset once instantiated and sometimes there might be hidden dependencies.

Tags: 

JavaScript Inheritance

One of the big deceptions in JavaScript when coming from other object-oriented languages is that is has classes. Therefore a developer might be puzzled to see a code like this:

Tags: 

JavaScript String Extension Methods

It happens sometimes when writing code and cope with an object that you need a functionality namely a method which the object doesn't expose. And as you do not have ownership over that object as it is provided by the language or framework, it appears the need somehow to extend that object to have the desired behavior. In that case JavaScript is a language which is powerful and flexible enough to easily solve the problem. It provides a way to generate extension methods fast.

JavaScript CSV Export with Unicode Symbols

There are often problems exporting unicode symbols to CSV file format. Developers tend to forget to add the UTF-8 BOM at the start of text and text is displayed incorrectly when opened in Excel application. Therefore I add a small example of such an export which might be useful for developers who have come to that problem too.

Using Data Attributes for Custom Validation Messages in HTML5

The introduction of HTML 5 facilitated the writing of validation logic on users' form controls, allowing the creation of usable forms with less or no scripting. Now it is easy to mark form fields with attributes to define what kind of validation hould be applied. The REQUIRED attribute marks the designated field as required and that form can not be posted without a value entered. The PATTERN attribute applied to a field defines that field content should correspond to predefined regular expression.

Tags: 

Rate Limiting in ASP.NET MVC

Rate limiting, also known as request throttling, is an important mechanism for controlling how often web resources are accessed from a client. Implementing it on your web application or service will allow you to utilize its resources better and protect it from a high volume of malicious requests. In this article we will demonstrate how to implement and setup request throttling in an ASP.NET MVC application.

ASP.NET MVC Sales Dashboard Application

In an older blog entry, we looked at creating a sales dashboard application for ASP.NET. Today, we will briefly describe how to achieve the same setup in MVC. The complete sample is available for download at the bottom of the page.

To start off, we create a new Visual Studio 2012 MVC application, with .NET Framework 4.0. To be able to take advantage of the charting component, we add a reference to the Shield.Mvc.UI dll:


The folder structure of the application looks like this:

ASP.NET Sales Dashboard

In this blog entry, we demonstrate how to create a Sales Dashboard application for ASP.NET. The complete code is available for download at the bottom of the page.

The finished sample looks like this:
sample

To start off, we create a new Visual Studio project for web. The web application needs to contain a single .aspx file, which will host the related controls. The second step is to include the .dll files for the chart components to the project:

Customizing the ShieldUI Calendar Control

In this blog entry we look in greater detail into how to customize the ShieldUI Calendar widget. The final result is demonstrated in the following example.

Pages

Subscribe to RSS - Technical