jQuery plugin to disable text selection on elements

It took my a while to find a bit of script that worked cross browser, but the jquery plugin at http://code.jdempster.com/jQuery.DisableTextSelect/ does the job!

When working on the UI of a web application text would often get selected by the browser incorrectly, for example while dragging an element, or clicking on an element with an onclick event.

If you are using jquery already; download it, include it, then use:


If you need this functionality without including the whole of jquery, take a look at the source code for the plugin. It’s only about 20 lines long. It uses a different method for Firefox and Internet Explorer, with a fallback for everything else but it should be easy to convert in to native JS or another javascript framework.

Get 5.1 surround sound in ubuntu with Realtek ACL662

Just switched over to Ubuntu as my primary OS and been working (hard) get to get everything working properly. Still worth it thought.

Anyway, one of the more difficult problems was getting 5.1 sound out of the sound card in Ubuntu. The motherboard has a built-in 5.1 sound card, the realtek ACL662. Some people have little trouble enabling surround sound but there seems to be an issue with this card. I managed to find a solution by merging a few ideas together.

Here are the steps I took:

  1. By default, Ubuntu is only set to run 2 sound channels (left and right). To enable 6 channels (5.1) we need to edit the sound config file. Theres an excellent tutorial for doing that here. But put simply, edit /etc/pulse/daemon.conf and uncomment the line "; default-sample-channels = 2", changing it to "default-sample-channels = 6"
  2. The most important part for this card. Edit /etc/modprobe.d/alsa-base and add "options snd-hda-intel model=3stack-6ch-dig" to the end of the file.
  3. Restart the machine.
  4. Open sound preferences (System > Preferences > Sound)
  5. Make sure that the ALSA mixer is selected.
  6. Bring up the sound mixer.
  7. Hopefully, the “Front, Center, Surround & LFE” sliders will be available. If not try to add them by clicking on Properties.
  8. Make sure all sliders are on full.
  9. Still on the mixer, go to the ‘Options’ tab and set ‘Channel mode’ to ‘6ch’.
  10. Ok everything and close the mixer.
  11. To test, at the command line try "$ speaker-test -Dplug:surround51 -c6 -l1 -twav"

Hopefully that’ll do it. If not, there are a tonne of other guides if you search for “Ubuntu 5.1 sound”. Checkout the forum post that helped me find this solution here, at the Ubuntu forums.

If options 7 and/or 9 aren’t available to you, I’d guess the fix hasn’t solved your problem.

Selecting and uploading multiple files with one form element, wordpress style

We’re building a CMS at work and one of the requirements is a half decent file manager. Having seen how easy the wordpress upload tool is, we wanted to replicate it. Clients don’t want to sit there having to individually select and upload 50 files from a folder!

There are a number of options available to do this:

  1. Using a flash (swf) file to perform the upload
  2. Using a java applet to perform the upload
  3. Using an HTML file input box to create a hidden array of file input boxes

My issue with #3 is that you still have to individually select all the files in a folder before clicking upload. If you want to upload 50 files, thats 100 clicks and a case of RSI. So, I ignored #3 entirely.

Ideally,  I wanted solution #1, but I found a lot of answers to solution #3,  followed by #2. In the end I tried out four different solutions, all open source.


By far my favourite, and the one we ended up using, this is the same tool wordpress use for their image upload plug

in. It is the most difficult to configure, but its got the most flexibility. SWFUpload uses a .swf file for the actual file uploads, which get posted to a script you specify in the setup. There are then a load of javascript callbacks that allow you to track the progress of files and update your page with the results. All in all, very impressed.

Check it out and download it here: http://www.swfupload.org

There are also demos at: http://demo.swfupload.org

UPDATE: I stumbled across a blog post with a tutorial for creating your own flash file, incase you don’t

want to use SWFUpload. It looks pretty simple, so check it out: Multiple File Upload Using Flash

Continue reading “Selecting and uploading multiple files with one form element, wordpress style”

Blackberry app world (store) launches

Somebody just mentioned that the Blackberry application store launched yesterday and so I had to try it out! So far, it looks promising, but have hit a number of teething problems.

Yesterday I was unable to browse the store on my phone because I was in the UK. Today I’m able to browse the store, but unable to download Shazam, an app that I could download yesterday.

I’m also a little worried that, as it grows bigger, it will be harder to find the application you are after and with only IE support if you want to view it on your computer, that sucks.

Hopefully we’ll see a load of updates over the next few days!

Blackberry storm multi select messages

I just upgraded to the Blackberry Storm despite reading mixed reviews and after day one am quite happy with it. There are a few niggles but overall I think it does a good job.

One of my major concerns was that I couldn’t select multiple messages or items  to delete en masse. I flicked through the manual (for some reason I never read the manual first) and couldn’t find anything. A google search quickly solved the problem.

To multi-select:

  1. Hover on the first item you need to select (using your thumb is the suggestion)
  2. Quickly hover over the item below (you have to be pretty quick, use a different finger)
  3. This should put you in to multi select mode, there will be a blue square in the bottom corner
  4. Hovering on an item in this mode will select all items between it and the first item selected
  5. To get out of this mode, click on the blue sqaure

I use the word item, essetianlly I wanted to select mutlple messages but I think the trick also applies to other things too.