Wednesday 28 October 2009

jQuery UI slider that uses a text box for input

'Quick start' users can go straight to the demo...

.. but if anyone is interested this came about when our ever diverse creative team came up with a feature that needed a slider input that was also clever enough to work if the user typed a value into a text box (the feature was around currency which is why the example uses pounds).

I looked around and couldn't really find anything other than the jQuery UI slider which was neat, simple but also allowed you into the events and properties of the slider so you can extend on it's basic functionality.

Now you can add the jQuery slider markup to a page:

<div id="sliderLow" class="slider"></div>

Drop in a text box:

<input type="text" class="amountLow" onKeyUp="SetSliderValue('#sliderLow', this)" />

And I guess the clever bit is the custom javascript that allows you to add as many sliders as you like to a page using parameters for sliderId, minimumValue, maximumValue, inStepsOf and inputControlClass:

SetupSlider('#sliderLow', 0, 40000, 250, '.amountLow');

Anyway it's all done using HTML and CSS and it also uses the numeric.pack plugin to stop anything other than numbers being entered. Feel free to rip this off or take it away and extend it further.

Go to the demo... ENJOY!

Thursday 1 October 2009

Awesome online music editing software

What's so cool about this app is that all the memory heavy library files are stored on Aviary's server- just build a track and export it. Also this thing let's you record from your machine AND gives you some wicked sound effects to lay on top.

Ignore the crap demo track... for the library files click the button bottom left, record button is bottom right.

http://aviary.com/tools/myna and click ‘Launch Myna’.

(FIX) Visual Studio hangs, crashes and restarts when opening .ASPX or .ASCX files

So I come in to work, do my morning SVN update, open my Visual Studio 2008 solution and the aspx file I was working on the previous night hangs, crashed and restarts... errr WTF?!?

After doing this with every .aspx and .ascx file I opened I decided to abandon VS and use Notepad++... this was NOT a good solution! What made it even stranger is that I could open the same aspx/ascx files in a different VS solution and they'd open fine - no crashes, no restarts.

Stuck in VS hell for a couple days I thought ok let's take some time to figure this out. I googled some fixes, first I found a few suggestions on StackOverflow, then a hotfix update for an ASP.NET with MVC bug but I still couldn't resolve the issue. Then I reinstalled VS - made me lose my keyboard and environment
settings but I still had the crash/restart problem.

FINALLY I did something clever, instead of just watching the crash I debugged into it which gave me a null reference error in some shared code. Essentially another dev had been working on a shared project which was checking for an entry in the root web config:

var configEntry = System.Configuration.ConfigurationManager.GetSection("DumbAss") as NameValueCollection;

I had updated SVN at a project level so I got the shared change but missed the root web config update - I mean how often does the thing change anyway!

Essentially this hang, crash, restart issue is not always a Visual Studio problem (although it could handle it better). If like me you're stuck and need VS up and running check your web.configs are up-to-date with all the required config sections and if you're still getting VS restarting it's a good idea to step in with debug mode so you can see the real error that's being thrown.