Bill Farmer

Random thoughts on random subjects

Move Linux Mint Root Partition

by Bill Farmer. Categories: Hacking .

I recently added a new disk drive to my workstation and, as part of reorganising, wanted to move the Linux Mint root partition from one disk to another. Naturally I googled duckied it and found a certain amount of useful info.

I used gnuparted to copy the partition from one disk to another. The standard method to reinstall grub on a partition so it will boot appears to be to mount it and use grub-install with the –boot-directory option like this.

Read more →

Fried Rice

by Bill Farmer. Categories: Recipes .

This is our version of Chinese take-away fried rice. Use whatever meat and vegetables are in the larder. Tasty meal for four

Ingredients

  • 2 onions, chopped
  • 2 cloves of garlic, chopped
  • 2 carrots, grated
  • 1/4 white cabbage, thinly sliced
  • 1 1/2 cups of easy cook rice
  • 250g chopped gammon ham
  • 100g cooked prawns
  • 100g petit pois
  • 1 3/4 cups water or stock
  • Vegetable oil

Method

  1. Put a large dollop of oil into a large skillet or wok.
  2. Add the onions, garlic, cabbage and carrots and place on a medium heat.
  3. Cover and let the vegetables cook for a while.
  4. Add the rice, meat, prawns and peas.
  5. Add the water and give a good stir.
  6. Cover and allow to cook until the water is absorbed.
  7. Add more water if necessary.
  8. It is possible to get a tasty paella-like crust on the bottom of the pan if timed just right.

Read more →

Pan fried lamb’s liver, bacon and chorizo

by Bill Farmer. Categories: Recipes .

Back in the mid 70’s, I had to do some work at Kingston upon Thames Power Station. When I stopped for lunch, I found a little Greek restaurant opposite in a parade of shops and restaurants. That whole area, including the power station has since been redeveloped, and bears no resemblance. I had their lunch time offer of pan fried kidneys, probably with rice.

When I got home, I mentioned this to she who did most of the cooking at that time and she came up with something which became her kidney special. It evolved into a completely different dish over time.

Read more →

Handlers in Android

by Bill Farmer. Categories: Hacking .

Using a handler to return results from a worker thread

This has taken me quite a while to put together. There are throw-away remarks in the Android docs about this, but no useful examples. You want to get the results back from a worker thread to your main activity so you can do stuff with them. There are several parts to this.

  1. The main activity implements Handler.Callback, and has a handleMessage function.
  2. When the worker thread is created, include a reference to the main activity.
  3. In the worker thread constructor, create a Handler, including the reference to the main activity.
  4. When some results need passing back, send a Message back to the main activity using the handler.
    public class MyActivity extends Activity implements Handler.Callback
    {
        //...
        // On create
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            //...
            WorkerThread worker = new WorkerThread(this);
        //...
        public boolean handleMessage(Message msg)
        {
        //...
    public class WorkerThread extends Thread
    {
        Handler handler;
        //...
        // Constructor
        public WorkerThread(Handler.Callback callback)
        {
            handler = new Handler(callback);
            //...
        private void someFunction()
        {
            handler.sendEmptyMessage(WHATEVER);
            // or
            Message msg = handler.obtainMessage(WHATEVER, thingy);
            handler.sendMessage(msg);
            //...

The handler will send the message back to the activity in the UI thread, so you can do whatever with the contents.

Read more →

Chorizo Egg and Tomato Toasted Sandwich

by Bill Farmer. Categories: Recipes .

This is a nice snack for two.

Ingredients

  • Two eggs
  • Sliced chorizo or crispy bacon
  • Four slices of bread
  • Tomato thinly sliced
  • Cheese sliced

Method

  1. Toast two slices of bread and fry two eggs
  2. Meanwhile slice the tomato thinly
  3. Flip the eggs, otherwise the tomato won’t stay on top
  4. Layer chorizo slices, egg, tomato slices and cheese slices on each piece of toast
  5. Put the toast slices on heatproof plates and put under a hot grill to melt the cheese
  6. Toast the other two slices of bread
  7. When the cheese is melted take the plates out and press down the other slices of toast on top
  8. Slice the sandwiches in two diagonally

Read more →
Previous page Next page