A new 5k PR

I was feeling very tired and lethargic today, and annoyed with my lack of web storage space for photos.

After napping for the afternoon, I decided on a short run, using my newly calculated heart rate zones. I chose zone 3 for 5k, and managed to run my personal best time over 5k, despite the light hills. I think a sub-30 minute 5k is within sight on the flat. I am really pleased with my progress since I started using the heart rate monitor.

{ No comments }

Great day for a run

It was perfect weather for running, cloudy and windy with a few spots of rain. I took on the light hills of Bernera and got my heart rate pumped up a bit.

{ No comments }

Test post from BlackBerry App

Just a quick test of the BlackBerry WordPress app. Looks quite easy to use! Composing this in the car near Carlisle (I am not driving of course)

On our way back from Scotland

{ No comments }

Geek friendly copy / paste from a terminal

A simple little script to echo stdin (or a file) to port 8080 on the host computer. Then simply browse to http://hostname:8080 and the contents will be there. Can be easier than trying to copy a lot of text in PuTTy. I saved it as to_nc.sh. Then you can do something like

cat filename | to_nc.sh

The script is really small, but does rely on netcat (nc) being installed.

if [[ "$1" != "" ]]
then
        { echo -ne "HTTP/1.0 200 OK\r\n\r\n"; cat $1; } | nc -l -p 8080
else
        { echo -ne "HTTP/1.0 200 OK\r\n\r\n";
        cat -
        } | nc -l -p 8080
fi;

{ No comments }

Astronomy Picture of the Day Wallpaper

I thought it would be a fun project to create a little Java program to make a nice wallpaper of the Astronomy Picture of the Day. You can get the executable JAR file here. It only works on Windows, and doesn’t need installing, just save the file and run it (assuming you have Java installed).

It’s not endorsed or affiliated with NASA in any way, it’s just for my own fun.

{ 1 comment }

Saving a JPEG Image in Java

The default ImageIO save behaviour of images leaves something to be desired, so I put together a simple convenience method for saving them, based on the technique from Universal Web Services.

private void saveImageToJPGFile(Image img,
String fname) throws FileNotFoundException, IOException
{
    BufferedImage bufImage =
    new BufferedImage(img.getWidth(null), img.getHeight(null),BufferedImage.TYPE_INT_RGB);
    Graphics2D bufImageGraphics = bufImage.createGraphics();
    bufImageGraphics.drawImage(img, 0, 0, null);
    Iterator iter = ImageIO.getImageWritersByFormatName("jpeg");
    ImageWriter writer = (ImageWriter)iter.next();
    // instantiate an ImageWriteParam object with default compression options

    ImageWriteParam iwp = writer.getDefaultWriteParam();
    iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    iwp.setCompressionQuality(1);   // an integer between 0 and 1
    // 1 specifies minimum compression and maximum quality

    File file = new File(fname);
    FileImageOutputStream output = new FileImageOutputStream(file);
    writer.setOutput(output);
    IIOImage image = new IIOImage(bufImage, null, null);
    writer.write(null, image, iwp);
    writer.dispose();
    output.close();
}

{ No comments }

Capital Cities for Memoriser

Via this post on lifehacker I found the brilliant memory aid Memoriser. It doesn’t come with any questions by default, so I made a list of capital cities in the correct format:

capitals.ini

The data is originally from About.com

{ No comments }

Impressive iPhone app

I’ve just installed the WordPress app on my iPhone and I’m very impressed with how easy it is to use. I’ve even been inspired to take a photo of the garden work in progress.

{ No comments }

New blog

This is the obligatory “First Post”. I’m still finding my feet with WordPress, and I hope I will think of some interesting content…

{ No comments }