Got this gem off the World of Warcraft forums. Lifted, pasted, and edited for your enjoyment.
A Shaman, a Warlock and a Hunter are all helping rebuild Lordaeron's ruins to fortify it against attack. The Warlock opens his lunchbox, "Man if my wife makes me tuna fish sandwich for lunch once more I'm going to hurl myself off the battlements." The Shaman opens his lunchbox, "If my wife makes me peanut butter and jelly again i'm going to hurl myself off these battlements!" And finally the hunter goes "If I get salad again for lunch im going to hurl myself off these battlements!
Sure enough the next day the warlock got tuna, so he lept off the battlements and fell to his death. The shaman got pb&j again so he hurls himself off the battlements to a similar fate. Finally the hunter realises he has salad again and jumps over the battlements to his doom. Suddenly the warlock soul stones and stands up fresh as a daisy, the shaman anhks and gets up very much alive... and the hunter... smells and looks really gross...
"You know what? I might actually miss that guy if he wasnt such a damn fool" stated the warlock "Why's that?" queried the shaman... "He made his own lunch!"
Wednesday, 10 January 2007
The Secret to Success
While testing and debugging an admin page in .NET 2.0 today, I was curious as to why a message confirming the submission had succeeded was being displayed before any submit action was taken. Perhaps something was being updated when the page loads. Perhaps it wasn't checking Page.IsPostBack. I then found the server side code block that displays the message:
if (!string.IsNullOrVoid("success")) {
message.Text = "You submission was
completed successfully.";
}There you have it. An infallible way of assuring users and superiors that your code works perfectly.Tuesday, 9 January 2007
Internet Explorer - Drop Kicks with DOM Selects
What day would be complete in the Web IT world without Internet Explorer, and it's shopping list of problems, showing up to crash the party. Take the following (edited) code I was debugging today:
If you just stopped there you will still receive an Invalid Argument error - so what gives? It turns out that IE has problems handling the type casts of the list items. The solution is to create a new list item, assign its value and text, and then add the item to the list.
Rejoice, it now works.
If this isn't enough, this problem continues in Internet Explorer 7, which still follows Microsoft's method of add(). I'm also informed that IE does not handle innerHTML for selects, even though Microsoft invented it. Good work, Microsoft.
// Get a <select> listInternet Explorer 6, however, does things slightly differently, and requires try{} and catch{} statements to cater for this.
ddlFoo = document.getElementById("ddlFoo");
item = dropdownlist[3]; // Get the third item in the list
// Get another <select> list
ddlBar = document.getElementById("ddlBar");
ddlBar.add(item, null); // Add the item to the list
If you just stopped there you will still receive an Invalid Argument error - so what gives? It turns out that IE has problems handling the type casts of the list items. The solution is to create a new list item, assign its value and text, and then add the item to the list.
Rejoice, it now works.
If this isn't enough, this problem continues in Internet Explorer 7, which still follows Microsoft's method of add(). I'm also informed that IE does not handle innerHTML for selects, even though Microsoft invented it. Good work, Microsoft.
Subscribe to:
Posts (Atom)
