Archive for October, 2006

Random Birthday for JMeter - Solution

Monday, October 30th, 2006

In a test I was running, I needed a valid date of birth in mm/dd/yyyy format. Here is the solution I came up with:

${__javaScript(with(new Date()) dob = String(Math.floor(Math.random() * 12) + 101).substr(1) + ‘/’ + String(Math.floor(Math.random() * 28) + 101).substr(1) + ‘/’ + String(getFullYear() - Math.floor(Math.random() * 99) - 1), dateString)}

The plain JavaScript version is

with(new Date()) dob = String(Math.floor(Math.random() * 12) + 101).substr(1) + ‘/’ + String(Math.floor(Math.random() * 28) + 101).substr(1) + ‘/’ + String(getFullYear() - Math.floor(Math.random() * 99) -1 ); alert(dob);

The first part gives us a zero padded month from 01-12. The second part gives a zero padded day from 01-28 (I did not want to deal with leap years and end-of month guessing for this test). The final part subtracts 1 to 100 from the current year (guaranteeing no future dates in the current year). Quick and dirty — Enjoy!

Internet Explorer 7 Update

Monday, October 30th, 2006

I have been using the IE7 betas at home without much incident. This morning I decided to update to the final release. An interesting problem is that the IE7 beta must be uninstalled before the final version is installed. The installation program does that automatically, and the idea is that IE7 then installs automatically after the reboot. Well, as one might expect, there was an error and I found that IE6 was on the PC after the reboot. I then went to the IE7 download site and installed IE7 from there (http://www.microsoft.com/windows/ie/downloads/). Problems may have included ZoneAlarm and McAfee, but during the restart I did not have the option of turning these off if they were indeed running.

Firefox Update check

Monday, October 30th, 2006

Firefox 2 has been out for almost a week now. When I go to Help > Check for updates in version 1.5, I get the message “There are no new updates available. Firefox may check periodically for updates.” Interesting. I decided to download it manually (http://www.mozilla.com/en-US/firefox/).