Thursday, 10 December 2015

Windows Live Writer goes open source with Open Live Writer(OLW)

Open Live Writer, Its a fork of Microsoft's Windows Live Writer and is open source. Project developed by some Microsoft developers is kept under .net Foundation.

This initial release is v 0.5 and they have a complete road map

More details can be found here at .net Foundation website.

You can download a copy at OpenLiveWriter.Org and start using it.

Wednesday, 9 December 2015

Microsoft announced rewards on bugs in CoreCLR and Asp.Net Beta 5

Microsoft has promised rewards to all those who find bug in Core CLR and beta 5. The program ends on 20Jan 2016.

Following vulnerabilities will not be considered:

  • Publicly-disclosed vulnerabilities which are already known to Microsoft and the wider security community
  • Vulnerabilities in anything earlier than the current public betas of CoreCLR & ASP.NET 5 ( >= beta 8)
  • Vulnerabilities in released versions of ASP.NET
  • Vulnerabilities in user-generated content
  • Vulnerabilities requiring extensive or unlikely user actions
  • Vulnerabilities which disable or do not use any built in mitigation mechanisms
  • Low impact CSRF bugs
  • Server-side information disclosure
  • Vulnerabilities in platform technologies that are not unique to CoreCLR or ASP.NET (for example IIS, OpenSSL etc.)
  • Networking bugs in Beta 8 are not included.

Sunday, 29 November 2015

Chocolatey - A package manager for windows

Think of a situation where you have to re-install your windows and need to install all the necessary softwares again. Its heck of a work to find all the softwares till you keep a copy of all in one place. Now no more worries about keeping all softwares or remembering the website. Here is a package(software) manager that will help  you with all that.

Chocolatey is a package manager for windows.

How to install?

Run this command into your command prompt.

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

How it will help?
Its got 2,941 unique packages as of today.

The only problem is you have to use command prompt to install software and use the exact keyword to install the software. For example to install VLC media player keyword is vlc.

For installation command is: choco install <PackageName>
For upgrade command is: choco upgrade <PackageName>
For searching a package: choco search <Software Name>

Here is list of all the commands you can run Chocolatey Commands Reference.

You can also create a package of your own. Command for that is following: choco new <PackageName>. There are certain rules which you need to take care of can be found here: 
choco install notepadplusplus googlechrome atom 7zi For installing multiple softwares once you can use: 

choco install notepadplusplus googlechrome atom 7zip

This will install Notepad++, Chrome,Atom & 7zip

Tuesday, 24 November 2015

HTTP verbs

Many developers still don't know what is Http verb and how many of them are there and what is its actual use how web server treats them differently.

For Http 1.1

  • Get - Retrieves the information identified by URI
  • Head - Retrieves the message headers for information identified by URI.
  • Put - Stores the enclosed entity under the request URI.
  • Post - Post a new entity enclosed in the request.
  • Delete - Deletes the resource identified by URI.

Get and head are considered to be as safe methods becuase they are just meant for retrieval.

More detailed info can be found on W3C website

Monday, 23 November 2015

Getting started with Node

Javascript based frameworks are now a new buzzwords in development be it Angular or Node. The best thing with node is that you can write server side code also in javascript. Basically you can run your javascript applications outside the browser.

Node works on v8 Javascript engine developed by Google. Now you can work on one language throughout your application. No need to say and I quote "I am using blah-blah for my serverside code".  :)

You can download Node from

Node comes with a package manager called NPM(Node Package Manager). If you are familiar with Nuget or choclatey it won't be difficult for you to get started with this.

Using Visual Studio to code Node is a good idea you can download a free version of visual studio from Visual Studio website here and can install Visual Studio tools for Node. This page has a wiki link(Documentation) and also contains guidelines and other tips.

Start learning node by coding. There many tutorials available at Node School. Go through API here.

Happy Coding !!

Shortcuts in SQL server

Knowing shortcuts is very handy for a developer you dont have to touch mouse and break the rhythm. I came across one interesting shortcut in SQL Server.

For any SQL object in your database you can use this shortcut in Management Studio

See the sceenshot below. Just selected the table name and pressed the shortcut will give you all the details

Lots of other shortcuts are available here.. Management Studio Keyboard Shortcuts

Sunday, 22 November 2015

Writing a simple web crawler

Crawling is a thing which all search engines do across the web. This is a simple web crawler which crawls the the page you give and will give you back all the links on that page. Here for the sake of example I took

using System;
using System.Net;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;

public class Crawler
	public static void Main()
	string url = "";
	HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
        httpWebRequest.UserAgent = "Anurag's Crawler";
        WebResponse webResponse = httpWebRequest.GetResponse();
        Stream stream = webResponse.GetResponseStream();
        StreamReader streamReader = new StreamReader(stream);
        string htmlText = streamReader.ReadToEnd();
	var allLinks = GetNewLinks(htmlText);
		foreach (var link in allLinks)
	private static List GetNewLinks(string content)
    Regex regexForLink = new Regex("(?<=<a\\s*?href=(?:'|\"))[^'\"]*?(?=(?:'|\"))");
    List<string> newLinks = new List<string>(); 
    foreach (var match in regexLink.Matches(content))
        if (!newLinks.Contains(match.ToString()))

    return newLinks;

Web Crawler  This is a crawler written using Reactive Extension
One more web crawler thats available and bit complex

Tuesday, 24 February 2015

Passing Exception to Controller from Global asax

Came across this scenario where we have to redirect for all un-handled exceptions to user diplaying the StackTrace, Exception message and other details.

protected void Application_Error(object sender, EventArgs e)
            Exception exception = Server.GetLastError();

            RouteData routeData = new RouteData();

            // Routing to ~/Error/Error
            routeData.Values.Add("controller", "Error");
            routeData.Values.Add("action", "Error");
            routeData.Values.Add("error", exception);

            // clear error on server, not to display yellow error screen

            IController home = new TWC.IssueTrak.Mobile.Controllers.HomeController();
            home.Execute(new RequestContext(new HttpContextWrapper(Context), routeData));

 public ActionResult Error(Exception exception)
            return View("~/Views/Shared/_Error.cshtml",Exception);

@model System.Exception
<div>Exception Message: <b>@Model.Message</b></div>