Category Archives: Geekiness

Getting to grips with android development

Action Bar

After fooling around with the excellent app inventor, I thought I should branch out in to real android apps.  I downloaded Android Studio and looked at the first tutorials.

Getting the Action Bar working in the second tutorial drove me nuts.  These are the rather hidden, not to say missing things from that tutorial.

  1. The openSearch() and openSettings() functions are missing and you are expected to add them.  I googled this and found a nice placeholder for a function thusly:
        private void openSearch() {
            Toast.makeText(this, "Search button pressed", Toast.LENGTH_SHORT).show();
        }
    
  2. The icons have to be added manually.  You follow the hint and download the Action Bar Icon Pack.  Then you find the icon you want and copy all the drawable-xxxxx subfolders for that icon in to the project on the same level as the drawable folder in the project structure.  Android Studio automagically includes the right image in the right place.
  3. Finally, the icons will not appear if the main java class extends android.support.v7.app.ActionBarActivity.  It only needs to extend Activity (this is my guess, I can’t find it anywhere, but it works), but you do need the minimum API (set in the build.gradle to be 11…

Madness, but I got there.  This is all impossibly Greek to me still, but I did get it to work, so that is progress.

Things to remember:

  • the funcion in the java code is connected to the button xml through the android:onclick parameter!   Very neat.

Lubuntu 14.04 on Inspiron 1300

Lubuntu looks perfect for old hardware.  It runs brilliantly on my old inspiron 1300 but there was no network applet at all so I was pretty frustrated getting it on wifi.

There is lots of help on the internet, but it took me a while to realise that the missing network applet was a bug and the fix was easy.

http://www.webupd8.org/2014/04/fix-lubuntu-1404-network-manager.html

Brew controller + freezing room = pink jacket

2014-03-20 09.02.19I geeked out and made a brew controller for the wine.  It looks at the room temperature and the brew temperature and does a nifty little calculation to determine whether the brew belt should be on or not.  It then reaches out to the internet and posts the current values.  This gives a nice little dashboard  for me to look at.

CaptureLast night it got a little too cold, and despite the belt being on all the time, it could not keep the temperature up to the target.  I looked around and found a perfect little jacket to help it along.  My youngest grew out of it in the last few months, but I don’t think it was as tight on her as it is on the carboy!!

The brew controller is some way from completion and is rather Heath Robinson at the moment.  It does the job, but I did have it working with a beautiful display showing the temperatures.  But this turned to gobbledygook when it started switching the power to the brew belt.  I’ll get there.

Heath Robinson
Heath Robinson

Lots of customisation is to come, not least an improvised thermowell to put the thermometer in to the middle of the brew rather than taped to the side.

More CakePHP notes

Get the authentication details in a view. Permission based so in a user with low rights you need to specifically identify the property you want

<?php debug($this->Session->read('Auth.User')); // works with power user ?>
<?php debug($this->Session->read('Auth.User.username')); // works everywhere ?>

If you want to make a banned view (under ACL) accessible, in the Controller use Auth->Allow:

public function beforeFilter() {
	parent::beforeFilter();
	// this makes the index visible to everyone
	$this->Auth->allow('index', 'view');
}