Sunday, July 06, 2008

GridBagLayout help

I have to admit I quite like GridBagLayout. Not a lot of people admit to that I guess. However, I was recently impressed with MigLayout and wondered if I could hack up something similar for grid bag and make it a little more tidy. You may or may not agree; opinions as always are welcome.

The basic premise is that any property that GridBagConstraints supports can be set using property:value.

Here's the class......off you go...

// Copyright (c) 2008 Luke Biddell//// Permission is hereby granted, free of charge, to any person obtaining a copy// of this software and associated documentation files (the "Software"), to deal// in the Software without restriction, including without limitation the rights// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell// copies of the Software, and to permit persons to whom the Software is// furnished to do so, subject to the following conditions://// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE// SOFTWARE.package uk.co.biddell;

Friday, February 22, 2008

Cocking Oil

Tuesday, April 03, 2007

A cat called custard

Last Saturday night the doorbell rang at about 10pm, there's a young lad at the door.

"Do you know the owner of a ginger cat? I've just run him over and he's crawled into a hedge down the road."

I grabbed my torch and raced down the road; the cat was there in a hedge shaking and bleeding from the mouth. Still fairly lively though given what had happened to him. It was pretty obvious I had to get him out as if he went any further into the hedge it would be really difficult to get him out. Luckily I managed to get hold of him at the first attempt and dragged him out. He was squirming a lot which felt like a good sign. I sat him on the floor and calmed him down before taking him back to my house. I got him inside and took him into the kitchen. He coughed and blood spurted all over the kitched floor. His lower jaw was clearly broken, hanging down and one of his back legs was dislocated judging by his limp.

We grabbed one of our cat boxes and as I'd been drinking the young lad that ran him over and his girlfriend agreed to take him to the vets. He was pretty quiet in the car, I could hear him breathing and his airway sounded good, breathing hard but not laboured.

We got to the vets and they took him away. About 15 mins later the vet returned. The cat's lower jaw is completely split in half and the roof of his mouth is badly fractured too. They have him on oxygen and painkillers. The surgery will cost a significant amount of money. If we can't find the owners within 24 hours then he will be put down. If his condition worsens then he will be put down. We all felt pretty dejected - he was alive but if we didn't find out who owned him he was dead. We figured that at the very least he would spend his last hours in comfort rather than freezing and bleeding to death in a hedge. I told the vet to call me straight away if anything changed.

We went back to my house and photocopied a bunch of fliers to put through people's doors asking if they know of the cat and to call the vets immediately. I delivered them all sometime after midnight and eventually went to bed.

After lunch on Sunday I decided to ring the vets as I hadn't heard anything. Still no word from the owners but at least his condition was stable.

I decided to go further afield and try more fliers. He was just too well groomed to be stray, he had to be owned by someone. So I started to flier the rest of the estate and asked around the residents to see if they knew him. He was known in the area and had been seen in the gardens so that was a good start.

By now I had one flier left and was giving up and going home when I walked past a couple of kids playing in the alley. I decided to go back and ask them if the knew the cat. The little girl I talked to said she hadn't seen her ginger cat for a day or so. We went and got her mom and from the description it was surely their cat - especially as they confirmed that he hadn't be spayed. The vet had told me that he hadn't been spayed and that pretty much any cat that gets run over is a male who hasn't been spayed.

I gave them the last flier and went home - fingers crossed.

5 hours or so later I had a call from the vets saying the owners had come forward and he was going to get the operation he needed. His condition had improved and he was doing really well.

Tuesday, January 02, 2007

If you only knew what I've forgotten

I was thinking the other day about the things I can't remember anymore.

That may sound like a crazy statement but it's not as mad as it sounds. I was trying to do some mathematics the other day and was stuggling. At university my math was good, and the particular problem I was attempting to solve, I knew I used to know how to do it and couldn't remember anymore.

So what's worse, not knowing how to do something. Or knowing that you used to know how do something and have since forgotten?

I think the latter is worse and my current plan is to drink more wine so I forget I ever knew how to do anything.

Fly Icarus Airlines

Friday, July 14, 2006

Are birds scared of heights?

Do you think that any bird has been scared of heights? If so, would it evolve into something flightless, like New Zealand’s Kakapo?

If that’s the case, did we evolve from an aquaphobic fish? Sounds mad, BUT, it could happen!

Evolution is a strange thing, and I don't pretend to understand it, but is it the creation of solutions to problems that exist, or is it creating problems by solutions that don't?

What prompted the evolution of an eyeball? What decided that being able to see (and therefore interpret) gives an advantage over blind genetic peers? Is it only based upon how efficiently the thing could grow and reproduce... What decided reproduction was a good idea? Is it because death is built in?

Saturday, July 08, 2006

Safe hands

As I stumble along the path of parenthood I realised that I should be extremely grateful for my time at school. Especially playing cricket. I was a reasonable wicket keeper which is coming in handy catching Livia's sick.

Wednesday, May 24, 2006

Professor Bubbleworks unifies dark matter and alternate realities

The end of the Professor Bubbleworks ride at Chessington (don't ask me why I was there - I am a kid at heart) has streams of water arcs that pass above your head. Those arcs are periodically lit by strobe lighting, effectively freezing and focussing your attention on a particular water drop's trajectory.

This got me thinking about time and alternative realities. There is a common thought that all possibilities are playing out all of the time (let's conveniently ignore what that might mean for conservation of energy and the bounded/unbounded universe); but why do we only experience a single reality (i.e. why haven't I won the lottery yet?). Could it be that each reality is like one of those water droplets, but the collapsing of the wave function (I can't remember what that actually means ;-) ) is like the strobe or a filter on our reality? If that was the case, could we alter the filter or frequency of the "reality strobe" to "light up" alternate realities?

What's this got to do with dark matter? Well, there's an awful lot of it... and we don't know what it is and we can't "light it up" to look at it... but could the dark matter actually be our alternate realities playing out?!

Wednesday, April 19, 2006

X Factor Voting

This Blog is about the biggest scam ever perpetrated against the Great British public.

Is it statistically impossible for Louis Walsh, Simon Cowell and Sharon Osborne with a free public vote, to end up with one contenstant each, left in the final of the X Factor competition.......

Therefore, by inference, the programme owners are stealing millions of pounds from the public by deception. Why on earth doesn't the IBA force them to publish listings of the vote on the Web, so you could check that all was above board, or at least have the vote independently adjudicated by the IBA.......?