Wednesday, November 26, 2014

Array

NUMERIC DATA TYPES
This is an integer, so whole number eg 7 or a Real number so 7.2.
ALPHANUMERIC DATA TYPES
This is a CHAR so single character or digit, eg ‘C’.
String, several characters together, like star citizen.
BOOLEAN
Data that can only take two values so true or false.


ARRAY OF DATA
contains several data items, usually of the same type, grouped with a single name. Accessed using an index, Stored continuously within computer memory.
continuously means like all together, in sequence.
In Python an array is called a list.
If you have a list/array you can easily add things to the list and take away from the list without changing the source code on the fly. This also allows more flexibility with using it other than storing each one as a separate variable.


li = ['a', 'b', 'new', 'mpilgrim', 'z', 'example', 'new', 'two', 'elements']  
for item in li:  
   if item == 'example':  
       print "this is an example function"


This will go through the list until it finds “example” and it will print the text.
a one dimensional array as one row whereas a two dimensional array has an unlimited amount of rows and columns, similar to a spreadsheet.
all arrays start at position 0
so in: M A R A D; M is in position 0 and A is in pos 1
0 is still the first character/part of the array.

An array is used to make a program more efficient when it comes to a lot of data, it is also good for iteration as it means you can eliminate using each variable separately. Arrays are dynamic.

Wednesday, November 12, 2014

System Life Cycle

1) Problem
2) Analyse the Problem
3) Design
4) Implementation
5) Test
6) Install
7) Maintain
8) Evaluate (Goes back to 1)

Waterfall and Spiral 
Waterfall is the traditional one which only goes through the system life cycle once
The Spiral is when the system life cycle carries on.

Waterfall
Information Gathering
Interview This is time consuming bit allows us to probe for answers and get first hand information
Questionares 
This is useful when there are lots of users although there is a limit to how much you will find out.
Observe the Current System
Although time consuming this is objective rather than subjective and might spot things that the user doesn't.

Feasibility Study is a report to identify the possible solutions to the problem and how possible they are.
Economic or technical feasibility of the new system.

Importance of Analysis

  • Problem must be accurately defined to solve it effectively 
  • User may not understand potential of computer system 
  • Developer not likely to understand the industry which the user working in 
  • Developer must produce a solution that the user requires to meet their needs
  • clear communication between the user and developer is important

Monday, November 10, 2014

Data Types and Data Structures

Numeric Data Types
Basic Data Types

  • Integer whole number eg 7
  • Real/float decimal point eg 7.2


Alphanumeric data types

  • Char a single character, Digit or symbol eg C
  • String several characters grouped  together eg Mr Smith


Boolean

  • A data can only have one of two values (TRUE or FALSE, 1 or 0)
Array Definition
  • A data structure that contains server data items
  • of the same data type
  • Grouped together with one name
  • Individual items are accessed using an index
  • Stored contiguously in computer memory
Use
  • Instead of having variables that we have to declare at front, we can use a list, the software can go through the list easily and find the variable in the list easily.
  • Fewer variables.
  • Use iteration to go through the list with the given variable instead of going through each variable to find the given variable.
  • They are dynamic, can change the program as it is running.

Array Declaration
  • Identifier/name
  • Data type
  • Dimension (1 or 2) One dimension has only has one row two dimension has a row and column.
  • All arrays start at index 0

Sunday, November 9, 2014

Magic 8 Ball Homework

import random
import time
generate = random.randint(1,20)
userQ = input("Welcome to Magic 8 ball, ask me anything!\n")
print("*Shaking ball*")
time.sleep(2)
if generate == 1:
    print("It is certain")
elif generate == 2:
    print("It is decidedly so")
elif generate == 3:
    print("Without a doubt")
elif generate == 4:
    print("Yes definitely")
elif generate == 5:
    print("You may rely on it")
elif generate == 6:
    print("As I see it, yes")
elif generate == 7:
    print("Most likely")
elif generate == 8:
    print("Outlook good")
elif generate == 9:
    print("Yes")
elif generate == 10:
    print("Signs point to yes")
elif generate == 11:
    print("Reply hazy try again")
elif generate == 12:
    print("Ask again later")
elif generate == 13:
    print("Better not tell you now")
elif generate == 14:
    print("Cannot predict now")
elif generate == 15:
    print("Concentrate and ask again")
elif generate == 16:
    print("Don't count on it")
elif generate == 17:
    print("My reply is no")
elif generate == 18:
    print("My sources say no")
elif generate == 19:
    print("Outlook not so good")
elif generate == 20:
    print("Very doubtful")
time.sleep(0.5)
while True:
    generate = random.randint(1,20)
    userQ = input("Ask me another question (to exit say ¦put down 8 ball¦)\n")
    print("*Shaking ball*")
    time.sleep(2)
    if generate == 1:
        print("It is certain")
    elif generate == 2:
        print("It is decidedly so")
    elif generate == 3:
        print("Without a doubt")
    elif generate == 4:
        print("Yes definitely")
    elif generate == 5:
        print("You may rely on it")
    elif generate == 6:
        print("As I see it, yes")
    elif generate == 7:
        print("Most likely")
    elif generate == 8:
        print("Outlook good")
    elif generate == 9:
        print("Yes")
    elif generate == 10:
        print("Signs point to yes")
    elif generate == 11:
        print("Reply hazy try again")
    elif generate == 12:
        print("Ask again later")
    elif generate == 13:
        print("Better not tell you now")
    elif generate == 14:
        print("Cannot predict now")
    elif generate == 15:
        print("Concentrate and ask again")
    elif generate == 16:
        print("Don't count on it")
    elif generate == 17:
        print("My reply is no")
    elif generate == 18:
        print("My sources say no")
    elif generate == 19:
        print("Outlook not so good")
    elif generate == 20:
        print("Very doubtful")
    time.sleep(0.5)
    if userQ == "put down 8 ball":
            break

Thursday, November 6, 2014

Software Development Cycle

DEVELOPMENT TOOLS
There are several different tools that could/might be used within the software development cycle are as follows:


  • API - This is an Application Programming Interface which is comparable to a lego set, building blocks as an API is basically a large library with pre made parts that you can use easily create your program. An example is within windows win32, this is the main api that control very simple things within windows. WebGL or OpenGL is also an API which can help with rendering the 3d model or animation etc.


  • SOURCE CONTROL - This is a system within a network database where one person can work on a bit of the program can check in which allows you to control it for a certain amount of time and cannot be interfered until this programmer has stopped working on it and checked out. There is also version where it keeps track of the different changes. Branching is another idea where you can take parts of the code off the main program and work on them in isolation.


  • BUILD TOOLS - AKA COMPILER - These are programs that put all the different pieces and parts that make up the whole program and help the developers compile the program into a complete version.


  • BUG TRACKING - Every piece of software in the world has bugs, nothing is perfect. This is a separate system that helps organise the bugs within a large program which prioritises issues and assigns jobs to fix bugs. This can sometimes link with the Source Control and mingle with the versioning.

  • AUTOMATED BUILD TOOLS - This is a service/script that runs and can compile the program in the correct order when something needs to be updated regularly. So it checks out and builds the system automatically which saves time.


Wednesday, November 5, 2014

Buffering and Interrupts

What is buffering?
Its an area of memory thats used in-between a slow and fast device to make sure the device receives information more slowly. The data is temporarily stored there while the secondary storage device receives it. This allows the processor to carry out other processors while the data is being received by the slower device.

Example: When we click on a video, the video does not start automatically meaning we have to wait for the video to load, that is when it is buffering. When it is buffering, there is enough data being transformed to the CPU so that there would be enough data for the video to run smoothly.

Advantages
1) can run videos more smoothly
2)The quality remains fairly high

Disadvantages
1) Increases loading time therefore it increases the waiting time for the video to load.
2) Synchronisation issue
3) Its going to use resources in the computer eg GPU/RAM

Interrupts
1) When the buffer needs service, it sends a signal to the CPU needing assistance to transfer the data to the output which means the buffer interrupts the CPU which means the CPU stops what ever processes it doing and goes and fetches the data and fills up the buffer.
2) Error messages are interrupts which means we have to respond to it.

An interrupt is a signal to the CPU to pause what its doing on that point so that it could service the interrupt and then go back to what is it doing.

Key Points 
1) Data sent to buffer from primary memory
2) This allows processor can continue with other tasks
3) Interrupts sent when buffer is full
4) Buffer is emptied to storage device
5) Buffer used to allow RAM and secondary storage device to transfer data as they do so at different       speeds
6) when buffer is empty
7) Interrupt is sent to processor
8) To request buffer refill
9) Process cycles until al data is transferred.


Data: 
1)Raw facts and figuers
2)No structure or content 

Information
1)Structured organised data
2)Processed data

Eg Bar Code, the computer identifies the number in the data base, identifies what is it and matches the price.


Magnetic Ink Recognition
1) the computer can recognise the ink's shape and read it accurately.

Optical Character Recognition
1) Captures images then it compares the shapes that has been captured with the data that is stored.

Optical Mark Recognition
1) The machine captures the marks that are on sheets that are in certain places and sends the co-ordinates to the data base.