We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Beginner needs help w. a Visualizing Data example
Page Index Toggle Pages: 1
Beginner needs help w. a Visualizing Data example (Read 909 times)
Beginner needs help w. a Visualizing Data example
Mar 25th, 2008, 1:23am
 
(reposting - hopefully I can get a reply)

I know this is going to be an easy fix...and I'm going to keep stabbing at it, but I seem to be overlooking something.

I'm working on typing up the example in Ch 3 (Visualizing Data) (yes, I have downloaded the sample code as well) and seem to be missing something very basic.

My code is identical to the example step01 pde file (except hand typed).  I don't see any glaring syntax errors.

but I keep getting this error when I try to run:
Semantic Error: Type "Table" was not found.

But I have made sure that the Table.pde file is in the folder of my sketch.
ex>
$ pwd
/home/cmoody/sketchbook/chapter3_test1

$ ls
Table.pde  chapter3_test1.pde  data


any ideas?

Cheers,
-Chris
Re: Beginner needs help w. a Visualizing Data exam
Reply #1 - Mar 25th, 2008, 7:13am
 
Are you sure the tab that contains the Table class is actually called Table?

Both the tab name and the filename have to be the same I believe.
Re: Beginner needs help w. a Visualizing Data exam
Reply #2 - Mar 25th, 2008, 11:45am
 
the tab and the class don't have to be the same, as you can write multiple classes on one tab.

Are you sure you haven't written something like

class table

or

Class table

instead of

class Table

?
Re: Beginner needs help w. a Visualizing Data exam
Reply #3 - Mar 27th, 2008, 7:02pm
 
I have this problem frequently when using tabs, so I'm interested in the solution. I usually just don't use tabs to avoid it. Could it be a pug in the PDE?
Re: Beginner needs help w. a Visualizing Data exam
Reply #4 - Mar 27th, 2008, 7:26pm
 
The tab name is completely irrelevant. The only thing that matters is if the name ends ".java" or not. The name doesn't have to bear any resemblance what so ever to the class(es) contained within.
Re: Beginner needs help w. a Visualizing Data exam
Reply #5 - Mar 27th, 2008, 7:30pm
 
/tmp/build35588.tmp/Temporary_681_3299.java:8:23:8:27: Semantic Error: Type "Table" was not found.

I just re-typed everything and I still get the error.  Here's the code:
=============

PImage mapImage;
Table locationTable;
int rowCount;

void setup(){
 size(640,480);
 mapImage = loadImage("map.png");
 locationTable = new Table("locations.tsv");
 rowCount = locationTable.getRowCount();
}

void draw(){
 background(255);
 image(mapImage, 0, 0);
 
 smooth();
 fill(192,0,0);
 noStroke();
 
 for (int row = 0; row < rowCount; row++){
   float x = locationTable.getFloat(row,1);
   float y = locationTable.getFloat(row,2);
   ellipse(x,y,9,9);
 }
}
============

I have performed: Sketch, Add File, ... for both map.png and Table.pde.  When I do this to Table.pde (which is downloaded from benfry.com) it asks "do you want to replace Table.pde?" - I click yes.

Is there something else I should be doing to let this project know about the Table.pde class?

Again, please pardon my ignorance.  I'm very new to Java and Processing.

Cheers,
-Chris
Re: Beginner needs help w. a Visualizing Data exam
Reply #6 - Mar 27th, 2008, 7:34pm
 
ya know what, I think I just found my problem.  With the project open, I just performed "File, Open, ... Table.pde".  This opened another processing window, but this time had my code in one tab and the Table.pde code in another tab.  I clicked play and a window opened on the screen.

It seems to have executed ok.

Is this normal to have to do this with every included "module", code snippet, etc?

-Chris
Re: Beginner needs help w. a Visualizing Data exam
Reply #7 - Mar 27th, 2008, 7:46pm
 
When you do "Open..." you should only open the .pde file that matches the directory, so if in your processing directory you have a sketch called "MySketch", go into the MySketch directory and open MySketch.pde. This should also open every other .pde file in that directory and put them in tabs. These will all then be lumped together behind the scenes when the sketch is run, and it should "Just Work"
Re: Beginner needs help w. a Visualizing Data exam
Reply #8 - Mar 27th, 2008, 8:54pm
 
Ok.  Thanks for the explanation.  I guess when I was first trying the example, I didn't close/re-open the pde... or add the Table file in another tab...so it wasn't getting "included".  I was under the impression from the book that if it was in the data folder, that it would "just work" as you explained.

I'm assuming that any "external" files/modules/methods,etc need to all be open in other Tabs for the project to run.

Thanks a bunch. (I'm sure I'll have more questions shortly) Smiley

Cheers,
-Chris
Page Index Toggle Pages: 1