Comput LCC 6310
Popular in Course
Popular in Literature
This 0 page Class Notes was uploaded by Dr. Belle Hahn on Monday November 2, 2015. The Class Notes belongs to LCC 6310 at Georgia Institute of Technology - Main Campus taught by Staff in Fall. Since its upload, it has received 10 views. For similar materials see /class/233944/lcc-6310-georgia-institute-of-technology-main-campus in Literature at Georgia Institute of Technology - Main Campus.
Reviews for Comput
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 11/02/15
Overview Programming concepB 1 Q Process intensity Look at projects 3 The Computer as am Expressive Medium Lecture 19 Process Entensity instantial assets a temptation When first learning to program instantial assets can provide immediate reward Process intensity term coined by Chris Crawford Us39 th 39htfel quot fquot Refers to the quotcrunch per bitquot ratio mg em mg a more 53 a How much prooessing does the computer do on the data But instantial assets Don39t make use of the uni ue ro rties ofoom utational media InstantIal assets data displayed by computer q D De p Limit possibilities for interaction Sound les Create an authonal bottleneck Bitmaps Are computationally quotopaquequot Text Animations The essence of the medium The essence of the computer as a representational medium is not Intervention in the production or display of 3 dimensional forn39s or visual imagery tools Interaction with a participantobserver interactivity Control of electromechanical devices installation Mediation of signals from distant locations communication The essence of the computer as a medium is Computation processes of mechanical manipulation to which observers can ascn39be meaning Instantial assets limit interaction More degrees of interactive freedom require more complexity of response As the interactor can do more the program needs to do more Responses generated from instantial assets Limit response to oombinations of assets Require more assets as the range of response grows Can be an authon39al bottleneck Instantial design tends to limit interaction or collapse response Computation code rhetoric Uninterpreted computation Rhetorical strategis Physical symbol system Interpretation Complex causal ows 1 Representation Overuse of instantial assets blocks flow between code and rhetoric Computational opacity The meaning of instantial assets are opaque to code Example oode that triggers video clips can39t reason about or manipulate the meaning of the clips This opacity limits the code39s ability to resequence these assets in meaningful and interesting ways Assets must be designed for sequencibility or Assets must be quotopenedupquot to the code ManComputer Symbiosis No not cyborgs And certainly not the replacement of men with machines automation etc The idea of computers and people working together in a productive thriving relationship How it should work Licklider states two main aims to let computers facilitate formulatiVe thinking as they now facilitate the solution of formulated problems to enable men and computers to cooperate in making decisions and controlling compleX situations Without in exible dependence on predetermined programs People set goals perform evaluations form hypothesis etc Computers do the heavy lifting How it should work 27 Computers currently as of the 60s getting better at humanlike tasks proving theorums playing chess etc Suggests that it will continue to improve Al suf cient for doing military planning by 1980s Five years for symbiosis to develop Fifteen years to grow it Aims of the Symbiosis Computers need wellformulated problemspreprocessed data to be able to solve them Sometimes very hard to get problems data into that state So try to bring computers to that level Computing in real time Takes too long for a programmer to write code then wait for its turn for the code to be assembled and run and then you get your answer that isn39t necessarily the actual answer to your problem Why Lioklider notes that a lot of the time of a human expert himself is taken up by Clericalmechanical tasks Better suited to a computer Humans are more suited to working at something in parallel have exibility in thought Computers do a small number of set things well and quickly Roughly opposites thus working together would work well Exactly what will each party do Humans will set goals supply motivation be able to nd sources easily etc Computers will make models from hypotheses test those models do simulations show results however they are needed transform results into more humanreadable forms Also evaluate possible courses of action And a subset of What humans do but Will defer to their judgement What is needed for this to happen FiX the speed mismatch 1960s computers too fastexpensive to work with a single person used by many Evolve into a network of giant databasescomputers that would be used by all and have balanced speed Need more memory billions of bits costing billions of dollars to hold any appreciable fraction of scienti ctechnical literature Need indelible and published memory manywrite readonlyjl What else Better ways of storing things in memory The trie Fix dissimilarity between human and computer languages Instructions directed to computers specify courses instructions directed to humans specify goals So get computers to be better at devisingsimplifying methods for achieving goals LCC 63110 The Computer as am Expressive Medium Lecture 16 Parsng HTML By parsing HTML you can process web information and create visualizations or manipulations of it Last week we looked at the swing classes for HTML parsing This week we39ll learn a standalone Java package for HTML parsing HTMLParser available from htmlparsersourcefomenet Go to DownloadsCurrent Download the latest release build release 16 June 10 2006 Before we start a quick reminder about using external Java libraries within Processing Overview Programming concepB HTML parsing recursion HTM LParser library from htmlparsersouroeforgenet Reminder accessing external libraries Placejars or class files within the min folder in processing For example if the class library is called I 2 lg m crate an IL quot folder within the libraries folder and add the jar les Use the la keyword to bring external classes into your program Class libraries live in packages 39 means quotmake all the classes in ltpackagenamegt available for use in my pro ramquot Package nams can be hierarchical eg orghtmlparserutil If you get an error that a class can39t be found look in the documentation to see what package you need to import The imported packages in the example oode should get you pretty far The Parser class Parser is the main class for parsing the html file pointed to by a URL What is parsing To parse an html file means to turn the raw text of the page into structured tags that you can process Look for speci c tags Get attributes from tags One way to parse an HTML file with HTMLParser Parse parse new PasezltURLgt NodeList nodelist pasepasenu11 quot returnsa nodes tags hat satisfy th filter The null lter returns a list oontaining all the tags Reminder Exceptions To handle them code that might cause certain kinds of exceptions should be enclosed by one of the following A i3939 statement that catches the exception some code that throws an exception r 3 Exception e r what to do in case the exception happens A method that speci es that it can 39 quot a the exception void nlyllastyMethodO Exception some code that throws an exception We39ll see that 4 throws an exception so we39ll need to handle it in our code Reminder Exceptions Exceptions are thrown whenever java encounters an error situation You39ve probably all run into exceptions like the NullPointerException 39 of 2 n r A n rlbyJavabut 5 de ne their own When an exception is thrown it travels up the call stack the stack of method calls The default behavior for exceptions is for them to travel all the way to the top where they terminate your program and print out the exception To keep the program going you can handle exceptions that might happen in your own code NodeLists NodeLists contain 7 v 1 each representing a quotg or Nodes are hierarchical just like the structure of html documents Let39s look at the toplevel tag structure for the class webpage printlnquotThere are quotnodeList siZequot nodes quot y39 printlnquotThe tag nodes are v for int i0 iltnodelistsize i Node n nodelistelement tiy39 if n 39 Tag Tag t Tag nr39 printlnt getTagName Let39s see this in Processing Hierarchical structure Since nodes are nested our class webpage example contains 4 nodes 2 of which are Tags lt DOCTYPEgt ltHTMLgt To get further content we will need to examine the children of the top level nodes if n instanceof Html NodeList sublist n getChilden look at the Tag nodes in the sublist 1 Let39s see this in Processing And also look at the documentation quottraversing the hierarchical structure NodeList Node4 39 Get a list of the children nodes ofa node So to search the nodeList for speci c nodes you need to search the top level then search within the children of the top level and so forth NodeList NodeList If the seoond parameter is true it will look in the children lists for you filter recursive Use a NodeFilter to tell it what kind of node you39re looking for Many kinds of node lters are already de ned such as TagNameFilter Let39s look at an example Quick aside literators We39ve seen how to step through all the objects in a list using a for loop and an integer cou t Another way to step through a list is to use a for loop with an i 39 Iterators are useful because they allow the caller to remove elements from the underlying collection during the iteration The HTML parser package provides an iterator for a NodeList called i i a e methods provided are boolmn I 7quot lie 50 returns true if the iteration has more nodes Node t y x returns the next node in the iteration We39ll see how to use SimpleNodeIterator in a coming example Exampie fired all images on a page First create a quotTquot for the kind of tag you39re looking for TagNameFilter imgfilte new TagNameFiltequotIMGquot Use NodeLis 3939 quot x39 x to create a list ofjust the image tags make sure to set recursrve searching to t NodeList imgnodes nodelistextractnllllodes39l hamatchf Let39s see this in Processing Getting tag attributes String Tag 7 attribute Retums the String value of the attribute Some examples of useful attributes for image tags gives you the URL for the image 39 for image tags givs you the alt text associated with an image 2 for link tags gives you the URL associated with a link If a tag doesn t have the requested attribute returns null Let39s try to draw the images from a webpage But first a quick reminder about 39 I 5 Example Draw images from a webpage Assume you have a NodeList of ImageTags eg imgnodes for i z A 1 t n ImageTag imgtag ImageTag inextllode string imgurl imgtaggetImageliRL 232 pimg iniqurl Let39s look at a complete image drawer example in Processing Threads 39 is basically a program39s path of execution Ifa program runs as a single thread then any time it needs to wait for something eg to open a web page it will lock up To prevent this you can make different pars ofyour program run in separate threads So while one part ofyour program is waiting for something other pans can still be doing things In Java every thread begins by executing a a method in a particular object 3939v is declared to be public takes no arguments has no return value and is not allowed to throw any exoeptions Let39s look at a simple example in Processing Example searching the alt attribute Just like we used f to to get the image source we can use it to get the image description text the ALT attribute Use string methods to see if the alt text contains a search string Stringi searc String retums its location within the String otherwrs boolean LIrnageTag imgtag string searchstr hstrgt ifsearchstr appears anywhere within the 39 e 1 string altatt r imgtaggetnttributequotBLTquot if altatt I null ampamp Ialtattequalsquotquot searchstr I 71 i return false Let39s see this in Processing Disturbing code Nondisturbing code void method1 printlnquotBeginning of method 1quot 39 I l quotEnd of method 1quot void method1 printlnquotI 39m in method 1quot 39 l r e println void method2 printlnquot1 m in method 2quot What will this do It39s Following Ulrike Mekihg the disturbing code work V id recursiveMethwdnt depth When processing web information we may want to crawl a site This means following links and recursively parsing Links are just another tag type and the HREF is just an attribute if depth lt 0 i return i else i pint1n Beginning of method 1 at depth quotdepth Let39s see an example 39 depth 1 pint1nquotEnd of method 1 at depth quotdepth i Good recursive functions have a r where they stop and a f quoti J 39 39 here they call themselves Let39s try this simple example in Processing
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'