Skip to main content

How to switch boot order within Windows & Linux

If you have both Windows and Linux installed on your computer, default  booting operating system would be Linux.
If you are frequent Windows user than Linux, the default booting OS(Operating System) should be Windows else you will waste time in every time choose boot to Windows.
Note that to change the boot sequence you will require the root level access as you are going to modify "/boot/grub/grub.cfg".
If you are using x windows system, open the file "/boot/grub/grub.cfg" using any text editor. If you don't have root level access then open text editor using sudo command as:
sudo -u root gedit 
Then open the file grub.cfg. In the grub.cfg search for "menuentry" and check for menuentry having "Windows " loader line.
Count the number of menuentries before Windows entry. Do not count Windows entry as menu entry start from 0. Set the counted value at:
set default="0" 
in the grub.cfg file as set default="5" now save the grub.cfg file and you are done. Just restart the computer and check if the changes are reflected on boot loader.
Alternatively you can do above easily with terminal as below.
  • Open the terminal by pressing buttons "Ctrl + Alt + T" ( Control + Alt + T). 
  • On terminal type following command:
           cat /boot/grub/grub.cfg | grep menuentry
  • This will print output as below 
  
  • Count the menuentry till the Windows entry. The counting should start from 0.
  • Now edit the file using command sudo -u root vi /boot/grub/grub.cfg
  • Update the counted value instead of set default="0" as lets say in above case it is 8 so, set default="5".
  • Save the file, and restart the computer. 
Note: While counting for "menuentry" make sure that count one menuentry for all "menuentry" present under submenu such as in above image submenu "Previous Linux versions"{ }. For this you will have to open file in text editor or cat completed file on terminal, to check what entries present under Submenu.

Comments

Popular posts from this blog

How to boot Samsung Galaxy SL( GT-I9003) in recovery mode

** I Will Not responsible for any damage done with use of below mentioned methods. ** Power off your Samsung Galaxy SL (GT- I9003) to start in recovery mode. Once you have power off the phone, press and Hold Volume UP and Home button. Make sure you have hold volume up, don't press in  the middle of the volume buttons.  Now keep pressing these two buttons(VOL UP + HOME) and presspower button for 2-3 seconds. Release only power button, but keep pressing Volume Up + Home Button, until you see the screen shown below. Once you see recovery screen release the Home button else your phone will restart as first selected option will be restart and pressing home will make that happen.

In the recovery mode, volume up & down act as a up scroll and down scroll buttons, by pressing Home button you will be able to click the selected option.

How to flash CWM Recovery to Samsung Galaxy SL( GT-I9003) using Odin

** I Will Not responsible for any damage done with use of below mentioned methods. ** To flash the CWM recovery to your Samsung Galaxy SL you will require to following things in place: Odin  : you can download it from here.CWM Recovery image : you can download it from here. Thanks to XDA-developers. USB driver to connect your phone with computer. Install Samsung Kias so it will install the USB driver. Once you have downloaded above required items and installed the USB driver, reboot you phone to download mode. You can read how to reboot phone in download mode from here. Now connect the phone with USB cable to computer. 
Extract the Odin from the zip file that you have downloaded at some location on your computer and launch the Odin executable by double clicking it. Wait for Odin to detect your phone.You will be able to see it in yellow once detected on odin screen as shown below.
Click the PDA button to select the CWM recovery image. Once you have selected the recovery image, check the od…

Exception handling with RestTemplate

Spring framework offers RestTemplate for consuming RESTful services. Recently I used RestTemplate for consuming one of the third party RESTful service.

RestTemplate offers 'ResponseErrorHandler'; which you can extend to decide which are errors for you and how to handle those error. You can override hasError and handleError methods of ResponseErrorHandler.
In handleError you can throw customException if you want, as outlined in below code.

import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.ResponseErrorHandler; import java.io.IOException; public class RestTemplateErrorHandler implements ResponseErrorHandler { @Override public void handleError(ClientHttpResponse response) throws IOException { throw new MyCustomException(response.getStatusText(), response.getStatusCode()); } @Override public boolean hasError(ClientHttpResponse response) throws IOException …