www internet n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
WWW / Internet PowerPoint Presentation
Download Presentation
WWW / Internet

Loading in 2 Seconds...

play fullscreen
1 / 67
pearlie

WWW / Internet - PowerPoint PPT Presentation

126 Views
Download Presentation
WWW / Internet
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. WWW / Internet Aaron Bloomfield CS 415 Fall 2005

  2. Impact of Internet on Programming Languages

  3. Formatting Languages

  4. HTML Background • HyperText Markup Language • Tim Berners-Lee– 1989 • Subset/Instance of SGML • Developed to support WWW • Developed as a document-layout language

  5. Markup Languages • Used to encode formatting • Markup tags embedded in text • Output device interpreted tags • Originally used in word processing

  6. SGML • Standard General Markup Language • Rules for defining logical structure of a document • Basis for creating markup languages • Essential info easily transferred

  7. HTML • HTML file processed and displayed by Web Browser • Passive language • Program that displays the html code decides how to interpret the description

  8. Tags • Tell Web Browser how to format text on screen • Always enclosed in angle brackets: <tag> • Not case sensitive • Whitespace does not matter

  9. Anchors • Allow jumping to different spots • HREF • Inserts a hyperlink <A HREF=http://www.virginia.edu>UVA</A> • Name • Allows a different spot in the document to be jumped to directly <A NAME=“sec2”>Section 2</A>

  10. Images • Only need image URL • SRC tag • Images can be placed anywhere • Align

  11. HTML Evolution • W3C & IETF: HTML standards • Internet Drafts: published, tested, commented on, and become Document Type Definitions • Browser authors add to HTML • Support it in their browsers • Community accepts or abandons additions

  12. PDF • Portable Document Format • The second generation of PostScript • PDF files retain their formatting across different viewing environments • Applications exist for converting documents to PDF • Can contain hyperlinks

  13. Tex • Document preparation system • Typesetting for math and technical material • Very close control over document

  14. Tex: File Creation • Tex file created with regular text editor • Tex converts it into a DVI (DeVice Independent) file • DVI file read by another program • Creating DVI file allows for 1 file to produce the same output by different reading programs

  15. LaTeX • Macro package for Tex • Used for document preparation • Author does not format document • Specify defaults for document classes • You can create your own document classes

  16. Latex Example \documentclass{article} \title{Latex Example} \begin{document} Body text goes here. \end{document}

  17. PL Concepts • Formatting languages are not PLs • But their use employs: • Parsing • Generating output in a different form • Nesting

  18. the eXensible Markup Language XML

  19. What is XML? • XML is a markup languge used to represent data in a structured, portable manner • It allows programmers to use a standard parser for many different types of data without having to worry about small changes in document structure affecting their parsing code • It allows for easy interchange of data between heterogenous systems • Why do we care about XML? Its not a programming language.

  20. Example: Gradebook • Without XML:Doe, John 80 75 60 92Doe, Jane 81 90 54 84 • With XML:<grades> <student name=”Doe, John”> <grade name=”hw1”>80</grade> <grade name=”hw2”>75</grade> ... </student> ...</grades>

  21. XML isn't perfect • For some applications the tags make up a significant fraction of a documents size • In general, this doesn't matter • XML by itself doesn't provide a whole lot of services • Things like linking, templating, parsing, and defining schemas are provided by other languages • It isn't really that revolutionary • It is very similar to SGML and ASN1

  22. XML DTD <?xml version=”1.0”?> <!ELEMENT grades (student+)> <!ELEMENT student (grade+)> <!ATTLIST student name #CDATA #REQUIRED> <!ATTLIST student id #CDATA> <!ELEMENT grade (#CDATA)> <!ATTLIST grade name #CDATA #REQUIRED>

  23. Why do we use DTDs • They show an agreement between two groups on a specific way of expressing some data. • There are tools that will verify a document to a DTD • They don't let you enforce restrictions beyond the structure of the document • Without another tool there isn't a way to require that a grade tag only encloses a number.

  24. Real-world uses of XML • Data exchange is great, but how is XML really used? • RSS/RDF • FOAF • SOAP/XMLRPC • Content Management/Syndication • Streaming Video (SML) • Microsoft Word • ... and much, much more

  25. Content Mangement • Many businesses like to write content once, and format it for a variety of destinations • We want to have a version for the web (HTML), cellphones (WML), and print (SGML). • We don't want to have to make each version by hand • Gererally it works like this: • A story is written and marked up in XML • CMS software uses stylesheets to create the different output from the same source • Everybody is happy

  26. Style sheets for XML • The most common style sheet language is XSLT: the eXensible StyLesheet and Templating language. • It allows us to transform one XML document into another document. • Unlike XML, XSLT is a programming language • XSLT programs just are expressed in XML • XSLT is interpreted • XSLT is dynamically typed and type-safe, does dynamic type checking, and is statically scoped

  27. Example: gradebook stylesheet <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:template match=”/”> <xsl:apply-templates /> <xsl:template /> <xsl:template match=”student”> <h1><xsl:value-of select=”@name”></h1> <table><xsl:applytemplates /> </table> </xsl:template>

  28. Gradebook continued <xsl:template match=”grade”> <tr> <td><xsl:value-of select=”@name”/></td> <td><xsl:value-of select=”.”/></td> </tr> </xsl:template> </xsl:stylesheet>

  29. More XSLT • We can also do conditional processing • <xsl:variable name=”thisgrade” select=”.”/><xsl:if test=”$thisgrade < 60”><h2><xsl:value-of select=”.”/></h2><xsl:if/><xsl:if test=”not ($thisgrade < 60)”> <xsl:value-of select=”.”/><xsl:if/> • ...and other things<xsl:value-of “sum(./grade) div count(./grade)” />

  30. Internet Applications and Multimedia

  31. History • People like to be able to use their senses • However, the space that digital pictures, sounds, and video required was far more than a disk could hold • ~1994 the Internet became more popular in the common household • However, browsers were originally mostly text based and connections were too slow to support large files

  32. Flash • Macromedia created Flash which, in one simple program allowed people to develop multimedia content • Flash uses vector graphics, which is very space efficient and incorporates other methods for compressing media types • Also provides streaming content, extremely useful to an internet user

  33. ActionScript • ActionScript is Flash’s scripting language • From a programmer’s point of view, makes Flash a lot easier to work with • The programmer has complete control over what is going on in their application • Enhances one’s ability to create an interactive application, be that a presentation, a game, or a movie

  34. ActionScript cont. • ActionScript and Flash are primarily used today as a 2D graphics environment. • However, people are also using ActionScript to create interactive forms on the web • Another useful application is that a company could store something on it’s main server, and when they have to give a presentation out in Seattle, they could just access that and have real time stream and interactivity

  35. More on ActionScript • In ActionScript, we don’t need to specify what type the variable is. ex. favColor = “pink”; sets the variable named ‘favColor’ to a string with the value “pink”. • Also, favColor can later be changed to another type. ex. (following first example) favColor = 1; sets the variable ‘favColor’ to the number 1.

  36. More on ActionScript • However, if you want a function to only take a certain type and only return a certain type, you can do something like this: ex. Function doThis(myWord:String):Number { } • Also, ActionScript (being part of Flash) was designed with interaction in mind. ex. on (release) {clip2._visible = false; }

  37. More on ActionScript • There are currently other languages out there which are intended to achieve the same results as ActionScript. • The popular ones include JavaScript and upcoming Avalon. • Using ActionScript, a programmer can extremely enhance a presentation with sound, graphics, video, and their overall layout

  38. More on ActionScript • Both ActionScript and JavaScript are based on the ECMA-262 (The European Computers Manufacturers Association) • One big difference is that ActionScript doesn’t support browser specific objects and commands. • Microsoft’s future OS is planning on distributing Avalon as a feature with it. Will support 2D and 3D vector graphics.

  39. Internet Applications (Applets)

  40. Applets • One common misconception is that an applet refers to Java applets, which isn’t necessarily the case • Something to note about these applications is that they can use the computing power of the server or of the user

  41. Java Applets • Even though we have stated that applets do not necessarily have to be Java, this is a predominant form • One crucial feature of Java and Java’s Virtual Machine is that it is machine-independent • To do this, applets need to be able to access some information about the user’s machine, but Java Applets are not allowed/able to read or write files on/to the users machine

  42. Interpreted/Compiled • Originally, the Java Applets for the Java Virtual Machine were intended to be Interpreted • This has its weaknesses, so there are two other methods that the JVM can use

  43. More on the JVM • One thing that the JVM can do is look at what part of the program that is being most heavily used and convert that into machine code • The other option is the Just-in-Time (JIT) Compiler • This takes the Java bytecode and converts it to instructions that can be directly performed by the processor (also using machine code)

  44. More on the JVM • Users of ActionScript like to point out that whatever they create will look the same on any machine (though you do need to download the Flash viewer) whereas JavaScript can be interpreted differently in different (especially the less mainstream) browsers • Along the same lines, Java applets (as previously stated) were designed to be machine independent and could potentially even work on someone’s cell phone

  45. PERL & CGI Practical Extraction & Reporting Language (Pathologically Eclectic Rubbish Lister)

  46. Agenda • Brief History • Language Overview • Benefits of using Perl (Efficiency, Portability) • Common Gateway Interface (CGI)

  47. Brief History • Developed by Larry Wall • Perl 1.000 released in 1987 • Perl 3.000 released in 1988 under GNU Public License • Current stable release: Perl 5.8.1 • Today, Perl comes standard on most operating systems (e.g. Solaris, Redhat, Mac OS X) • 3rd party companies offer pre-built Perl distributions for other OSs (e.g. Windows)

  48. What is Perl? • Interpreted language • Wall originally intended Perl for: • Scanning arbitrary text files • Extracting information • Printing reports from extracted info • System management tasks • Expression syntax borrows heavily from other languages (C, sed, awk, sh)

  49. Wall on Perl • “Perl is a language for getting your job done.” • “Perl is designed to make easy jobs easy, without making hard jobs impossible.”

  50. $str = “Hello, world!”; sub PrintHello { while(1) { if ($str =~ m/o..w/) { print “$str\n”; } else { print “NO MATCH\n”; break; } } } &PrintHello;