Wednesday, January 7, 2015

Representation Of Data and Binary

All digital data are stores as binary. Eg Words, Cameras, Monitors...

When converting binary into decimals or reverse the left side is the most significant bit and the right side is the least significant bit.
8 bits = 1byte

BCD is when we code each part of the data by using a nibble.


By using Sign Magnitude method we loose a bit meaning the biggest number we can store is 127.

2a Complement
We assume that the MSB is a negative and the rest of the bit is positive adding to the negative number.

Three way of coding
EBCDIC is dead, stores data on a magnetic tape. cannot store keyboards characters.
ASCII every keyboard character is given a corresponding binary code. every letter is given a binary number.
UNICODE uses 2 bytes it is replacing ASCII it is used to cover more languages in the world, it is more important in the internet as it can store more languages.


Monday, December 1, 2014

How Internet Works


  • It is an wire that has connections to computers and servers
  • Each server has IP address that has a given name.
  • Anything we get from the internet are files that are stored in the servers hard disk that are connected to the internet.
  • DNS which allows us look up the IP address for any particular name.
  • The computers are connected to ISP that is connected to the wire.
  • When pictures are sent they are split into smaller sections called packets.
  • Everything connected to the internet has a IP.

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