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