Rapid Environment Editor

Since Windows 95, and earlier, Windows has suffered from a miserable editor for environment variables. Something most users need to do at some point, usually when something is going wrong and they are on with support, should not have to decode a line of cryptic characters and %TOKENS%. Linux, I expect to be a bit rough, but not a “consumer” OS. I even considered writing a Control Panel app once, but lost interest.

Enter Rapid Environment Editor. It shows the User and System environment vars in a separate tree, allowing you to individually edit each entry in the PATH, for example. AND it shows in red the segments that are INVALID! Duh! Click save, and you are done.

I just donated $10. Highly recommended.

 

http://www.rapidee.com/en

How do you add a local Eclipse feature from a local build?

I’m trying to use a branch version of the m2e Android plugin to fix a problem with ADK r20 (see error-importing-maven-android-android-project-to-eclipse-with-adt-20 )

Turns out, Ricardo already merged the adt-20 branch to master.

$ git clone https://github.com/rgladwell/m2e-android.git
$ cd m2e-android
$ mvn install

So that builds the project. Takes a while too.

Now you uninstall the old plugin from Eclipse.

  1. Help -> Install Software… > What is already installed?
  2. Find “Android Configurator for m2e” with “me.gladwell.eclipse….”
  3. Click “Uninstall…”
  4. Restart Eclipse.

How do you create a local site to install from?

  1. Help > Install Software… > Add…
  2. Name = local m2e-android
  3. Location = /G:/projects/mobile/m2e-android/me.gladwell.eclipse.m2e.android.update/target/repository  (dont include the jar – the folder must be user – not the file: protocol either)
  4. Check “Android Connector for M2E” and Finish.

…and you are off!

Water Flow

Here we are in the midst of the worst drought in my memory, and this, the year of the prairie native garden walk. Our garden looks like a hayfield.

While I was watering some bushes, I wondered how long I need to hover over a bush to water it sufficiently. Too little, the moisture is waster, too much and that wastes water & time.

Assumption: I should dump 2 inches of water in a 2 foot diameter circle which is the dripline of the bush. That is where the roots hide.

So a circle of 2 feet to the depth of 2 inches is Pi*r^2*d, or 3.14*(12^2)*2 = 904 in^3.

I used a stopwatch app and a 2 qt measuring cup and found the water flow to be 6 seconds for 2 qts, or 12 seconds / gal. Using the conversion, 1 gal=233 cu.in., we get 233/12 cu.in. per second, or 19 cu.in./sec.

So divide 904 cu.in / 19 cu.in/sec => 47 seconds per bush. If I go a minute, good. For a bigger bush maybe 2 as the volume increases as the square of the radius.

Observation 1: math is cool
Observation 2: dimensional analysis is probably the most useful thing I learned in school. That, and algebra.

HOW ABOUT WOLFRAM ALPHA?

Supposed to be way cool information engine. Lets try.

“how long to fill a bucket 2 feet in diameter and 2 inches deep at a rate of 2 quarts per 6 seconds” -> Huh?
“volume of a vertical cylinder 2 feet in diameter and 2 inches tall” -> 15.67 gallons
“( 2 qts / 6 seconds ) in gal/minute” -> 5 gal/min
“(volume of a vertical cylinder 2 feet in diameter and 2 inches tall) / ( 2 qts / 6 seconds )
-> “Using closest Wolfram|Alpha interpretation: cylinder 2 feet in diameter and 2 inches tall”

Can’t get anything else useful. Boo. By the time I get anything useful, I can do it on paper.

Jenkins and Android

We use Jenkins to build our Android app. I am converting the build from r12 to r18 (now r20, since Google I/O 2012) which is forcing some config changes, but trying to preserve the old build in case we need to rebuild something old. So I use $ANDROID_HOME, specified in the System config under “Android SDK root”, which each job will specify, to point to the correct SDK. And I define two other vars, ANDROID_HOME_18 and ANDROID_HOME_12 to refer to later.

[EnvInject] - Injecting as environment variables the properties content 
ANDROID_HOME=${ANDROID_HOME_18}
PATH=${ANDROID_HOME_18}/tools:${ANDROID_HOME_18}/platform-tools:${SONAR_RUNNER_HOME}/bin

[EnvInject] - Variables injected successfully.
[locks-and-latches] Checking to see if we really have the locks
[locks-and-latches] Have all the locks, build can start
$ /usr/share/android-sdk-macosx.r18//tools/android list target
/usr/share/android-sdk-macosx.r18//tools/android: line 30: dirname: command not found
/usr/share/android-sdk-macosx.r18//tools/android: line 33: basename: command not found
/usr/share/android-sdk-macosx.r18//tools/android: line 40: dirname: command not found
/usr/share/android-sdk-macosx.r18//tools/android: line 44: dirname: command not found
/usr/share/android-sdk-macosx.r18//tools/android: line 48: basename: command not found
[android] The configured Android platform needs to be installed: android-8
[android] Installing the 'android-8' SDK component(s)...
$ /usr/share/android-sdk-macosx.r18//tools/android update sdk -u -a -t android-8
/usr/share/android-sdk-macosx.r18//tools/android: line 30: dirname: command not found
/usr/share/android-sdk-macosx.r18//tools/android: line 33: basename: command not found
/usr/share/android-sdk-macosx.r18//tools/android: line 40: dirname: command not found
/usr/share/android-sdk-macosx.r18//tools/android: line 44: dirname: command not found
/usr/share/android-sdk-macosx.r18//tools/android: line 48: basename: command not found
: can't find sdkmanager.jar
[android] Using Android SDK: /usr/share/android-sdk-macosx.r18/
[android] Waiting 1 seconds before starting emulator...
$ /usr/share/android-sdk-macosx.r18//platform-tools/adb start-server

Lots of things missing. dirname and basename live in /usr/bin, cannot be found due to bad path. sdkmanager.jar missing. Add /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin to PATH. Better. Still cannot find the android-8 libs. Spent a lot of time, adding debug to the Ant scripts, trying to log the environment. Ready to crack into the source. Sigh.

Read a bit on the Android Emulator Plugin, and it exports ANDROID_HOME. Could it be colliding with mine? I injected a NEW home variable, instead of ANDROID_HOME, and use that to pass in the current SDK location.

[EnvInject] - Injecting as environment variables the properties content 
XXX_ANDROID_HOME=${ANDROID_HOME_18}
PATH=${ANDROID_HOME_18}/tools:${ANDROID_HOME_18}/platform-tools:${SONAR_RUNNER_HOME}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

[EnvInject] - Variables injected successfully.
[locks-and-latches] Checking to see if we really have the locks
[locks-and-latches] Have all the locks, build can start
[android] Using Android SDK: /usr/share/android-sdk-macosx.r18/
[android] Waiting 1 seconds before starting emulator...
$ /usr/share/android-sdk-macosx.r18//platform-tools/adb start-server
[android] Starting Android emulator
[android] Erasing existing emulator data...
$ /usr/share/android-sdk-macosx.r18//tools/emulator -no-boot-anim -ports 58553,58554 -prop persist.sys.language=en -prop

and that seems to work.

Takeaway : don’t define ANDROID_HOME locally, let the plugin define it. It will anyway.