Monday 4 June 2018

Machine code and it's successors - case study

Early history of the machine code and programming languages.

The first computers in 1940s had limited abilities, due to the amount of memory and possibilities to handle computation processes. The programmers should find more efficient ways to giving commands to the computers. The one of the ways was to create the programming language. That was useful not only in terms of efficiency but, in terms of expanding the popularity of the computers across the world. The development of firsts programming languages resulted in spreading the amazing possibilities which computers gave to the humanity, across the world.

The programming languages becoming more easier to understand for humans because the creators included more syntax from humans languages like English.
Popularity of the computers resulted in creating and updating more easier programming languages than machine code.

Nowadays, programming languages are not comparable to those from 60 years ago, because they syntax is focused on commands - obviously in English.

There is no necessity to be a genius to embrace the functioning of simple "for" loop or incrementation process. However, those features gives us the opportunity to create something powerful. Web design Hull Web design services Freelance web designer web design blog IT specialist Why is the mobile version of the website important? What it's SSL certificate and how it benefits website? The most important features for e-commerce store? Why website does not appear in Google results? Content marketing is a wide field in which our imagination is the only limitation What is the guideline when choosing a hosting for the website? What is worth paying attention to when designing your company's website? The value of blogging in the terms of website design. Freelance web designer - Why do you need affordable website? The ultimate guide how to become freelancer in 2020 6 Features of best UX for web design in 2020 How works Google Assistant. OK Google get started 6 website types which hit the trends in 2020. 10 reasons why CMS need to die in 2020. What is ZCash and how does this modern cryptocurrency work? 5 Best ways to make money online in 2020. How you can make money online - find something adequate to skills The comprehensive guide how to become programer in London - 2020.

Machine code - case study.

Let's start from the very beginning.

Machine code or machine language is a set of instruction given to the computer to receive desired calculation or computing process. Aforementioned instructions are executed directly by the Central Processor Unit(CPU), it is different than programming languages do because the programming languages have built-in compiler or interpreter which translate the code written by the developer to machine code then the CPU is able to interpret it and eventually execute it.


Web design Hull Web design services Freelance web designer web design blog IT specialist Why is the mobile version of the website important? What it's SSL certificate and how it benefits website? The most important features for e-commerce store? Why website does not appear in Google results? Content marketing is a wide field in which our imagination is the only limitation What is the guideline when choosing a hosting for the website? What is worth paying attention to when designing your company's website? The value of blogging in the terms of website design. Freelance web designer - Why do you need affordable website? The ultimate guide how to become freelancer in 2020 6 Features of best UX for web design in 2020 How works Google Assistant. OK Google get started 6 website types which hit the trends in 2020. 10 reasons why CMS need to die in 2020. What is ZCash and how does this modern cryptocurrency work? 5 Best ways to make money online in 2020. How you can make money online - find something adequate to skills The comprehensive guide how to become programer in London - 2020.

Final reflection - summary.

My quiz application project has been finished!

In this post I would like to express my opinion about how valuable was to participate in this project.
Also, it is a perfect chance to highlight things possible to develop in the future.
A few words about the learning outcome and some comments about finished application.

At the beginning of the term, I got a chance to choose the subject for the main project of Computer Skills&Research module. That was a perfect opportunity to explore the world of simple web-based application, how they function, how to create simple application etc.

After a quick research I found the tutorial in the internet in which the author explained how to prepare application which every developer should make during early stage of his/her career.
The tutorial gives me an opportunity to learn line-by-line with comments, how to program the app and the functions of programming language - how to use them in this particular example.

During the study of tutorial, I learned enormous amount of abilities of javaScript and how to use them - I already explained those features in previous posts. I am certain that it would be beneficial in the future projects development.

The app is ready to play, but at the moment it has only 3 questions. It could be future developed and customised. There are possibilities to perform actions such as:

  • style the interface nicely,
  • make a progress bar
  • make a countdown timer, to check if people can beat the clock
  • Add share button - to gives possibility to share on social medias
However, the most important thing is to extend the database with questions. Let the users choose their desired topic, level of difficulties and language preferences.

The fact that disappointing me the most is, that the time is limited and it is almost impossible to be a buffalo soldier and the programmer at the same time - some of the possible developments ideas will stay only in the to-do-list. 


Web design Hull Web design services Freelance web designer web design blog IT specialist Why is the mobile version of the website important? What it's SSL certificate and how it benefits website? The most important features for e-commerce store? Why website does not appear in Google results? Content marketing is a wide field in which our imagination is the only limitation What is the guideline when choosing a hosting for the website? What is worth paying attention to when designing your company's website? The value of blogging in the terms of website design. Freelance web designer - Why do you need affordable website? The ultimate guide how to become freelancer in 2020 6 Features of best UX for web design in 2020 How works Google Assistant. OK Google get started 6 website types which hit the trends in 2020. 10 reasons why CMS need to die in 2020. What is ZCash and how does this modern cryptocurrency work? 5 Best ways to make money online in 2020. How you can make money online - find something adequate to skills The comprehensive guide how to become programer in London - 2020.

javaScript and displaying the quiz results

In this part of analysis, I would like to present the function which is responsible for displaying the quiz results.

It is obvious that if the quiz is completed - the user wants to check the score.
Please have a look at the function below.
The function showResults() gathering the answers given by the user by querySelectorAll comand.
(In one of the previous post, I explained the possibility of setting the correct answer inside the database with question)

The variable numCorrect is incremented if the user given correct answer.

Using forEach loop, javaScript gives us the possibility to find selected answer and judge if the answer given by the user was correct or not, then make the decision about increment the score or not.

After the quiz is completed, the script color the correct answers on green, or if answer provided by user was wrong - red.

As a summary of our score the script shows number or correct answers provided divided by total answers.
function showResults(){

  // gather answer containers from our quiz
  const answerContainers = quizContainer.querySelectorAll('.answers');

  // keep track of user's answers
  let numCorrect = 0;

  // for each question...
  myQuestions.forEach( (currentQuestion, questionNumber) => {

    // find selected answer
    const answerContainer = answerContainers[questionNumber];
    const selector = 'input[name=question'+questionNumber+']:checked';
    const userAnswer = (answerContainer.querySelector(selector) || {}).value;

    // if answer is correct
    if(userAnswer===currentQuestion.correctAnswer){
      // add to the number of correct answers
      numCorrect++;

      // color the answers green
      answerContainers[questionNumber].style.color = 'lightgreen';
    }
    // if answer is wrong or blank
    else{
      // color the answers red
      answerContainers[questionNumber].style.color = 'red';
    }
  });

  // show number of correct answers out of total
  resultsContainer.innerHTML = numCorrect + ' out of ' + myQuestions.length;
}
Web design Hull Web design services Freelance web designer web design blog IT specialist Why is the mobile version of the website important? What it's SSL certificate and how it benefits website? The most important features for e-commerce store? Why website does not appear in Google results? Content marketing is a wide field in which our imagination is the only limitation What is the guideline when choosing a hosting for the website? What is worth paying attention to when designing your company's website? The value of blogging in the terms of website design. Freelance web designer - Why do you need affordable website? The ultimate guide how to become freelancer in 2020 6 Features of best UX for web design in 2020 How works Google Assistant. OK Google get started 6 website types which hit the trends in 2020. 10 reasons why CMS need to die in 2020. What is ZCash and how does this modern cryptocurrency work? 5 Best ways to make money online in 2020. How you can make money online - find something adequate to skills The comprehensive guide how to become programer in London - 2020.

JavaScript and database with QuizQuestions

In this post I would like to explain how to prepare container for questions in javaScript.
The main purpose of creating container similar to the database is to store the data, and display the data to the user - in this particular example it means that we need a container to store the questions of the quiz application.

The container is declared as constant and it contains desired data. Thanks by the vast posibilities of javaScript, we can specify which answer is correct, then use a script to compare correctAnswer with userInput.
Note that questions are strings data type and they have to be included between double-quote symbols, to show to the javaScript interpreter the type of the data.
const myQuestions = [
  {
    question: "Who is the strongest?",
    answers: {
      a: "Superman",
      b: "The Terminator",
      c: "Waluigi, obviously"
    },
    correctAnswer: "c"
  },
  {
    question: "What is the best site ever created?",
    answers: {
      a: "SitePoint",
      b: "Simple Steps Code",
      c: "Trick question; they're both the best"
    },
    correctAnswer: "c"
  },
  {
    question: "Where is Waldo really?",
    answers: {
      a: "Antarctica",
      b: "Exploring the Pacific Ocean",
      c: "Sitting in a tree",
      d: "Minding his own business, so stop asking"
    },
    correctAnswer: "d"
  }
];
Web design Hull Web design services Freelance web designer web design blog IT specialist Why is the mobile version of the website important? What it's SSL certificate and how it benefits website? The most important features for e-commerce store? Why website does not appear in Google results? Content marketing is a wide field in which our imagination is the only limitation What is the guideline when choosing a hosting for the website? What is worth paying attention to when designing your company's website? The value of blogging in the terms of website design. Freelance web designer - Why do you need affordable website? The ultimate guide how to become freelancer in 2020 6 Features of best UX for web design in 2020 How works Google Assistant. OK Google get started 6 website types which hit the trends in 2020. 10 reasons why CMS need to die in 2020. What is ZCash and how does this modern cryptocurrency work? 5 Best ways to make money online in 2020. How you can make money online - find something adequate to skills The comprehensive guide how to become programer in London - 2020.

Analysis of javaScript in relation to QuizApplication

The tool which performs the most important operation of QuizApplication is javaScript - powerful web-based programming language used to handle user input, display output, decide what to do next, and deal with operations makes by the user.

First of all, if the developer wants to use one of capabilities of the javaScript - it is necessary to prepare the main idea of entire application and design how it should work.
After that the commands and calculations to be performed should be wrapped in the functions with it's name and parameters.

For example function buildQuiz()
function buildQuiz(){
  // we'll need a place to store the HTML output
  const output = [];

  // for each question...
  myQuestions.forEach(
    (currentQuestion, questionNumber) => {

      // we'll want to store the list of answer choices
      const answers = [];

      // and for each available answer...
      for(letter in currentQuestion.answers){

        // ...add an HTML radio button
        answers.push(
          `<label>
            <input type="radio" name="question${questionNumber}" value="${letter}">
            ${letter} :
            ${currentQuestion.answers[letter]}
          </label>`
        );
      }

      // add this question and its answers to the output
      output.push(
        `<div class="question"> ${currentQuestion.question} </div>
        <div class="answers"> ${answers.join('')} </div>`
      );
    }
  );

  // finally combine our output list into one string of HTML and put it on the page
  quizContainer.innerHTML = output.join('');
}
This function store the answer choices,adds HTML radio button for each question, adds question and answers to the output and finally combine output into HTML string and display as results on the page


Web design Hull Web design services Freelance web designer web design blog IT specialist Why is the mobile version of the website important? What it's SSL certificate and how it benefits website? The most important features for e-commerce store? Why website does not appear in Google results? Content marketing is a wide field in which our imagination is the only limitation What is the guideline when choosing a hosting for the website? What is worth paying attention to when designing your company's website? The value of blogging in the terms of website design. Freelance web designer - Why do you need affordable website? The ultimate guide how to become freelancer in 2020 6 Features of best UX for web design in 2020 How works Google Assistant. OK Google get started 6 website types which hit the trends in 2020. 10 reasons why CMS need to die in 2020. What is ZCash and how does this modern cryptocurrency work? 5 Best ways to make money online in 2020. How you can make money online - find something adequate to skills The comprehensive guide how to become programer in London - 2020.