Sindbad~EG File Manager
12.18.06 Downloaded all source files produced by students in the CS240 class fall 2006 and began to try to make the project work
well enough to demonstrate the intended functionality in Leiden in January. For that we don't need databases and student/teacher
logins.
1. There were two copies of constructor source. Deleted the one not in the package.
2. There was a copy of query.php as dbAccess.php with Sang Soo Kim's name as author (!). Left it rather than change it to query.php.
3. Deleted all reference to the Up button in constructor.java
4. created theStack as specified
5. Add the ActiveLine field to Script
6. Got the In button to be enabled when it should be.
7. Disabled database access by putting return into Query in dbAccess
8. Deleted code in index.php that tried to access the database and made $include = 'start' to begin with
so the login page is skipped.
12.19.06
9. Discarded Constructor.java and started to rewrite it from scratch. Completed "in" and most of "execute" in four or five hours.
10. Made isPrimitive static public in SymbolTable.java
12.20.06
11. finished "execute" and wrote displayScript.
12. Downloaded and installed Firefox 2.0 so the Error Console will be on the Tools menu.
13. deleted some properties in stylesheets/index.css that were causing error messages in the Error Console.
14. In IE, but not in Firefox, there is a "Java Console" under the Tool menu, that can display things written with System.out.println.
15. Modified parser.java to accept an and-delimited list of variables after "return". Constructor will retain all listed objects
when execution returns to the caller; the first one will be the actual return value. But execute1 doesn't do this, so
when we step over (as opposed to into) L = EquilateralTriangle(A,B,C), we don't retain the triangle. Moreover, in
CopySegmentScript, we don't even retain the first segment. That's because when we decrease the level, we only
decrease it on the copy in theSymbolTable, which must be different from the one in theFigure.
12.21.06
16. When a called script has a variable that clashes with a variable in the calling script (that is not passed as a parameter)
then the value of that variable is not restored by Execute1 after it returns. That is OK, according to the specs, but
if that variable is an auxiliary return (i.e. mentioned in the "and" list after "return", this causes trouble.
17. Implemented the "back" button successfully using new class State and a stack of States. To do this I added the "copy"
method in SymbolTable.
18. Used the copy method also to make a copy of theSymbolTable to pass to execute1 when executing a
script from Constructor.java. This solves the problem in 16. Now I can step through and back in the first two scripts.
19. Well, not quite. The triangle returned from EquilateralTriangle in the second script does not show up! I spent two
hours trying to find out why. Its visible field is false when its draw method is called, even though true shortly before that.
That's because it's set to false in Diagrammer, line 236, because its argument D is already false. But D is true just
before that. Well, they must not be the same D, which also explains why D doesn't follow when A is dragged.
12.22.06
17. Added one line setIsInput(1) in Constructor.java after about two hours of debugging. Without this, updateConstructions
does not recompute D from its inputs, since it thinks D is an input point. Now D does follow A when dragged.
18. But the triangle in CopySegmentScript still doesn't show up, because its argument D is invisible so it is made invisible.
How, where, and why is D made invisible? There was a missing theFigure.add() in Constructor.java, but that wasn't the
problem. Well, D is only made visible after the return from the Triangle call, but it's set as an arg of triangle T
before that return. If we just set all the args of multiple returns to be visible after the return, then triangle T
shows up, but it does not drag correctly in CopySegmentScript, although it does in EquilateralTriangleScript. Well,
this behaviour proves that the D that occurs as an arg of T is NOT the same object as the D in theFigure. Why not?
Because, in Execute1, the multiple returns still have their args fields belonging to tempArgs. So I put code in
Execute1 to rename the arguments of all the returns. That does the job--now I can step through and back in both the
first two scripts.
19. Now to make the inButton work. The first test is to step in to EquilateralTriangle from CopySegment. It's throwing a
ClassNotFound exception from Scripts.java looking for SegmentScript.class. Well, there's no such file, of course, since
Segment is a primitive command. I moved isPrimitiveCommand to Scripts.java, added primitiveReturnType, and made
getReturnType work on a primitive or non-primitive command.
20. Replacement of variable names in the called script doesn't preserve the "P=" initial part of each line, resulting in
a null pointer exception. The culprit is the toString method in the Command class. Once I fixed that, and got the
construction of the Hashtable Subst correct in the in() method, it worked! (at about midnight).
21. But back() does not properly undo dragging and selection operations, and it seems that points can become
disconnected from the construction when back() is used. That's because the clone() method of ArrayList does not
clone the objects. I tried to fix this in the constructor of State. But I still have the bug: to see it
choose EquilateralTriangle, then execute, back, execute. Now you can drag the points away from the segment!
So evidently the args of the segment don't point to the same points that you're dragging. I fixed this
by rewriting SymbolTable.copy() to fix up the arg pointers, and using it in the constructor of State.
At 3 am the back button is working properly.
22. Moving on to the third script, CopySegmentOntoLineScript, we find that startData always produces points named
A,B,C,D, even when the script's parameters are P,Q,A,B.
12.23.06
23. Made startData a method in the Scripts class. The default one will assign random locations, not closer together
than 40 pixels, to all the points, and not do anything about objects of other types. If a Script has
parameters of other types than point, or requires some relations between the points, it should override
startData and call super.startData(), and then fix up the data as desired and return it.
24. Tested CopySegmentOntoLineScript and found crashes in SymbolTable. The trouble was at line 531 of SymbolTable.java;
the fix involved oldReturnLabel. In addition, the script CopySegmentScript returns multiple values and so it must
specify their return types.
25. Next bug: at the end of CopySegment, if you drag by A, point L doesn't change properly. Before the return statement
is executed, everything drags fine. The reason for this is that the arguments of L are now "dead", i.e. no longer
in the symbol table. After "return" is executed, the construction and argument fields of the returned object need
to be changed to the name of the script to which the "return" statement belongs, and the arguments with which
that script is executed. That will be the activeScript. I fixed this in execute adding the part about actualArgs.
Now, it works to drag by A at the end of CopySegment. But, you hear the hard disk humming, probably due to garbage
collection?
26. Next bug: Run script BisectAngle; step into EquilateralTriangle; null pointer exception at the return statement.
That exception was caused by actualArgs having the wrong length; a mere typo. But then it still gives a null pointer
exception. At this point the original script variables have been renamed so you can't use getParameterNames to
look in theSymbolTable for ActualArgs. Moreover, the return statement doesn't seem to have been properly renamed.
12.24.06
27. Fixed this bug, rewriting the code for renaming variables in "in" to not rename the return variable.
12.25.06
28. Still not working right; in CopySegment if you go "in" to EquilateralTriangle, "return" doesn't work right.
That is because activeScript.getParameterNames is returning null for the parameter names! I saw that bug
yesterday but somehow "it fixed itself".
1.10.07
29. Added fixupSubstForReturn in Constructor.java and called it. This fixed incorrect behavior on
return.
30. Added BisectAngle2Script.java, tinkered with menu wording in Diagrammer, etc.
3.14.12 This year the site was moved to MonkeyBrains's server, and apparently it's now broken as a result.
Looking at index.php, I see a test on $error, when nothing has been assigned to $error. I can't get any
output from php on this page. Apparently monkeybrains needs <?php instead of <? .
That would be because short_open_tag is off in php.ini. I changed that on the server in php.ini,
and then (when that had no effect) in php-ini-production. That still had no effect. Apparently I must
also restart Apache, for which I used
/usr/local/etc/rc.d/apache22 restart
That worked, enabling the short open tag, but now the site is dead--nothing shows up.
The problem turned out to be, of course, Unix permissions. In the meantime I learned that it is
OK to include a php file that contains HTML or other php code. So eventually I got the toplevel screen to
show up; but the applets aren't found. So I changed CODEBASE in construction.php; apparently the applets
were once one level up, and now they're under the main website directory instead. So now it finds the
.class files ok but nothing is drawn. The java files are all in dynamicgeometry.zip.
Nothing is in the applets directory (presumably that's where the java files
should live).
3.15.12 It seems the difficulty is that Java isn't installed on the server.
So I tried to do that, specifically to install openjdk6 following instructions found on the web.
I guess Rudy downloaded the files for me to start with, anyway they were there, but there were some hitches
with files I had to to download locally, then upload to the server. To get the Mac to not open zip files
automatically, use Safari Preferences | General and uncheck "open safe files automatically". Java has
to be built on the server using "make install clean". There were zillions of scary warning messages from the C
compiler--it's a wonder this thing runs at all. The makefile ran for maybe half an hour.
Finally it started echoing code instead of executing it,
and I had to kill the build and try "make install" again. Eventually it completed, with a final message that
I should execute some commands that could not be executed, but javac works, and applets/AppletTest.html demonstrates
that an applet runs on the server now. Nevertheless MY applets do not run, they just hang up without initializing
properly. The source code for these applets is under classes/org/dynamicgeometry/. However, I could not succeed
to recompile them, either locally or on the server.
Preview in code does not work on my php pages, as it claims it can't find the included files.
4.30.12 I modified AppletTest.html to use a "codebase" string and put a package command in the test
applet's code (DrawingLines.java) and compiled it in org/dynamicgeometry/Test. It runs fine. Conclusion:
the codebase command is not the problem.
I recompiled the applets in classes/org/dynamic/geometry/diagrammer and /constructor and /scripts.
All but one compiled successfully (that one script I renamed as ParallelogramToQuadrilateral.foo for now).
I checked that the class files now have today's date. But the applets still don't load and run.
Maybe it's a browser problem. (Not likely as the test applet runs.) Tried it in IE under Windows. Lots of
security warnings. Told it to treat this site as trusted. Still get unknown publisher dialogs after which
applet does not run.
Maybe it's a Unix permissions problem: Nope, I set all the permissions to 777 on the class files.
I found out how to turn on the Java console in Safari; "class not found" is what we get.
Also in Firefox, which I downloaded. Nevertheless AppletTest.html is working fine. So what is
different with AppletTest than with the index.php? Turned trace level to 5 in the Java console.
It's looking for the class files on a path including an incorrect segment ../ which is not needed
since the file is being 'included' by php, so when it runs, it thinks it's one level higher than it is.
It seems I didn't really manage to set all permissions to 777; when that's done it DOES find
the classes. But now Constructor and Diagrammer are throwing ClassNotFound exceptions.
Mysteriously, it works the same with
codebase="..//classes" and codebase="classes". It seems that exactly one of those should work.
Anyway, now it finds the classes. But I get a null pointer exception when pressing the Execute button.
I recompiled Constructor.java and this problem disappeared. But then, it came back; I'm still getting
"null pointer exception".
5.1.12 There were indeed duplicate copies of the code; and the codebase commands were misused. I removed
all the codebase commands and made sure there's just one copy of the code. Then I could see my debug messages
in the Java Console. Soon I found the problem, and then
added code to execute() in constructor.java to make sure theSymbolTable is not null at startup. Now the
applet is working as well as it ever did.
To do (since 2007): Change title from "Dynamic Geometry" to "Euclid's Constructions".
Fix thumbnail display
Fix flicker problem
Fix need to double-click Execute the first time
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists