How to Check If My Processor is x86 (32-bit) or x64 (64-bit) in Windows?

There are many ways of checking if your processor is 64 bit or 32 bit on windows platform. 


I will be discussing the simplest and easy method which is full proof.  


Just open Command prompt and type 
                             SYSTEMINFO
 ( command is not case sensitive),  within a minute command prompt will be full with of information. you just have to search for "System Type :" This row will tell you your processor type as shown in below image. 


  

Error : The value of ESP was not properly saved across a function call.

Sometimes you may face such a error while executing your program written in C++: 
  
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.
or 
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.


The above mentioned error you will get only if you are running program compiled in debug mode. If the program is compiled in release mode you will get Exception code: 0xc0000005 which is Access Violation exception. 


Cause of error:


Consider a situation,  you have declared one function with one calling convention ( for example __cdecl ). You do LoadLibrary, get the proc address, now if you are calling function with other  calling convention such as ( __stdcall ) by mistake. Function executed, your task completed sucessfully. Everything will work fine until  you try to use the return value of the function.


The error Access Violation occurred because you have declared function with __cdecl calling convention, means function has its own stack clean up code. And you are trying to access the function with __stdcall which means, function does not code to cleanup the stack, so compiler will insure that after function returns the callee will celanup the stack, which eventually means there are two stack cleaner exists. 
Now function execution will complete as expected but then the time will come to assign the value of return variable which is present in the ESP register due to two cleanup codes the second time asses to the ESP will be evaluated in the exception as register is already cleaned by one of the cleaner. 

How to enable Hibernate option on Windows 7

Hibernating is good option when you want to stop and resume your work from some point where you had off your computer/laptop.  


Windows 7 by default you will see only following options in the under Shut Down option. 




To enable hibernate you will need to carry following steps:


1. Launch the command prompt under administrator user.  To do this Search cmd on start menu. Right click cmd any select "Run as administrator".


2. Run following command on command prompt
           powercfg -h on




3. Now open "Power Options" from control panel.  Path Control Panel-> Hardware and Sounds -> Power Option.


4. On Power Option panel select "Choose when to turn off the display".



5. On "Edit Plan Settings" panel click "Change Advanced Power Settings", which will launch the advanced power settings panel.


6. Now as shown in above screen shot select your active power plan. Expand "Sleep" menu item, expand "Allow hybrid sleep". Now there will be two options with value as "off". Make then to "On".  Now check your shut down menu list under start menu it should display "Hibernate" under sleep menu. 


Also if you fell you don't want hibernate option. Disabling hibernate is very simple. Just launch command prompt under administrator user as mentioned in step 1. Now execute following command on command prompt. 
          
         powercfg -h off


Check your start menu the hibernate option will not be display here after.





How to keep Laptop On When the Lid is Closed: Windows 7

Sometimes you may want to keep your laptop on but the screen should be off, or you may want to close the LID. But it may happen that when you close the Lid the laptop get in to sleep mode or even it get switched off.

You can control this behavior by following below given simple steps:

On your find the battery icon which will be present on the windows taskbar, usually located on left of the task bar shown as below. Click on the battery icon will show you some more options. Click on  "More options" link.  It will show you power options. 


If you do not find the battery icon you can directly got to power options using  Control Pane -> Hardware and Sound -> Power Options. ( Control Panel option is present on the Start menu options.)



Now it will show you the control panel for power options windows as shown below.


On this window click "Choose what closing the lid does" link present on the left hand of the screen. This will show you the actions that you can choose when you close the lid as shown below.




  Now choose your action as "Do nothing". Selecting "Do Nothing" will stop your laptop from getting switched off or getting sleep mode when you close the lid.


How to burn ISO Images in Windows 7

Windows 7 offers many features, one of the feature is burning the ISO image on disk.  When you click on the ISO image, you will be able to see the Burn disc image option getting enabled on the top bar. On right click the ISO Image also you will get Burn Disk Image Option.






On selecting Burn disk image option it will prompt you to choose the DVD drive. Choose the DVD drive for burning the ISO image. Now you are ready to burn the image. 




You can also check on verify disc after burning to make sure it is burned without any errors.


Although there are many disk burner programs available, Windows 7 makes it so easy to bur the disk image.



Golang: Http POST Request with JSON Body example

Go standard library comes with "net/http" package which has excellent support for HTTP Client and Server.   In order to post JSON ...