Can you notify me when the run is over?

18 06 2012

It is not directly an OR related post. I am writing this, because it may help you some others, who have same problems as me.

While I’m getting a simulation run from Java (it is a simulation for a heuristic in my thesis) I’m surfing on the internet, because it is boring to wait. It is not certain when the run will over. So I looked for a solution and came up with an idea; playing a sound file!

First of all I have found a simple “beep” file, which you can download here. I placed the wav file into my desktop. Then in Java I used the following codes;

AudioClip song;
URL songPath = null;
try {
songPath = new URL(“file:///”+System.getProperty(“user.home”)+”/Desktop/beep.wav”);
} catch (MalformedURLException e1) {
song = Applet.newAudioClip(songPath);

…. stuff goes here, calculations, etc,etc…;

Well, you see, it is easy as pie. In most programming language, there is a simple way to play sound file. In this text it is for Java programming language in Windows 7. I think it is suitable for most platforms though. AudioClip and URL are included Java API. So you don’t need any other library for this job.

Hope your calculations be faster!