Enabaling BASH shell on Windows 10 Anniversary Update

APT-GET

Windows 10 Anniversary Update is already out and millions of PCs getting updated. Whole load of cool features were added on this update. For me the star features is the BASH shell for Windows 10. By default it doesn’t get enabled. I assume you already have this great update. If yes, lets go through the steps to enable this great feature.

First things first, you need to enable the developer mode of Windows 10 to enable this feature. Simply open the Settings window (or tell Cortana to open it for you). In the Settings window click on the Update and Security button.

Settings Wiindow

In the Update and Security window, select For Developers in the left side pane and click on the Developer option in the right side pane (You might have to restart the PC after this change). This change will enable you few things on your Windows 10 PC. For the moment I just focus on one feature that enables you the Ubuntu BASH Shell.

Now open Control Panel (or let Cortana do the dirty work for you) > Programs > Programs and Features.

Now click Turn Windows Features on or off and scroll down the dialog box. Select Windows Subsystem for Linux (beta) and click OK. This will install what you need and will require to restart your PC. You are ready to rock after this step.

Few more things to do before we get started. Lets open a command window. Type bash and press . Now type “y” to continue. Wait for few minutes till Windows Store installs Linux Subsystem.

Installing BASH

After a successful installation, give a username and password to continue.

User names and Passwords

Now you are good to go. Lets try out some BASH commands in ubuntu, like to check what is the version of ubuntu. Type

Here is the output. We have Ubuntu 14.04.4 LTS

Ubuntu Release

Its real Ubuntu Guys… I just did a apt-get update and look at the results.

APT GET

Have a nice day. !!! 🙂

Merge Two Arrays – The LINQ Way

I just came across a requirement of  merging two arrays of integers. So I already had this integer array and there was a new array of same type and required merging those two. Yep remove any duplicates as well.

Line 4 of the Code

It just says add idList2 to idList1 and remove of any duplicates and convert the output to an array. In this case to an Integer array.

Output Window

Output Window

Happy Coding !!! 🙂

Choosing an ASP.net Flavour

At the beginning there was only ASP.net Web Forms. Now you have three different models to choose with.

  1. ASP.net Web Forms
  2. ASP.net MVC
  3. ASP.net Web Pages

ASP.net Web Forms

These are set of pages that has a UI (User Interface), Server Controls and Server Code. When a user sent a request to the page using the browser, it goes to the server,  then compiled and executed at the server side. Finally generates HTML markup that can be rendered on your browser. If you are a experienced Windows Forms developer its a good choice to choose Web Forms. It is the event driven world that you already familiar with.

Server Controls such as Button, Grids, Labels, DropDowns can be easily dragged and dropped to your design and start coding like you did with Windows Forms.   To write server code to handle the logic for the page, you can use a .NET language like Visual Basic or C#.

More details on ASP.net Web Forms

ASP.net MVC

The MVC stands for Model View Control. This is a design pattern most developers are familiar with. This is a light weight framework that can be used with ASP.net features such as Membership based authentication and Master Pages. This pattern separates your application into three parts. The logic of the application goes under Model. The presentation layer goes under View and finally talking between model and the presentation layer goes under Controller. Again to write code and handle the logic you can use a .NET language like Visual Basic or C#.

More details on ASP.net MVC 

ASP.net Web Pages

This flavour gives you a taste of script based programming like you did with classic ASP or PHP. A special syntax called Razor will escape your HTML code to dynamic code using a .NET language like Visual Basic or C#. If you know HTML, CSS and little bit of JavaScript and you have programmed with a .NET language like Visual Basic or C# and you are ready to start building ASP.net Web Pages.

More details on ASP.net Web Pages 

Have a Good Day !!! 🙂

How do I print “1” as “0001” ?

Yep, a nice little question. Some of you may have wondering how to do that. In my database ID field it says “1” (or any integer value) on my Web Page or Windows Form I need to print this as “0001”. Do we have a simplest method to do that? And the answer is (drum roll) ….. YES ..

OK, next question what does this format specifier “D” means. Here is the MSDN help about it.

The “D” (or decimal) format specifier converts a number to a string of decimal digits (0-9), prefixed by a minus sign if the number is negative. This format is supported only for integral types.

The precision specifier indicates the minimum number of digits desired in the resulting string. If required, the number is padded with zeros to its left to produce the number of digits given by the precision specifier. If no precision specifier is specified, the default is the minimum value required to represent the integer without leading zeros.

Also we can use another string method known as . Lets have a look on that code.

allows you to apply any character (type of Char) as the leading character. In this case ‘0’

Have Fun 🙂