Friday, March 30, 2012

how to get the android_id from an avd/emulator


Just a couple of commands take care of this. What's nice is that this can be automated from the shell, and can thus be included in scripts and in CI (e.g. in Jenkins)

[16:23:59] ~ $ adb -s emulator-5556 pull  /data/data/com.android.providers.settings/databases/settings.db
194 KB/s (24576 bytes in 0.123s)

[16:38:59] ~ $ sqlite3 settings.db "select value from secure where name='android_id'"
9774d56d682e549c

The output of the sqlite3 command is the required android_id:  9774d56d682e549c

Sunday, March 18, 2012

"dependency injection" is such a big phrase for a simple idea


Dependency Injection is a 25-dollar term for a 5-cent concept.
Dependency injection means giving an object its instance variables. Really. That's it.
This is the best explanation of DI that I've yet heard.

source: James Shore


Saturday, March 10, 2012

fix mp3 replay gain (AKA normalize) quick and easy

Some things are SO much easier on Linux than Windoze. Don't need an audio editor, even an open-source one like audacity to perform this routine task on Ubuntu.

sudo apt-get install mp3gain

dir=/music/EckhartTolle-StillnessSpeaks
 
# fix replay gain for all songs in $dir
for i in `ls -1 $dir`; do mp3gain -r -k $i; done


where:
-r: radio mode: apply track gain automatically
-k: prevent audio clipping


Friday, March 9, 2012

install sun-java6-jdk on lucid x64

I tried the standard repo/method:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

which did work for me on my laptop. But I couldn't get this to work, for the life of me, on my lucid x64 server, for weird reasons:

Package sun-java6-jre is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package sun-java6-jre has no installation candidate

I had to resort to a custom ppa for sun-java6-jdk that worked just fine
https://launchpad.net/~ferramroberto/+archive/java

source: http://ubuntuguide.net/install-sun-java-6-jrejdk-from-ppa-in-ubuntu-11-04