Thursday, November 22, 2012

Speed up virtual android

To run the android emulator fast and smooth - use an x86 image with hardware visualization enabled.
To enable the virtualization: on windows, simple just install the "Intel x86 Emulator Accelerator (HAZM)". The install package could be downloaded using the Android SDK Manager.

On Linux (Debian) make sure the following packages are installed:
qemu-kvm, libvirt-bin

To run the emulator as a kernel-based virtual machine, execute:

emulator-x86 -avd -kernel android-sdk-linux_x86/system-images/android-16/x86/kernel-qemu -qemu -m 512 -enable-kvm

Wednesday, November 21, 2012


How to memorize what the Big-endian is and what the Little-endian is?
(The decision to use that meaningless names only in favor of J. Swift talent was quite stupid in the first place.)

So, here's a "simple" rule:
Let's say that the "end" is the starting byte of the memory word (lowest address).
Then "Little" will mean the less-significant, i.e. little part of the number is located at that first byte end.
In contrary, "Big" will mean the most-significant, i.e. biggest part of the number is located at the end  (the first byte).

How to memorize which architecture uses which notation?
The PC which costs a little is based on the x86 architecture which is Little-endian.
Workstations, like SPARC, SGI cost big money, and also they are Big-endian.

Crypted Jelly Bean fix

Android v4.2 changed default provider for SecureRandom. Because of that the Cipher throws this exception on v4.2: BadPaddingException: pad block corrupted.

The solution is quite simple. Just add explicitly specified provider as the second parameter of the SecureRandom.getInstance() method:

 SecureRandom sr = SecureRandom.getInstance( "SHA1PRNG", "Crypto" );

Read more here

Tuesday, November 20, 2012

Depricate an IP address

Say, a server has a number of IP addresses, but we don't want some addresses to be used as outbound.

ipconfig /all   gives us which address is preferred:

 Autoconfiguration Enabled . . . . : Yes
 IPv4 Address. . . . . . . . . . . :
 Subnet Mask . . . . . . . . . . . :
 IPv4 Address. . . . . . . . . . . :
 Subnet Mask . . . . . . . . . . . :

To make an address not preferred, remove it from the interface and recreate it again using the netsh:
interface ipv4 add address LAN mask= preferredlifetime=0

keyboard switching utility

Updated the language switching utility
This utility assigns mostly unused the right "windows" key to switch between the system's languages.