Friday, October 17, 2014

Removing Messy Boot-load Entries in Windows 7

Sometimes when you install multiple copies of operating systems and then uninstall, you might face the problem that the bootloader entry doesn't get removed automatically. It starts getting weird when you have number of same operating system bootload entries. I had myself installed Ubuntu 12.04 inside Windows 7 and then, for some reason, had to switch to version 14.04.1. What I got was two Ubuntu's appearing at my boot screen.
The solution to this problem (in Windows 7) is:

1. Open cmd in Windows 7 as administrator
2. Write this command
3. Your area of interest in this output will be this line
4. Read carefully what entry you want to delete from here and copy the identifier of that entry into your clipboard. I couldn't do it from console also I don't run such long strings to avoid typing mistakes plus it requires you to look hard. What I did was
which is nothing but redirecting output to some file.
Now you can easily copy into clipboard by opening that file in notepad.
5. Paste this into command as follows
and then press "return" key.

Be careful manipulating with bsdedit as you're working as an administrator.
Good luck.

Wednesday, October 8, 2014

How to Check if the Number is Some Power of 2?

To check if some number is a power of two there many methods available but there is an efficient one to do this. First of all assure that the number is not (because zero is not some power of two). Then assure if the (number - 1) and number's logical and is zero. Let's take a look what is happening behind this logical and operator. You may run it for any power of two.