Prevent JQuery from trying to cast a value

I had to fix a bug where we wanted to get the id number from an attribute and do some CSS stuff with it.
The relevant JQuery code was using .data() to retrieve the value we cared about, which is usually what you want to do.
But when a very small amount of id’s do not contain a letter, the .data() call converts this value for you as an int instead of a string.
So a === check we made was not working for a very small subset of id’s because the value was what we expected, but the value’s type was not.

If you don’t want JQuery to try and cast the value to what it thinks it should be, don’t use .data() use .attr().

http://stackoverflow.com/questions/10958047/issue-with-jquery-data-treating-string-as-number

Advertisements

Auto deploying a site after a successful Jenkins build

I found myself wanting to have a test site auto deploy once the tests on our continuous integration server had passed.
The reason for this is so that the new Selenium tests I wrote for the site would always be running against the latest version.

This meant configuring Jenkins (the relevant continuous integration software) to run a one line command for the project’s post build action.
Here’s the command:

psexec \\[Remote server’s IP address] -u mydomain/admin -p thisisapassword cmd /c “[Path to deployment script]”

You will need to install psexec onto the server that runs the above command. So in this case, the windows server that is hosting Jenkins.
See here for the files and where you should put them https://technet.microsoft.com/en-us/sysinternals/psexec.aspx?f=255&MSPPError=-2147217396
You do not need to install psexec on the server with the deployment script.

If you are also doing this for selenium tests, I recommend in the selenium test’s Jenkins project, adding a quiet period of a couple of minutes in order to give the deployment code some time to well, deploy. You’ll need to click the advanced settings button to see this hidden option though.