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 Sp2002 P1 Milestone

Ask question on P1 here:

The square/line map has Tech Parkway connecting North Ave. to 10th St. In reality, and on the campus map on that link, Tech Pkwy merges onto Northside Dr which intersects 10th St.?

Don't worry about it for now. You don't need anything more complicated (or, in this case, more correct) than the square/line representation. If you want to go ahead and add northside drive in your own map, feel free. Shaggz

What is the name of the street in the bottom right corner of the map.. On this map it seems to say Brittainy however on the alum map for addys of buildings on that street it says Brittain. Which is it?

Are we supposed to handle each possible street case on our specific map and hardcode the position the line is supposed to move to? This seems like a bad idea. Maybe it will become more clear how we're supposed to complete this task after Tuesday's class, but if anyone could help now, that would be great.

Do we need to handle the case when the input is invalid? Thank you.

Like Shaggz said on the first question. (P.S., Please SIGN your questions!) For all questions of accuracy, just do this map. As you'll find on P7, you're going to dump it all anyway, so make it flexible. Yes, you are supposed to handle each possible street case on the specific map. How you create the relationship between map graphical coordinates and the logical street/intersection name is entirely up to you. I'm not going to lecture on it. I'm assuming that you can use Arrays, Dictionaries, OrderedCollections, and create your own objects as you need to in order to maintain the mapping. Finally, no, we're not going to test with invalid input, but it's a good idea to handle it. Mark Guzdial

Ok, I have just imported the .GIF map from the website and stored it. My problem now is finding a 'good' way to draw lines on this object. What I mean by good is, what I think is best, is knowing the co-ordinates of the intersections. I have looked but have not found anywhere how to obtain the co-ordinates on a Form. So if anyone knows a way to find the co-ordinates of points and a good way to draw lines on it, I would like to know. Thanks. Randy

Randy, I explained how to draw lines on Forms on Thursday. If you just download the GIF, you do have to figure out the coordinates yourself. If you draw the lines, you know all the coordinates. To get the coordinates, you might put the GIF on the display then use Sensor mousePoint to poll the mouse for it's location as you point at features of the map. Mark Guzdial

For turning we are supposed to go to under our tas name... how do we know which tas ours and such, and is the turnin ready to go yet?

Dennis Cook

Should be posted in the next day or so. Mark Guzdial

When you zoom in on the map (future milestones) do the coordnates zoom-in also, or remain the same, say I had a line at 5,5 when I zoom in 2x, is that line still located at 5,5? Brett Flury

As the user, I don't care. I just care that you make routes and other features work right. Mark Guzdial

Rather than make seperate streets for "Ferst-1," Ferst-2," and other segments, I think I would rather make my roads smarter to make things easier down the line (more general-purpose). This would break the "sample code" that was given on the Milestones page (instead of traveling on "Ferst-1," one would simply travel on "Ferst"). So, my question is, is the code listed on the Milestones page simply an example of what the TA's would check our implemtation with, or is it something that we would have to conform to exactly (cut-and-paste accuracy)? Alexander Powell

You MUST work for the given street names. Yes, you might be able to get it to work "better." But your user wants it this way. Mark Guzdial

Question on data structures:

Is there any way we can implement Vectors in Squeak (i'm talking about those structures that are like arrays, except they can be resized).

And, are there sources/ways out there that we can find this information ourselves (eg. are there any vector-like structures in squeak)?

Like I said in class on Tuesday, Java Vectors are Squeak OrderedCollections. There is an appendix in the textbook with lots of examples of using various collections in Squeak. Mark Guzdial

I'm not sure if this is exactly what you're looking for, but maybe it'll help you out :) Try looking in the System Browser (you'll find it in that Tools tab) and check out the classes in the "Collections" categories. ellie

I'm having some problems trying to figure out how to rotate text. Obviously I've looked through the browser. So far I'm getting a general idea that Squeak wants me to create some kind of object (a transformation object) and then send it when I print the string. I'm very confused because when I look at some classes that might work they sure take a LOT of arguments to them. For example, DisplayObject class has this method....

displayOn: aDisplayMedium transformation: displayTransformation clippingBox: clipRectangle align: alignmentPoint with: relativePoint rule: ruleInteger fillColor: aForm

I tried creating a transformation object and setting the rotation to 90 degrees but am having some problems. Can anyone point me in some sort of direction? Thanks. -Jeffrey Tchang

I haven't figured out how to rotate the text yet, but I've been trying to get the form the DisplayText object is drawing on when you use the message send asDisplayObject on a string. Then, you should be able to rotate the form the text is in. For some reason, though, I'm not able to rotate the text inside that form. It doesn't give me an error. The text just sits there and doesn't rotate. -Nathan Owens

Okay, my map is an imagemorph, and my route is drawing, the only problem is the route is drawing on the background, not the image morph, so you never see it. I have looked but cannot find a way to tell the pen to draw on the imagemorph, any ideas? Chase Peeler

check out the Pen class methods for drawing on a form. Then, check out the ImageMorph class. I think you'll find a method in there for how to set the form the ImageMorph uses. If you use the same form for the ImageMorph and what the Pen draws on, you should get it to come out right. I'd suggest using a SketchMorph, though. It's easier to draw on and use the same form as the Pen (at least for me) -Nathan Owens

Does anyone else have a problem with Red? It is showing up as green for me on in both windows and linux, I defined my own color (myColor := Color r: 1 g:1 b: 0.) and that gives me red. Anyone know what the problems is? Chase Peeler

What are you drawing on? Try drawing right on the Display. Red works for me there. Default forms are B/W. Mark Guzdial

I tried finding a more general squeak discussion area to ask this in, but I cannot find one. When I try to publish my project, I get an error that says a primitive failed.....what do i do? Chase Peeler

Chase, what primitive failed? Did you try clicking on the Debug button and looking at the primitive and what parameters it was working on? Instructions on using the Debugger are in the book. Mark Guzdial

Thanks, Nathan – good answers. You all know how to rotate Forms. What you need to do is to get your DisplayText into a Form to rotate. Try something like:
dt := 'Hello World!' asDisplayText.
dt foregroundColor: Color black backgroundColor: Color white.
f := Form extent: 200@200.
dt displayOn: f
f display

You can only draw with Pens on Forms. Stick the Forms into ImageMorphs (or SketchMorphs) later. Mark Guzdial

For some reason I am still having problems rotating forms. I've tried all kinds of things but whenever I rotate the form it becomes to this big block. I set the form extent to a next rectangle (thin and long) before doing the rotation. I do the rotation and it gives me this large square. Any ideas? -Jeff Tchang

It appears from the testing that I've done, that when you rotate a form, it keeps the width the same as before instead of shrinking it. Really, the width and height values should be exchanging places, but the width is just being copied into the height value. For some reason, too, the width is also expanded by 2. Here's what I got for before and after on a form with text:

before bounding box: 0@0 corner: 83@14 after bounding box: 0@0 corner: 85@85

Does anyone know why it does that? Is it because it creates a form to literally rotate it in and then doesn't change the form back to the original size? Any help would be nice; I really would like to see all the text correctly. -Nathan Owens

Question you say you will input the following:
g openInWorld. "show the map"
g startAt: 'Hemphill' and: '10th'.
My problem is that when you run openInworld it works correctly,
but the display is only painted over if you click back on work
space to type startAt, it will disappear. But ofcourse when you
run showRoute: everything works. is this a problem? I am using
the pen... Brett Flury

everything works means everything works but it doesn't sound very stylish: 20% Good Smalltalk style Webb

What's going on, Brett, is that you're drawing directly on the Display with the Pen. When the screen is redrawn, your "scribbles" are erased. The way around this is to draw into a Form, then put the Form into a SketchMorph or ImageMorph. Now, redraws won't affect you. Mark Guzdial

I have my image opening up in a sketchMorph. However, you are able to drag the image around the screen, causing the coordinates to change for the intersections. Is there anyway to correct this by making the imageMorph unmovable? If not, any other suggestions?
Brian Pashel

self beSticky Webb

Webb's right, but there's another answer: Use a coordinate system local to the GIF (e.g., take all coordinates as relative to the topLeft of the SketchMorh's boundingBox). Then you can handle wherever you get dragged to. Mark Guzdial

Correct me if I am wrong, but since my pen draws on my sketchMorph correctly no matter where i place it on the screen, I assume that as long as the pen knows to draw on the sketchMorph it will treat the top-left corner of the sketch morph as 0,0 Chase Peeler

Pen's don't know how to draw on SketchMorphs. They know how to draw on Forms, including the Display. Mark Guzdial

Is there anyway to remove a sketchMorph after its been created? -Nicholas Gibbs

this is the same with all morphs; self delete, or smack the halo. Webb

To "smack the halo," Alt-Click/Cmd-Click on the SketchMorph, then click the left-corner X halo. That'll delete it. Mark Guzdial

I am loading the map from a file on my hard disk, is this going to be okay for when i turn it in? since you will only have my code, not my harddrive as well? Chase Peeler

No, it won't be okay. Perhaps load from the Web? I think we're turning in projects – have it pre-loaded? Mark Guzdial

I am trying variable = Pen newOnForm: XXX and this is not allowing my pen to draw on the form, any suggestions?
Try my above example, or the one in Thursday's lecture notes – it does work Mark Guzdial
Are you using a sketchMorph? if so, look through the methods in the SketchMorph class for drawing, you will find something better to use in there...

Thanks, but I have looked in SketchMorph and I cant find anything but PenOnMyForm and I can not get that working either

Can I assume that the road conecting Cherry and Williams is Bobby Dodd Way?
Charlie Murff

I'm sorry, I'm just blind. Somehow i missed how it was labeled 3rd.
Charlie Murff

Can we assume that when running this portion of the program that squeak will be able to access the internet? Nabil Schear
Yup. Mark Guzdial

Very good question, how do we let our TA know whether we opened the image from the web or from our harddrive, and what the name of the image is if it is off our harddrive?
Brian Pashel
See previous answers. Mark Guzdial

I have downloaded the GIF and plotted all the co-ordinates, however is it a good idea to use a file to read the co-ordiantes from or use a collection? - Deepak
Neither – put it in a method. Mark Guzdial

An example for rotating a form with (red) text in it.
dt := 'Hello World!' asDisplayText.
dt foregroundColor: Color red backgroundColor: Color white.
dt computeBoundingBox.
f := Form extent: 100@16 depth: 16.
dt displayOn: f.
nf := f rotateBy: 30.
nf display

Is there a special "repaint" method for SketchMorphs? If I wait to the end to
, it works fine. However, if I
earlier, and then do my pen work on the SketchMorph's form, the pen work doesn't appear. (Even with
.) I'm pretty sure
doesn't make a copy of the SketchMorph...
Michael L. Mitchell
When you create the SketchMorph withForm:, the form is copied then. Drawing on the form after that won't show. Mark Guzdial

I was able to get a SketchMorph to redraw after the form was updated by calling fullReleaseCachedState on the morph. -D. Hilley

Lots of people are worried about how to load the map image from the website. You have two choices:
  1. If you want to put the SketchMorph in your project, it will get saved in your .pr file.
  2. You can load it from the Web.

Here's how to do #2:
form := HTTPSocket httpGif: ''.
(SketchMorph withForm: form) openInWorld

In reference to my previous question...
I am vainly attempting to change a SketchMorph's form after it is displayed.
just don't seem to be doing the job. If I can't change the form on the fly, then I can either wait until the end to display the map, which means "openInWorld" doesn't display it, or I can make another SketchMorph to display the map with the route drawn, which sounds inefficient. Perhaps related... anywhere I draw (including display) the lines are green. So I tried specifying my own (rgb and hsv), and nothing but white and black comes out right (as Chase Peeler said, red is (r:1 g:1 b:0). The form is a ColorForm, and its bit depth is 8. Michael L. Mitchell

It can't change the form itself on the fly, but you can still draw on that form (or at least I've been doing that). I'm using a SketchMorph, too. I don't even have to call an extra method in order for the pen strokes to appear. If it helps any, I created the pen after the SketchMorph. You might also use the SketchMorph method to create a new pen on the form the SketchMorph has. One difference might be that I'm using a basic form, and you're using a ColorForm. I don't know what the differences between them are, though.

About the color, try using a regular form. I've tried both an 8 and 16 bit depth on a Form, and have had no trouble using the "Color red" message to specify the color. Hope this helps! - Nathan Owens

I've used the code from the previous example to rotate text but what's happening is I'm getting a black box that surrounds the form with the text. I can't seem to find a way to change the color of the box surrounding my form. I've tried making the "nf" transparent, but then my text form disappears instead of the black box.

sorry, forgot to add spaces between my question and the previous one. Also my name is Daniel Combiths.

Are those two hard to see streets Curran and Danley?
I asked this after class but cannot remember what Guzdial said, any know how to change the width of the pen lines? Brian
I am unable to read the street names:

1) between Hemphill and Street that runs from 10th to Ferst-1


2)the street that connects 8th-2 and 5th (maybe starts with a P)

can anyone help me out? thanks

I believe Danley and Plum are the streets you are looking for.

I was wondering what the best way to print out a hardcopy of our code is and should publishing our project1 take almost 5 minutes?
Brian Pashel
If Publishing takes too long, then you've got some really large objects that you have connected to Workspace variables. Try closing your workspaces and emptying the trash (the Trash is in the Squeak flap). Mark Guzdial

on the map drawing on coweb, Dalney should be spelled Danley.

Daniel Combiths
A few inconsistencies and misspellings have been noted - just go with what is on the gif even if Brittainy is not a street, etc. Keep in mind the user is going to want to say 'techwood' instead of 'Techwood Drive' eventually. eh? Webb
Like Webb says: Go with whatever the map says. Mark Guzdial

My idea for this project is to essentially use the Joe the Box example given, except turning it into, Ferst the Street. I'd have each street and intersection as an object. They would draw themselves as a black line with a name on a white background. When the objects were selected (by travelOn, startAt, or stopAt) they would undraw themselves and then draw themselves over in Red. My problem is that by turning the whole street red I would overshoot the intersections. The way that I had originally planned to overcome this problem was to make each block of each street, that is the segment of street between each pair of intersections, into a seperate street object. That way when you used travelOn on each of these streets it would create a nice neat route. However, when I read the questions above I realized that Alexander Powell had asked the reverse question, and had been answered that you MUST use the given streets. I have the sinking feeling that this means I can't partition those given streets into more. Am I allowed to partition those streets, and if I can't can anyone give me a way to avoid overshooting intersections?

Walter Langendorf
I think you're missing something about Alexander Powell's question. Doing the "reverse" or, what Alexander purported, meant forgetting about the distinction of ferst1, ferst2, so on. You are talking about further dividing the streets into blocks, which should not change the route tracing scheme if done correctly. However, these intersections may not make a good road object... Webb
Oops, ok, so I CAN divide the streets into blocks, "8th-1, blk2" etc? If so I should be able to do pretty well.

Thanks alot,
Walter Langendorf

There was a question posted earlier about primitives failing while trying to publish a project. I did the debugging and it didn't pull up anything from my code at all, it was all internal but managed to crash out my project anyways. What is causing this and how can I avoid it? ~Stephanie Smiegowski

First, EVERYBODY, PLEASE CREATE A WHO'S WHO PAGE AND SIGN YOUR NOTES WITH ASTERISKS, E.G. Mark Guzdial. It makes it easier to pick out individual postings and to figure out who people are. Second, "primitive failing" doesn't tell me much. USE THE DEBUGGER! What primitive? On what input? Mark Guzdial

I had the same problem. I lost most of my project, but rewrote it. I think that I had originally downloaded a bad sources.gz file. So to remedy the problem, I just started over; re-downloaded the vm, image, source. Nicholas Gibbs
I've said it on nearly every day in class so far, but I'll try again: YOU NEVER LOSE ANYTHING IN SQUEAK!! If you re-wrote it, you did work you didn't have to do. It's all in your .changes file, and it's all in plaintext. A bad sources file won't screw up your projects file. Mark Guzdial
Squeak froze when I tried to publish a project. (So, when opened up that project, it was still frozen). I did look at the .changes file, but It did not have the most recent changes (the ones I was trying to save). It doesn't matter. I ended up refactoring a lot of the project last night. Nicholas Gibbs

When i set the color to red it becomes yellow and when i set it to yellow it becomes red. Whats going on? - Deepak
Bad graphics board? Don't know. Mark Guzdial

Can someone kindly list out all the names of the streets appearing on the map given on coweb? There are a few names that I can't quite make out and I want to make sure I have all the names right. Thanks in advance.
Austin Lee
Don't worry about it. If you can't read it, neither can we, and we won't be using it in testing. Mark Guzdial

i think we may have gone over this...but is there a way to find out what kind of object we are working with..kind of like instanceof in java? thanks Jimmy Sobeck
Every object responds to the message "class" with its class. As I also said in class yesterday, it's a VERY bad idea to code by asking an object it's class. Mark Guzdial

On The primitive failing questions, I was the first person to post this, the primitive failed error only came up when I tried to publish my project in linux, when I rebooted into windows, this did not happen. I later discovered that as long as I clicked proceed in the error window, the project still published fine. My squeak images, changes file, etc are just symlinked from my windows partition, so I came to the conclusion that it might have something to do with the fact that it was trying to publish it to a fat32 partition from within linux. Chase Peeler

I know Brian already asked this, but he didn't get an answer. What is the best way to print a finished project for our hardcopy? Should we just print the relevant portion of our .changes file? Patrick Ringham
File out your code (you saw me do it in class, and it's in the book). Print that. Mark Guzdial

I can load and unload my file. But whenever I try and load my project file back in I get "Message not Understood: MethodsFor:Stamp:". I tried to debug, but the error is why beyond me. Is there anything that you have to set up in order to load and unload projects correctly? Brian Pashel
That means that you have filed out a subclass, but not its superclass. So the class definition is missing and the class method methodsFor:stamp: is not understood. Mark Guzdial

About saving/turning in the project:
While saving the project, Squeak asks me if I want to save the modifications to teh changes file, or something similar. Is this necessary? Would we need to turn this in?
I think it is asking if you want to file out the change ste along with the project...The answer to this question is a definate yes...When you edit within that project, all your changes (and new additions) get addred to the change set. So, esentialy, the change set cotains all your code...this should definately be included with the project! Lushi (an ex-TA)
Read the turnin directions, Ashish. It's absolutely critical if you want your code graded. Mark Guzdial

When I send the message showRoute to my GTCampusMap instance, the red line sometimes show up and sometimes won't, in which case I have to move the map a little bit to make it appear on the map. Do I need to send some sort of refresh message at the end of showRoute method? I cannot seem to find it. Donghan Li
Donghan – You may be using a SketchMorph, then getting the form from it and creating a pen on that form. This is not the best way to do things, and the updates are slow. Instead of creating a pen and attaching it to the SketchMorph's form, use "penOnMyForm" to get the pen from a SketchMorph. Alexander Powell
Look in Chapter 6 – there's a way to get the World to update, though this sounds kind of suspicious. Mark Guzdial

should we be worrying about things such as the route starts at 'hemphill' and '10th' and then travels on atlantic (do we need to make sure they are traveling on adjacent streets)? also, should they be able to show the route if there is no stopping place?
Cristi Jones

Cristi, you just have to put asterisks around your name, *Cristi Jones* to get Cristi Jones. You don't have to create an anchor – CoWeb does that for you. Assume that the routes are well-formed – that's not the point of this exercise. (Of course, dealing with ill-formed routes is a sign of a good design.) Mark Guzdial

Calling SketchMorph's
is stopping my program's execution (as in, none of my code after it is seems to be run, and any following
self halt
will not trigger a break. If I break before
and step over it, the code continues as normal, but the Morph doesn't display. Since we need the map to display before we draw the line on it, I can't wait until the end to
. Suggestions? Michael L. Mitchell
Why do you need to display the SketchMorph? You can't draw on it. You can only draw on a Form. Draw on the Form, then open the Form in a SketchMorph at the end. Mark Guzdial
Your suggestion makes it clear that this doesn't have to happen, but shouldn't calling
display the map at that point (as the comment indicates), and then calling
draw the line on top of that? If I only display the SketchMorph at the end, then I must wait for
to run first. Michael L. Mitchell

Ok, i am using a SketchMorph with the GIF on a form in it. I have gotten the pen to correctly do red on the main display, however, using the same pen commands (pen obtained by SketchMorphs penOnMyForm command) results in a green line on the form. Is there any official solution to this? The form in the SketchMorph keeps defaulting to a ColorForm and thus i cant try 16 or 32 bit color to see if that fixes the problem. Will we be penalized severly for a green route? :)
Brian Byrne
Why are you using penOnMyForm? Why not create your own Form so that you're in control? Mark Guzdial
The form inside the SketchMorph is my form, created from file. I was using penonmyform so that i could use revealpenstrokes on the showroute command.
Brian Byrne

When you say to put the coordinates in a method, are you suggesting we have a method that does something like case statements and returns a coordinate? Or could we write a method that returns the coordinates by looking through a statically defined collection (defined in an initialize method or something similar).

Not sure I understand what you mean here. Michael Winburn
Sure. Something like either of those. Mark Guzdial

I'm having a lot of trouble reading the street names. Here are some problems:

(1) Tech-Parkway has a hyphen; North Avenue does not. Should all multiworded streets contain hyphens?

(2) Many of the streets are impossible to read. Is it "Dalney" or "Danley"? "Brittany" or "Brittainy"?

Chris Verges
The names will be as they are on the map. If they're not readable for you, they're not readable for us, so we won't use those. I think I said both of these earlier. I also suggested putting your name in Who's Who and putting *'s around your name for reference. (This is my last check tonight – see you all in class tomorrow.) Mark Guzdial
This is of course not so handy now, it's Dalney. If you spend a fair amount of time lurking in the bushes outside the CRB, you'll probably notice the street sign sooner or later Shaggz

For anyone still having the green/red problem, i have a bitmap that you can load off my prism account that forces the form to 32bit color mode. this fixes the color problem.
Of course im not responsible if acme goes down, and i wont remove it until after grades are back. (i need it too :) )
Brian Byrne

Can someone explain why a ColorForm with 8bit color depth shows green pen strokes even when I set my pen's color using
myPen color: (Color red). ?
Matt Lassiter

For turning in a hardcopy of our code, do we just do a fileout on the Class category and then print that out via a text editor?
James Burghardt

Link to this Page