Archive for 'Web'

Rate limiting with Redis

The rate limiter pattern is a special counter that is used to limit the rate at which an operation can be performed.

There are a few classes of rate limiting or velocity checking you can do:

  1.  Per user or API key: ensure that any given user account or API account key holder can only perform (n) actions per minute.
  2.  Per IP address: ensure that any given IP address can only perform (n) actions per minute.
  3.  Per global action: ensure that a particular action can ...
Continue Reading →

AngularJS Filter

In this post we’ll analyze the filter functionality provided us by AngularJS.

Filter is a way to format the data displayed. There are several built-in filter but we can create our own filters.

To invoke filters, in the HTML code, we have to use the pipe (|) inside the double braces ( {{ }} )

For example, in this way we’ll capitalize all characters of string:

{{ 'Today is a beautiful day' | uppercase }}

Continue Reading →

Sharing data between controllers in AngularJS

I wrote this article to show how it can possible to pass data from one Controller to another one.

There are two ways to do it, using a service or exploiting depending parent/child relation between controller scopes.
In this post, we’ll analyze the last one method.

It is possible to send data from parent controller to a child controller and viceversa.
To transmit data from the FirstController to SecondController, which the scope of the first one is parent to the scope of ...

Continue Reading →

Create an e-mail attachment by retrieving from the network

During an implementation of an existing project I have had to add a feature to send an e-mail with attachment that has to be a report of reporting services.

The chosen format is pdf so you need to get the parameters to be passed via url querystring to export the report in pdf format.

I have chosen to download the pdf file, and then I have attached them to the email on the fly without saving it to db or ...

Continue Reading →

Penetration testing: removing excessive HTTP response headers in Azure/IIS8

Headers response fields like:
1.    Server: the web server software being run by the site (examples: “Microsoft-IIS/7.5”, “Apache”)
2.    X-Powered-By: the collection (there can be multiple) of application frameworks being run by the site (examples: “ASP.NET”, “PHP/5.2.17”, “ ServiceStack/4.011”)
3.    X-AspNet-Version: obviously an ASP.NET only header (examples: “2.0.50727”, “4.0.30319”)
4.    X-AspNetMvc-Version: Again, you’ll only see this in the ASP.NET stack and typical examples include “3.0”, “2.0” and “1.0”.
can revealing critical information that may allow the server machine to become ...

Continue Reading →

AngularJs – Call a js function after repeat ends its loop

How often you have to call a javascript function after the page load complete?
JQuery gives a solution that easily allow the user to manage this need and execute some block of code after all items of the page has been loaded.

A script like this, will be executed after the page is loaded:

$(document).ready(function() { ... });


… but what about calling a javascript function, using angularJs looking for a specific element of the page rendered by an ngRepeat loop?
Continue Reading →