Get Android Studio debug certificate fingerprints on Windows

Here is a small batch file that will retrieve Android Studio debug certificate fingerprints. Make sure that keytool.exe is in your %PATH%

@echo off
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
pause

Copy / paste the a bough commands in an empty file and save it with a .bat extension.

Android Studio debug certificate fingerprints
Android Studio debug certificate fingerprints

Hard reset Nokia Express Music 5800

Here is how to hard reset ( back to factory default settings ) Nokia Express Music 5800.

I suggest you back up your phone content using Nokia suite before proceeding because hard reset will erase everything from your phone. If you have a memory card I suggest you backup the contents and then format it because some of the apps you downloaded trough Ovi Store are actually installed on your memory card and the next time you attach the memory card after hard reset those apps will be installed again.

To hard reset your phone using on screen keypad enter the following code:

*#7370#

Then for security code enter:

12345

Your phone will restart and after some time booting will be as good as new!

CLastError

Small class for resolving and presenting in user readable form the codes from ::GetLastError() Win32 API function. The class has 2 static methods:

1
2
3
4
5
6
7
8
9
10
void CLastError::Get( const DWORD& dwErrorCode, CString& strErrMessage )
{
	LPTSTR lpErrorText = NULL;
 
	::FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, 
		0, dwErrorCode, 0, lpErrorText, MAX_PATH, 0 );
 
	strErrMessage = lpErrorText;
	::LocalFree( lpErrorText );
}

The ‘Get’ method supplied an error code will resolve the code to user readable error message and store it in the supplied ‘strErrMessage’ string!

1
2
3
4
5
6
7
8
9
10
11
12
void CLastError::Show( const DWORD& dwErrorCode, const CString& strAppName )
{
	CString strErrMessage;
	Get( dwErrorCode, strErrMessage );
 
	CString strDisplayError;
	strDisplayError.Format( 
		_T("%s encountered an error and needs to close!\n\nError was: %s"),
		strAppName, strErrMessage );
 
	AfxMessageBox( strDisplayError, MB_ICONERROR | MB_OK );
}

The ‘Show’ method supplied an error code will resolve the code to user readable error message and the message will be displayed to the user trough AfxMessageBox() function.

Class declaration:

class CLastError
{
public:
 
	CLastError( );
	virtual ~CLastError( );
 
public:
 
	static void Get( const DWORD& dwErrorCode, CString& strErrMessage );
	static void Show( const DWORD& dwErrorCode, const CString& strAppName );
};

Class implementation:

CLastError::CLastError( )
{
}
 
CLastError::~CLastError( )
{
}
 
void CLastError::Get( const DWORD& dwErrorCode, CString& strErrMessage )
{
	LPTSTR lpErrorText = NULL;
 
	::FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, 
		0, dwErrorCode, 0, lpErrorText, MAX_PATH, 0 );
 
	strErrMessage = lpErrorText;
	::LocalFree( lpErrorText );
}
 
void CLastError::Show( const DWORD& dwErrorCode, const CString& strAppName )
{
	CString strErrMessage;
	Get( dwErrorCode, strErrMessage );
 
	CString strDisplayError;
	strDisplayError.Format( 
		_T("%s encountered an error and needs to close!\n\nError was: %s"),
		strAppName, strErrMessage );
 
	AfxMessageBox( strDisplayError, MB_ICONERROR | MB_OK );
}

vHash

vHash is small Windows utility for generating hashes using various cryptography providers and algorithms that they support such as MD-5, SHA-1, etc. It’s written on C using Win32 API making it light and dependency free.

Currently the utility does not support keyed hash algorithms such as HMAC or MAC. Also the program is Unicode.

vHash

Downloads and more information are available on the vHash project page.

Windows 7 USB installation

Due to the enormous amount of software installs and uninstalls I decided it’s about time to reinstall my desktop machine. Having no spare DVD around my installation media of choice was a USB key.

Installing windows 7 from USB key is quite fast actually. Here is how to prepare Windows 7 bootable USB.

The requirements
NOTE: My installation was Windows 7 Professional SP1 x64. After completion of this process the space occupied on the USB key was 3,11 GB.

You will need a flash drive around 4 GB, an ISO image or DVD of Windows 7 and a machine running Windows XP or later. Also an archive tool able to extract ISO files. I use 7-Zip.

Preparing the installation media

1. Formatting the USB drive
Plug in the USB memory stick, right click on the drive in ‘Computer’ and select ‘Format…’. I recommend doing complete format by removing the check box next to ‘Quick Format’ option.

format

Depending on the drive size and speed the format will take some time.

2. Making the USB drive bootable
For this step we will use a command line utility called Diskpart. It’s bundled with every Windows version from 2000 onward.

To start Diskpart, click on the Start button and type diskpart. The diskpart utility will appear. Give it some time to load and enumerate your drives.

NOTE: For complete list of commands that the utility supports type: help at the DISKPART> command prompt.

diskpart1

To list your drives type list disks. From the list of your drives find the USB stick by comparing the size of the drive with the size of your USB stick. In my case the flash drive was ‘Disk 3’

Untitled3

At the ‘DISKPART>’ command prompt select your USB drive by entering the following command where # is the drive number of your flash drive:

DISKPART> select disk #

Now type in the following sequence of commands:

DISKPART> clean
DISKPART> create partition primary
DISKPART> active

Close the utility by typing:

DISKPART> exit

Your flash drive is now bootable. It’s time to copy the windows installation files on it.

3. Coping the Windows 7 installation

Extract the Windows 7 iso image to a location of your choice. If you are using 7-zip right click on the .iso image select 7-zip and from the sub menu select ‘Extract files…

NOTE: If you are turning Windows 7 DVD in to a bootable Flash drive installation just copy the contents of the DVD on the flash drive.

Untitled7

Copy the contents of the extracted .ISO file on your USB drive as you normally would.

Untitled8 
Now you have a bootable Windows 7 installation. Restart your computer and set it to boot from the USB. Install Windows 7 as you normally would.

This method is applicable also for Windows 2000, XP and Vista.