Friday, April 28, 2006

Select Item by Text (using Prototype)

Function to select an item in a <select> element by its text value. Using the Prototype Library.

function selectItemByText ( selectElement, nameToSelect ) {
nameToSelect = nameToSelect.toLowerCase();
( $A($(selectElement).options ).detect (
function ( option ) {
== nameToSelect ;
) || new Object() ).selected = true;

I love prototype

Thursday, April 20, 2006

why me?


So yeah, I've been back at work for a few weeks now. coming up to the end of the 3rd week, although with illness and easter break, i'll have only actually have worked for 10 days. not bad.

The job? I thought it was ok. today I'm not so sure. I don't really know what to do. They seem to have me down as a vbscript/asp expert, which i'm not, and a lot of people there don't want to touch the stuff i'm doing. I can see that, unless i take drastic steps, i'm going to be cobbled with doing most of the legacy stuff and not get a chance to work on the newer bits. bummer.
So far, it's been reasonably challenging. The company have their own Content Management System, which is a piece of shit, but a piece of shit which they've made their money back on many times over, so they're reluctant to do any serious work. Decided today that I'm going to start refactoring its ass. At least that way it'll just be out of date, rather than an out-of-date piece of shit.

Homewise, everythings ok. spent the weekend travelling down to a's parents. Was ok, nothing spectacular happened. Went for a nice walk in the cotswolds, ate some food, but apart from that not a lot. Last night got out for a brief walk after work, for the first time this year. Going to try and do that more often, although it's been pouring down with rain so far this evening. Been spending too much time watching series five of six feet under, which amy bought on DVD, as she couldn't wait for it to come onto terestial telly. we didn't get the digi-box (thanks gary) until after it had finished on e4.

Looking forward to taking murray and hélène up on their offers of putting us up (in berlin and normandy respectively). Amy's already got the german phrase book out, but I'm sure I'll get away with a polite Halo! and then speaking english. That will at once both comfort and annoy me. I can use endless computer based languages, but I'm shit at natural languages. Perhaps i've not got the patence to abstractly learn lists of words. perhaps if I lived with the language i'd pick it up. but that's not likely to happen any time soon.

Need to write a few emails to people, as a couple of friends have sent me lots of long emails, and they're just sitting in my inbox waiting for some kind of response.

Gary's podcast was nice to hear, an awkward sign off, but it's genuinely interesting to get different perspective on things.

Right, better go and make some dinner. been trying to eat less gluten, although it's only been the last few days, and hasn't really involved a lot of chance in diet. it's mostly lunch - sandwiches are easy to make and transport. today, the salad i took to work had leaked all over my bag - garlic dressing seeping out. not nice, and means I need to wash my bag now. the sushi on tuesday was good though, even if it did take too long to make. i'm rambling now.

Wednesday, April 05, 2006

TSQL Script to Find All Identity Columns in a Database

select syscolumns.Name [Identity Column], sysobjects.Name [Table]
from syscolumns
inner join sysobjects on =
where autoval is not null

[Oh geeky joy!]