Friday 27 January 2012

Book Review: The Disappearing Spoon by Sam Kean

What a lovely book.
Anyone who even has a passing interest in science fact, history, fiction and friction should go get a copy.
I would go further and suggest it become a standard textbook for any science 101 classes in school.
Immensely readable, it packs so much intertwined history anecdotes that you feel that all the scientists of the 20th century worked in the same lab.
To give a poignant example I would provide the example of Zyklon-B.
It was a derivative of Zyklon-A developed by a german scientist trying to develop gas weapons for use against the French in WWI. He was Jewish.
Oh the humanity.
Go get it.

Wednesday 25 January 2012

Holy Robot and a Beetle Beetleman!

Ok, It was B's birthday today, so I bought him a robot arm.
A kit I might add. 200+ parts.
He put it together and was maneuvering cork stoppers with ease within an hour.
Damn. For $70 I wanted him to take at least 2hrs.
Here it is and I apologize for the fuzziness:

Now the beetle.
We had ordered some food, and left the light on out the front.
We heard a massive BANG at the door and figured it was the delivery.
Nope.
A F**k off beetle.
Huge bugger.
Here it is...



Don'tcha just love Australia?

I might point out that I was sitting out the back stoop imbibing Bourbon a few hours ago and a 4' wingspan bat crashed into our fence - flailing about screeching away. Impressive. Not as impressive as this bad boy, bit pretty cool.

Monday 23 January 2012

Review: "Sherlock" BBC TV Series

I first thought this was going to be rubbish because I just couldn't see how you would get past the "snigger" factor when hearing a modern day character saying "Sherlock Holmes and Dr Watson" or "Inspector Lastrade."
And given the Downey/Law movies, I was reticent to watch the series for fear of either being polluted.

Boy was I wrong.
Having Moffat and Gattis as producers and writers makes it all worthwhile.
Far from overlapping with the Downey/Law movies, they can be viewed completely separately.

Each episode is like an individual movie with all the beautiful production values you expect from the BBC.
And better because you really have to work to see most of the clues.
This is so unlike most TV detective shows where you have figured out the answer in the first 10 minutes.
To quote Sherlock:
"DULL! DULL! DULL!"
There are no 'wasted' or comedy relief characters - every actor does a brilliant job without overwhelming any of the others.
I particularly liked Lastrade as so often he is portrayed as a bit dim while Rupert Graves does a brilliant job being "the best Scotland Yard has to offer."
And a wonderful portrayal of Mrs Hudson by Una Stubbs rounds it off.
The writing is up to the standard you expect from Moffat and Gattis being snappy, witty and rich.

After watching all six episodes movies we immediately went to the websites associated and had great fun digging around. For reference they are:

The Science of Deduction
John Watson's Blog
Molly Hooper's Diary

I strongly recommend this series. Worth every minute of your time to watch them.

I would have to say though that I had some odd thoughts around Moriarty. My memories of the original Conan Doyle stories makes me think of him as as an old man of crime and not a young psycho nut-job just starting out on a career in manipulation.  Yet Andrew Scott did a great job and was believable.

On a side note, there's talk about CBS doing a version of the series set in the US. Not sure how that would work though... The Sherlock we know and love is damn smart, sarcastic, caustic, rude and arrogant and I suspect that would not be quite as endearing to American viewers.

Thursday 19 January 2012

Creating a dummy groovy/maven project and make it executable


Problem:
I like groovy.
The company uses maven and java.
The live servers don't have groovy installed.
So I downloaded the Intellij Idea community edition and got to work.

So here is a contrived solution that yields an executable jar file.
First go to some project folder (I was testing with Idea CE 11 so I used IdeaProjects):

bandit:IdeaProjects user$ pwd
/Users/user/IdeaProjects

Now use maven to create an example project:

bandit:IdeaProjects user$ mvn archetype:generate -DarchetypeGroupId=org.codehaus.gmaven.archetypes -DarchetypeArtifactId=gmaven-archetype-basic
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Interactive mode
[INFO] Archetype [org.codehaus.gmaven.archetypes:gmaven-archetype-basic:1.4] found in catalog remote
Define value for property 'groupId': : com.company
Define value for property 'artifactId': : example
Define value for property 'version': 1.0-SNAPSHOT: 
Define value for property 'package': com.company: 
[INFO] Using property: name = Example Project
Confirm properties configuration:
groupId: com.company
artifactId: example
version: 1.0-SNAPSHOT
package: com.company
name: Example Project
Y: y
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20 seconds
[INFO] Finished at: Thu Jan 19 16:31:24 EST 2012
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------

This will create a project called example:

bandit:IdeaProjects user$ cd example
bandit:example user$ find . -print
.
./pom.xml
./src
./src/main
./src/main/groovy
./src/main/groovy/com
./src/main/groovy/com/company
./src/main/groovy/com/company/Example.groovy
./src/main/groovy/com/company/Helper.java
./src/test
./src/test/groovy
./src/test/groovy/com
./src/test/groovy/com/company
./src/test/groovy/com/company/ExampleTest.groovy
./src/test/groovy/com/company/HelperTest.groovy

Ok. Now create a new project in Idea CE and do this:
1. use import project from external model and click next
2. choose maven and click next
3. choose the correct root directory and check import Maven projects automatically and click next
4. choose the com.company:example:1.0-SNAPSHOT maven project and click next
5. ignore the next panel as it's fine and click finish

Now you have the project open, edit the pom.xml.
It will look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Generated from archetype; please customize.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.company</groupId>
    <artifactId>example</artifactId>
    <name>example project</name>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <version>1.4</version>
                <configuration>
                    <providerSelection>1.8</providerSelection>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generateStubs</goal>
                            <goal>compile</goal>
                            <goal>generateTestStubs</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

What we need to do is add some extras.

In the dependencies add this:

        <dependency>
            <groupId>org.codehaus.gmaven.runtime</groupId>
            <artifactId>gmaven-runtime-1.8</artifactId>
            <version>1.4</version>
        </dependency>

And in the plugins add this:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

Now open the Example.groovy in src/main/groovy/com.company.
It should look like this:

//
// Generated from archetype; please customize.
//

package com.company

/**
 * Example Groovy class.
 */
class Example {
    def show() {
        println 'Hello World'
    }
}

Add a main method:

//
// Generated from archetype; please customize.
//

package com.company

/**
 * Example Groovy class.
 */
class Example {
    public static void main(String[] args) {
        System.out.println("Working!");
    }
    def show() {
        println 'Hello World'
    }
}

Now go back to the command line and run a package:

bandit:example user$ mvn clean package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building example project
[INFO]    task-segment: [clean, package]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory /Users/user/IdeaProjects/example/target
[INFO] [groovy:generateStubs {execution: default}]
[INFO] Generated 1 Java stub
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/user/IdeaProjects/example/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent!
[INFO] Compiling 2 source files to /Users/user/IdeaProjects/example/target/classes
[INFO] [groovy:compile {execution: default}]
[INFO] Compiled 1 Groovy class
[INFO] [groovy:generateTestStubs {execution: default}]
[INFO] Generated 2 Java stubs
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/user/IdeaProjects/example/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent!
[INFO] Compiling 2 source files to /Users/user/IdeaProjects/example/target/test-classes
[INFO] [groovy:testCompile {execution: default}]
[INFO] Compiled 2 Groovy classes
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: /Users/user/IdeaProjects/example/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.company.ExampleTest
Hello World
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.411 sec
Running com.company.HelperTest
Hello World
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 sec

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar: /Users/user/IdeaProjects/example/target/example-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Thu Jan 19 16:47:12 EST 2012
[INFO] Final Memory: 26M/81M
[INFO] ------------------------------------------------------------------------

And now we can run it:

bandit:example user$ java -cp target/example-1.0-SNAPSHOT.jar:/opt/local/share/java/groovy/lib/* com.company.Example
Working!

I should have set UTF-8 instead of MacRoman and also obviously I could have used maven to put the Main-Class in the manifest, but this is a contrived example.
Also obviously I have to ensure the groovy 1.8 jars are on the server...
Or...
I could jars-in-a-jar solution...

That darned "No suitable ClassLoader found for grab" with groovyc and java -cp


Update Apr 7, 2012: Hmm. Seems this is a very popular post. I intend to expand it and cover how to approach the details more clearly.

I like groovy.
Problem is, we don't have it installed on our live servers.
So I have to compile the groovy code into java class files and deploy them.
But when you're using the @Grab annotation, things go bad.

I kinda like using @Grab to snarf the specific dependencies, but you always run into the dreaded:

Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: No suitable ClassLoader found for grab

Now all that @Grab does is download the jars you needed and pops them into ~/.groovy/grapes.
Once it's done it's job you don't need it for either running groovy scripts or for the java class.
Here's a rather artificial contrived explanation of how to get around the ClassLoader issue.

(Of course you could just use grape directly, or specify your own .m2 jars or whatever, but I noted this question open in a few places, so I contrived this example)

First create your script, say, x.groovy...

@Grab(group='com.gmongo', module='gmongo', version='0.8')
import com.gmongo.GMongo
// Instantiate a com.gmongo.GMongo object instead of com.mongodb.Mongo
def mongo = new GMongo("the.mongo.ip.address", 27017)
def db = mongo.getDB("some_database")
println db.my_collection.find([SomeKey:[$ne:"0"],SomeOtherKey:"0"]).count()

Now run it:

groovy x.groovy
149845

Cool.
Now we use groovyc to compile it...

groovyc -d classes x.groovy

But when we try to run it using java...

# Building CLASSPATH here purely for clarity...
# We compiled the groovy class into classes:
CLASSPATH="classes"
# We need the gmongo jar:
CLASSPATH="$CLASSPATH:~/.groovy/grapes/com.gmongo/gmongo/jars/gmongo-0.8.jar"
# And because tis is just an example, I knew I needed this one as well:
CLASSPATH="$CLASSPATH:~/.groovy/grapes/org.mongodb/mongo-java-driver/jars/mongo-java-driver-2.5.2.jar"
# And I dev on a Mac and use MacPorts, so groovy is installed in /opt/local/share:
CLASSPATH="$CLASSPATH:/opt/local/share/java/groovy/lib/*"
# Now run it:
java -cp $CLASSPATH x
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: No suitable ClassLoader found for grab
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 ...elided for brevity...
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:165)
 at x.<clinit>(x.groovy)
</clinit>

Rats. So we need to remove the @Grab now that it's done it's work and downloaded the jars...

//@Grab(group='com.gmongo', module='gmongo', version='0.8')
import com.gmongo.GMongo
// Instantiate a com.gmongo.GMongo object instead of com.mongodb.Mongo
def mongo = new GMongo("192.168.4.112", 27017)
def db = mongo.getDB("some_database")
println db.my_collection.find([SomeKey:[$ne:"0"],SomeOtherKey:"0"]).count()

And re-compile using the specific gmongo jar:

groovyc -cp ~/.groovy/grapes/com.gmongo/gmongo/jars/gmongo-0.8.jar -d classes x.groovy

And now we can run it as before

# Building CLASSPATH here purely for clarity...
...elided...
java -cp $CLASSPATH x
149845

Hope that explains it for those stuck with that issue.

Oh, and if you need to see the classpath from within a script go here: http://blog.blindgaenger.net/print_groovys_classpath_for_debugging.html
Waaaay cool.

Friday 13 January 2012

Wow. Meteor impacts!

Just got a call from my brother. Wanted to know if I knew anything about a meteor impact in western Finland. Not an unreasonable request given my history (and his), but I didn't. So I did a search.

Did you know... That of the top 50 meteor impacts with craters greater than 20 km in size, 7 are in Australia? Neat. Here's the full list:

http://en.wikipedia.org/wiki/List_of_impact_craters_on_Earth

Cool. Actually been to some of them. Here's the list of impact craters in Australia: http://en.wikipedia.org/wiki/List_of_impact_craters_in_Australia

Wolfe Creek is waaay cool and I visited it sometime in the 80's. http://en.wikipedia.org/wiki/Wolfe_Creek_crater

But back to my brother. He's going to visit this page, so here's a list of impact craters in Europe: http://en.wikipedia.org/wiki/List_of_impact_craters_in_Europe

He can do a sort and see the ones in Finland.
Cheers!

Wednesday 11 January 2012

Stopping and/or Restarting an embedded Jetty instance via web call


I had a need to allow a web call to stop and restart an embedded Jetty instance.
So basically, I need to have something like this:

curl -v http://localhost:9103/some/path  # Calls a handler and does something RESTful 
curl -v http://localhost:9103/stop       # Stops the Jetty instance
curl -v http://localhost:9103/restart    # Restarts the Jetty instance

First up create a main class:

package com.company;

import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.NCSARequestLog;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.RequestLogHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EmbeddedJetty {

  private static Logger log = LoggerFactory.getLogger(EmbeddedJetty.class);

  public static void main(String[] args) throws Exception {
    while (true) {
      // Realistically all parameters should be read from some external file...
      log.info("Starting Jetty on port 9103");
      Server server = new Server(9103);

      HandlerCollection handlers = new HandlerCollection();
      ContextHandlerCollection contexts = new ContextHandlerCollection();

      // I added this to show how to add access logs to an embedded server.
      RequestLogHandler requestLogHandler = new RequestLogHandler();
      NCSARequestLog requestLog = new NCSARequestLog("/tmp/jetty-yyyy_mm_dd.request.log");
      requestLog.setAppend(true);
      requestLog.setExtended(true);
      requestLog.setLogTimeZone("UTC");
      requestLogHandler.setRequestLog(requestLog);

      // We want the server to gracefully allow current requests to stop
      server.setGracefulShutdown(1000);
      server.setStopAtShutdown(true);

      // Now add the handlers
      YourHandler yourHandler = new YourHandler(server);
      handlers.setHandlers(new Handler[]{contexts, yourHandler, requestLogHandler});
      server.setHandler(handlers);
      
      // Start the server
      server.start();
      server.join();
      
      // It's stopped.
      log.info("Jetty stopped");
      if (!yourHandler.restartPlease) {
        break;
      }
      log.warn("Restarting Jetty");
    }
  }
}

Now the handler:

package com.company;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class YourHandler extends AbstractHandler {

  private static Logger log = LoggerFactory.getLogger(YourHandler.class);
  private Server server = null;
  public Boolean restartPlease = false;

  public YourHandler(Server server) {
    this.server = server;
  }

  private boolean stopServer(HttpServletResponse response) throws IOException {
    log.warn("Stopping Jetty");
    response.setStatus(202);
    response.setContentType("text/plain");
    ServletOutputStream os = response.getOutputStream();
    os.println("Shutting down.");
    os.close();
    response.flushBuffer();
    try {
      // Stop the server.
      new Thread() {

        @Override
        public void run() {
          try {
            log.info("Shutting down Jetty...");
            server.stop();
            log.info("Jetty has stopped.");
          } catch (Exception ex) {
            log.error("Error when stopping Jetty: " + ex.getMessage(), ex);
          }
        }
      }.start();
    } catch (Exception ex) {
      log.error("Unable to stop Jetty: " + ex);
      return false;
    }
    return true;
  }

  @Override
  public void handle(String string, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

    String pathInfo = request.getPathInfo();
    // THIS SHOULD OBVIOUSLY BE SECURED!!!
    if ("/stop".equals(pathInfo)) {
      stopServer(response);
      return;
    }
    if ("/restart".equals(pathInfo)) {
      restartPlease = true;
      stopServer(response);
      return;
    }

  // Go off and do the rest of your RESTful calls...
  // And close off how you please
    response.sendRedirect("http://nowhere.com");
  }
}

And you can now run your main class from your IDE of choice.

Just for reference I added a log4j.properties:

# Site
log4j.logger.com.company=DEBUG, SITE_CONSOLE
log4j.additivity.com.company=false

# Set root logger level
log4j.rootLogger=DEBUG, CONSOLE
log4j.logger.org.eclipse=INFO, CONSOLE
log4j.additivity.org.eclipse=false

# ---------------------------------------------------------------------------------
# Appenders - Notice I have added a discriminator to the conversion pattern
# --------------------------------------------------------------------------------- 
# For console logging - not in production obviously as you'd use a rolling file appender
log4j.appender.SITE_CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.SITE_CONSOLE.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.SITE_CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS}{UTC} SITE  %-5p [%t] %c{1.} %x - %m%n

# The baseline CONSOLE logger
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS}{UTC} JETTY %-5p [%t] %c{1.} %x - %m%n

I created a plain Java SE app and added a 'lib' folder with these jars in it:

jetty-continuation-8.0.4.v20111024.jar
jetty-http-8.0.4.v20111024.jar
jetty-io-8.0.4.v20111024.jar
jetty-server-8.0.4.v20111024.jar
jetty-servlet-8.0.4.v20111024.jar
jetty-servlets-8.0.4.v20111024.jar
jetty-util-8.0.4.v20111024.jar
jetty-webapp-8.0.4.v20111024.jar
log4j-1.2.16.jar
servlet-api-3.0.jar
slf4j-api-1.6.2.jar
slf4j-log4j12-1.6.2.jar

From the Jetty8 release.
I then ensured that the MANIFEST included these jars.
Just for reference the META-INF/MANIFEST.MF looks like this:

cat META-INF/MANIFEST.MF 
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_29-b11-402-10M3527 (Apple Inc.)
Class-Path: lib/jetty-all-8.0.4.v20111024-javadoc.jar lib/jetty-contin
 uation-8.0.4.v20111024.jar lib/jetty-http-8.0.4.v20111024.jar lib/jet
 ty-io-8.0.4.v20111024.jar lib/jetty-server-8.0.4.v20111024.jar lib/je
 tty-servlet-8.0.4.v20111024.jar lib/jetty-servlets-8.0.4.v20111024.ja
 r lib/jetty-util-8.0.4.v20111024.jar lib/jetty-webapp-8.0.4.v20111024
 .jar lib/log4j-1.2.16.jar lib/servlet-api-3.0.jar lib/slf4j-api-1.6.2
 .jar lib/slf4j-log4j12-1.6.2.jar
X-COMMENT: Main-Class will be added automatically by build
Main-Class: com.company.EmbeddedJetty

I know I included the javadoc un-intentionally...
This scheme requires a lib folder alongside the jar with those files in it.
(Need to figure out how to bundle the Jetty8 jars so that the app is self-contained...)
So the jar can be started like this:

java -jar /some/folder/EmbeddedJetty/dist/EmbeddedJetty.jar

K

Book Review: The Grand Design by Stephen Hawking

Hmm. I have to say I was disappointed. If I had to sum up the book in one sentence it would be "I think M-Theory is our best shot at a GUT."

It's not that the book was not well written - it is.
Nor that it covers some details regarding the Strong Anthropic Principle that are glossed over elsewhere.
Nor that it fleshes out the mechanisms regarding Feynman diagrams and the Sum over Histories calculations.
Nor that is is sprinkled with Hawkings humorous quips and comments.
It's just that...
Well...

I expected not so much a revelation but a new way to view the relationship between the microscopic and macroscopic worlds.
And I didn't get it.
Worse, it seems that 99% of the book has been written about before.
And the appellation "New answers to the ultimate questions of life" seems almost completely incorrect.
Greenes "The Fabric of the Cosmos" came out in 2004 and apart from some minor differences says much of the same things.
And "Cycles of Time" (2010) by Penrose provides a detailed 'new' way of viewing the 2nd law and how it relates to the beginning of the universe (if 'beginning' is the right word) that isn't even mentioned by Hawking.
If this book had come out 10 or even 5 years ago it might have been considered "...mind-blowing stuff.." as the Sunday Times describes it.
But it didn't. It came out this year.
I accept that there must have been considerable difficulties relating to transcribing Hawkings thoughts and speech to paper, so it would have taken a long time to create.
But still...

Unrelated to the content I must add that for the copy of the paperback I purchased the choice of font and paper was unfortunate. Galliard and glossy paper make it physically difficult to read when not in natural light as the reflection gets irritating fast. I did love the comics and the artwork as they provided an insight to the beauty and difficulty of analysing the universe.

All in all, I'd have to say "don't bother" and would recommend Penrose and Greene as better choices.

Tuesday 10 January 2012

Book Review: The New New Rules by Bill Maher.

I tried.
I really did.
I got to 'D'.
Then I just had to put it down.
I just couldn't read any more.
I like Bill Maher as a... well... a... Whatever.
I liked the documentaries.
Well...
Most of them.... Some... But this book...
I tried to laugh.
I really tried.
But like a stoney faced gargoyle looking down on nuns, I read page after page and I just couldn't.
Maybe it's American humor and I'm just not tuned to it.
In any case, unless you are a fan of him, and his show, and American, and...
Well... I will have to put this on the shelf and regret the loss.

Monday 9 January 2012

There's a dead cockroach next to my ashtray

But I'm getting ahead of myself. I "used" to have a daughter.
Well step-daughter to be truthful.
She turned out ok. Except I have this nagging feeling that she blames all her sorrows on me.
Basically because the last time I saw her was some 15 years ago and the last thing she said to me was:
"I blame it all on you."
Er... Ooookaaaayyy... Sort of puts a wet blanket on things.
As per her somewhat forceful request, I've stayed away.
Anyway, when she was very young she used to sing a lot.
I say "sing" for some values of "sing" that include wailing.
(There was gnashing of teeth involved... Mine mostly. Eh. She was young.)
No matter. She used to paraphrase songs. Like when KLF did the... wait... Let me provide her rendition:
"Doctor POO-OOO, Doctor POO. Doctor POO-OOO, Doctor POO. Doctor POO-OOO, Doctor POO."
Er. Yes.
And she once assaulted me with the question:
"Why do porpoises need tents?"
Took a while. Ah. Yes. "To all intents and purposes."

Now. How did I get here?
Oh yeah.
The cockroach.
It's f**king hot at the moment.
I'm upstairs in what is laughably called my 'office'.
I came upstairs to type a post and realized it was 32C (as per the display on the portable air-con).
You gotta be joking!
It's 10:30pm!
I turned on the air-con and beat a hasty retreat downstairs to let the room cool down.
Went outside and sat down with a bourbon and soda.

You forget sometimes you're in Australia...

As Dylan Moran put it: "3/4 of a mile from the surface of the sun!"
Then what felt like a brown armored mouse hit me in the forehead.
Big bugger.
Glittering brown Queensland cockie flying at warp speed.
SMACK!
Right between the eyes. Couldn't protect myself*.
(*for the Monty Python fans)
2 inches of flying brown titanium at mach 2.
Nearly knocked me out.

B*stard.

After I flailed about trying to get it off me, it did a barrel roll and crash landed next to the ashtray and expired.
Upside down with residual nervous twitches.
Within seconds, ants started coming along and began the disassembly process.

Like I said, sometimes you forget you live in Australia.
Even the cockroaches have a hard time.
F*cking love it.

Review: The Holographic Universe by Michael Talbot

I have a strong suspicion I read this when it came out in 1992.
The first part is quite good; being a discussion of David Bohm and his work in physics.
The second and third parts have a certain 'aura' that became distinctly uncomfortable.
Then I had a holographic moment.
No, no, I was re-reading Chariots of the Gods!
Michael Talbot had morphed into Erich von Daniken!
It's funny after all these years that I can now go back and revisit the statements that I was so much in awe of and look up the psychic events Talbot describes.
Like Sai Baba and the like.
What a crock.
So much promise and so much rubbish.
The shoe horning of the holographic principle into almost every paragraph is distinctly embarrassing.
I regret that I harassed so many people in the 90's about this and it turns out to be a pile of...
Oh well.
We live and learn.

Wednesday 4 January 2012

No Smart Comment goes Unpunished

Speaking of weird things I stumbled across an English website dedicated to “Christians against Mental Slavery.” Oooookaaay. Sounds self defeating to me. Apparently they want it to be a crime for anyone to monitor or influence human thought with the use of technology without consent. So, their website itself and of course CCTV in the Holy See is right out, I suppose. 

I love their catch-phrase though: “A website which we pray that god will use to change the course of human history.” Then almost as an afterthought they have “, for the better” tacked on the end. For whom, one might ask.

The site is broken by the way. The main page has a stuffed link so unless you know what’s wrong and enter the URL manually, you can’t actually enter the site or visit any of the pages. I suppose that’s what they mean when they use the phrase “informed consent” because you have to be informed (in HTTP) to enter the site and by doing that you’re giving consent. Convoluted I grant you, but logical.

Their “Scientific Evidence” page is rather curious and entertaining though. The use of microwaves to cause people to hallucinate and “hear voices.” is quite interesting, but it all seems pointless to me given that TV and video games are doing such a great job of influencing people. And don’t come back with that “video games can’t influence children” nonsense. Advertisers pay millions for a 15 second slot on TV and they wouldn’t do it if it didn’t work.

And speaking of monitoring, did you know that a large percentage of Americans believe they (and their pets apparently) are being stalked by groups and driven to suicide by government officials who “want to take out the trash.” Apparently they burgle your house (but don’t take or move anything), stage accidents in front of people and the like. Now I’m not talking about plain old community harassment here. Odd. But don’t despair, if, like some people in Canada who had their entire neighborhood bought out by an organized (and obviously rich) gang of harassment professionals just to target one person, you want to fight back, then you can! Yes! Just buy Orgone tools such as the Pulsed Crystal Succor Punch which is a quartz crystal with mobius knots around it that you hold over your heart chakra. Ah. Yes. That’s better. Now I am no longer bothered by those pesky thoughts and people and reptilian aliens and psychic gremlins who stand behind me in supermarkets and do things specifically to annoy me (and drive my pets to suicide) that no-one else can see.

It all sounds a tad loony, but it, like UFOs, has a dedicated and growing following. Odd.

Tuesday 3 January 2012

Dead Flies and Calculations

Remember slide rules? Eee when I were a lass we didn’t have fancy calculators... Now I’m going to relate a story about what slide rules are for and the kind of anarchic calculations you can perform with them.

I remember when I was in high school in the bustling metropolis of Mt Barker deep in the outback of Western Australia. I say “bustling” in the sense that the most movement on the main street on an average day then was when a stray sheep wandering across the deserted streets.

I would use a slide rule to the amazement of farm boys who were more interested in calculating the amount of sheep dip to use on their fathers flock. And could only use the fingers they had between them to do that. Working out the right amount of sheep dip for flocks of greater then ten caused a furrowed brow and the removal of shoes to use toes.

I remember one calculation which got me an award of sorts. The teacher was impressed by the effort and accuracy of the calculations, but somewhat disapproved of the subject. I’ll explain. 

First you catch a fly. Now W.A. in the late 60’s was awash with them as it was before the introduction of dung beetles. So catching one was relatively easy. Next you pop it in a match box for safe keeping and obtain a length of very thin cotton and a thumb tack. You tie a small knot of the cotton around the shaft of the thumb tack and push it into your school desk. Then you make a very small and loose knot in the other end. The length of the cotton should be around a foot or so. B says he used hair instead of cotton to achieve the same goal.

Now you retrieve your fly and gently place the loose knot between the head and thorax of the fly and tighten the noose ever so slightly. Not too much or you’ll end up with the premature loss of your fly.

Then you let the fly go. And hey presto! Your own private fair ground attraction. The fly buzzes around going up and down in weird loops reminiscent of those rides called crabs or spiders or whatever. Anyway, you use a stopwatch and a notebook and take readings until eventually in an heroic attempt to get away the fly decapitates itself. The head falls in a gentle arc in one direction and the body buzzes around for a second or so before dropping like a stone to the desk. A friend of mine at the time managed to get three flies in this macabre whirly gig. Cute.

Anyway, this is where you pull out your trusty slide rule and start calculating the trajectory of head and body. I did a 5 page dissertation with graphs, tables,  charts and drawings showing the mass to arc trajectories of various heads and bodies of normal flies, blue bottles and sand flies. The teacher wasn’t happy but had to concede that they were as accurate and complete as any scholarly document he had seen. He stuck it to the wall in the science room amongst the sad remnants of other pupils attempts to engage with science.

The other thing I “calculated” was the strength and length of rubber to use with “Gidgies” when hunting frogs. Huh? Oh, yes... A Gidgie is a arm mounted sling shot with about three foot of heavy rubber band. With a  strong arm (which I didn’t have) and a ball bearing you could punch a hole in a car door from 100 foot away. I haven’t done that myself, but I did know guys at school who did. Vandals. 

Anyway, I figured this out once when a friend of mine, Garry, and myself climbed up a water tank overlooking a dam in a farmers paddock. We were armed with Garry’s gidgie and a handful of ball bearings. We sat patiently until a frog would rise to the surface and Garry would take pot shots at them. They don’t die by the way. If you hit the water very close to them, they sort of go limp, roll over and sink a bit. After a while they start kicking limply and in a minute they are off swimming again. Sigh. We didn’t have video games or TV or psychedelically painted minis or any other distractions available to “townies.” It was the 60’s in an outback town after all. 

And that, my friends, is what slide rules are intended to calculate. Try doing the same with a calculator and all the fun is drained from the exercise.

I was 13 at the time. And bored out of my skull. I might just mention that my attempts to bring some sort of life to the classroom in this sort of manner earned me a large number bruises from chalk and duster projectiles from the unsympathetic teachers.

Monday 2 January 2012

The Root of all Evil

Now to many of you educated loonies this may not be news, but I’ve had to explain this to a couple of people recently, so I have taken it upon myself to educate. 

So. 

It’s not 
25.8069758
As you would expect based on the square root of an invalid famous number. Learn ancient greek and find out that it’s actually:
24.8193473
Ok. It’ll take a few of you to work that one out. Go read that last book of the standardized new testament again and think about it. You’d think it was the first number, but you’d be somewhat incorrect. Dr Ellen Aitken discovered the correct number.

An old article but see here: 666 not the devils number

One last thing. B just pointed out an item for sale on eBay. A Millennium Falcon chess set (from Star Wars for anybody not born this century). Now I looked at this items photo which starts bidding at £4.99. And I had a thought that it was in remarkable nick. And in very good focus for something that big.  I mean, it had Chewie and C3P0 playing chess on it right? 

That big? 

Hang on a moment! 

Then I got it. The damn thing is about half an inch across! So some dude is dismantling some Hasbro (or whatever) model of a Millennium Falcon and selling the pieces of that toy on eBay for £5, or thereabouts, a go! Man, oh man, I wish I’d thought of that!

Sunday 1 January 2012

Rawhead Rex, Maniac Nurses and a Steam Powered Cat Cannon.

Ok. It’s past 11pm but I’m feeling better. Well I say “better” for some values of better which don’t include being subjected to the movies “Rawhead Rex” and “Maniac Nurses.” The idea of a biker with a head like Arnie who had some rather bad dental work done with what must have been a ball peen hammer or a very drunk surgeon with piranhas attached to his hands terrorizing the Irish countryside and a bunch of nurses with Uzis shooting people and lazing around a chateau in lingerie is not my idea of convalescence. 

I’m not kidding. Somebody actually managed to get funding to produce these movies. What on earth where the venture capital people snorting when the writer pitched the story is what I want to know. Can you imagine the scene? Several VCs sitting around a desk and some writer comes in and says: 
“Ok. Imagine this. A farmer is sick of a neolithic stone sticking up in his field. So he pulls it down right? And it releases a demon right? And this demon, see, is dressed like Arnie in the T2 movie see, but has really bad teeth see, and he starts attacking the locals see, and a photographer sees the verger in the local church see, who has stuck his hands into a desk, see, and a red light comes out see, and... Oh. Yeah. Ta. Thanks for the funding for that movie. Excellent. We’ll start and finish shooting this week. Oh I got another pitch see... Oh. You wanna hear it? Well sure thing. Well, see, there’s these lesbian nuns in a convent and they wear lingerie see, and use Uzis on anyone who violates their code see...”
And people have the gall to say that the “Lost” series is convoluted... Sigh.

Still, my “rest and recuperation” has yielded some results. We worked out a great use for cats in general. Now I need to mention that I’m a great cat lover, but the idea of a steam powered belt fed cat cannon tickles more than just my fancy. 

B could hardly contain himself as he drew a diagram ala Steam-Punk Victoriana device that has dozens of cats being fed into a steam powered static electricity generator and since cats have a natural affinity for static electricity this would make wonderful anti-personnel devices. Just imagine being struck by a frantic cat (which at high speed is just a chain saw with a brain anyway) with it’s fur fluffed out at 90 mph delivering 50,000 volts of charge. 

Enough to stop a crazed neolithic biker with bad teeth and a penchant for eating Irish farmers or even crazed Uzi wielding lingerie wearing nuns I should imagine. B considered a Puppy Launcher, but it just doesn’t quite have the same impact, if I can use that word, as a cat with enough vooom to power a small town does it now?

I wipe the tears from my ears.