DOC PREVIEW
Columbia COMS 3156 - Software Engineering

This preview shows page 1-2-19-20 out of 20 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 20 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 20 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 20 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 20 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 20 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Software EngineeringToday we will be covering…XML - ElementsXML – valuesXML – minOccurs/maxOccursXML – max/min [II]XML – Attribute groupsXML Attribute groups [II]XML – Choice and SequenceXML – Choice and Sequence [II]XML - ConclusionNetwork basicsFirewallsNATSocketsSimple Client – Janak ParekhSimple Server – Janak ParekhMultithreaded ServerParse this Stream/FileConclusionSoftware EngineeringRecitation 2Suhit GuptaToday we will be covering…XML IISockets, Server – Client relationships, Servers capable of handling multiple clients.XML - ElementsElements are capable of taking on several values ––string boolean float double decimal timeInstant timePeriod month year century recurringDate recurringDay timeDuration recurringDuration binary uriReference ID IDREF ENTITY NOTATION language IDREFS ENTITIES NMTOKEN NMTOKENS Name QName NCName integer nonPositiveInteger negativeInteger long int short byte nonNegativeInteger unsignedLong unsignedInt unsignedShort unsignedByte positiveInteger date time–And on and on and on and on…..–Read the primer 0 for more and in depth informationXML – values<xsd:simpleType name="MyInteger" base="xsd:integer"> <xsd:minInclusive value="1"/> <xsd:maxInclusive value="99"/> </xsd:simpleType><xsd:simpleType name="Sku" base="xsd:string"> <xsd:pattern value="\d{3}-[A-Z]{2}"/> </xsd:simpleType>XML – minOccurs/maxOccursAdding Attributes to the Inline Type Definition <xsd:element name="Item" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> <xsd:element name="productName" type="xsd:string"/> <xsd:element name="quantity"> <xsd:simpleType base="xsd:positiveInteger"> <xsd:maxExclusive value="100"/> </xsd:simpleType> </xsd:element> <xsd:element name="price" type="xsd:decimal"/> <xsd:element ref="comment" minOccurs="0"/><xsd:element name="shipDate" type="xsd:date" minOccurs='0'/> <xsd:attribute name="partNum" type="Sku"/> <xsd:attribute name="weight" type="xsd:decimal"/><xsd:attribute name="shipBy"> <xsd:simpleType base="string"> <xsd:enumeration value="air"/> <xsd:enumeration value="land"/> <xsd:enumeration value="any"/> </xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element>XML – max/min [II]You can specify max and min valuesBy combining and nesting the various groups provided by XML Schema, and by setting the values of minOccurs and maxOccurs, it is possible to represent any content model expressible with an XML.XML – Attribute groupsAdding Attributes Using an Attribute Group <xsd:element name="item" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> <xsd:element name="productName" type="xsd:string"/> <xsd:element name="quantity"> <xsd:simpleType base="xsd:positiveInteger">....<xsd:attributeGroup name="ItemDelivery"> <xsd:attribute name="partNum" type="Sku"/> <xsd:attribute name="weight" type="xsd:decimal"/> <xsd:attribute name="shipBy"> <xsd:simpleType base="xsd:string"> <xsd:enumeration value="air"/> <xsd:enumeration value="land"/> <xsd:enumeration value="any"/> </xsd:simpleType> </xsd:attribute></xsd:attributeGroup>XML Attribute groups [II]Using an attribute group in this way can improve the readability of schema, and facilitates updating schema because an attribute group can be defined and edited in one place and referenced in multiple definitions and declarations. These characteristics of attribute groups make them similar to parameter entities in XMLXML – Choice and SequenceNested Choice and Sequence Groups<xsd:complexType name="PurchaseOrderType"> <xsd:choice> <xsd:group ref="shipAndBill" /> <xsd:element name="singleAddress" type="Address" /> </xsd:choice> <xsd:element ref="comment" minOccurs="0" /> <xsd:element name="items" type="Items" /> <xsd:attribute name="orderDate" type="xsd:date" /></xsd:complexType><xsd:group name="shipAndBill"> <xsd:sequence> <xsd:element name="shipTo" type="Address" /> <xsd:element name="billTo" type="Address" /> </xsd:sequence></xsd:group>XML – Choice and Sequence [II]A choice group element allows only one of its children to appear in an instance.Un-named groups of elements can be constrained so that only one of the elements may appear in an instance.Alternatively, they can also be defined, and along with elements in named groups, they can be constrained to appear in the same order (sequence) as they are declared.XML - ConclusionI think that should be it on XML.Any more info… read about it on the webXML Primer 0 - http://www.w3.org/TR/2000/WD-xmlschema-0-20000407/http://www.w3schools.comNetwork basicslink: connection between components, including wireless => point-to-point (modem), multiple access (Ethernet)router, switch: forward packetsnode: router (= intermediate system), host (= end system)clients: access resources and servicesservers: provide resources and services (may also be client)dumb terminal: no local processingFirewallscomputer between internal (“intranet”) and external network= policy-based packet filteringwatch single point rather than every PClimit in/out services, restrict incoming packetscan’t prevent people walking out with diskspacket filter: restrict IP addresses (address filtering), portsconnection filter: only allow packets belonging to authorized (TCP) connectionsencrypted tunnel: tunnel = layer same layer inside itself à virtual network: connectintranets across InternetNA(P)T: network address (and port) translator are not firewalls, but can prevent allincoming connectionsNATSocketsWhat are ports?What are sockets?What is the difference?Simple Client – Janak Parekhimport java.net.*;import java.io.*;public class client { public static void main(String[] args) { try { Socket s = new Socket("128.59.209.243",2099); BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter pw = new PrintWriter(s.getOutputStream()); /* The following comment does not work as intended--Java is too clever * about connections, so this line gets printed immediately */ // System.out.println("Connected to server, talking"); pw.println("Hello"); pw.flush(); // Now wait for something back String st = br.readLine(); System.out.println(st); // Clean up s.close(); } catch(Exception e) { e.printStackTrace(); } }}Simple Server –


View Full Document

Columbia COMS 3156 - Software Engineering

Download Software Engineering
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Software Engineering and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Software Engineering 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?