Friday, November 26, 2010

ImageView.setImageURI does not work for file URIs

The following code fails:

File f = ...
ImageView imageView = ...
imgView.setImageURI(Uri.fromFile(f));

Workaround:

imgView.setImageDrawable(Drawable.createFromPath(f.getAbsolutePath()));

Thursday, November 25, 2010

MySQL root password reset

The other day MySQL Workbench somehow set the password for the localhost root account from None to some other value while I tried to change the password of another user. Don't know exactly what happened, but to rest the password you should:
  1. start mysql
  2. type "use mysql"
  3. type "update user set password='' where user='root';"
  4. type "flush privileges
After this, the root account has no password. Note that without step 4 changes to the user table will have no effect whatsoever. Took me 30 minutes to find out ...