Sunday, 5 March 2017

RFID

this stands for Radio Frequency Identification Key

this can be used for unlocking car doors

the tag is the transponder and the reader transmits the signal
the signal activates the RFID transmitter (tag)

how it works:

antenna sends radio wave signal and the transponder receives the radio waves and induces an electrical current and sends the response to the reader via radio waves

no physical connection is needed

the tag must be near the reader

Sunday, 12 February 2017

files in programming

to create a new file:

dim aLine as string

fileopen(1, "Diary2.txt", openmode.output)
console.writeline
aLine = console.readline
Printline(1,aLine)
fileclose(1)


to read a file:

dim NextLine as string

fileopen(1, "diary.txt" , openmode input)
console.writeline
do wile not EOF(1)
next line  lineinput(1)
console.writeline(NextLine)
loop
fileclose(1)

to append a file (add onto a file)

dim aLine as string

fileopen(1, "Diary2.txt", openmode.append)
console.writeline
aLine = console.readline
Printline(1,aLine)
fileclose(1)

different translators

assembler


  • translates assembly language program into machine code


compiler


  • takes source code of a high level language and translates into object code
  • looks at the entire source code to translate and optimize the instructions 
  • the compiler will produce object code that can be distributed to people who do not need the development environment to execute the code.

interpreter

  • an interpreter analyses and executes source code line by line 
  • as each statement is analysed, the interpreter calls routines to carry out each instruction

software

software can be split into two different software's
application software
system software

system software covers 4 things

operating system:
manages the computer hardware
manages secondary storage
manages I/O devices
designed to act as an interface between user and computer.
manages the operation of the computer
links hardware application and uses virtual machine


library programs (DLL):
dynamic link library
carry out common tasks
critical for applications
will contain code, data resources
control dialogue boxes
mange memory display text and graphics

translator software:
compiler
assembler
interpreter
used by programmers to convert by one program to another
the CPU doesn't understand the programmers code, has to be translated into machine code of 1's and 0's

utility software:
to ensure the computer is running efficiently often supplied with the operating system
disk formatting tool

RAM- random access memory- volatile
ROM- read only memory- non-volatile

an operating system manages:
hardware to allocate processes
main memory
I/O devices
secondary storage

Virtual machines: the purpose is that the complexities of how tasks are done are hidden away from the user

Thursday, 19 January 2017

January Mock corrections

1a) a system stores integers in 16 buts. using binary representation, show the steps of subtracting 6 from 18, using two's compliment.

18= 0000000000010010
6=   0000000000000110
-6=  11111111111111001
                                      1
        1111111111111010
        0000000000010010
 12= 000000000000110

1b) A801= 1010100000000010

1.01010000000   0010

decimal value = -2.75


2a) smallest positive value

0.1000000  0001


3c) calculate the number of bytes

10 x 10 = 100
100 x 2 = 200
200 / 9 = 25 bytes

5b) if an image required 3000 colours - how many bits would be required for the colour depth?
12 bits

Sunday, 15 January 2017

logic gates

there are 6 different logic gates:

AND gate

Image result for and gate
A
B
A.B
0
0
0
0
1
0
1
0
0
1
1
1
The AND gate is an electronic circuit that gives a high output (1) only if all its inputs are high





OR gate
Image result for or gate
A
B
A+B
0
0
0
0
1
1
1
0
1
1
1
1
The OR gate is an electronic circuit that gives a high output (1) if one or more of its inputs are high.






NOT gate
Image result for not gate
A
1
0
0
1
The NOT gate is and electronic circuit that produces an inverted version of the input at its output. It is also know as an inverter. If the input variable is A, the inverted output is NOT A.

NAND
Image result for nand gate bbc bitesize
A
B
0
0
1
0
1
1
1
0
1
1
1
0
This is a NOT-AND gate which is equal to an AND gate followed by a not gate. The outputs of all NAND gates are high if any of the inputs are low




NOR gate
Image result for nor gate
A
B
0
0
1
0
1
1
1
0
1
1
1
0
This is a NOT-OR gate which is equal to an OR gate followed by a NOT gate. The outputs of all NOR gates are low if any of the inputs are high.





EXOR gate
Image result for xor gate
A
B
A+B
0
0
0
0
1
1
1
0
1
1
1
0
the “Exclusive-OR” gate is a circuit which will give a high output if either, but not both, of its two inputs are high.







Tuesday, 10 January 2017

Bubble sort algorithm

Bubble sort is a simple algorithm that compares based in which each pair of adjacent elements is compared. the values are then swapped when they are not in order. However this is not suitable for large sets of data as it is not a quick method for sorting.

Algorithm  
for all elements of the list
if list(i) > list(i + 1)
swap(list(i) = list(i + 1))
end if
end for
return list
end bubble sort

Pseudo-code 
repeat
swapped = false
for i = 1 to array - 1 do
if A(i) > A(i + 1) then
temp = A(i)
swap A(i) = A(i + 1)
A(i + 1) = temp
swapped = true
end if

Code
Module Module1
    'Callum Westcott
    'These are my variables
    Dim swap As Boolean
    Dim num(8) As Integer
    Dim temp As Integer
    Sub Main()
        'these are the values for the array
        num(1) = 20
        num(2) = 72
        num(3) = 69
        num(4) = 88
        num(5) = 42
        num(6) = 169
        num(7) = 101
        num(8) = 99

        'this do loop will make sure that all of the number will show in order
        Do
            swap = False
            For index = 1 To 8 - 1
                If num(index) > num(index + 1) Then
                    temp = num(index)
                    num(index) = num(index + 1)
                    num(index + 1) = temp
                    swap = True
                End If
            Next
        Loop Until swap = False

        'this will display the ordered array
        For index = 1 To 8
            Console.WriteLine(num(index))
        Next
        Console.ReadLine()
    End Sub

End Module











Sunday, 4 December 2016

representing images, sound and other data

5a) a bitmap image has resolution 1000 x 400. Calculate the resolution in megapixels.
1000 x 400 = 400,000
B) Each pixel in the image is stored using 16 bits. Calculate the file size in bytes in bytes.
400,000 x 16 = 6,400,000
6,400,000 / 8= 800,000

6a) a bitmap image resolution 2000 x 5000 uses 400 distinct colours. Calculate the size of the file in megabytes /mebibytes
2000x x 5000 = 10,000,000
log(400) / log(2) = 9
10,000,000 x 9 = 90,000,000
90,000,000 / 8 / 1024 / 1024 = 10.7 MiB
B) the image's resolution is increased to 5000 x 5000. Calculate the increase in file size from part a in megabytes to one decimal place / mebibytes
16.1 Mib increase
C) calculate the change in file size from part b if the number if colours is increased to:
i 500
2.2 MiB

glossary

Glossary

Absolute Error - difference between true resultant value and nearest representable value

ADC (Analogue-to-digital converter) - to sample electrical equivalent of sound and convert sample into digital signal using two voltage levels

Algorithm - a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.
Analogue Data - data that varies in a continuous manner
Assignment - storing data into a variable, giving that data a memory location

Bitmap - defines a display space and the colour for each pixel or "bit" in the display space

Bits - the smallest unit of data in a computer, has a single binary value: 0 or 1

Bytes - 2nd smallest unit of data, 8 bits or 2 nibbles

Compression - process of reducing the number of bits required to represent data
DAC (Digital-to-analogue converter) - to playback recorded sound

Even Parity - a parity checking mode in which an extra bit, called a parity bit, is set to 1 if there is an even number of 'one' bits in a one-byte data item.

Hz (Hertz) - unit of frequency (used to measure wave frequencies, such as sound waves)
Iteration - also known as looping; process where a set of instructions are repeated until a condition is met
Nyquists Theorem - "sound must be sampled twice its highest analogue frequency in order to extract all of the information from the bandwidth and accurately represent original acoustic energy"

Odd Parity - a parity checking mode in which an extra bit, called a parity bit, is set to 1 if there is an odd number of 'one' bits in a one-byte data item.

Overflow - where the value is too large to be represented using the available number of bits

Pixel - the smallest representable element of an image that can be individually processed

Precision - maximum number of significant digits that can be represented

Pseudocode - a notation resembling a simplified programming language, used in program design

PCM (Pulse-code modulation) - a method used to digitally represent sampled analog signals

Relative Error - absolute error divided by the true resultant value

Resolution - the number of pixels within an image, expressed in terms of horizontal x vertical axis

Selection - also called decision; program takes course of action depending on the answer e.g. if statement.

Sequence - where an action or event leads to the next ordered action in a predetermined order

Underflow - where the value is too small to be represented using the available number of bits

Vector - co-ordinate based image that does not have a reduction in clarity when zoom is increased or decreased


Bubble Sort- a simple algorithm  that compares based off each pair.

Sunday, 20 November 2016

Arrays

when storing a single number you would have declare one integer (Short) variable

to store 3 numbers you would need three variables

an array is a data structure that stores many items using a single variable

a single variable stores one single data item

an array is like lots of boxes held together

Dim numbers(4) as integer
Dim sNames(5) as string

the number in the brakets indicated the size of the array. We always start from zero

Exam marks(0) = console.readline
Exam marks(1) = console.readline
Exam marks(2) = console.readline
Exam marks(3) = console.readline
Exam marks(4) = console.readline

for Index = 0 to 4
    console.writeline(ExamMarks(Index))
    Next Index

the above section of code will print out every time in the array

array processings makes use of for loops

how to enter into an array

for Index = 0 to 4
    console.writeline("Enter exam mark numbers" & Index)
ExamMarks(Index) = console.readline

   Next Index



Representing sound in a computer

analogue data that varies in a continuous matter

analogue-to-digital converter (ADC): to sample electrical equivalent of sound and convert sample into digital signal using two voltage level

to playback recorded sound, use of digital to analogue can vector (DAC)

PCM: form of an analogue signal is produced by an ADC

PAM: pulse aptitude modulation

formula to calculate file size:
file size = sample rate(Hz) x length of recording (seconds) x sampling resolution (Bits)

example

44,000 Hz x 60 seconds x 16 bits = 42,240,000 bits = 5,280,000 bytes
or 5.28 MB or 5.03 MiB

Nyquist's theorem

sound must be sampled at least twice its highest analogue frequency in order to extract all of information from the bandwidth and accurately represent original acoustic energy.

Data Compression

some data files are quite large high resolution or music sampled data high frequency result in several megabytes of data.

compression- process pf reducing the number of bits required to represent data

lossless: often used where the graphic might be changed by another person or where the image contains layers of graphics that need to be kept separate from each other.
no data loss
it is high quality

lossy: offers a higher compression on rotation

run length encoding: a method of compressing data by eliminating repeated data

dictionary based: compression technique is used whem compressing text files

For loops


For Loops

for loops are used when you know exactly how many times the code must be repeated


















this is an example of for loops working, it shows all the values from one number to another.

Sunday, 6 November 2016

Bit Mapped Graphics

pixel: the smallest addressable area of an image

resolution: the number of pixels per unit of measurement

the resolution of an image or VDU screen is expressed as the number of pixels per column
E.g 1024 x 768 = 817,152

Bit mapped graphics

the colour of each pixel is stored as a binary pattern in video memory in a monochrome screen (two colours) Just 1 bit will be needed for each pixel.
0 for white and 1 for black

if 2 bits are used for each pixel then four colours can be stored, for example :
00 - white
01 - blue
10 - red
11 - black

Colour Depth

the colour depth is the number of bits used to re-pressure a single pixel.

if 8 colours was waned then 3 bits would be needed
2 to the power of 3 = 8
2 to the power of 4 = 16
2 to the power of 8 = 256

Bytes required per pixel?

if 16 colours are wanted then we would use 4 bits per pixel
in bytes this would be 1/2 a byte

if 256 colours are wanted then we would use 8 bits per pixel
there would be 1 byte allocated to each pixel

formula for bits in a pixel, if you have N bits, you can store 2^N different colour codes.

Vector

co-ordinates of images are stored as mathematical data.
points are described by relative distance from the origin
objects can be scaled and grouped together by its features

Tuesday, 1 November 2016

Bits, Bytes and nibble

Nibble = 4 bits
2x nibble = 1 byte (8 bits)
Kb = Kilobit = 1000 bits = 125 bytes
Mb = Megabit = 1000 Kb

KB = Kilobyte = 10^3  = 1,000
MB = Megabyte = 10^6 = 1,000,000
GB = Gigabyte = 10^9 = 1,000,000,000
TB = Terabyte = 10^12 = 1000 GB

Ki = Kibibyte = 2^10 = 1024 bytes
Mi = Mebibyte = 2^20 = 1,048,576
Gi = Gibibyte = 2^30 = 1024 Mi
Ti = Tebibyte = 2^40 = 1024 Gi