Hyperventilation

24. January, 2012

Pulled a lifeless child out of swimming pool yesterday. Odd feeling.

What I remember most is two things:

  1. How long it took about 80 people around the pool to notice that a man was calling for help. He was calling and waving and a couple of people even waved back. But his plea for help somehow didn’t really register until I took the child from him and shouted as well.
  2. The foam coming from the mount of the child as I dropped him on the ground outside of the pool.

Luckily, a doctor was close-by and managed to revive the child. He did first aid until the staff doctor from the hotel’s infirmary arrived. The staff of the hotel also called an ambulance that arrived only a few minutes later. All in all, when the near-death registered, professional help came quick.

If you have a child who loves to dive: Make sure they don’t take deep breaths before diving. They’ll lose consciousness without any prior warning sign – it’s called shallow water blackout. From the Wikipedia article:

Significantly, victims drown quietly underwater without alerting anyone to the fact that there is a problem and are typically found on the bottom[…]

Some tips for people who want to save lives:

  • People who are about to drown don’t call for help – if they had the air, they wouldn’t be drowning in the first place. Look for signs of panic and utter silence. Playing children scream, shout and splash. Downing swimmers just splash.
  • People move all the time. If you think something is odd, watch them for 10 seconds. If you don’t see any controlled movement in that time, call for help. Remember that water is never still. So if the hands float a bit, that’s not movement. Watch out of for leg movement, swimming moves, looking around (head movement). If in doubt, call for help – pulling someone out of water takes a lot of time.

Some More WINs

14. January, 2012

Making food visible for the blind … I really like the smiles when the dish is served.

(source: Braille Burger WIN)

I fondly remember this line from MAD magazine: If a student takes six hours to write a paper by hand, how long would it have taken had he used a pencil?

Maybe even longer:

(source: Finger Painting WIN)

In the next video, a couple of people had lots of books and lots of time and a lot of creativity went into it, too:

(source: Book Party WIN)

Some people only read books. Wimps! There is so much more you can do:

Book Carving WIN

And last but not least: Something to enjoy like a great sunrise – “Seconds of Beauty


Fun With Generics: Return Anything

13. January, 2012

If you want to return anything in Java, you usually use Object – with Java 5 and autoboxing, this even allows to return primitive types.

But with Generics, you can do better: You can return whatever the caller wants.

How? Like so:

     public <T> T get() {
        @SuppressWarnings( "unchecked" )
        T result = (T) ...calculate the result...;
            
        return result;
     }

Use cases: Calling unknown methods or reading field values with the Reflection API. Instead of cluttering your code with casts, just write (where ReflectionUtils.invokeMethod() uses the trick above):

     Map<String, List<Map<String, String>> map = Maps.newHashMap();
     Set<List<Map<String, String>> entries = ReflectionUtils.invokeMethod( map, "entrySet" );

Cool, eh?

Unfortunately, Sun’s javac isn’t smart enough to determine a common upper bound between int and Object. So if you need to return int, you still need a cast:

     Map<String, List<Map<String, String>> map = Maps.newHashMap();
     int size = ReflectionUtils.invokeMethod( map, "size" );

Maven Tool 4 Eclipse 0.10.0 Released

12. January, 2012

I’ve just release a new version of Maven Tools 4 Eclipse (Changelog). It fixes the two most pressing issues:

  • Bug 367461 – [mt4e] mt4e needs priming.zip
  • Bug 354381 – Error: groovy.lang.MissingPropertyException: No such property: args for class: m4e.ImportTool

Have Fun!


DecentXML 1.4

12. January, 2012

I’ve just release DecentXML 1.4, my very own XML parser implementation.

See the change log for changes.

It will show up on Maven Central in a couple of days.


Two Nice Browser Games

11. January, 2012

If you’re looking for a simple game to fill a five-minute gap, here are two by Microsoft:

  1. Pirates Love Daisies (tower defense)
  2. Cut the Rope (logic puzzle)

Even though developed to show off IE9, they work perfectly well in Chrome.


A Couple of Cool YouTube Videos

5. January, 2012

If you ever wondered what happens when two drop of water drop:

Here is some good reasoning what is wrong about in discussion about climate change (stupid title, though):

And being a cat lover/owner:

Car wash? No problem. Just park here…