IE8 doesn’t support .trim()

I’m starting to understand the frustrations!

If you want to trim whitespace from the front and end of a string the solution is a regex.

function trimmed(query){

  return qeury.replace(/^\s+|\s+$/g, '');


Should do the trick ūüôā


Holy un-reproducible defects WATman!

This takes some explaining, bare with me!

A user from the US reports a defect in the acceptance testing environment (UAT)¬†regarding entering dates, she just isn’t able to at all. It comes to our team and they can’t reproduce it. QA in India look at it and confirm it can be reproduced, and that the problem is entering US dates ( MM DD YYYY), so it comes to me. I try to enter US dates and it doesn’t work. OK we have a bug.

Here’s the rabbit hole…

I jump in head first and look at the file containing the code. The file has over 3,000 lines of code in it for this grid, it contains everything, model, view, controller, the lot. I try changing some things around, there’s the multipleDateFormat container and I try moving the ‘d’ and ‘M’ around, it just swapped the display around (ok, so that’s what THAT does…) and I put it back. So I’m at a loss now, because how does it know when to us US and European formats for something like 01/02/2014?

So I jump in further…

I find a userLocale variable and I delve into the back end and discover it’s dependent on your login (your login has a locale, US = 1, everything else = 2), which explains why QA could only enter European formatted dates. So I test this theory by US login and… it doesn’t work. “The hell?!”.

So I dive in further…

I start putting console.log()s and breakpoints everywhere I think there might be a problem and start stepping through from the instant the button is pressed. (I should probably have done this first, but I like to understand what the code is meant to do before I start learning what it is doing) and find the dirty check, including my first encounter of ‘!!’ used, !!field.isDirty()&&… usually ! means ‘not’ so != is ‘not equal to’ so this is not-not false? Kinda, it means is definitely a true/false and not ‘undefinied’, which is equal to false… learn something new every day! So¬†anyway,¬†that’s working. Turns out it’s failing at the isWholeGridValid() check that decides to tell the user to correct some fields… only there aren’t any fields highlighted.

I nervously dive into the loop that checks each row…

Fails at the first row! Not even my data that’s causing it. What is this madness?! ‘Invalid date format’? I haven’t touched that date I swear! So I ask our most senior developer to take a look and he concludes with confidence¬†“Well the date’s obviously wrong”. -_-. Only… yes it is! It’s displaying as ‘sat Nov 2014’ WHY ARE YOU DOIN…. oh…. I compared the file with the latest in the repository and I’d gotten a ‘d’ and ‘D’ mixed up when I put them back, meaning it shows the actual day, not the number. Oops.

Back to square one…


Now US dates work!

I could now no longer reproduce the error. 8 hours of debugging and now¬†I can’t reproduce it. I test in local, dev and, knowing the code hasn’t changed check a different product in UAT just to rule out the deal being unique and it works fine. I let QA know to use the US login in the notes and get back to the scrollbar issue that came back (wasn’t having a good day, over 100 scroll bars in the app had disappeared thanks to IE10 and I missed some files that only show under specific conditions).

Later that day…

I’d just finished the daily build and receive an email: “Defect **** (failed) has been assigned to you”. I test it in local, works fine. In the Dev environment it works fine, UAT… fails. I almost fall out of my chair. The code is the same! I haven’t changed anything. Had I forgotten to test¬†in UAT? But why would it fail? My code is the same, I’d just done the daily build! What’s different? It’s not the date problem… it’s the validator, but the dates are correct this time because my mistake wasn’t committed…

It’s business time…

I strap on my headphones, put on my ‘Heavy’ playlist on Spotify and switch to Chrome’s debugger. I dive into the isWholeGridValid() and loop through the first row and hold my breath for the inevitable incorrectDateFormat… and…nothing.
I click through to the next… nothing.


I think ‘to hell with this’ and stick a break point on just after the line that stores the error and it jumps straight to Error[1].value = “”. Null?! Huh? But I haven’t… what? On the 49th row…. But I’d filled in the 3rd…

I look at the 49th row and a couple of fields are missing…

“hmm… what happened if I fill these in…”

*click* …

“grid saved” … :O

If the code is the same and the logins are the same, what is the ONE difference between the two? The data!! They both use different servers and databases. I try different products, the work (Yesss, I’m not an idiot).

So… to conclude… the data was wrong. The data had empty values where data was mandatory, I’d discovered a new defect! Unfortunately… I’d just filled in the only known case of data coming from the database as null.


It’s a bit… empty here.


If you’ve stumbled across here I’d like to first welcome you and secondly apologise for the lack of content. To be honest, I’m terrible at maintaining these things and I regularly let my unfiltered thoughts drift into it, when originally it was intended as a display of my works in progress and college/university projects. That is something I’d still like this to be and it’s summer and I’ve just started my year-long internship at The Walt Disney Company as a Junior Developer so I’ve been concentrating on that. However, I’m learning some ‘interesting’ lessons so far, the project is a real eye-opener and I’d like to talk about that later on and hopefully have some interesting insights into working with the technologies I am; particularly Java, Maven, Spring, ExtJS/Javascript, Hibernate and developer tools I otherwise wouldn’t get chance to experience, for example JetBrains’ excellent¬†WebStorm IDE and JRebel.

But for now, as it’s 3.35am GMT, I’m going to spill some thoughts into a Tumblr I’ve created and if you’d like to get more of an insight into me personally, feel free to visit it at¬†¬†and as I get more hands-on at Disney and start my super-exciting-projects-that-people-will-actually-use you’ll start to see this fill up a bit.

In the mean time, feel free to leave a comment, or question and if you’d like to see a particular focus on any aspect of software engineering, the technologies I’m using or the teaching of computer science let me know!

Thanks for visiting,

Shaun Munsey РJunior Developer Intern for TWDC (occasionally known as Reuben)