I found this incredible presentation on Zé’s blog, an animation from the Dan Pink‘s talk at the RSA.
I found this incredible presentation on Zé’s blog, an animation from the Dan Pink‘s talk at the RSA.

One more Shell script snippet.
Scenario: I have several directories, each one with a file called strings.xml. The problem with those files is that they are like:
"text"
I’d like to remove those double quotation marks inside the string element.
I’m already in the directory which contains all others directories with the xml files.
Solution: A script that for each directory, cat it xml file and substitute the occurrences of >” for > and “< for <.
for file in `ls`; do cat $file/strings.xml| sed ‘s/>”/>/g’| sed ‘s/” $file/strings.xml; done
Warning: Shell script and regular expressions are not the correct way to parse XML because there are special cases where you can not handle properly. But in simple cases like this one it can be useful.
How to reproduce:
1. An application with a bunch of EditText.
2. Go to setup and change the locale of Android.
3. Back to the application.
Expected behavior
Locale changed and input values are the same.
Observed behavior
Input values from the last EditText is copied to all others. Even if it’s a password sensitive EditText.
Variations:
1. Same behavior in a EditText with default TransformationMethod.
2. DatePicker and TimePicker have strange behaviors too. They lose what I was writing on them but they don’t copy content.
3. The behavior was first noticed on the internal component NumberPicker and after that tested on EditText.
Malicious usage scenario:
Someone is filling user/password form in a application, go to the bathroom and forget the phone over a table. Other one gets it, use the flaw and read the user secret password.
Possible cause:
When locale is changed and you enter again in a application, it has to be destroyed and created but somehow old values are filled again. Probably the routine that cares about writing i18n details such orientation (left-to-right/right-to-left) has a bug.
Affected versions:
Thanks to Diego Almeida who first noticed that behavior on NumberPicker. :]
Update: I filled a issue on Android project. Seems that they know about that behavior and the workaround is to put android:id properties on elements. The problem persists on NumberPicker even when using android:id on them! In fact, is my real problem.

import java.lang.reflect.*;
public class Foo {
public void bar(int param){
System.out.println(param);
}
public static void main(String args[]){
Object f = new Foo();
try {
Method m = f.getClass().getMethod("bar", int.class);
m.invoke(f, 42);
} catch (Exception e){
System.err.println(e);
}
}
}
$ java Foo
42
a new android I just drew. source-code: android_look.svg. CC-BY-SA as usual.
You can acess internal Android resources such strings, drawables, layouts and others. For example, if you need to create a button with the text “Cancel” you can do:
Using this you are using the internal resource for “Cancel” in that Android and all its i18n. Using the same logic you can access drawables, layouts, etc.
A simple and beautiful video about the early failures, things and people that tries to put you down and we have to face before achieve what we really want.
“If you never failed, you never lived”

Take a look at http://www.phenoelit-us.org/dpl/dpl.html. The weakest part of a network nowadays, a unconfigured wireless router.