Archive for December, 2008

Re-setting CSS Styles

Posted on December 18th, 2008 in Programming, css | Comments Off

Having had some proper developers come in and work on our code, it’s backed up my cosntant moaning that our code base is in a pretty bad state. Lots of duplication of code all over the place, and lots of pages across multiple sites, which could be common.

The other thing, which one of my developers claims to be very good at and knows almost all there is to know about it, is CSS.

The contractors however, have pointed out many many problems with our css, and have recommended resetting the styles on the sites, before doing anything. I don’t claim to be good at CSS, I know the basics but apart from that, I get my hands dirty with the backend code – so this link proved very useful and insightful when it was given to me. Explains style resets very well, and I now know what we need to do…. the question is will it ever happen?!

Left 4 Dead – Versus Difficulty

Posted on December 10th, 2008 in Games, Rants | Comments Off

In the latest patch for Left 4 Dead, Valve have decided to fix the difficulty under Versus mode to Normal.  I didn’t think much of this, having played on Expert and finding it ridiculously difficult, until I played it a few times.

What is now evident, is that people are just trying to rush through each level, instead of having to take it slow and steady and think about what they are doing.

Last night, 8 of us experienced gamers, on our own server, had to play it on Normal…. and it was boring. Too easy to fight off a rush of horde, too easy to kill Hunters, too easy to kill a Tank. Expert was too hard, Normal is too easy.

From the various threads I’ve read elsewhere it looks as if this is because people have been voting to change the difficulty mid-game – well here’s a novel idea – why not just disable that functionality?! Once a campaign has started, the difficulty can’t be changed. Let it be specified at the Lobby. That way all players know what they’re about to play. Don’t completely restrict the setting. I hate to think what an organised clan/team match will be like on Normal setting. It will be more like a sprint than a tactical team game.

JavaScript bra size calculator

Posted on December 1st, 2008 in JavaScript, Programming | Comments Off

Not sure that I would ever need this, however I would most certainly have liked to have been involved in creating it ;)

JavaScript bra size calculator

jQuery – Show and Hide Input Box & Highlighting

Posted on December 1st, 2008 in Programming, jQuery | Comments Off

As part of a recent project, I had to make a payment page clear, user friendly and intuative.  One of the key things was to only display fields when certain options were selected – in this case, when a radio button had a certain value.

<input type=”radio” name=”payRemainingBalance” value=”true” checked=”checked”/> the full amount ($amountDue).
<input type=”radio” name=”payRemainingBalance” value=”false” /> another amount. (Enter the amount you wish to pay in the field below)</td>
<div id=”anotherAmount”>
Another Amount: <input type=”text” name=”paymentAmount” id=”paymentAmount” maxlength=”8″ />
</div>

Using jQuery, this is very simple to do:

<script type=”text/javascript”>

$(document).ready(function(){
$(“input[@name='payFullAmount']“).click(function(){
$(“input[@name='payFullAmount']:checked”).val() == ‘false’ ? $(“#anotherAmount”).show() : $(“#anotherAmount”).hide();
});
});

</script>

As we don’t have an id on the radio button, we use the name of the input as the identifier, and a simple one liner to establish what the new value of the radio button is.

Due to the focus being on making it clear what is happening, it could be quite easy when you select the radio button, to miss what has changed on the page (a new input box appearing), so I decided to try and highlight the newly displayed input box by fading the background colour of the input box, in and out.  In order to do this in jQuery, you need the jQuery Color plugin.

<script type=”text/javascript”>

$(document).ready(function(){
$(“input[@name='payFullAmount']“).click(function(){
$(“input[@name='payFullAmount']:checked”).val() == ‘false’ ? $(“#anotherAmount”).show() : $(“#anotherAmount”).hide();

if ($(“input[@name='payFullAmount']:checked”).val() == ‘false’) {
$(“#paymentAmount”).animate({ backgroundColor: “#EFB559″ }, 1000).animate({ backgroundColor: “#FFFFFF” }, 1000).animate({ backgroundColor: “#EFB559″ }, 1000).animate({ backgroundColor: “#FFFFFF” }, 1000);
}

});
});

</script>

Our starting background colour is #FFFFFF, we fade to #EFB559 in 1 second, back to #FFFFFF in 1 second, to #EFB559 in 1 second, and finally back to #FFFFFF in 1 second.  This gives the effect of highlighting the field in an orange colour twice, hopefullyhelping the user notice what has changed on the page.