Chapter 9 and 10
Breaking down of a system to gain insight to its compositional sub-systems.
Piecing together of systems to give rise to more complex systems, this making the original sub-systems of the emergent system.
Device, system or object which can be viewed in terms of its input, output and transfer characteristics without knowing what is inside.
Opposite of Black-Box. Inner components or logic are available for inspection.
Use Triple quotes when a strings spans multiple lines.
String Methods (string.method)
Functions with Strings and Lists
List Methods (list.method)
Strings are immutable; lists are mutable
Opening Files for Reading and Writing and Reading into a Variable
file = open("practice.txt","wt") wt is writing and rt is reading
file.write("a string"\n) \n makes a new line
data = file.read() Now you can use string methods on data
The OS Module offers a number of powerful capabilities for dealing with files, e.g., renaming files, finding out when a file was last modified, and so on.
We start accessing the OS module by typing:
The function that knows about directories is
listdir(), used as
listdir takes a path to a directory as input.
for i in range(1,10):
math knows about sin() and sqrt()
a combined device for modulation and demodulation, for example, between the digital data of a computer and the analog signal of a telephone line.
formatted unit of data carried by a packet mode computer network.
a system for connecting a number of computer systems to form a local area network, with protocols to control the passing of information and to avoid simultaneous transmission by two or more systems.
The Internet is a global system of interconnected computer networks that use the standard Internet protocol suite (TCP/IP) to link several billion devices worldwide.
Internet Service Provider
a unique string of numbers separated by periods that identifies each computer using the Internet Protocol to communicate over a network.
the part of a network address that identifies it as belonging to a particular domain.
Post Office Protocol Used to retrieve email from a mail server
Simple Mail Transfer Protocol Internet standard for electronic mail (e-mail) transmission
Big O Estimates
Array Access (Selecting a character from a string)
Binary Search of a Sorted Collection
Better Sorts (Quick Sort, Merge Sort)
O(n log n)
Slower Sorts (Bubble, Insertion, Selection)
Traveling Salesmen (EX of NP-Complete problem) (Intractable Problem)
Halting Problem - Unsolvable (Proven by Alan Turing, 1936)
The File Transfer Protocol standard network protocol used to transfer computer files from one host to another host over a TCP-based network, such as the Internet
URL(Web Address when used with HTTP)
Uniform Resource Locator Specific character string that constitutes a reference to a resource
Hypertext Transfer Protocol Application protocol for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web
Hypertext Markup Language Standard language in the making of a web page
Sound to Text
file = open(filename,"wt")
for s in getSamples(sound):
First: Make sure that all red values are even.
Second: For every pixel where the message picture is black, add one to the red value at the corresponding x,y.
def encode(msgPic ,original ):
for pxl in getPixels(original ):
if (getRed(pxl) % 2) == 1:
setRed(pxl , getRed(pxl) - 1)
for x in range(0, getWidth(original )):
for y in range(0, getHeight(original )):
msgPxl = getPixel(msgPic ,x,y)
origPxl = getPixel(original ,x,y)
if (distance(getColor(msgPxl),black) < 100.0):
setRed(origPxl , getRed(origPxl )+1)
<title>The Simplest Possible Web Page</title>
<h1>A Simple Heading</h1>
<p>This is a paragraph in the simplest <br \>
possible Web page.</p>
<img src="mediasources/flower1.jpg“ />
A structured set of data held in a computer, especially one that is accessible in various ways.
A request for information from a database.
Structured Query Language
Special-purpose programming language designed for managing data held in a relational database management system.
Hexadecimal is base 16
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,10 (16 base 10)
#FF0000 is Red
255 for red (FF), 0 for green, 0 for blue
#0000FF is Blue
0 for red, 0 for green, 255 for blue
#000000 is black
0 for red, 0 for green, 0 for blue
#FFFFFF is white
255 for red, 255 for green, 255 for blue
Jython is first translated into Java, which is both compiled and interpreted, every time a program is run. Thus one reason Photoshop operations are so much faster than our picture functions is that Photoshop’s code has already been compiled and is ready to run at the click of a button.
There are some practical issues that determine the relative speeds of different computers. Some are: the clock speed of the processor, the number of cores of the processor, the amount of cache memory on board the processor (or nearby), the amount and speed of RAM, the size and speed of the hard disk, the system bus width and speed.