Showing posts with the label Programming

Best Coding Editor

By McDonald, T.   |  Date 11th of February 2021 Starting the 100 days of code challenge? New to coding? The first thing that you need to do is get a suitable coding editor or IDE. This will allow you to code and make it a much easier experience. For instance, a good editor will highlight any syntax errors and throw up exceptions that once you have learned what they mean will give you clues as to the mistakes in your code. In addition, you will need to compile some code, the IDE will do for you, in order to make it run. Exceptions are errors found in the code at either runtime, when you try to run the code, or by the complier when you compile the code. Notably, you will need to install some languages in order to start coding.  For example, if you want to code in Java, you will need to install Java on your computer. However, if you want to code something more server side like javaScript, you will not need to install a language called javaScript. Coding Languages that we th

Dynamic Tables in JavaScript

  Problem I need a table that will expand and decrease in size as new items are added and or deleted. Restaurants Must be in JavaScript Solution HTML You will need to make a place holder in the html file using the table tags and give it an id <table id="myTable"></table> JavaScript Creating a button var btn = document.createElement("INPUT"); btn.setAttribute("type", "button"); btn.setAttribute("value", "x"); btn.setAttribute("onclick", "aFunction(this)"); Remember you will have to navigate using dot notation to where the aFunction(this) is if it is contained within an object or accessed by going through an object. Creating the table var table = document.getElementById("myTable"); var row = table.insertRow(-1); // -1 will add new rows to the bottom. var cell1 = row.insertCell(0); var cell2 = row.insertCell(1); var cell3 = row.insertCell(2); var

Objects, Dot and Bracket notation in JavaScript

By McDonald, T.   | Date 14th of August 2020 If you want to be a coder, you will need to know about objects and how to interact with them. Have you been watching teach yourself videos and reading teach yourself blogs? Are you feeling a little bit lost with the jargon? I will show you that the jargon around objects in JavaScript is not as confusing as it first sounds. What is an object? An object can be thought of as a thing that can be represented in the real world such as a car or a shop. The car has attributes sometimes called properties, for example colour or model, and protocols sometimes called methods such as peddles or stirring wheel. The attributes describe the characteristic of the car while the protocols are how to interact with the car. You can have many objects and they can all have a different state. First let’s look at the structure of the object. Object creation: objectName = {}; The above creates an empty object. objectName = { objProperty_1 : “va

Problems with spreadsheets

By McDonald, T.   |  Updated 24th of March 2020 Small errors in spreadsheets have been the cause of major problems in real life. Examining the kinds of common errors in spreadsheets helps us understand the general problems working with data can present. In order to understand these problems, it is a good idea to look at what a spreadsheet is and how equations can go wrong. Spreadsheet ideas   A spreadsheet consists of one or more sheets: A sheet is a two-dimensional (array) of cells in which each cell is referenced by an index consisting of its column letter and row number. A cell can contain data or a calculation (known as a formula). There is a text box, known as a formula bar, in which the contents of a cell are displayed, and which is used for creating and editing the contents of the cell. What is a spreadsheet?   A sheet can contain one or more: Tables (sheets) A table is a two-dimensional array of data; some data is numeric, some is text. The tabl