<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Problem Set 2: Using Abstract Datatypes</title>
	<atom:link href="http://www.cs.virginia.edu/cs2220/?feed=rss2&#038;page_id=163" rel="self" type="application/rss+xml" />
	<link>http://www.cs.virginia.edu/cs2220</link>
	<description></description>
	<lastBuildDate>Thu, 04 Nov 2010 18:05:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: David Evans</title>
		<link>http://www.cs.virginia.edu/cs2220/?page_id=163&#038;cpage=1#comment-8</link>
		<dc:creator>David Evans</dc:creator>
		<pubDate>Wed, 08 Sep 2010 13:31:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.cs.virginia.edu/cs2220/?page_id=163#comment-8</guid>
		<description>A student asks,
&lt;blockquote&gt;
Once we downloaded ps2.jar and installed it via the &quot;add external JARs&quot; method we used for PS1, how do we import all the classes?  
&lt;/blockquote&gt;
To use the provided classes, you need to import them into your program by adding the line,
&lt;pre&gt;
import ps2.*;
&lt;/pre&gt;
to the beginning of your file.

If you use the API types, you will need imports for those also:
&lt;pre&gt;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Set;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>A student asks,</p>
<blockquote><p>
Once we downloaded ps2.jar and installed it via the &#8220;add external JARs&#8221; method we used for PS1, how do we import all the classes?
</p></blockquote>
<p>To use the provided classes, you need to import them into your program by adding the line,</p>
<pre>
import ps2.*;
</pre>
<p>to the beginning of your file.</p>
<p>If you use the API types, you will need imports for those also:</p>
<pre>
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Set;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Evans</title>
		<link>http://www.cs.virginia.edu/cs2220/?page_id=163&#038;cpage=1#comment-7</link>
		<dc:creator>David Evans</dc:creator>
		<pubDate>Tue, 07 Sep 2010 23:26:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.cs.virginia.edu/cs2220/?page_id=163#comment-7</guid>
		<description>The Java runtime will look for the documents in the current working directory.  In Eclipse, this is determined by the Working Directory setting.  You can edit it by opening the Run Configurations dialog (select Run &#124; Run Configurations), and then select the &quot;Arguments&quot; tab.  The default value is probably set to the bin directory in your workspace.  If you select Other you can select any directory you want as the working directory.  This should be the directory where you extracted the test files.

For the arguments, just list the filenames, separated by spaces.</description>
		<content:encoded><![CDATA[<p>The Java runtime will look for the documents in the current working directory.  In Eclipse, this is determined by the Working Directory setting.  You can edit it by opening the Run Configurations dialog (select Run | Run Configurations), and then select the &#8220;Arguments&#8221; tab.  The default value is probably set to the bin directory in your workspace.  If you select Other you can select any directory you want as the working directory.  This should be the directory where you extracted the test files.</p>
<p>For the arguments, just list the filenames, separated by spaces.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nmd3ey</title>
		<link>http://www.cs.virginia.edu/cs2220/?page_id=163&#038;cpage=1#comment-6</link>
		<dc:creator>nmd3ey</dc:creator>
		<pubDate>Tue, 07 Sep 2010 22:43:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.cs.virginia.edu/cs2220/?page_id=163#comment-6</guid>
		<description>Professor,
 
We are working on part II of ps2 and we believe we have the basic program down. When we&#039;ve attempted to debug the program (manually), we found that the program cannot find the documents (constitution.txt, etc).
 
Our first question is where should we save these files and as what format (should we keep the folder zipped or extract it)?
We have presently saved the files in the same folder location as the .java class.
 
Our second question is how should we tell the program to search for the documents?
We are currently trying to run the location of file in the (x)=arguments of the configuration.
 
Thank you for the help.</description>
		<content:encoded><![CDATA[<p>Professor,</p>
<p>We are working on part II of ps2 and we believe we have the basic program down. When we&#8217;ve attempted to debug the program (manually), we found that the program cannot find the documents (constitution.txt, etc).</p>
<p>Our first question is where should we save these files and as what format (should we keep the folder zipped or extract it)?<br />
We have presently saved the files in the same folder location as the .java class.</p>
<p>Our second question is how should we tell the program to search for the documents?<br />
We are currently trying to run the location of file in the (x)=arguments of the configuration.</p>
<p>Thank you for the help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: evans</title>
		<link>http://www.cs.virginia.edu/cs2220/?page_id=163&#038;cpage=1#comment-5</link>
		<dc:creator>evans</dc:creator>
		<pubDate>Mon, 06 Sep 2010 13:16:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.cs.virginia.edu/cs2220/?page_id=163#comment-5</guid>
		<description>An enterprising student asked:
&lt;blockquote&gt;
I have a question about what part 6 is asking us to do.

Suppose file1 contains: &lt;code&gt;This is the text.&lt;/code&gt;
And file2 contains: &lt;code&gt;This isn&#039;t the text.&lt;/code&gt;

Both seem to match the following substrings: &quot;Thi&quot;, &quot;his&quot;, &quot;is &quot;, &quot;s i&quot;, &quot; is&quot;, &quot; th&quot;, &quot;the&quot;, &quot;he &quot;, &quot;e t&quot;, &quot;te&quot;, &quot;tex&quot;, &quot;ext&quot;, &quot;xt.&quot;

However in the description, it says that the outputs should (or at least could) be in the double digits.  In my example there are already 13 matches, so this seems far too low.  Is my reasoning about the  problem correct?
&lt;/blockquote&gt;
Comparing texts at the character granularity would be a sensible thing to do (in some cases), but here we are breaking the text into &quot;words&quot;, where a word is a sequence of characters separated by a punctuation or whitespace marker.  

The good news is that we have provided the &lt;code&gt;Document&lt;/code&gt; constructor to do the tallying for you, so you do not need to worry about this.  You can use the &lt;code&gt;Document&lt;/code&gt; constructor like this:
&lt;pre&gt;
Document d;
try {
        d = new Document(file, window);
} catch (FileNotFoundException fnfe) {
	System.err.println(&quot;Error: cannot open file: &quot; + file + &quot; [&quot; + fnfe + &quot;]&quot;);
} 
&lt;/pre&gt;
where file is a String that contains the name of the file to analyze and window is an integer representing the window size (e.g., 3).  

Here&#039;s how I implemented the Document constructor:
&lt;pre&gt;
public Document(String fname, int window) throws FileNotFoundException {
	name = fname;
	Scanner s = new Scanner(new File(fname)).useDelimiter(&quot;[^A-Za-z]&quot;);
	WordWindow w = new WordWindow(window);
	tt = new TallyTable();
		
	while (s.hasNext()) {
		String word = s.next().toLowerCase();			
		w.insert(word);
		tt.tally(w.currentWindow());
	}
		
	for (int i = 0; i &lt; window; i++) {
		w.insert(null);
		tt.tally(w.currentWindow());			
	}		
}
&lt;/pre&gt;
Because of the useDelimiter(&quot;[^A-Za-z]&quot;) it is break words where there is any non-alphabetic character.</description>
		<content:encoded><![CDATA[<p>An enterprising student asked:</p>
<blockquote><p>
I have a question about what part 6 is asking us to do.</p>
<p>Suppose file1 contains: <code>This is the text.</code><br />
And file2 contains: <code>This isn't the text.</code></p>
<p>Both seem to match the following substrings: &#8220;Thi&#8221;, &#8220;his&#8221;, &#8220;is &#8220;, &#8220;s i&#8221;, &#8221; is&#8221;, &#8221; th&#8221;, &#8220;the&#8221;, &#8220;he &#8220;, &#8220;e t&#8221;, &#8220;te&#8221;, &#8220;tex&#8221;, &#8220;ext&#8221;, &#8220;xt.&#8221;</p>
<p>However in the description, it says that the outputs should (or at least could) be in the double digits.  In my example there are already 13 matches, so this seems far too low.  Is my reasoning about the  problem correct?
</p></blockquote>
<p>Comparing texts at the character granularity would be a sensible thing to do (in some cases), but here we are breaking the text into &#8220;words&#8221;, where a word is a sequence of characters separated by a punctuation or whitespace marker.  </p>
<p>The good news is that we have provided the <code>Document</code> constructor to do the tallying for you, so you do not need to worry about this.  You can use the <code>Document</code> constructor like this:</p>
<pre>
Document d;
try {
        d = new Document(file, window);
} catch (FileNotFoundException fnfe) {
	System.err.println("Error: cannot open file: " + file + " [" + fnfe + "]");
}
</pre>
<p>where file is a String that contains the name of the file to analyze and window is an integer representing the window size (e.g., 3).  </p>
<p>Here&#8217;s how I implemented the Document constructor:</p>
<pre>
public Document(String fname, int window) throws FileNotFoundException {
	name = fname;
	Scanner s = new Scanner(new File(fname)).useDelimiter("[^A-Za-z]");
	WordWindow w = new WordWindow(window);
	tt = new TallyTable();

	while (s.hasNext()) {
		String word = s.next().toLowerCase();
		w.insert(word);
		tt.tally(w.currentWindow());
	}

	for (int i = 0; i < window; i++) {
		w.insert(null);
		tt.tally(w.currentWindow());
	}
}
</pre>
<p>Because of the useDelimiter("[^A-Za-z]") it is break words where there is any non-alphabetic character.</pre>
]]></content:encoded>
	</item>
</channel>
</rss>