Random images in Umbraco
Monday, February 11, 2008 3:40:52 PM (GMT Standard Time, UTC+00:00)
Following on from a recent post of mine about how to setup changeable headers using the media picker in Umbraco a new site I have been working on required something a little extra -they wanted the headers to simply be chosen at random. from a given media folder.
First, create a new (blank) XSLT file and add the following:
What this does is it uses the StartNode (a media folder) passed in from the macro to loop through any valid files (in this case jpg/gif/png and pull out the image if it's valid. I was thinking about replacing the for-each loop and simply using the index but I'm not sure if there would be any performance improvement except for if there were a lot of header images in the folder.
You'll then need to create a new macro and add a parameter with the name "StartNode" and select "mediaCurrent" as the Type. That's it :)
I'd like to build on this and have a "valid" headers selector which would use a Multiple Media picker and would allow for banner ads to be selected at random but that can wait for a client that needs it ;)
The turnover challenge 2008
Friday, February 08, 2008 4:02:36 PM (GMT Standard Time, UTC+00:00)
I'm always up for a laugh and a challenge -especially where business is concerned, without pushing yourself I think your company will just shrivel up and die. This time however I think I may have bitten off more than I can chew -which may very well result in public humiliation, women's clothing and the most bizarre gym session ever!
While "playing" squash the other day with a mate of mine -Ian- who runs Avant Garde - a hair salon based in my local gym Next Generation and I jested about challenging each other to increasing our turnover to (for me anyway) ridiculous heights for the tax return 08/09 and so began the turnover challenge 2008.
The aim of the game is simple -we have to turnover more than £x00,000 in the next tax year. For a little more fun we decided to add in a forfeit for the company who earned the least. What's the forfeit I hear you cry! Well that's what's up for debate at the moment but basically it should be:
- Fun!
- Suitably humiliating to make sure you don't want to lose!
- Non-financial
- Non-harmful to us (i.e. no tattoos, piercing's etc)
- Non-harmful to the businesses
- Non-harmful to others
- Legal!
We've come up with a few ideas but I thought I'd throw it out there for other ideas as I'm sure something amusing will come up! My fav's so far:
- A gym session in women's clothing: miniskirt, sports top and high heels (knowing Ian he'll wear the panties too!)
- Do a parachute -though I think that's something I want to try anyhow...
- Paragliding/Snowboarding/Other etc in the nuddy
- (Me) -become a hairdresser (Ian) -learn to code
The thing I like about the gym session is that it's scaleable i.e. "for every £10k difference in turnover, the other has to run for another minute on the treadmill..."
If you don't think that's a hard challenge, put it this way, to meet the target we've both got to more than double our turnover. If neither of us make it I suggest you get a weeks pass at my local gym -Next Generation April 2009!
You've got until April 1st 2008 to get the forfeit ideas in...
Issues with sensitivity of Links Crossbow training on a huge projector screen
Wednesday, February 06, 2008 2:28:52 PM (GMT Standard Time, UTC+00:00)
If you're a regular reader of my blog you'll know we were lucky enough to get a projector a while ago but it's not without problems. As silly as it sounds, playing the Wii on a 98" screen is sometimes pretty hard!
The main issue I've found is that it's expecting a screen at most 42" and so you only need to move the end of the controller a tiny distance for it to go from one side of the screen to the other. In the case of Links Crossbow Training we found it made getting bigger scores really darn hard.
Last night though I was fiddling with some of the settings and have found if you reduce all the settings to a minimum (the screen you're first shown asking you to point at the center) it really helps, I've set the crosshairs to move more slowly and I also increased the Wii's sensitivity in the main settings so I could sit futher away and check out the results - Big Points on a Big Screen!
FWIW if you're into the arcade shooters this is a great game to play -certainly worth the £20 price tag...
Is Google taking the P? How should I know, it's all gibberish to me...
Friday, February 01, 2008 12:12:28 PM (GMT Standard Time, UTC+00:00)
I recently signed up for a new Google account for client related stuff and ever since have found that the entire user interface has changed into another language -I would guess Greek or Polish but I don't really have a clue. I don't know why it started like this as I sure as damn-it chose English but it makes me laugh every-time I see it.
I've even tried changing all my settings to English but Google just doesn't want me to read what it's saying -luckily I'm familiar enough with the interface that I can navigate around it without needing to know what it's saying ;)

Some Google fun
Monday, January 28, 2008 10:24:23 PM (GMT Standard Time, UTC+00:00)
Thanks to Chris Anderson for this one -shame I missed it the day he posted it due to mega issues but worth sharing:
- Goto Google (www.google.com incase you're that uneducated :P)
- Type into the search "find Chuck Norris"
- Click the "I'm feeling lucky button"
- Enjoy
Well it made me smile at least
*Goes off to find a good CN movie*
Registration opens for the UK launch of Visual Studio 2008 -in Birmingham
Friday, January 18, 2008 12:13:38 PM (GMT Standard Time, UTC+00:00)
For those of you Microsoft readers I thought I'd let you know I've just had an email come through about Visual Studio's UK Launch. It's happening on March 19th 2008 in Birmingham's ICC. Registration has finally opened and you can register here: http://go.microsoft.com/?linkid=8126604
Alternatively check out the live cast at: www.heroeshappenhere.co.uk.
Why am I excited about this? Well the last launch event I went to gave away free -and full- copies of Microsoft Visual Studio 2005 and SQL Server 2005 to every delegate! Hope to see you there -let me know if you can make it.
Fantastic new -and cheap domain name registrars
Wednesday, January 16, 2008 12:59:38 PM (GMT Standard Time, UTC+00:00)
After our recent issues with Fasthosts (or as they are now fondly referred to in the office - Farcehosts) I have made the conscious decision to move away from them completely over the forthcoming months (probably years). We no longer have any clients on their hosting platform but we still have circa 300 domain names registered through various accounts through their sister company UKReg.
Due to the authority's charges, we can't just transfer all these domains away as it'd cost us a fortune (and possibly one we can't recoup) so I'm going to do it as they expire. In our search to find an alternative provider someone suggested we check out the new kid on the block - Heart Internet. According to those in the know on Underscore they are a bunch of guys who used to work at 1&1 and decided they could do it better.
So far I've found their service to be great -and value wise they're cheaper than most providers which is a bonus. As with most of the providers these days it's all managed through their easy to use online control panel which is pretty straight forward. If you're on the lookout for great value or cheap domain names give Heart Internet a look.
BTW if you're wondering where Heart Internet's .co.uk domain names from 9p is, check under the transfer fees. Still £2.59 is a great price for any .co.uk!
How to: Remove users from the ASP.Net membership database
Sunday, January 13, 2008 8:37:44 PM (GMT Standard Time, UTC+00:00)
I'm sure I've blogged about this in the past -or perhaps it's just in my "to blog about list" but I thought I would share this little ditty on the Sunday night.
If you ever need to delete a user from your ASP.Net Membership database this is a really useful SQL script to do just that (I often find that the ASP.Net web administration tool throws a SQL Exception while trying to delete a user).
To use the code to delete a user from the ASP.Net membership database simple identify the Guid of the user and enter it where I've written 'THE GUID OF THE USER HERE' and hit go :)
USE ASPNet
GO
DECLARE @UserId uniqueidentifier
SET @UserId =
'THE GUID OF THE USER HERE'
DELETE FROM aspnet_Profile
WHERE UserID =
@UserId
DELETE FROM aspnet_UsersInRoles
WHERE UserID =
@UserId
DELETE FROM aspnet_PersonalizationPerUser
WHERE UserID =
@UserId
DELETE FROM dbo
.aspnet_Membership
WHERE UserID =
@UserId
DELETE FROM aspnet_users
WHERE UserID =
@UserId The message I was referring to above usually looks something like the following:
Msg 547, Level 16, State 0, Line 9
The DELETE statement conflicted with the REFERENCE constraint "FK__aspnet_Us__UserI__17036CC0". The conflict occurred in database "ASPNetMemberships", table "dbo.aspnet_UsersInRoles", column 'UserId'.
The statement has been terminated.
I've not looked into why it's happening (I expect it's something to do with an incorrect install on my behalf) but I'm sure there's a solution for it. I know there are a couple of built in SQL scripts i.e. aspnet_Users_DeleteUser but they required more params to get working ;)