Subversion for web design – how we do it @ Karyx

Update: Dreamweaver CS4

The latest version of Dreamweaver (CS4 currently) now has integrated Subversion support, thankfully, which means that cloaking the .svn files is no longer necessary as DW will ignore them by default. You can configure the site to connect directly to your subversion server but in our experience unless that is a repository on the local network, it adds a painfully long pause every time you try to open a file whilst it’s checking it out from the repository. Better to use Tortoise or Versions, methinks but plus points for Adobe for incorporating this feature.

Subversion using Versions, Tortoise, Beanstalk & Dreamweaver

You can set up your own local subversion server but we find it’s easier to have our Subversion repositories hosted on the net – that way we can access them at any time. Here at Karyx we use a service called Beanstalk ( http://www.beanstalkapp.com/ ) – it lets you have a number of repositories for free and shows in a very pleasant and picturesque way all the changes that have recently taken place on the repository. You can even use it to compare different versions of files, to see where a change may have been made.

SUBVERSION CLIENTS
We recommend TORTOISESVN for pc (it integrates directly with Explorer in a context menu) or VERSIONS for mac (Versions is a brilliant piece of easy-to-use and well-engineered software). Get them here:

TORTOISE SVN (pc)
http://tortoisesvn.tigris.org/

VERSIONS (mac)
http://versionsapp.com/

SUBVERSION SET UP
Setting up a local repository can be a bit of a faff but once it’s in place, it’s pretty painless to use. Our recommended method is:

1. create an empty repository on the server (beanstalk)
2. check it out locally to a new folder on your development machine
3. copy your project files into the new folder
4. highlight the files, right-click and choose “add” to add them into your repository
5. “Commit” the files

Note that when you check out the repository, it will ask you for a destination folder. Bear in mind that both TortoiseSVN and Versions will create a subfolder with the name of your repository in it, in whichever destination folder you choose, so you can nominate your root ‘Projects’ or ‘Sites’ folders as a destination. I know this sounds a bit arcane but if you create a dedicated folder to put the repository in, you will very likely end up with a path like

c:\Projects\MyNewProject\MyNewProject\

Now you will find you have a local subversion repository that is connected to the subversion server. Any file changes within this folder will now be tracked, although you will have to “Commit” any changed files to the subversion server to make the changes official.

BASIC USE OF SUBVERSION
Subversion maintains a repository – it keeps a collection of hidden folders on your local machine that contain hashes of all the files. Whenever a file is changed from the most recent version, it makes a note of this and then when you do a “Commit” – to post changes up, it pre-selects all the affected files. You can write a comment by each commit and this is recommended as it helps when you are reviewing changes to find out what exactly you did three months ago. You can also choose to “Ignore” files and folders (3rd party applications or javascript frameworks, etc).

When other users make changes to the files, you should highlight your local folder (in Explorer | Windows), or choose the working directory (in Versions | Mac) and then choose “Update” to go and grab the latest version of the changed files. Versions helpfully indicates remote file changes in it’s file list.

DREAMWEAVER GOTCHA
Dreamweaver works pretty well with Subversion and Subversion wipes the floor with Dreamweaver’s Check-in/Check-out features. There’s a 3rd party extension you can install to do Commits and Updates but our preferred method is to use the software described above.

One thing though – if you are testing your code by deploying to a remote server and you select a folder to upload, Dreamweaver will also upload the hidden version control folders (.svn files) – not good. A work around is to download and install this extension:

http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1018603

This works by cloaking the subversion folders, so you need to have cloaking enabled in Dreamweaver. Also it’s not automatic, so when you have your basic site checked in to Subversion, you need to go to the Commands menu and then choose Cloak SCM Directories option. You will need to do this whenever you create a new directory. Alternatively, just make sure you upload selected files and not folders.

MORE ON SUBVERSION

There’s a definitive guide to subversion here:
http://betterexplained.com/articles/a-visual-guide-to-version-control/

or a “designers” guide here:
http://www.thinkvitamin.com/features/design/subversion-for-designers

and here’s some advice on commenting your commits:
http://www.wildbit.com/blog/2008/11/11/the-importance-of-commit-messages/

I hope this all helps. Subversion is definitely worth getting into if you want to stay confident in your code!

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

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

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