Archive for the ‘Misc. techie’ Category

Recording with Java Sound on Vista

On XP, getting a line to record from can be achieved via AudioSystem.getLine(info).

Unfortunately, that doesn’t work on Vista – however it is possible to open a line by looping through the available mixers until you find one that successfully opens:

...
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
for (int i=0; i<mixers.length; i++) {
	Mixer m = AudioSystem.getMixer(mixers[i]);
	try {
		targetDataLine = (TargetDataLine) m.getLine(info);
		targetDataLine.open(audioFormat);
		System.out.println("Opened a line using " + mixers[i]);
		break;
	}
	catch (Exception ex) {
		// Ignore the problem and try another mixer.	
	}
}
...

HTH

Adding a Wordpress contact form

So, I thought I’d set up a contact form for this blog, and I’m a newbie to Wordpress so I did a quick google and soon turned up a number of options.

FWIW this is what happened:

  • I downloaded Contact Form 7 (http://wordpress.org/extend/plugins/contact-form-7/) and tried that.  The installation instructions were slightly out of date, but I worked out that it is now configured via the ‘Settings’ link under Tools – Plugins.  Despite it’s name, it offers sophisticated control over the contact form it provides – including easy definition drop-downs in the form. However, I wanted a ‘CAPTCHA’ box (evidently the name for the ‘enter the code below’ mechanism used to stymy bots) – and Contact Form 7 states that a 2nd plug-in (Really Simple Captcha) is needed. The blurb for that plug-in said that “In most cases you can install automatically from WordPress.” – which I didn’t understand, and then it mentioned some pre-requisites on the server … so I got cold feet and started looking elsewhere.
  • Next port of call was http://eazeenet.in/contact-form-with-captcha-plugin-for-wordpress/ – but the form didn’t seem to appear at all for me, so I moved on
  • Finally I tried Mike Challis’ Fast and Secure Contact Form from http://wordpress.org/extend/plugins/si-contact-form/. That all worked fine first time – including the CAPTCHA part. However, my one criticism is that the validation errors seem a bit unfriendly to me (e.g. “INPUT ERROR: Please make corrections below and try again”, “A proper e-mail address is required” and “Please complete the CAPTCHA” [I didn't know it was called a 'CAPTCHA' until tonight]). Also, despite lots of other configuration options, the validation messages cannot be modified via the settings.  I worked around this my modifying the si-contact-form.php directly.

Meanwhile, I discovered that my server wasn’t set up to send mail via STMP directly – so I installed ‘configure SMTP’ from http://coffee2code.com/wp-plugins/configure-smtp/ and configured it to send mail via gmail (for which of course I had to enter my gmail credentials – <gulp>).  Fear aside – having heard a piece on Radio 4 just yesterday about e-mail accounts being hacked in to – that worked perfectly.

So, in the end I got the contact form I was after, hoorah.

Having typed this up now, I suspect that the pre-requisites that Really Simple Captcha mentioned are probably in place – so I could try that (and Contact Form 7) again. Hmm, is life too short?

Search
Categories