How to analyse a .phd heap dump from an IBM JVM

If you have been handed a .phd file which is a dump of the heap of an IBM Java virtual machine, you can analyse it using the Eclipse Memory Analyzer Tool (MAT), but you must install the IBM Monitoring and Diagnostic Tools first.

Download MAT from I suggest the Standalone version.

Unzip it and run the MemoryAnalyzer executable inside the zip. Add an argument to control how much memory it gets e.g. to give it 4GB:

./MemoryAnalyzer -vmargs -Xmx4g

Once it’s started, go to Help -> Install new software.

Next to “Work with” paste in the URL for the IBM Developer Toolkit update site:

Click Add…

Type in a name like “IBM Monitoring and Diagnostic Tools” and click OK.

In the list below, an item should appear called IBM Monitoring and Diagnostic Tools. Tick the box next to it, click Next, and follow the wizard to accept the license agreements and install the toolkit.

Restart Eclipse when prompted.

Choose File -> Open Heap Dump and choose your .phd file. It should open in MAT and allow you to figure out who is using all that memory.

Which Raspberry Pi photo was funniest?

We had a great day at the Egham Raspberry Pi Jam, and Rabbit Escape and our Photo Booth:

seemed to go down well:

But which photo was funniest? Here are some of the entries (I had to choose kids’ ones without faces to go on here, but there were some other great ones!):

But the winner has to be the eyeball wearing a hat!

Thanks everyone, see you next time!

Raspberry Pi Funniest Photo Game

For our latest Egham Raspberry Pi Jam, we worked on a photo booth program, using the Raspberry Pi camera. Here’s how we did it.

Downloads: funniest-photo-game.odp,

Update 1: fixed a bug where it tried to create a directory that already exists

Update 2: see the winning photo!


What we did

  • Made and decorated a box that held the Pi and camera steady for taking photos:
    Decorated Box for Raspberry Pi
    (Note the holes for the wires!)
  • Created some costumes (see “Costumes” below)
  • Wrote a Python program (see “Program” below) to display pictures on top of the camera picture, and take photos
  • Wrote up the instructions and competition rules


We made lots of costumes that show up over the picture. They all needed to be 1280×720 pixels, PNG files that use Indexed Color mode. (In Gimp we clicked “Image”, then “Mode”, then “Indexed Color” before choosing “File” then “Export” or “Overwrite” to save them as .png files.)

Here are some examples:

Once we’d made the costumes we put them in a directory called “costumes” next to the program file,


To get the Pi ready to run our program we needed to type these commands:

sudo apt-get update
sudo apt-get install python-picamera
sudo apt-get install python-imaging

Once we’d done this, we created the Python program and directories described in the next section, and then we ran the program with:



We made a directory to hold our program on the Desktop of our Raspberry Pi, which we called “photo-booth”. Inside that, we made a “costumes” directory containing our costumes, and a “gallery” directory to hold the saved photos. Also inside “photo-booth” we saved this code as “”:

import io
import picamera
from PIL import Image
import time
import pygame
import subprocess
import os

class PhotoBooth:
    def __init__( self, camera ): = camera
        self.costumes = os.listdir( 'costumes' )
        self.current_overlay = None
        self.cos_num= 0
        self.current_costume = None



    def set_up_camera(self): = ( 1280, 720 ) = 24

    def change_costume(self, change):
        self.cos_num += change
        self.cos_num = self.cos_num%len(self.costumes)
        self.current_costume = 'costumes/'+self.costumes[self.cos_num])
        self.overlay(self.current_costume, 128)

    def overlay(self, image, alpha):
        pad ='RGB', (
            ((image.size[0] + 31) // 32) * 32,
            ((image.size[1] + 15) // 16) * 16,
        pad.paste(image, (0, 0))

        if self.current_overlay is not None:

        self.current_overlay = camera.add_overlay(pad.tostring(), size=image.size)
        self.current_overlay.alpha = alpha
        self.current_overlay.layer = 3

    def take_photo(self):
        stream = io.BytesIO()
        camera.capture( stream, format='jpeg' ) 0 )
        captimg = stream )
        imgrgba = self.current_costume.convert("RGBA")
        captimg.paste( imgrgba, ( 0, -100 ), imgrgba )
        self.overlay(captimg, 255) 'gallery/photo%d.png' % time.time().real )
        self.overlay(self.current_costume, 128)

    def run(self):
            while True:
                for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                    if event.type == pygame.KEYDOWN:
                        if event.key == pygame.K_LEFT:
                        if event.key == pygame.K_RIGHT:
                        if event.key == pygame.K_SPACE:
                        if event.key == pygame.K_ESCAPE:
                        if event.key == pygame.K_g:
                  'ls gallery/*.png | head -1 | xargs xdg-open', shell = True)
                    if event.type == pygame.MOUSEBUTTONDOWN:

if not os.path.exists( 'gallery' ):
    os.makedirs( 'gallery' )

with picamera.PiCamera() as camera:
    booth = PhotoBooth( camera )

Download code and costumes

You can download the code and costumes we used here:

If you have any questions, feel free to leave a comment below!