Posted in capacity as Module Leader Group Software Development, Department of Computing Sheffield Hallam University A Morgue One hundred students, 10 clients, 5 labs of University PCs, overzealous Facilities department and the Sheffield weather. What could possibly go wrong? Last week was ‘Scrum Week’. Nineteen groups of students working flat out 9-5, Monday to Friday…
Read MoreQuick code snippet. Assume you have: Then you could use the following jQuery:
Read MoreJust posted a codepen if anyone looking at Recursive Javascript functions. The scenario here could I am sure be tackled other ways but I wanted to do it with a recursive function. Given an array of random numbers, the function getNewNumber will finish off the array by populating it with the remaining number between 1…
Read MoreIn online surveys you may want users to have to answer a radio button style question. You can set a default value with checked as follows: However, you have to make a decision what the default with be and for lazy form fillers you might end up with incorrect data. In HTML5 radio buttons we…
Read MoreA couple of years ago I did a post entitled Adding Form Fields Dynamically with jQuery. In this post I am going to re-visit the same problem but this time use Knockout.js to create the dynamic form fields. View The Demo Introducing Knockout.js Knockout.js is a Model-View-View-Model Javascript library. What it excels at is ‘binding’ data…
Read MoreThere comes a time with a large Javascript project where having the code behave more like a ‘usual’ programming language becomes useful. This is where ‘strict mode’ comes in. Javascript is very forgiving. Take the following: No problem. Yet programming from other languages will throw their arms in horror – The Variable has not been…
Read MoreAs part of the range of new HTML5 Javascript goodies localStorage allows developers to store data client side for later reuse. Sounds familiar? Yep, just like cookies, but without the size limitations as you can store Megabytes of data using localStorage. Setting Values To set a localStorage value you use the method setItem(). localStorage.setItem(name,value); So…
Read MoreThe CSS float property is often used to create columns. Waiting in the wings are some newer techniques such as the CSS column-count property which will make adding columns much easier. For example given a HTML snippet of : We can use the following CSS to put the list into 5 nice columns. View Demo…
Read MoreTernary The ternary operator makes for a shorthand if … else condition : if true do this ? else to this For example the following if … else: … can be done with the ternary operator with: JSFIDDLE Demo Waltzing (m)tilde ~ The little used tilde character ~ is a bitwise operator that works right…
Read MoreJavascript functions can be written in a number of different ways. Function declarations Firstly we have the ‘classic’ named function: This technique is known as a ‘function declaration’. JSFIDDLE Demo Function Expressions Then we have the anonymous function: The above function has no name and is associated with an event. This technique is a type…
Read More