Simple Data Source Crawler Plugin to Set the Document Title
|
|
- Merilyn Shepherd
- 6 years ago
- Views:
Transcription
1 Simple Data Source Crawler Plugin to Set the Document Title IBM Content Analytics 1
2 Contents Introduction... 4 Basic FS Crawler behavior Using the Customizer Filter to Modify the title Field Using a crawler plugin to set the title Type A Web Crawler, Pre-fetch Plugin Web Crawler, Post-Parse Plugin Data Source Crawler, Type A Data Source Crawler, Type B Debugging crawler plugins Getting the content Use Java Regex to pick the first line in the document Setting Existing Index Fields Results Appendix A: Plugin Source Code Appendix B: Source code for Java Regex testing
3 Author Date Version Kameron Cole January 6,
4 Introduction The title of a document is not as obvious to a machine, as it is to a human. Consider this Word doc Clearly, I want This is the Title to be the title! I have selected the Title Font Style, after all! Even Windows wants to call this document This is the Title note what Windows chooses as the defualt filename when I click Save 4
5 Strangely enough, though, Windows does NOT actually set the title Property to anything: 5
6 Of course, I could set it myself 6
7 How many users of Word even know that this is possilbe? Further, I can always save the document with a completey different filename, or, even different title Property 7
8 Basic FS Crawler behavior. In my test collection, I have created two txt files: The contents of the files look like: 8
9 Note the the defaul behavior of any file system crawler is to use the file name as the title: We can explore this in the crawler s metadata Fields. Note that both _$FileName$_ and _$Title$_ are mapped to index Fields, and are avaialbe for fielded search. 9
10 If we do a fielded search for each field, we get the same results: 10
11 11
12 For demonstration purposes, we will put both Fields into the summary: 12
13 Using the Customizer Filter to Modify the title Field I can use this regular expression in a Filter in the Application Customizer to remove the file extension and the dot /\..*$// 13
14 Using a crawler plugin to set the title A simple use case might be that the first line of each document is the title at least is it more likely to be the title that the filename. The Title Filter above will not work for this scenario. There are two other options: a Post-parse Crawler Plugin and a UIMA Annotator. Of these, the Crawler Plugin will be the best for performance, simplicity, and manageability. Type A There are several types of crawler plugins: Web Crawler, Pre-fetch Plugin Web Crawler, Post-Parse Plugin Data Source Crawler, Type A Crawler types: Content Integrator Content Manager DB2 JDBC database Notes Quickr for Domino Seed list File system Data Source Crawler, Type B Crawler types: Agent for Windows file systems crawler BoardReader crawler Case Manager crawler Exchange Server crawler FileNet P8 crawler SharePoint crawler 14
15 In this article, we will focus on a Windows File System crawler, which is Type A. It is always a good idea to begin with looking at the sample application, MyCrawlerPlugin.java, in $ES_INSTALL_ROOT/samples/dscrawler Here are the fundamental points for creating this type of crawler plugin: Extend com.ibm.es.crawler.plugin.abstractcrawlerplugin. The AbstractCrawlerPlugin class is an abstract class. Implement the following methods: o o o o o o o init() ismetadataused() iscontentused() activate() deactivate() term() updatedocument() The init, activate, deactivate, and term methods are implemented to do nothing. The ismetadataused method and iscontentused method are implemented to return false by default. See note below for important consequeces. The updatedocument method is an abstract method, so you must implement it. For name resolution, use the ES_INSTALL_ROOT/lib/dscrawler.jar file. Debugging crawler plugins The only way to do debugging is to write to the product logs. This is done via a custom logging utility: /** Logger */ private static final PluginLogger logger; static { PluginLogger.init(PluginLogger.LOGTYPE_OSS,PluginLogger.LOGLEVEL_INFO); logger = PluginLogger.getInstance(); /** End Logger **/ Here are the available methods to write to the logs /* Testing Logging Statements*/ logger.info("this is info."); 15
16 logger.warn("this is warning."); logger.error("this is error."); /* End Testing Logging Statements */ It is important to note that the default logging settings for a Collection are set to WARNING/ERROR. This means that if you leave the settings as default, you will not see the above statement "This is info." To show informational messages in the collection log file, open the administration console. Select the collection, click Actions > Logging > Configure log file options, and then select All messages for the type of information to log and trace. After you stop and restart the crawler session, informational messages appear in the collection log file. All Logger statements will show up in a new, separate log, called <collection_id>_<date_stamp> Getting the content The updatedocument() method takes as an argument a pointer to the content of each document, in a CrawledData public CrawledData updatedocument(crawleddata crawleddata) To get the actual contents, you call: List<Content> orgcontentlist = crawleddata.getoriginalcontents(); Note that a List is required, since the API supports compound documents (there may be more than one document in a content item). The result List returned by getoriginalcontents method cannot be modified. If you need to modify the content, you must create a new list containing all contents to be indexed. List<Content> contentlist = new ArrayList<Content>(); if (orgcontentlist.isempty()) logger.error("orgcontentlist is empty"); for (int i = 0; i < orgcontentlist.size(); i++) { contentlist.add(orgcontentlist.get(i)); In this article, we do not modify the contents. However, as a best practice, we will still create the copy. 16
17 Note: even though you do not modify the contents, you must set the iscontentused() method to return true (see above). If you do not, the crawleddata.getoriginalcontents() will return an empty list. public boolean iscontentused() { return true; Note: If you use the Eclipse New Class wizard to generate unimplemented methods, iscontentused() will NOT get auto-generated. Use Java Regex to pick the first line in the document We use the following regex declaration to pick the first line in any document: private static final String TITLE_PATTERN = "^\\A(.*)"; private Pattern titlepattern = Pattern.compile(TITLE_PATTERN); We will pass the entire content as a String into the following method: private String gettitle(string doc) { List<String> result = new ArrayList<String>(); matcher = titlepattern.matcher(doc); while (matcher.find()) { result.add(matcher.group(1)); return result.get(0); It is critical to insure that the String content is copied exactly, so as to preserve the line feeds and carriage returns. The traditional Java method of using readline() would actually skip everything in the document, except the textual content. Therefore, you need to use the read() method, and get each character: // Now read the content into a String 17
18 InputStream in = null; BufferedReader br = null; StringBuilder sb = new StringBuilder(); try { int value = 0; for (Content content : contentlist) { if (contentlist.isempty()) logger.error("contentlist is empty"); // Get InputStream object to ready the content. in = content.getinputstream(); br = new BufferedReader(new InputStreamReader(in)); while ((value = br.read())!= -1) { char c = (char) value; sb.append(c); contentstring = sb.tostring(); in.close(); catch (IOException ioe) { throw new CrawlerPluginException(ioe); title = gettitle(contentstring); Setting Existing Index Fields There is one method to set Index fields (the methods are distinct for datasource and web crawler (wc): You must first get the Fields: List<FieldMetadata> metadatalist = crawleddata.getmetadatalist(); if (!(metadatalist == null)) { 18
19 for (int i = 0; i < metadatalist.size(); i++) { logger.warn("field name: " + metadatalist.get(i).getfieldname() + "\n"); logger.warn("field value: " + metadatalist.get(i).getvalue() + "\n"); logger.warn("\n"); else logger.error("metadatalist is empty"); It is very important to note that, even though the Metadata Fields are all mapped to Index Fields, the CrawlerPlugin API only returns the Metadata Field names. In other words, this code logger.warn("field name: "+metadatalist.get(i).getfieldname()+"\n"); logger.warn("field value: "+metadatalist.get(i).getvalue()+"\n"); produces: <OFMsg> "2" " "664"24" title_test" title_test.win_98180.crawlerplugin" WIN-134UMQA234V" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field name: $Title$ Therefore, our main code must search for the name, $Title$, not title: // Set the title Field if (!(metadatalist == null)) { for (int i = 0; i < metadatalist.size(); i++) { if (metadatalist.get(i).getfieldname().contentequals(" $Title$ ")) { metadatalist.get(i).setvalue(title); logger.warn("new Field value: " + metadatalist.get(i).getvalue() + "\n"); 19
20 Results Here you can see that the filename remains unchanged, but the title is now set to the first line of the documents: 20
21 Here is the logging output: 21
22 <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 This is warning. <OFMsg> "1" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 This is error. <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field name: $Directory$ <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field value: E:\rawdata\title_test <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field name: $FileName$ <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field value: doc1.doc <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 22
23 <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field name: $Extension$ <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field value:.doc <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field name: $ModifiedDate$ <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field value: <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field name: $FileSize$ 23
24 <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field value: 494 <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field name: $Title$ <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 Field value: doc1.doc <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 This is the title for doc1. <OFMsg> "2" " "4020"25" title_test" com.ibm.es.crawler.plugin.logging.pluginlogger.java"241"3 New Field value: This is the title for doc1. 24
25 Appendix A: Plugin Source Code /** * */ package crawlerplugins.typea; import com.ibm.es.crawler.plugin.abstractcrawlerplugin; import com.ibm.es.crawler.plugin.crawleddata; import com.ibm.es.crawler.plugin.crawlerpluginexception; import java.io.bufferedreader; import java.io.bufferedwriter; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.io.outputstream; import java.io.outputstreamwriter; import java.util.arraylist; import java.util.list; import java.util.regex.matcher; import java.util.regex.pattern; import com.ibm.es.crawler.plugin.content; import com.ibm.es.crawler.plugin.fieldmetadata; import com.ibm.es.crawler.plugin.logging.pluginlogger; import java.util.arraylist; import java.util.list; import java.util.regex.matcher; import java.util.regex.pattern; /** p8admin * */ public class TitleCrawlerPlugin extends AbstractCrawlerPlugin { /** Logger */ private static final PluginLogger logger; static { PluginLogger.init(PluginLogger.LOGTYPE_OSS, PluginLogger.LOGLEVEL_INFO); logger = PluginLogger.getInstance(); 25
26 /** End Logger **/ private static final String TITLE_PATTERN = "^\\A(.*)"; private Pattern titlepattern = Pattern.compile(TITLE_PATTERN); String title = ""; private Matcher matcher; public TitleCrawlerPlugin() { super(); public boolean iscontentused() { return true; public void init() throws CrawlerPluginException { /* * [Tips] If your crawler plug-in module requires something to do for * initialization, add the code here. [Example] Get JDBC connection for * your local system. connection = * DriverManager.getConnection("jdbc::db2::xxxx); */ public boolean ismetadataused() { /* * [Tips] If your crawler plug-in module updates both metadata and * security tokens, returns true. If your crawler plug-in module updates * security tokens only, returns false. */ return true; public void term() throws CrawlerPluginException { /* * [Tips] If your crawler plug-in module requires something to do for * termination, add the code here. [Example] Close JDBC connection for * your local system. connection.close(); */ return; 26
27 /* * (non-javadoc) * * com.ibm.es.crawler.plugin.abstractcrawlerplugin#updatedocument(com.ibm.es *.crawler.plugin.crawleddata) public CrawledData updatedocument(crawleddata crawleddata) throws CrawlerPluginException { /* Testing Logging Statements */ logger.info("this is info."); logger.warn("this is warning."); logger.error("this is error."); /* End Testing Logging Statements */ // print metadata List<FieldMetadata> metadatalist = crawleddata.getmetadatalist(); if (!(metadatalist == null)) { for (int i = 0; i < metadatalist.size(); i++) { logger.warn("field name: " + metadatalist.get(i).getfieldname() + "\n"); logger.warn("field value: " + metadatalist.get(i).getvalue() + "\n"); logger.warn("\n"); else logger.error("metadatalist is empty"); String contentstring = ""; List<Content> orgcontentlist = crawleddata.getoriginalcontents(); /* * The result list by getoriginalcontents method can not be modified. * Create a new list containing all contents to be indexed. */ List<Content> contentlist = new ArrayList<Content>(); if (orgcontentlist.isempty()) logger.error("orgcontentlist is empty"); 27
28 for (int i = 0; i < orgcontentlist.size(); i++) { contentlist.add(orgcontentlist.get(i)); // Now read the content into a String InputStream in = null; BufferedReader br = null; StringBuilder sb = new StringBuilder(); try { int value = 0; for (Content content : contentlist) { if (contentlist.isempty()) logger.error("contentlist is empty"); // Get InputStream object to ready the content. in = content.getinputstream(); br = new BufferedReader(new InputStreamReader(in)); while ((value = br.read())!= -1) { char c = (char) value; sb.append(c); contentstring = sb.tostring(); in.close(); catch (IOException ioe) { throw new CrawlerPluginException(ioe); title = gettitle(contentstring); logger.warn(title); // Set the title Field if (!(metadatalist == null)) { for (int i = 0; i < metadatalist.size(); i++) { if (metadatalist.get(i).getfieldname().contentequals(" $Title$ ")) { metadatalist.get(i).setvalue(title); logger.warn("new Field value: " + metadatalist.get(i).getvalue() + "\n"); 28
29 return crawleddata; private String gettitle(string doc) { List<String> result = new ArrayList<String>(); matcher = titlepattern.matcher(doc); while (matcher.find()) { result.add(matcher.group(1)); return result.get(0); Appendix B: Source code for Java Regex testing package test; import java.util.arraylist; import java.util.list; import java.util.regex.matcher; import java.util.regex.pattern; public class RegexTest { private Matcher matcher; //Alternative private static final String TITLE_PATTERN = "^\\A(.*)"; private Pattern titlepattern = Pattern.compile(TITLE_PATTERN); 29
30 //private static final String TITLE_PATTERN = "/^(.*)$/m"; //private static final String TITLE_PATTERN = "\\A.*"; public static void main(string[] args) { String data = "Testing... \n" + "Address 1: 88 app 2/8\n" + "superman taman, puchong\n" + "36100, Malaysia\n" + "Address 2: abc" + "testing end"; String doc = "First Line is Always the Title \n"+ "After that, there are many lines of text which \n"+ "represent the body of the article"; RegexTest obj = new RegexTest(); //List<String> list = obj.getaddress(data); String title = obj.gettitle(doc); System.out.println("Test Data : "); System.out.println(doc + "\n"); System.out.println("Title : " + title); private String gettitle(string doc){ List<String> result = new ArrayList<String>(); matcher = titlepattern.matcher(doc); while (matcher.find()) { result.add(matcher.group(1)); return result.get(0); 30
Developing, Compiling, and Running a Non-Web Data Source Crawler Plug-in with IBM Content Analytics with Enterprise Search 3.0
Developing, Compiling, and Running a Non-Web Data Source Crawler Plug-in with IBM Content Analytics with Enterprise Search 3.0 Vijai Gandikota April 2013 Contents Introduction... 1 Understanding the code
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationProject #1 Computer Science 2334 Fall 2008
Project #1 Computer Science 2334 Fall 2008 User Request: Create a Word Verification System. Milestones: 1. Use program arguments to specify a file name. 10 points 2. Use simple File I/O to read a file.
More informationCS1092: Tutorial Sheet: No 3 Exceptions and Files. Tutor s Guide
CS1092: Tutorial Sheet: No 3 Exceptions and Files Tutor s Guide Preliminary This tutorial sheet requires that you ve read Chapter 15 on Exceptions (CS1081 lectured material), and followed the recent CS1092
More informationBasic Tutorial on Creating Custom Policy Actions
Basic Tutorial on Creating Custom Policy Actions This tutorial introduces the Policy API to create a custom policy action. As an example you will write an action which excludes certain values for an asset
More informationCS Week 11. Jim Williams, PhD
CS 200 - Week 11 Jim Williams, PhD This Week 1. Exam 2 - Thursday 2. Team Lab: Exceptions, Paths, Command Line 3. Review: Muddiest Point 4. Lecture: File Input and Output Objectives 1. Describe a text
More informationLecture 4: Exceptions. I/O
Lecture 4: Exceptions. I/O Outline Access control. Class scope Exceptions I/O public class Malicious { public static void main(string[] args) { maliciousmethod(new CreditCard()); } static void maliciousmethod(creditcard
More informationString temp [] = {"a", "b", "c"}; where temp[] is String array.
SCJP 1.6 (CX-310-065, CX-310-066) Subject: String, I/O, Formatting, Regex, Serializable, Console Total Questions : 57 Prepared by : http://www.javacertifications.net SCJP 6.0: String,Files,IO,Date and
More informationKnox Manage manages the following application types: Internal applications: Applications for internal use
15 Applications Knox Manage manages the following application types: Internal applications: Applications for internal use Public applications: Applications that are deployed through Google's Play Store
More informationExceptions. References. Exceptions. Exceptional Conditions. CSE 413, Autumn 2005 Programming Languages
References Exceptions "Handling Errors with Exceptions", Java tutorial http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html CSE 413, Autumn 2005 Programming Languages http://www.cs.washington.edu/education/courses/413/05au/
More informationToday. Book-keeping. File I/O. Subscribe to sipb-iap-java-students. Inner classes. Debugging tools
Today Book-keeping File I/O Subscribe to sipb-iap-java-students Inner classes http://sipb.mit.edu/iap/java/ Debugging tools Problem set 1 questions? Problem set 2 released tomorrow 1 2 So far... Reading
More informationByte and Character Streams. Reading and Writing Console input and output
Byte and Character Streams Reading and Writing Console input and output 1 I/O basics The io package supports Java s basic I/O (input/output) Java does provide strong, flexible support for I/O as it relates
More informationJava in 21 minutes. Hello world. hello world. exceptions. basic data types. constructors. classes & objects I/O. program structure.
Java in 21 minutes hello world basic data types classes & objects program structure constructors garbage collection I/O exceptions Strings Hello world import java.io.*; public class hello { public static
More informationThe XML PDF Access API for Java Technology (XPAAJ)
The XML PDF Access API for Java Technology (XPAAJ) Duane Nickull Senior Technology Evangelist Adobe Systems TS-93260 2007 JavaOne SM Conference Session TS-93260 Agenda Using Java technology to manipulate
More informationCOT 3530: Data Structures. Giri Narasimhan. ECS 389; Phone: x3748
COT 3530: Data Structures Giri Narasimhan ECS 389; Phone: x3748 giri@cs.fiu.edu www.cs.fiu.edu/~giri/teach/3530spring04.html Evaluation Midterm & Final Exams Programming Assignments Class Participation
More informationChapter 4 Defining Classes I
Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the
More informationEJB - INTERCEPTORS. Interceptor methods can be applied or bound at three levels
http://www.tutorialspoint.com/ejb/ejb_interceptors.htm EJB - INTERCEPTORS Copyright tutorialspoint.com EJB 3.0 provides specification to intercept business methods calls using methods annotated with @AroundInvoke
More informationExceptions and Libraries
Exceptions and Libraries RS 9.3, 6.4 Some slides created by Marty Stepp http://www.cs.washington.edu/143/ Edited by Sarah Heckman 1 Exceptions exception: An object representing an error or unusual condition.
More informationEach command-line argument is placed in the args array that is passed to the static main method as below :
1. Command-Line Arguments Any Java technology application can use command-line arguments. These string arguments are placed on the command line to launch the Java interpreter after the class name: public
More informationExceptions vs. Errors Exceptions vs. RuntimeExceptions try...catch...finally throw and throws
Lecture 14 Summary Exceptions vs. Errors Exceptions vs. RuntimeExceptions try...catch...finally throw and throws 1 By the end of this lecture, you will be able to differentiate between errors, exceptions,
More informationpublic class Q1 { public int x; public static void main(string[] args) { Q1 a = new Q1(17); Q1 b = new Q1(39); public Q1(int x) { this.
CS 201, Fall 2013 Oct 2nd Exam 1 Name: Question 1. [5 points] What output is printed by the following program (which begins on the left and continues on the right)? public class Q1 { public int x; public
More informationWeek 12. Streams and File I/O. Overview of Streams and File I/O Text File I/O
Week 12 Streams and File I/O Overview of Streams and File I/O Text File I/O 1 I/O Overview I/O = Input/Output In this context it is input to and output from programs Input can be from keyboard or a file
More informationBackend. (Very) Simple server examples
Backend (Very) Simple server examples Web server example Browser HTML form HTTP/GET Webserver / Servlet JDBC DB Student example sqlite>.schema CREATE TABLE students(id integer primary key asc,name varchar(30));
More informationInheritance E, xc Ex eptions ceptions I/O
Inheritance, Exceptions, I/O ARCS Lab. Inheritance Very Very Basic Inheritance Making a Game public class Dude { public String name; public int hp = 100 public int mp = 0; } public void sayname() { System.out.println(name);
More informationFIFO PAGE REPLACEMENT : import java.io.*; public class FIFO {
FIFO PAGE REPLACEMENT : import java.io.*; public class FIFO public static void main(string[] args) throws IOException BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int frames,
More informationObject Oriented Programming and Design in Java. Session 2 Instructor: Bert Huang
Object Oriented Programming and Design in Java Session 2 Instructor: Bert Huang Announcements TA: Yipeng Huang, yh2315, Mon 4-6 OH on MICE clarification Next Monday's class canceled for Distinguished Lecture:
More informationProject #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently.
Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple magazine data system. Milestones:
More informationFile IO. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 20
File IO Computer Science and Engineering College of Engineering The Ohio State University Lecture 20 I/O Package Overview Package java.io Core concept: streams Ordered sequences of data that have a source
More informationBBM 102 Introduction to Programming II Spring Exceptions
BBM 102 Introduction to Programming II Spring 2018 Exceptions 1 Today What is an exception? What is exception handling? Keywords of exception handling try catch finally Throwing exceptions throw Custom
More information*** TROUBLESHOOTING TIP ***
*** TROUBLESHOOTING TIP *** If you are experiencing errors with your deliverable 2 setup which deliverable 3 is built upon, delete the deliverable 2 project within Eclipse, and delete the non working newbas
More informationJava Programming. String Processing. 1 Copyright 2013, Oracle and/or its affiliates. All rights reserved.
Java Programming String Processing 1 Copyright 2013, Oracle and/or its affiliates. All rights Overview This lesson covers the following topics: Read, search, and parse Strings Use StringBuilder to create
More informationExceptions. CSE 142, Summer 2002 Computer Programming 1.
Exceptions CSE 142, Summer 2002 Computer Programming 1 http://www.cs.washington.edu/education/courses/142/02su/ 12-Aug-2002 cse142-19-exceptions 2002 University of Washington 1 Reading Readings and References»
More informationExceptions. Readings and References. Exceptions. Exceptional Conditions. Reading. CSE 142, Summer 2002 Computer Programming 1.
Readings and References Exceptions CSE 142, Summer 2002 Computer Programming 1 http://www.cs.washington.edu/education/courses/142/02su/ Reading» Chapter 18, An Introduction to Programming and Object Oriented
More informationTechniques of Java Programming: Streams in Java
Techniques of Java Programming: Streams in Java Manuel Oriol May 8, 2006 1 Introduction Streams are a way of transferring and filtering information. Streams are directed pipes that transfer information
More informationFull file at
Chapter 1 Primitive Java Weiss 4 th Edition Solutions to Exercises (US Version) 1.1 Key Concepts and How To Teach Them This chapter introduces primitive features of Java found in all languages such as
More information16-Dec-10. Consider the following method:
Boaz Kantor Introduction to Computer Science IDC Herzliya Exception is a class. Java comes with many, we can write our own. The Exception objects, along with some Java-specific structures, allow us to
More informationCS Programming I: File Input / Output
CS 200 - Programming I: File Input / Output Marc Renault Department of Computer Sciences University of Wisconsin Madison Fall 2017 TopHat Sec 3 (PM) Join Code: 719946 TopHat Sec 4 (AM) Join Code: 891624
More informationMore on Objects in JAVA TM
More on Objects in JAVA TM Inheritance : Definition: A subclass is a class that extends another class. A subclass inherits state and behavior from all of its ancestors. The term superclass refers to a
More informationPROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write
More informationProgramming Assignment Comma Separated Values Reader Page 1
Programming Assignment Comma Separated Values Reader Page 1 Assignment What to Submit 1. Write a CSVReader that can read a file or URL that contains data in CSV format. CSVReader provides an Iterator for
More informationProject 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently.
Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple movie data system. Milestones: 1. Use
More informationCSPP : Introduction to Object-Oriented Programming
CSPP 511-01: Introduction to Object-Oriented Programming Harri Hakula Ryerson 256, tel. 773-702-8584 hhakula@cs.uchicago.edu August 7, 2000 CSPP 511-01: Lecture 15, August 7, 2000 1 Exceptions Files: Text
More informationCS11 Java. Fall Lecture 4
CS11 Java Fall 2014-2015 Lecture 4 Java File Objects! Java represents files with java.io.file class " Can represent either absolute or relative paths! Absolute paths start at the root directory of the
More informationCS 200 File Input and Output Jim Williams, PhD
CS 200 File Input and Output Jim Williams, PhD This Week 1. WaTor Change Log 2. Monday Appts - may be interrupted. 3. Optional Lab: Create a Personal Webpage a. demonstrate to TA for same credit as other
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions
More informationI/O in Java I/O streams vs. Reader/Writer. HW#3 due today Reading Assignment: Java tutorial on Basic I/O
I/O 10-7-2013 I/O in Java I/O streams vs. Reader/Writer HW#3 due today Reading Assignment: Java tutorial on Basic I/O public class Swimmer implements Cloneable { public Date geteventdate() { return (Date)
More informationMSc/ICY Software Workshop Exception Handling, Assertions Scanner, Patterns File Input/Output
MSc/ICY Software Workshop Exception Handling, Assertions Scanner, Patterns File Input/Output Manfred Kerber www.cs.bham.ac.uk/~mmk 21 October 2015 1 / 18 Manfred Kerber Classes and Objects The information
More informationSteps: First install hadoop (if not installed yet) by, https://sl6it.wordpress.com/2015/12/04/1-study-and-configure-hadoop-for-big-data/
SL-V BE IT EXP 7 Aim: Design and develop a distributed application to find the coolest/hottest year from the available weather data. Use weather data from the Internet and process it using MapReduce. Steps:
More informationUnstructured Information Processing with Apache UIMA. Computers Playing Jeopardy! Course Stony Brook University
Unstructured Information Processing with Apache UIMA Computers Playing Jeopardy! Course Stony Brook University What is UIMA? UIMA is a framework, a means to integrate text or other unstructured information
More informationCS 231 Data Structures and Algorithms Fall 2018
CS 231 Data Structures and Algorithms Fall 2018 Interface, Node Based Stack, Exception Handling, Class BufferedReader Lecture 12 October 1, 2018 Prof. Zadia Codabux 1 Agenda Node based implementation of
More informationCS Programming I: File Input / Output
CS 200 - Programming I: File Input / Output Marc Renault Department of Computer Sciences University of Wisconsin Madison Spring 2018 TopHat Sec 3 (AM) Join Code: 427811 TopHat Sec 4 (PM) Join Code: 165455
More informationLecture 14 Summary 3/9/2009. By the end of this lecture, you will be able to differentiate between errors, exceptions, and runtime exceptions.
Lecture 14 Summary Exceptions vs. Errors Exceptions vs. RuntimeExceptions...catch...finally throw and throws By the end of this lecture, you will be able to differentiate between errors, exceptions, and
More informationFall 2017 CISC124 10/1/2017
CISC124 Today First onq quiz this week write in lab. More details in last Wednesday s lecture. Repeated: The quiz availability times will change to match each lab as the week progresses. Useful Java classes:
More informationIT101. File Input and Output
IT101 File Input and Output IO Streams A stream is a communication channel that a program has with the outside world. It is used to transfer data items in succession. An Input/Output (I/O) Stream represents
More informationRequirement Document v1.2 WELCOME TO CANLOG.IN. API-Key Help Document. Version SMS Integration Document
WELCOME TO CANLOG.IN API-Key Help Document Version 1.2 http://www.canlog.in SMS Integration Document Integration 1. Purpose SMS integration with Canlog enables you to notify your customers and agents via
More informationDefensive Programming. Ric Glassey
Defensive Programming Ric Glassey glassey@kth.se Outline Defensive Programming Aim: Develop the programming skills to anticipate problems beyond control that may occur at runtime Responsibility Exception
More information/* Copyright 2012 Robert C. Ilardi
/ Copyright 2012 Robert C. Ilardi Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
More informationAlternate Methods for Informatica Metadata Exchange SDK
Alternate Methods for Informatica Metadata Exchange SDK Informatica Metadata Exchange SDK provides a set of COM-based APIs for exchanging metadata with the PowerCenter repository. You can also use this
More informationOBJECT ORIENTED PROGRAMMING. Course 6 Loredana STANCIU Room B616
OBJECT ORIENTED PROGRAMMING Course 6 Loredana STANCIU loredana.stanciu@upt.ro Room B616 Exceptions An event, which occurs during the execution of a program, that disrupts the normal flow of the program's
More informationUtilities (Part 3) Implementing static features
Utilities (Part 3) Implementing static features 1 Goals for Today learn about preconditions versus validation introduction to documentation introduction to testing 2 Yahtzee class so far recall our implementation
More informationBIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic
BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines
More informationSoftware Engineering Large Practical: Preferences, storage, and testing
Software Engineering Large Practical: Preferences, storage, and testing Stephen Gilmore (Stephen.Gilmore@ed.ac.uk) School of Informatics November 9, 2016 Contents A simple counter activity Preferences
More informationWeb Server Project. Tom Kelliher, CS points, due May 4, 2011
Web Server Project Tom Kelliher, CS 325 100 points, due May 4, 2011 Introduction (From Kurose & Ross, 4th ed.) In this project you will develop a Web server in two steps. In the end, you will have built
More informationI/O STREAM (REQUIRED IN THE FINAL)
I/O STREAM (REQUIRED IN THE FINAL) STREAM A stream is a communication channel that a program has with the outside world. It is used to transfer data items in succession. An Input/Output (I/O) Stream represents
More informationType of Submission: Article Title: Watson Explorer REST API Tutorial #1 Subtitle: Java Programming. Keywords: WEX, WCA, analytics, Watson
Type of Submission: Article Title: Watson Explorer REST API Tutorial #1 Subtitle: Java Programming Keywords: WEX, WCA, analytics, Watson Prefix: Mr. Given: Kameron Middle: A. Family: Cole Suffix: Job Title:
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions and
More informationPlease note that if you write the mid term in pencil, you will not be allowed to submit a remark request.
University of Toronto CSC148 Introduction to Computer Science Fall 2001 Mid Term Test Section L5101 Duration: 50 minutes Aids allowed: none Make sure that your examination booklet has 8 pages (including
More informationAll code must follow best practices. Part (but not all) of this is adhering to the following guidelines:
Java Coding Guidelines Version 1.3.2 All code must follow best practices. Part (but not all) of this is adhering to the following guidelines: Development For code development, I recommend the following
More informationMultivalued Fields to Facets
Multivalued Fields to Facets ICA Enterprise Search 1 Contents Introduction: Behavior of Multivalued fields in Search Collections... 4 Create the Search Collection... 5 Develop a custom annotator to add
More information... 1... 2... 2... 3... 3... 4... 4... 5... 5... 6... 6... 7... 8... 9... 10... 13... 14... 17 1 2 3 4 file.txt.exe file.txt file.jpg.exe file.mp3.exe 5 6 0x00 0xFF try { in.skip(9058); catch (IOException
More informationGeneral Certificate of Education Advanced Subsidiary Examination June 2010
General Certificate of Education Advanced Subsidiary Examination June 2010 Computing COMP1/PM/JA Unit 1 Problem Solving, Programming, Data Representation and Practical Exercise Preliminary Material A copy
More informationMyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized
get with the programming Through the power of practice and immediate personalized feedback, MyProgrammingLab improves your performance. MyProgram m i ng Lab Learn more at www.myprogramminglab.com Preface
More informationLesson 3: Accepting User Input and Using Different Methods for Output
Lesson 3: Accepting User Input and Using Different Methods for Output Introduction So far, you have had an overview of the basics in Java. This document will discuss how to put some power in your program
More informationICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit
ICOM 4015 Advanced Programming Laboratory Chapter 1 Introduction to Eclipse, Java and JUnit University of Puerto Rico Electrical and Computer Engineering Department by Juan E. Surís 1 Introduction This
More informationShell Interface Assignment
Page 1 of 9 Shell Interface Assignment Creating a Shell Interface Using Java This assignment consists of modifying a Java program so that it serves as a shell interface that accepts user commands and then
More information0.8.0 SimpleConsumer Example
0.8.0 SimpleConsumer Example Using SimpleConsumer Why use SimpleConsumer? The main reason to use a SimpleConsumer implementation is you want greater control over partition consumption than Consumer Groups
More information2018/2/5 话费券企业客户接入文档 语雀
1 2 2 1 2 1 1 138999999999 2 1 2 https:lark.alipay.com/kaidi.hwf/hsz6gg/ppesyh#2.4-%e4%bc%81%e4%b8%9a%e5%ae%a2%e6%88%b7%e6%8e%a5%e6%94%b6%e5%85%85%e5 1/8 2 1 3 static IAcsClient client = null; public static
More information7. Java Input/Output. User Input/Console Output, File Input and Output (I/O)
116 7. Java Input/Output User Input/Console Output, File Input and Output (I/O) 117 User Input (half the truth) e.g. reading a number: int i = In.readInt(); Our class In provides various such methods.
More informationMixed projects: Java + Kotlin. Svetlana Isakova
Mixed projects: Java + Kotlin Svetlana Isakova Compilation of a mixed project *.kt kotlinc *.class *.jar *.java javac *.class Nullability Nullability Type =? Java Kotlin Nullability annotations @Nullable
More informationLab 10: Sockets 12:00 PM, Apr 4, 2018
CS18 Integrated Introduction to Computer Science Fisler, Nelson Lab 10: Sockets 12:00 PM, Apr 4, 2018 Contents 1 The Client-Server Model 1 1.1 Constructing Java Sockets.................................
More informationExploring EJB3 With JBoss Application Server Part 6.2
By Swaminathan Bhaskar 01/24/2009 Exploring EJB3 With JBoss Application Server Part 6.2 In this part, we will continue to explore Entity Beans Using Java Persistence API (JPA). Thus far, we have seen examples
More informationANN exercise session
ANN exercise session In this exercise session, you will read an external file with Iris flowers and create an internal database in Java as it was done in previous exercise session. A new file contains
More informationLab 2: File Input and Output
Lab 2: File Input and Output This lab introduces how to handle files as both input and output. We re coming back to Tracery (which you implemented in Lab 1) with this assignment but instead of always reading
More informationPrelim 1 Solutions. CS 2110, March 10, 2015, 5:30 PM Total Question True False. Loop Invariants Max Score Grader
Prelim 1 Solutions CS 2110, March 10, 2015, 5:30 PM 1 2 3 4 5 Total Question True False Short Answer Recursion Object Oriented Loop Invariants Max 20 15 20 25 20 100 Score Grader The exam is closed book
More informationCIS 120 Final Exam May 3, Name (printed): Pennkey (login id):
CIS 120 Final Exam May 3, 2013 Name (printed): Pennkey (login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic Integrity in completing this
More informationTiming ListOperations
Timing ListOperations Michael Brockway November 13, 2017 These slides are to give you a quick start with timing operations in Java and with making sensible use of the command-line. Java on a command-line
More information6. Java Errors and Exceptions
Errors and Exceptions in Java 6. Java Errors and Exceptions Errors and exceptions interrupt the normal execution of the program abruptly and represent an unplanned event. Exceptions are bad, or not? Errors,
More informationNote: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.
Com S 227 Spring 2018 Miniassignment 1 40 points Due Date: Thursday, March 8, 11:59 pm (midnight) Late deadline (25% penalty): Friday, March 9, 11:59 pm General information This assignment is to be done
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationChapter 9. Exception Handling. Copyright 2016 Pearson Inc. All rights reserved.
Chapter 9 Exception Handling Copyright 2016 Pearson Inc. All rights reserved. Last modified 2015-10-02 by C Hoang 9-2 Introduction to Exception Handling Sometimes the best outcome can be when nothing unusual
More informationpublic class Q extends P { private int num; private int i; P(int n) { public Q() { this.num = n;
Question 1. Part (a) [2 marks] [5 marks] The following code will not compile: public class P { public class Q extends P { private int num; private int i; P(int n) { public Q() { this.num = n; i = 0; Add
More informationICOM 4015-Advanced Programming. Spring Instructor: Dr. Amir H. Chinaei. TAs: Hector Franqui, Jose Garcia, and Antonio Tapia. Reference: Big Java
ICOM 4015-Advanced Programming Spring 2014 Instructor: Dr. Amir H. Chinaei TAs: Hector Franqui, Jose Garcia, and Antonio Tapia Reference: Big Java By Hortsmann, Ed 4 Lab 7 Continuation of HTTP and Introduction
More informationThis page intentionally left blank
This page intentionally left blank arting Out with Java: From Control Structures through Objects International Edition - PDF - PDF - PDF Cover Contents Preface Chapter 1 Introduction to Computers and Java
More informationSoftware Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore
Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Lecture 04 Software Test Automation: JUnit as an example
More information5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.
Today! Build HelloWorld yourself in BlueJ and Eclipse. Look at all the Java keywords. Primitive Types. HelloWorld in BlueJ 1. Find BlueJ in the start menu, but start the Select VM program instead (you
More information6. Java Errors and Exceptions. Errors, runtime-exceptions, checked-exceptions, exception handling, special case: resources
129 6. Java Errors and Exceptions Errors, runtime-exceptions, checked-exceptions, exception handling, special case: resources Errors and Exceptions in Java 130 Errors and exceptions interrupt the normal
More informationCN208 Introduction to Computer Programming
CN208 Introduction to Computer Programming Lecture #11 Streams (Continued) Pimarn Apipattanamontre Email: pimarn@pimarn.com 1 The Object Class The Object class is the direct or indirect superclass of every
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationLab 5: Java IO 12:00 PM, Feb 21, 2018
CS18 Integrated Introduction to Computer Science Fisler, Nelson Contents Lab 5: Java IO 12:00 PM, Feb 21, 2018 1 The Java IO Library 1 2 Program Arguments 2 3 Readers, Writers, and Buffers 2 3.1 Buffering
More informationcopy.dept_change( CSE ); // Original Objects also changed
UNIT - III Topics Covered The Object class Reflection Interfaces Object cloning Inner classes Proxies I/O Streams Graphics programming Frame Components Working with 2D shapes. Object Clone Object Cloning
More information