Sunday, February 27, 2011

We actually ran that C++ code, instructions.

If you want to learn how to code C++: CS111
If you want to learn how to code VB: CS80

how to count in binary

0 - 000
1 - 001
2 - 010
3 - 011
4 - 100
5 - 101
6 - 110
7 - 111

How to add in binary
we see it on the board.

practice:
convert 5 and 2 to binary. add them together

The World Wide Web is NOT the same as the Internet
the Internet is hardware
the Web is software

w3schools.com

HTML is the language you use to write web pages

hypertext markup language
web server
http://www.cs.qc.cuny.edu/tutors.html
HW #4:
midlevel and capstone exercises for ch 4

At home, try taking the practice Word Exam

Sunday, February 20, 2011

lecture notes, #3

what binary numbers mean

how to convert from base 2 to base 10
how to convert from base 10 to base 2
octal, hexademical numbers to binary and back
base 8, base 16

how do we count in hex?
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

0 - 0000
1 - 0001
2 - 0010
3 - 0011
4 - 0100
5 - 0101
6 - 0110
7 - 0111
8 - 1000
9 - 1001
A - 1010
B - 1011
C - 1100
D - 1101
E - 1110
F - 1111

Lecture HW#1:
1) Convert these decimal numbers to binary:
7
14
103

2) Convert these binary numbers to decimal:
11001
110
11
1101

3) Convert those numbers in part 2 to octal.
4) Convert those numbers in part 2 to hexadecimal.

programming languages
low-level languages
one very close to the actual instruction set of the CPU


00100010010100101100100000001111100101010
machine language

assembly language
mov ax, 4
mov bx, 3
add ax, bx

correspondence between assembly instructions and machine
mov 00100
ax 0001
bx 0010

http://en.wikipedia.org/wiki/Assembly_language

high-level languages
http://en.wikipedia.org/wiki/High-level_language

Some C++ code to calculate costs:
http://www.functionx.com/cpp/examples/ifelse1.htm
#include <iostream>
using namespace std;

void main()
{
    unsigned int Miles;
    const double LessThan100 = 0.25;
    const double MoreThan100 = 0.15;
    double PriceLessThan100, PriceMoreThan100, TotalPrice;

    cout << "Enter the number of miles: ";
    cin >> Miles;

    if(Miles <= 100)
    {
        PriceLessThan100 = Miles * LessThan100;
        PriceMoreThan100 = 0;
    }
    else
    {
        PriceLessThan100 = 100 * LessThan100;
        PriceMoreThan100 = (Miles - 100) * MoreThan100;
    }

    TotalPrice = PriceLessThan100 + PriceMoreThan100;

    cout << "\nTotal Price = $" << TotalPrice << "\n\n";
}

compiler
interpreter

Java, C++ compiled language
JavaScript, python

Binary <--> Decimal Conversion

See here for how to convert a binary number to a decimal number.
See here for how to convert a decimal number to a binary number.

At each of these links, there is a detailed description of the process in text, as well as a video. However, they accidentally put the same video in each. To see how a video of how to convert binary --> decimal, see it on YouTube here.

Actually, I'll also post both videos in this blog post:

Decimal to Binary:


Binary to decimal:


For now, practice with the practice numbers they give at those two links. Eventually, I will assign other binary and decimal numbers to convert for a homework.

Here is an extended ASCII chart.

How to convert between binary and hexadecimal.
How to convert between octal and binary. There are better ways.

Making Office 2003 Compatible with Office 2007 formats

You can download the Office Compatibility Pack from Microsoft:
By installing the Compatibility Pack in addition to Microsoft Office 2000, Office XP, or Office 2003, you will be able to open, edit, and save files using the file formats in newer versions of Word, Excel, and PowerPoint . 

How to obtain Microsoft Office (for PCs)

You can get it from microsoft, in one of three ways:

1) You can use the 60 day free trial, available here:

2) You can buy the full version available for cheap to university students, here:
For this, you will need your QC email, since it requires an email which ends in .edu. $80 is a pretty
good price for the full version of office.

3) For free, you can use Office Web Apps:
These run in your web browser. Unfortunately, Microsoft Access is not included as a Web App, but
it does include PowerPoint, Word, and Excel.

You can get the data files you need for the exercise either by downloading it from Prentice Hall website:

or by bringing in a Flash drive to lab next time and copying the folder onto it.

Friday, February 11, 2011

Thursday, February 10, 2011

Update:

The college is indeed closed for this coming Sunday, Feb 13th.

I still have to set up Blackboard, so hold on to your homeworks for now.

Sunday, February 6, 2011

lecture notes, #2

qccs012.blogspot.com
see my email address on the sidebar

Intro to computers, computer science

what is a computer?
something that computes

input, output, math ability, memory, control

input:
keyboard, mouse, mike

output:
speakers, printer, monitor

memory
short term - RAM
long term - CD ROM, hard drive, flash drive, floppy drive

CPU
central processing unit
CPU has:
-ALU: arithmetic / logic unit
-control unit: what happens first, second, third

von Neumann architecture
http://en.wikipedia.org/wiki/Von_Neumann_architecture

data is carried by the "bus"

Old way:
dedicated computer for a specific task
IBN Sorting Machine
http://www-03.ibm.com/ibm/history/exhibits/attic3/attic3_136.html

hardware: physical components
vs. software

Universal, general purpose computer
it has the capability of being any particular computer

we make it into a particular, specific computer by feeding it instructions. software.

fetch-execute cycle
we fetch an instruction
then we carry it out (executing it)
then, we fetch an instruction
then we carry it out (executing it)
then, we fetch an instruction
then we carry it out (executing it)
then, we fetch an instruction
then we carry it out (executing it)
then, we fetch an instruction
then we carry it out (executing it)

pseudo-code. instructions written for a human to understand. computer probably won't.

Adding machine.
program:
1) say "please enter a number"
2) get the number, store it in X
3) say "please enter another number"
4) get the number, store it in Y
5) add X and Y, store it in Z
6) say X "+" Y "=" Z
7) Go to step 1

IP - instruction pointer, inside the control unit.

RAM is volatile memory, short term.
hard disk is not volatile, long term
copy into RAM
set IP= 1
both instructions, data are stored in RAM

this program "loops"

-----

three levels of memory
long term: hard disk
short term: RAM -- random access memory
really short term: registers

sequential access memory -- scroll,
random access memory -- book

http://en.wikipedia.org/wiki/Floppy_disk

parallel, perpendicular
one of them means 0, the other of them means 1

bit - binary digit; 0 or 1

http://en.wikipedia.org/wiki/CD_ROM

more complicated info by combining bits

0, 1, 2, 3

could store these four values in 2 bits

0 - 00
1 - 01
2 - 10
3 - 11

5 pants
8 shirts
40 combinations; 5 x 8

8 bits = byte
how many combinations?
2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 2^8 = 256

three bits?
2^3
2 x 2 x 2

0 - 000
1 - 001
2 - 010
3 - 011
4 - 100
5 - 101
6 - 110
7 - 111

all the former possibilities with a leading 0
all the former possibilities with a leading 1
twice as many as before

you add a bit, you have twice as many possible values

four bits -- nibble
how many possible values?
2^4 = 16

0 - 0000
1 - 0001
2 - 0010
3 - 0011
4 - 0100
5 - 0101
6 - 0110
7 - 0111
8 - 1000
9 - 1001
10 - 1010
11 - 1011
12 - 1100
13 - 1101
14 - 1110
15 - 1111

we count memory in bytes
1 byte = byte
2 bytes = word
4 bytes = dword
1024 bytes = 2^10 = kilobyte ~= 10^3
1024 x 1024 bytes = 2^20 bytes = megabyte ~= 10^6
2^30 bytes = gigabyte ~= 10^9
2^40 bytes = terabyte ~= 10^12
http://en.wikipedia.org/wiki/Terabyte

used to be. but memory makers are greedy; they like to market to you also.
they use powers of 10

herz
kilohertz
megahertz
gigahertz

the bigger the number, the faster the computer

multiple CPUs


-----



in lab, we did the four practice exercises. you might want to go through the hands-on-exercises at home, once you get the book.

typography -- appearance of printed matter
font;
serif, sans-serif fonts
http://www.livescience.com/strangenews/more-difficult-fonts-improve-learning-110113.html

fixed-width (monospaced) vs. proportional
is every letter/symbol the same width?

W
i

  $   10.00
  $    0.54

lining up fonts

1 point = 1/72 inch
1 pica = 12 points

how do i make my paper:
adjust font face, point size
increase margins
line spacing
indent
how many sentences per paragraph
=rand(5,4)
lorem ipsem text

between character spacing; kerning
Wi

"WILL TYPE UP YOUR PAPERS. WILL ENSURE THAT THE SPELLING AND GRAMMER ARE CORRECT"

non-breaking space
non-breaking hyphen

windows and orphans

style - a bag of formatting
a way of separating formatting from meaning

reveal formatting - Shift F1

hw:
midlevel exercises and capstone exercise