Wednesday, 29 July 2015

Install windows 10 dual boot with no keys

Here we are Today, we have another great release of Windows i.e. Windows 10. Well, If you own a window7/8/8.1 you can directly upgrade your windows to windows 10. But there might be a problem installing window live upgrade. Here are few steps that you can do:

Download the window media creation tool. Once downloaded you can select the option you want to choose e.g. where to install the window media. Following would be options available:

1. Upgrade this PC
2. Create a USB
3. Get an ISO image.

I tried with first two option but couldn’t succeeded. So I downloaded the ISO Image to my SSD and used the windows USB tool to create a bootable USB for windows 10. Once the download is complete it would ask you to have prepared with product key. If you don’t have the product key present at this moment just Ignore the message for the time being and create a bootable USB device with the Windows USB tool.

Once done Plug the USB device in the system the reboot it. Launch the One time bootable window or boot menu when system is starting. For me the F12 key brings up the quick boot menu. Select the USB device and enter.

The system will Ask you to “Install Windows” say yes and proceed. Now if the window to ask the product key appears then look for the “Skip” option. It’s an option in very small fonts.
Select the type of installation you want. I had secondary SSD in my laptop so I chose the customize installation to select the target drive where I would want to install the Windows10. Now it will start copying/installing windows followed by couple of restarts.

once the installation is complete and system is restarted it will ask for the Product key again. Look for small option “Do this later” and the setup will let you continue with system setup. This is the things that I’m loving from Microsoft though at this moment the product is not available but they are not stopping you to install the windows. Once everything is setup e.g. WIFI/Internet, Express settings the system will restart. Thought it might ask for couple of more restarts. But everything will be fine and you’ll have your first experience of Window10.

Here’s how it looked on my system after installation.


There’s no restriction from Microsoft that stops you to install the new Windows 10. But this will install and unactivated copy. So I would suggest to buy the Windows10 from the windows store and apply the Product key to activate the windows. Once the product is activated you will be able to get the important updates from the Microsoft. And if you’re developer you can start working on the Universal app and use the market place right away.

Enjoy and Good Luck!!.

Thursday, 23 July 2015

Topshelf OSS Library – an unsung hero for windows services development

Creating a windows service itself is a hassle that includes various aspects of it like configuration, install-uninstall, recovery, start mode etc. Managing this settings is either can be achieved manually or by writing bunch of batch/command files that helps in deployment and management of windows services.
Recently, I came across an ultimate .Net OSS library that provides control almost everything related to a Windows service. The library is known as “TOPSHELF”, the contribution creds of this library goes to Travis Smith, Charles patterson and few more awesome contributors. See the well managed documentation of this project here.

How this library tool makes a difference creating a windows service? Let’s try to create a windows service:

public class TownCrier
    readonly Timer _timer;
    public TownCrier()
        _timer = new Timer(1000) {AutoReset = true};
        _timer.Elapsed += (sender, eventArgs) => Console.WriteLine("It is {0} and all is well", DateTime.Now);
    public void Start() { _timer.Start(); }
    public void Stop() { _timer.Stop(); }

The above code is expected to run as windows service. Now conventionally to make it a window service one must add a Window service file type then WindowsInstaller etc. Rather I’ll be using Topshelf library for hassle free setup:

Windows services made easy

public class Program
    public static void Main()
        HostFactory.Run(x =>                                 //1
            x.Service<TownCrier>(s =>                        //2
               s.ConstructUsing(name=> new TownCrier());     //3
               s.WhenStarted(tc => tc.Start());              //4
               s.WhenStopped(tc => tc.Stop());               //5
            x.RunAsLocalSystem();                            //6
            x.SetDescription("Sample Topshelf Host");        //7
            x.SetDisplayName("Stuff");                       //8
            x.SetServiceName("Stuff");                       //9
        });                                                  //10

That’s it now when I run this code my service will run as Console. Without Topshelf I would have create a separate class to run the service as console. But now I can see in few lines of code things are quite awesome. Let’s simply press F5 in visual studio to run the above code:

Running as Console service

Let’s simply press F5 in visual studio to run the above code:


Installation of window service

Simply call the generated .exe file with argument

SampleService.exe install

You will see some success log output on the command prompt:

Let’s take a look at the services window. Goto Run –> Services.msc.


And I can see my service is started and running. How cool is it..I’m sure this kinda stuff will make DevOPs guys happy. There are plenty of option that are configurable easily using this library, I can say OOS stack of .Net is coming into picture and helping developers making softwares better an better everyday.