CS2910 Week 2, Class 1 Today Data Encoding, Part 1 Parsing Data Python Muddiest Point Lab 2 – Bring text In Class, Thursday: Quiz Week 6, Monday: Midterm.

Slides:



Advertisements
Similar presentations
Problem Solving 5 Using Java API for Searching and Sorting Applications ICS-201 Introduction to Computing II Semester 071.
Advertisements

I210 review Fall 2011, IUB. Python is High-level programming –High-level versus machine language Interpreted Language –Interpreted versus compiled 2.
C Strings. The char Data Type for Storing Characters The char data type can is used to declare a variable that can hold a single character. Examples:
Wednesday, 12/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Wednesday, 12/11/02  QUESTIONS??  Today: CLOSING CEREMONIES!  HW #5 – Back Monday (12/16)
Introduction to Python Lecture 1. CS 484 – Artificial Intelligence2 Big Picture Language Features Python is interpreted Not compiled Object-oriented language.
CS2852 Week 8, Class 2 Today Tree terminology Non-Binary and Non-Search Trees Tree Traversals (Remaining slides not yet shown) Tomorrow: Quiz Implementing.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
Basic Java Programming CSCI 392 Week Two. Stuff that is the same as C++ for loops and while loops for (int i=0; i
CS2910 Week 1, Class 3 Today Lab 1 – Additional Assignment Working Ahead Primitives in Java SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder.
SE1011 Week 2, Class 3 Today Compiling and running Another example using Scanner Compile-time and Run-time errors Review for exam SE-1011 Slide design:
CS2852 Week 2, Class 1 Today Generics (Section 051) Big-O runtime analysis Muddiest Point Lab Quiz Includes writing a method from ArrayList class (See.
SE-1021 Software Engineering II Week 8, Class 1 Return Exam Producing UML diagrams automatically in EA Poll Everywhere Files Tomorrow Week 6 HW due (if.
CS2910 Week 1, Class 2 Today Announce Prof. Michael Vieau’s S-341 6p Thurs Wk 2 Assignment for tomorrow Data Encoding, Part 1 Parsing Data Muddiest Point.
CS2910 Week 1, Class 1 Today Introductions Class/Lab Layout Safety Review - Note about Lab Safety Review Announce Prof. Michael Vieau’s S-341 6p Thurs.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
Introduction to Strings Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg 1.
CS2852 Week 3, Class 2 Today Stacks Queues SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 22: Pointers.
CS2910 Week 5, Class 2 Today DNS Muddy Points More HTTP Headers Review for Midterm Exam This coming Monday: Midterm Exam SE-2811 Slide design: Dr. Mark.
SE-1021 Software Engineering II Week 1, Day 2 Attendance Survey results: Use powerpoint Safety Review Preparation for Lab 1 More on Java fundamentals…
SE1011 Week 6, Class 1 Today Return Half Exam 2 (cont.) Object Oriented Programming (cont.) Muddiest Point Next Half Exam: Week 7, Monday SE-1011 Slide.
COMPE 111 Introduction to Computer Engineering Programming in Python Atılım University
CS2910 Week 2, Class 1 Today Return Lab 1 Muddiest Points Quiz Parsing Data in Python SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
CS2852 Week 6, Class 1 Today The run-time stack Writing and proving recursive methods SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
CS2852 Week 5, Class 2 Today Queue Applications Circular Queue Implementation Testing SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
SE1011 Week 3, Class 2 Today Sit down by someone you don't know Learn their name Find out who came farther to get to MSOE at the start of the quarter Designing.
1 CS 177 Week 6 Recitation Slides Review for Midterm Exam.
CS2910 Week 10, Class 1 Today Modular Arithmetic RSA Week 10, Monday Quiz: Potential topics TCP window size & header format Public/private key encryption.
SE1011 Week 5, Class 1 Today More Java API tools Packages Object Oriented Programming Muddiest Point Tomorrow: Lab 5 – In-lab demo requirements now up.
CS2852 Week 7, Class 1 Today Binary Search Tree Implementing add Implementing find Return Quiz 4 (second attempt) Both sections are graded SE-2811 Slide.
CE1901 Week 6, Class 3 Week 6 Mini-Exam Review Muddiest Point Timing Diagrams (See this slide and Outcomes on course webpage – link now available)Outcomes.
CS2852 Week 6, Class 2 Today Class exercise: Implementing a recursive method Binary Search Trees Tomorrow: Quiz at start of lab Implementing a recursive.
CS2910 Week 4, Class 1 Today Encoding in Python – Review Quiz – Encoding in Python Introduction to HTTP SE-2811 Slide design: Dr. Mark L. Hornick Content:
CS2852 Week 3, Class 2 Today Big-O runtime analysis Linked Lists Muddiest Point Lab Quiz Includes writing a method from ArrayList class (See next slide)
CS2910 Week 7, Class 2 Today Quiz on encodings IMAP Encoding "Internet Messages" Tomorrow Office hour cancelled Monday Quiz on IMAP SE-2811 Slide design:
CS2852 Week 2, Class 2 Today Big-O runtime analysis Linked Lists Muddiest Point Lab Quiz Includes writing a method from ArrayList class (See next slide)
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
Week 7, Class 1: The Command Pattern (cont.) Get Ready for Poll Everywhere Labs 2 & 3 returned Lab 7 due this evening at 11pm Quiz tomorrow at start of.
CS2910 Week 4, Class 2 Today Sit by someone you have not yet worked with this quarter. Learn his/her name if unknown. Turn on your laptop and start Wireshark.
CS2910 Week 3, Class 1 Today What is a protocol? Using TCP in Python Defining methods in Python Long procedure design SE-2811 Slide design: Dr. Mark L.
CS2910 Week 8, Class 2 Today Return Quiz Look at Schedule TCP implementation! Week 8, Monday Quiz on SMTP May include some questions requiring you to interpret.
CS2910 Week 7, Class 1 Today Capturing SMTP with Thunderbird Tomorrow Extra office hour at 11 am (right after lab) Friday Office hour cancelled SE-2811.
CS2910 Week 5, Class 1 Today Sit by someone you have not yet worked with Turn on your laptop and start Wireshark. DNS Next week Monday: Midterm Exam SE-2811.
Strings CSE 1310 – Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington 1.
Strings CSE 1310 – Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington 1.
SE1011 Week 9, Class 3 Today Arrays with Loops! Homework SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 1.
CS2910 Week 6, Lab Today Dictionaries in Python SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
CS2911 Week 3, Class 2 Today Return Lab 3 Afternoon section: Hand out Lab 4 Checklist Review Muddiest Point Questions on Lab 4? What is a protocol? The.
Slide design: Dr. Mark L. Hornick
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
SE-1021 Software Engineering II
CS2911 Week 6, Class 1 Today This week, Lab: Quiz at start of lab
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
CS2911 Week 5, Class 3 Today Week 6, Lab: Quiz at start of lab
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
SE-1021 Software Engineering II
Slide design: Dr. Mark L. Hornick
CS2911 Week 2, Class 3 Today Return Lab 2 and Quiz 1
SE-1021 Software Engineering II
CS2911 Week 3, Class 3 (And wk4-c1)
CS2911 Week 3, Lab Today Thursday Friday Review Muddiest Point Lab 3
Slide design: Dr. Mark L. Hornick
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
Slide design: Dr. Mark L. Hornick
Presentation transcript:

CS2910 Week 2, Class 1 Today Data Encoding, Part 1 Parsing Data Python Muddiest Point Lab 2 – Bring text In Class, Thursday: Quiz Week 6, Monday: Midterm Exam SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1

Quiz Topics See OutcomesOutcomes The Internet Stack Binary Representations Parsing Messages Programming in Python SE-2811 Dr.Yoder 2

Representing bits and bytes (Corrected) ASCII characters: ‘A’ (0d) ‘\r’ CR (Carriage return) (0a) ‘\n’ LF (Line feed, New line) SE-2811 Dr.Yoder 3

Encoding Message Length Field at start of message d 0a Special code at end of message 31 0d 0a 00 HTTP header lines: 0d0a Predetermined size TCP header SE-2811 Dr.Yoder 4

Parsing Messages Field at start of message Read field – you know exactly what is where Special code at end of message Keep reading until you find the code Predetermined size Read all fields – you know exactly what is where SE-2811 Dr.Yoder 5

Exercise Consider the following format: A message has a four-byte header. The second and third bytes give the number of bytes in the payload. Write a program in pseudocode to read the message and save the payload. SE-2811 Dr.Yoder 6

Introduction to Python Python Interpreted Interactive Dynamically typed – Variable type determined at run-time Unit-tests essential white-space: delimited (like pseudocode) # comment Java Compiled Consider all code Statically typed – Variable type checked by compiler Unit-tests essential { } ; delimited // comment SE-2811 Dr.Yoder 7

Introduction to Python Python scores = list() OR scores = [] scores.append(1) my_tuple = (1,'hi',5.0) # tuples are immutable name = 'peter' OR name = "peter" # strings are immutable # no characters in python Java ArrayList scores = new ArrayList (); scores.add(1) String name = "peter"; // strings are immutable char c = 'a' SE-2811 Dr. Yoder 8 Note implied first argument "self"

Indexing lists and strings Python a = [1,2,3,4,5] x = a[0] # x is an int y = a[2:4] # y is a list s = "abcde" # s is a str c = s[0] # c is a str! b = s[2:4] # b is a str if isinstance(c,str): if type(c) is str: Java long[] a = {1,2,3,4,5}; long x = a[0]; # not possible for an array String s = "abcde"; char c = s.charAt(0); String b = s.substring(2,4); if(b instanceof String) if(b.getClass() == String.class) SE-2811 Dr. Yoder 9

Negative indices Python s = "abcde" length = len(s) d = s[-1] b = s[-2:-1] b = s[-2:] b = s[:2] OR b = s[0:2] Java String s = "abcde"; int len = s.length(); char d = s.charAt(len-1) b = s.substring(len-2,len-1) b = s.substring(len-2,len) b = s.substring(0,2) SE-2811 Dr. Yoder 10

Conversions Python Parsing Strings s = '1' i = int(s) s = str(i) Encoding/Decoding ASCII s2 = s[0] i = ord(s2) s3 = chr(i) Java Parsing Strings String s = "1"; int i = Integer.parseInt(s); s = ""+i; Encoding/Decoding ASCII char c = s.charAt(0); long i = c; char c3 = i; SE-2811 Dr. Yoder 11

If/else Python if a < b: comp = 'less than' elif a == b: comp = 'equal to' else: comp = 'greater than' print "a is",comp,"b" Java if (a<b) { comp = "less than"; } else if (a == b) { comp = "equal to"; } else { comp = "greater than"; } S.o.pl("a is "+comp+" b") SE-2811 Dr. Yoder 12 From Dr. Sebern's introductory video

Loops Python x=0 while x < 10: x += 1 for x in range(5,10): print x Java long x = 0; while (x < 10) { x++ } for(int x = 5; x<10; x++) { S.o.pl(x) } SE-2811 Dr. Yoder 13

Exceptions in Python Python try: raise Exception('Ow!') except ZeroDivisionError: print 'Division by zero' finally: print 'Cleanup' Java try { throw new Exception("Ow") } catch (ArithmeticException e) { S.o.pl('Division by zero') } finally { S.o.pl('Cleanup') } SE-2811 Dr. Yoder 14

Exercise Write Python code from your pseudocode in the earlier exercise. Assume that the entire message is available as a string (where each byte is an "ASCII" character in the string) SE-2811 Dr. Yoder 15

SE-2811 Dr. Josiah Yoder 16

Acknowledgement This course is based on the text Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 SE-2811 Dr. Josiah Yoder 17