View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Questions on Sum2000 P4 Milestone

Ask here!

How can we add a picture of our GUI to the cases web page. I checked some of the previous newspaper cases from last sememster and saw that they made it look better by showing how their GUI's looked. Could someone tell me as how can I post a pic of my GUI to the cases page.

thanks
manish

I'll kick things off with some questions:

1. I've tried to create a webserver by subclassing the ServerAction method and then creating a class method serverDirectory to overwrite the one in ServerAction. However, when I call "PWS link: default to: myNewServerAction new", it doesn't work. I went into the log file and noticed that it was still trying to call the directory for the original ServerAction and not my new one, even though I though I overwrote it and I called the subclass which should have the one that was overwritten. Any suggestions?

2. In the specs, we have been given a specific address to use. However, we've been told that we can use embedded HTML files to do this project. However, from what I've seen, embedded files need to be in an "embedded" folder so there would be no way to call the embedded file from the specific address given, which looks like it would just call methods like we talked about in the first part of the Web class. Is there something we can change (or that I don't know about) so that we can use embedded files with our address as given (i.e. Would it be legal if the page given to the TAs to check had a link to get to the embedded page to do the LaTeX display?)

Adam Blaiss


Has anyone figured out a way to return a GIF? The only things that I see are the ability to write it to a file (which is okay, but cause problems with overwriting the file and bad design and such) or putting it on a stream (which may be what I want but I can't figure out how to use it). I'm sure I'm starting way before anyone else (after all, it's not nearly as involving as the last two milestones) but I'd like to get things done ASAP. Thanks for any help that anyone can offer.

Adam Blaiss

Okay, well I haven't figured out a best solution, but my partner Rich showed me that you can delete a file through Squeak and thus the first option to write the GIF to a file is now quite viable and works with good design. Adam Blaiss


Adam, I'm not sure if you care anymore since you seem to have figured it out, but Mark mentioned in class that the GifReadWriter class is extremely useful for retrieving a GIF from a Form. You may want to have a look. On that note, however, I tried for a long time to find out how to delete files from Squeak, but to no avail. Could someone help with this? I figured it was something easy I was overlooking, but couldn't find it. Thanks.

Also, for your question #1 above: Do you have default inside single quotes? I don't know if that will solve your problem but I know it has to be. That might explain why the default is not looking at your new class for the server directory.

Shaun Dishman

Actually, Shaun, I'm using GIFReadWriter. Without it, I can't see how it could even be done unless you wanted to write your own low level routines to turn a Form into a GIF. To delete files, look at the class FileDirectory. It has a couple ways of doing that for you. About question #1, I do have quotes but still have the problem. I'm guessing though, as I think Guzdial mentioned it in class, that they'll have to set up their own serverDirectory anyway, and the use of subclass might be pointless. Adam Blaiss


Which stream should I use for the GIFReadWriter? Should I use a StandardFileStream? Do I even need to set one?
Thanks,

nobody



Answers to several questions:
Mark Guzdial



I have found some VERY strange behavior from Squeak tonight, and frankly
I don't know how to fix whatever I might have screwed up. I'll do the
best I can to explain my situation, and hopefully someone might have an
answer...

I was coding my Car and Pickup classes, and everything seemed to be
working right. I have a class variable called TotalCars within the Car
class that is incremented whenever a new Car is created - that way it
can be properly named (i.e., Car7). These Cars, Pickups, etc. are kept
inside an Array. I first noticed something was wrong when I printed out
the Array, and it listed its elements as something like (a Car8, a
Pickup12), etc.

Now, it should not be doing this - although their names might have been
Car8, Pickup12, etc., the classes are Car and Pickup - so the array
should have printed out as (a Car, a Pickup). However, upon closer
inspection, Car8 literally was the class name that was created whenever
I did a Car new. And what's weirder is that every time I did something
like

c := Car new.

and then checked the class on c, it was Car9, Car10, etc. So I figured
I would just delete the classes, since they were so messed up. But I
can't even delete them! Now their category is listed as 'nil', and
their name is AnObsoleteAnObsoleteAnObsoleteCar15, with superclass
AnObsoleteVehicle, and every time I try to delete them another
"AnObsolete" is added onto the name. I can't get rid of these things!
Can someone please explain what's going on?


Shaun Dishman

Okay, I think I fixed my own problem, and I thought it might be useful to explain what I found out. Maybe I'm the only one that didn't know this, or maybe I missed Mark saying it in lecture or something, but apparently you can't create a variable called 'name' within your classes - this is what I was doing, and whenever I assigned a value to name, that's when all the screwy behavior happened. Once I changed name to something like id, it seemed to be OK. However, I still can't figure out how to get rid of these obsolete classes, and would appreciate some help...

More questions (but these should be my last):

1. The exact URL given that the TAs will be accessing our website is http://yourmachine:8080/mathequations/. However, since I'm not using embedded HTML files and instead linking processes to requests within a Squeak method, it can recognize http://yourmachine:8080/mathequations as that is the name I'm linking to but not http://yourmachine:8080/mathequations/. However, I could change it to accept that extra slash but that means it wouldn't accept without the slash. The question is, what is the exact URL that the TAs will be using so that I know what to make it and they don't get an error?

2. Are the TAs supposed to set up the serverDirectory class variable from ServerAction? There doesn't seem to be a way to know where the server directory is going to be on their computer so that we could set it for them.

Adam Blaiss


Adam, feel free to toss the final $/ – we'll just type it mathequations. You set up all the serverActions.

Shaun, I've replicated your problem, and it surprised me, too. You can have a name instance variable – no problem. But you can't SET IT with a simple assignment from the class side – that didn't surprise me. What did surprise me is that, on the class messages side, name is the NAME OF THE CLASS. Change it, and you've renamed your class. Interesting! Mark Guzdial


Lab5 question (if there is a better place to post this, let me know)
I ran into a problem with an OrderedCollection.
newColltn has the contents: OrderedCollection(a Car a Car a Pickup)
newCount:= newColltn size.
Sometimes I get an error when running my code.
In the debug window, newCount has a value of 4. I am indexing through
newColltn, using newCount, so when it hits 4 I get an error since
there are 3 elements in newColltn.
why would newColltn size return 4 if there are three elements?
Thanks.
Christine Navalta
That's easy: Somewhere, you're incrementing newCount (or setting its size), but later deleting an element from newColltn.

You actually never need to do what you're doing. Either:
newColltn do: [:each | "do something here with each" ]
or
1 to: (newColltn size) do: [:index | "Do something here with newColltn at: index"]

Okay. I tried that but I am still getting "Error: attempt to index non-existent element in an ordered collection" every few times I run it.
I have:
1 to: (newColltn size) do:[:b |
( (newColltn at:b) currentPosition > myPosition )
ifTrue: ......(etc.)

The error is occurring at "newColltn at:b"
Maybe I am missing something obvious?

Okay, I figured it out. I am removing elements from newColltn if a condition is met, so its size may change during the execution of the block. Seems pretty obvious to me now. Thanks anyway.
Christine Navalta



Last question (I promise)!

Is it okay if we prompt the user (grader) for the directory in which the server folder is placed? If not and according to Mark's previous post, we have to set up all the server stuff (i.e. - the TA's won't manually change the ServerAction variable ServerDirectory), then I don't see how the web server can figure out what the directory is of the Server folder. Thanks for the help.

Adam Blaiss


Has anyone been experiencing any cacheing problems, and do we have to handle all of these? Everything is working fine under Internet Explorer, but we are having cache issues under Netscape. Basically, if you've already created an image from LaTeX, and you go to do it again, the previous one appears. If you then do a shift+Reload, the new one appears. Do we have to handle this, or what steps might we be able to take to get around this? I'm putting all kinds of header information on the page to tell the browser NOT to cache no matter what, and always get the new image, but it still wants to cache it for some reason. Any ideas?

Shaun Dishman


I am having problems creating and using a Stream. I would like to put a GIF on a stream using the GIFReadWriter putForm: onStream: method. I was trying to do this:
stream := ReadWriterStream on: (Array new: 10000) from: 1 to: 10000.
GIFReadWriter putForm: form onStream: stream.
request reply: stream.
but it doesn't seem to work. Any suggestions? Thomas Annandale



You can count on the TA to set the ServerDirectory. Shaun, if the name of your GIF is always the same, different browsers and different settings will cache the image differently. Try generating a random name. Thomas, I need to know why "it doesn't seem to work" – error? just nothing shows up? Also note that the Stream has to be Binary – try a RWBinaryStream. Mark Guzdial


I am having trouble displaying the gif file that I created.
I can create a GIF using the GIFReadWriter putForm: myForm onFileNamed: 'myfile.gif'. The file is created in my squeak directory and I can view it using a gif viewer. Now if I create an HTML file called 'myhtml.html' with an (img src= "myfile.gif")(these are within <>) within the body and try and run http://computername:8080/myhtml.html the gif does not display (the size is -1). However if I just open myhtml.html, the gif displays fine. I have set my serverDirectory to my directory where I have the html and gif files. Any suggestions?

Sara Harvey


I'm having trouble opening one of the slide sets from June 29. It is the file web-p3.ppt. I am running Office 2000. PowerPoint just gives me an error saying that the file can't be opened. I can open all the other sets of slides, so I know there's something wrong with the file itself. Can a new set of slides be posted instead (The kind that can actually be opened and read)?

Sergio Fernandez


I created a page that comes up at http://yourmachine:8080/mathequations. The only problem is the first time I accessed it it came up fine, but the second time and everytime thereafter it never came up. All I did was close Scamper and restart the program and it quit working. What's going on?

Michael Lawler

I'm just wondering if it's possible if Squeak can create HTML from conditionals like it can in JSP. Like can the following piece of JSP code be done with Squeak??

...
<% if (loginSuccessful) {
if (homepage == null)
homepage="snapshot.jsp";
%>
(some HTML code)

<%
}
else { ( USER IS NOT CORRECTLY LOGGED IN )
%>

(some HTML code)
...

I know this code is incomplete, but I think it shows what I'm asking. Can you generate HTML using Squeak conditionals... I tried something like "<? (true) ifTrue: [?> (some html code) <?] ifFalse: [?> (some other HTML code) <?].?>" but that doesn't work. Any suggestions or is this even possible??

Thanks! Kevin Meyer
Cache

I have cache problem on both Netscape and Internet Explorer, can someone help?

thanks.
chau phan, gte246k



Links to this Page