About RobinLayfield

uber goober

JQuery 1.2.6 quirk in Internet Explorer 7

I've been doing a lot of work lately with JQuery and I love it... I really do, it's a great piece of code, nay, framework, that strips out all the pain of working with JavaScript and provides a launchpad for great code and interface adventures.

Nonetheless, it's not without its headaches and recently I lost a few hours to trying to figure out why my JQuery functionality refuses to work on Internet Explorer 7. It's very frustrating, as everything works perfectly in Safari and Firefox and then as soon as IE comes up the site goes suddenly two-dimensional with none of the interesting UI customisations that JQuery makes so much fun to build.

After a bout of head scratching, coupled with the realisation that JQuery 1.2.3 works fine I started to experiment with the way the script was invoked, fearing that IE had some kind of issue with it.

Sure enough, that was the source of the problem and as soon as I changed my JQuery initialiser to run the "old-fashioned" way, the scripts came magically back to life. So here it is:

If you're having problems running JQuery in IE, open your html and look for the following lines

JAVASCRIPT:
  1. //shorthand for document.ready
  2. $((function(){
  3.  
  4. ...
  5.  
  6. }));

and change them to this. Be sure to check the closing part of the script too, as that is different

JAVASCRIPT:
  1. $(document).ready(function(){
  2.  
  3. ...
  4.  
  5. });

hopefully the JQuery developers will sort out that problem in time for the next version...

JavaScript forms submit gotcha!

I've just lost about an hour and a half of my life to a cheeky little JavaScript gotcha. I thought I'd document it here in the vain hope that it didn't get anyone else.

If you have a button on your form that is named "Submit" then beware! As soon as this button goes into the DOM, it will over-ride the form's Submit() method, meaning that you can no longer call that from JavaScript or JQuery or whatever you are using.

Make sure you give the button a different name, or even no name at all, for your own peace of mind!икони

Parallels Plesk 8.4 Ubuntu speeding up SMTP

If you've used PLESK for any great length of time, you'll know that whilst it is a great bit of software, for some reason it defaults to doing Reverse DNS lookups whenever a client connects to it to send mail.

Yeah rDNS is a useful tool for stopping spam and the like... but it also means that every single email sent takes 26-30 seconds to go out. That's frankly unacceptable when you are trying to operate a commercial service and vastly undermines any possible benefits from it.

The good news is that it is (fairly) easily resolved. All you have to do is put in a command-line flag to tell the mail server not to perform an rDNS lookup. The hard part is figuring out exactly where to stick it.

Up to version 8, I used to refer to this handy guide, which resolved the problem though in ways I couldn't quite understand! see here at

http://tyrannical.org/page-14

PLESK 8.4 introduces some major under-the-hood improvements, one of which is a subtle reorganisation of where the commands are stored. After some handy support from our ISP CWCS, we found that the command had moved to here:

/etc/inetd.conf

and all you have to do to switch off rDNS is to insert the following flag after the second occurrence of the phrase "tcp-env" in your inetd.conf.

-Rt0

More info and some other useful tips here

Anatomy of -Rt0
What does -Rt0 mean exactly? Well it's a command that's issued to the TCP server and it tells it to

R - Do not attempt to obtain $TCPREMOTEINFO from the remote host.
tn - Give up on the $TCPREMOTEINFO connection attempt after n seconds. (default is 26 seconds ho, hum)

The complete howto

  1. Login to your PLESK server using SSH
  2. type the command vi /etc/inetd.conf
  3. type the letter I (to insert)
  4. find the two lines that begin with smtp stream and smtps stream
  5. look for the second occurrence of tcp-env
  6. type -Rt0 into the line (note zero, not 'o')
  7. hit [esc]
  8. type : (shift-colon)
  9. type wq! (meaning write the file and quit from vi)
  10. hit [return]

now all you have to do is restart inetd, which is done on Ubuntu by entering the command

/etc/init.d/xinetd restart

You should now find that SMTP mail sending is lovely and quick. Phew!

Caveat
Please note that making some changes in the PLESK domain control panel will reset this command line, so you may need to edit it again if you start to notice delayed SMTP sends

Gingers gig at the 12 Bar Club (May 18th)

Yep! It's that time of year when all the Gingers come out of the woodwork to play their favourite music in one of London's most celebrated venues - the 12 Bar Club on Denmark Street.

This tiny little club - which was first built as a stables in 1635 - has played host to many great bands over the years and it's lo-fi rockabilly flavour pretty much guarantees a good night for anyone who crosses the threshold.

The Gingers are on at roughly 8pm but I'd recommend getting in about half an hour early, 'cos you're going to need a stiff drink to steady your nerves first

Nearest tube is Tottenham Court Road. More info on the 12 Bar and how to get to it here

Better icon for XAMPP

I recently set XAMPP up on my mac (get it here). It's an easy to setup and flexible web server environment. The best part is you don't need to have it running all the time - just fire up the XAMPP control panel whenever you need to do some localised development (ie. when you're on the train or out of range of wifi) and start the relevant servers. It's a one-click install and lets you flip between php 4 and 5 at the click of a radio button. Sweet!

The only thing is - call me a snob - the dock icon for the control panel is rubbish - it's pale and faded, and a bit meaningless looking...
See for yourself

Old XAMPP dock icon

I had a peek around the net and there's some much better logo images for XAMPP but not available as a replacement icon file. So I grabbed one and made my own. Here it is in action:

Updated XAMPP dock icon

OK it's not perfect - the anti-aliasing at the top is a bit hooky but at least it's a bit more presentable.

Here's how to set it up:

  1. First download the xampp.icns.zip file from here
  2. Unzip it
  3. furniture Bulgaria

  4. Open Finder and browse to 'Applications>XAMPP'
  5. CTRL-click the XAMPP Control Panel application and select 'Show Package Contents'
  6. Browse to 'Contents>Resources'
  7. drop the xampp.icns file into this folder
  8. then copy it and replace 'xcp.icns' with it

That's it. Job done and nice shiny more XAMPP like icon on your dock

the Jesus and Mary Chain – Dead Slow Rock’n'Roll

Man, I kid you not, I'm almost in tears right now - I've just got back from seeing one of the best bands of my adolescence play in a stunning return to form at Brixton Academy. I'm talking about the Jesus & Mary Chain - the band that made me want to pick up a bass guitar and turn the gain up to 11.  I'm spellbound, shocked and slightly awed.

Jim Reid

There's more to this than you might think - I've always, always rated this band - Just Like Honey is one of my favourite songs of all time. And I have seen them before - back in the days when they'd blast through the set with such feral animosity that you couldn't tell where one song ended and another began. Where Jim would say nary a word to the audience and William would turn his back on us. Maybe they were just a bit shy back then.

None of that was in evidence tonight: they opened with Never Understand and the gig just got better and better. Jim acknowledged the audience with a few sharp wisecracks and the performance was pitch-perfect. By the time they played Happy When it Rains, I was already in the moshpit being bounced around by hundreds of like-minded JAMC devotees. Have you ever been in a slow mosh?

Nine Million Rainy Days made it for me - not least because they played it straight after I'd shouted it out - it just blew me away. I'm pretty sure they closed out with an old Syd Barrett song, Vegetable Man, and I think they played I Wanna be Yr Dog at one point too.

This wasn't a gig, this was a five-star moment in Rock'n'Roll history.

Right, I'm off to find my PsychoCandy LP...

Rob

Woohoo! 2 exciting Ginger gigs lined up

yep.

We've been deep in rehearsal for what seems like months now and we're finally coming out to play. The big gig is Rough Beats 2007 - we've played this for the last couple of years and it's one of our favourite places. This year it takes place in Clapham, North Yorkshire. More details available here:

Rough Beats myspace page

We've also booked a warm up gig with those nice chaps from College Pinks, at Catch. Details here:

Wednesday 29th August @ Catch
22 Kingsland Road
Shoreditch
London E2 8DA

We're on shortly after 8.30

Catch Flyer