Amplitude 2017: A MasterCard Hackathon


MasterCard is going to conduct one of the biggest hackathons of India on November. Name of the hackathon is Amplitude 2017.

The theme of this Hackathon is #CashLessBanoIndia. Name of the theme is self-explanatory, the main focus of this hackathon is to come up with the ideas which will encourage people to use digital payments instead of Cash.

There are mainly 4 themes for this hackathon which includes creating meta data driven rules platform, how to accelerate the adoption of digital payments in India, To develop alternate payment solution for merchants and increase the security of P2P and P2M transactions.

MasterCard has some awesome products which can be used for this hackathon. By the way, developers can use any API or products they want for the hackathon.

Below is the process required for Amplitude 2017:


Some useful links:

For Registration:

To know the rules:

To know about the themes:

So if you are a geek and want to do something for the nation then just register yourself and be a part of the biggest hackathon of MasterCard.



Automatic Data refresh in Quicksight

In my last post I have covered insight of Amazon Quicksight. It is here.

In this blog we will see one more powerful feature of Quicksight which is automatic data refresh of any of the data sets you have chosen on Quicksight.

Let us have quick introduction of Quicksight:

Amazon QuickSight is a fast business analytics service you can use to build visualizations, perform ad hoc analysis, and quickly get business insights from your data. Amazon QuickSight seamlessly discovers AWS data sources, enables organizations to scale to hundreds of thousands of users, and delivers fast and responsive query performance by using a robust in-memory engine (SPICE)

Quicksight has launched scheduled data refresh just before few days which can be achieved as below:

  • Go to Your data sets page
  • Choose the data set you want to refresh
  • Click on Schedule refresh


  • In Schedule refresh window, click on Create
  • Now select as per your requirement (Daily, Weekly, Monthly etc)



Now you can ensure that your SPICE data sets, analyses and dashboards are always in sync with your source data.

Happy coding!

Text to speech utility

We all become lazy sometimes when we get long emails. But at the same time we had to listen to them as the mail contains important information.

If I tell about myself, then I grasp fast if someone speaks to me instead of reading something which is very long. And after talking with different people they had the same feelings.

That is why I thought to make something which takes text as input and speaks whatever is given as text and I created a project.

So now the problem is solved! If you have got a long mail but not in mood to read till end then just open this utility -> copy and paste all mail content into this utility -> Click on speak. It will read it out your whole email.

It is not only useful in above example, but it can be useful in many cases.

Utility looks like below:


It is available here.

If anyone wants the code then just contact me, I will provide.

Happy coding.




MVC6 (.Net core) applications are self hosted : Optional IIS integration

All ASP.NET Core applications are self-hosted.

Yes you read it right!

So does it mean IIS is not required?

Yes, I mean we can host MVC6 application even without IIS.

Wow…but How?

I assume you have already downloaded .Net core from here.

Next step would be to create sample MVC6 project.

For now you can directly clone it from Github by below commands:

git clone
cd cli-samples\HelloMvc

Then we would restore and run the project as below:

dotnet restore
dotnet run 

That is it!

Now navigate to localhost:5000 in your web browser and you can see your application hosted there.

You must be wondering how it happened?

You can check it by yourself in code.

Open Program.cs class and you can see below code there:

public class Program
    public static void Main(string[] args)
        var config = new ConfigurationBuilder()
            .AddEnvironmentVariables(prefix: "ASPNETCORE_")

        var host = new WebHostBuilder()
            .UseIISIntegration() //// Here IIS integration is optional


As you can see in above comments, IIS integration is optional in .Net core.

Happy coding!

Dependency Injection in MVC 1.0(ASP.NET Core)

Please note that below post would be more clear for those who already know what Dependency injection is.

As we all know that things has been little changed in .Net core and things has also been changed the way we suppose to register all of our services that we are going to use as DI.

Suppose you have one HomeController and in that controller you want to inject a service let us say MyService.

In controller it would look like as it was used to :

public HomeController(IMyServcie myService)


And in a class library called MyService, it would look like as below:

public class MyService : IMyService
private readonly IMyRepository _myRepository;

public MyService(IMyRepository myRepository)
_myRepository = myRepository;

You can even inject services into views using @inject. I have already written post on that which is here.

So now you might be wondering like where should we register this.

ConfigurationServices is your composition root so that’s where you register you services.

So it would be as below:

public void ConfigureServices(IServiceCollection services)

// Add application services.
services.AddScoped<IMyService, MyService >();

Okay so above scenario is ideal scenario but you might be having some questions as below:

  • What if you have some of your code written outside of your MVC application?.
  • Also what if you do not want to bloat the ConfigurationServices method with lots of AddScoped lines of code for other layers like Repository layer and Service layer?
  • What to do if I need to do in my other layers (Repository and Service) to first register them here (both are .NET Core class library projects) and then wire those containers into the parent container?

For that you just need to create different Extension methods in different layers which targets IServiceCollection as below:

public static IServiceCollection AddMyServices(this IServiceCollection services) {
services.AddScoped<IMyService, MyService>();
//…add other services

And in Repository layer it would have a extension method as below:

public static IServiceCollection AddMyRepositories(this IServiceCollection services) {
services.AddScoped<IMyRepository, MyRepository>();
//…add other Repositories

And now you could just as easily call the AddMyRepositories() in the AddMyServies extension method as opposed to the main project itself:

public void ConfigureServices(IServiceCollection services) {
//…other code


//…other code

That is it!

Happy coding!

WebCrawler in C# (.Net)



I have recently wrote code for WebCrawler in C#.

You can find code here at Github.

This is basically used to crawl on start and it would stop once it is stopped.

Please go through readme section for more details

Let me know for more details.

Happy coding!

Upload file in MVC 6 (ASP.NET Core 1.0)

There are many ways to upload files in MVC 6.

Below code is the simplest way I found till now, If I get any other simpler method then I will update this code.

view (cshtml) :

<form method="post" asp-action="Upload" asp-controller="Home" enctype="multipart/form-data">
    <input type="file" name="file" />
    <input type="submit" value="upload"/>

controller (cs) :

public IActionResult Upload(IFormFile file)
    if (file == null || file.Length == 0)
        throw new Exception("file should not be null");

    var originalFileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');


Happy coding!


2015 in review

The stats helper monkeys prepared a 2015 annual report for this blog.

Here's an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 7,000 times in 2015. If it were a NYC subway train, it would take about 6 trips to carry that many people.

Click here to see the complete report.

Getting a Configuration Value in ASP.NET 5 (vNext) and MVC 6

As you might already know that things has been bit changed for reading appSettings in MVC 6 and Asp.Net 5.

We will go step by step how to achieve this.

First of all as we were used to add Application settings in Web.config till now. But now onwards we need to add these key value in file called config.json as below:

"AppSettings": {
    "MyKey" : "MyValue",
    "MyKey2" : "MyValue2"


After this we will create a class which will be used to deserialize those all configurations we provided above.

public class AppSettings
    public string MyKey { get; set; }
    public string MyKey2 { get; set; }

After this we need to make some change in Startup.cs file as below:

public class Startup
    // Set up application services
    public void ConfigureServices(IServiceCollection services)

    public void Configure(IApplicationBuilder app)
        app.UseMvc(routes =>
             routes.DefaultHandler = new LocalizedRoute(routes.DefaultHandler);
             routes.MapRoute("default", "{controller}/{action}");



Thats it!! Now you are able to use those application setting by simply injecting IOptions<AppSettings> in your controller as below:

public HomeController(IOptions<AppSettings> myAppSettings)
    var myKey = myAppSettings.Value.MyKey;
    var myKey2 = myAppSettings.Value.MyKey2;

Here IOptions<> interface is part of something called Options Model which is used for accessing POCO style settings(ex: your AppSettings) across your application.

Stay tuned for more updates!

Create a free website or blog at

Up ↑